Subject: bug#42286: SWH fallback fails (git-fetch)

From: zimoun <[email-masked]>
Date: Thu, 9 Jul 2020 20:20:23 +0200

On Thu, 9 Jul 2020 at 02:39, zimoun <[email-masked]> wrote:

Well, "swh-download" perfectly works directly from the REPL.

> --8<---------------cut here---------------start------------->8---
> guix build -L . hi

[...]

> Trying to download from Software Heritage...
> Backtrace:
>            4 (primitive-load "/gnu/store/s56y8npabah6jc1bqrhsac6wqb1?")
> In ./guix/swh.scm:
>    573:13  3 (swh-download "https://github.com/zimoun/hello-example?" ?)
>    224:22  2 (call "https://archive.softwareheritage.org/api/1/revi?" ?)
> In web/client.scm:
>     563:0  1 (http-get "https://archive.softwareheritage.org/api/1/?" ?)
>     231:6  0 (tls-wrap #<closed: file 7ffff5f1b690> _ # _)
>
> web/client.scm:231:6: In procedure tls-wrap:
> --8<---------------cut here---------------end--------------->8---

The error is definitively something related to TLS and the gexp.  In
(guix git-download) "git-fetch", the "define build" returns a gexp and
here something is missing, even if the extension gnutls (module-ref
(resolve-interface '(gnu packages tls)) 'gnutls) is provided.  Hum, I
am not sure to understand what.

BTW, if in "git-fetch" from (guix git), I add these lines:

--8<---------------cut here---------------start------------->8---
  (setenv "GIT_SSL_NO_VERIFY" "true")

  (format #t "git-fetch~%")
  (http-get "https://archive.softwareheritage.org/api/1/content/sha256:31e066137a962676e89f69d1b65382de95a7ef7d914b8cb956f41ea72e0f516b/")
  (format #t "ok~%")

  (mkdir-p directory)
--8<---------------cut here---------------end--------------->8---

Then I also hit:

--8<---------------cut here---------------start------------->8---
The following derivations will be built:
   /gnu/store/wam9fca6vj3rifvqlix9c874vpwn5k82-hi-2.10.drv
   /gnu/store/cvp65m4wzmzd8pqdfvah4mrl4zkcw3vz-git-checkout.drv
building /gnu/store/cvp65m4wzmzd8pqdfvah4mrl4zkcw3vz-git-checkout.drv...
guile: warning: failed to install locale
environment variable `PATH' set to
`/gnu/store/378zjf2kgajcfd7mfr98jn5xyc5wa3qv-gzip-1.10/bin:/gnu/store/sf3rbvb6iqcphgm1afbplcs72hsywg25-tar-1.32/bin'
git-fetch
Backtrace:
           4 (primitive-load "/gnu/store/gcr6v6p6c5gwr4l6xzqcy6wln33?")
In ice-9/eval.scm:
   293:34  3 (_ #<directory (guile-user) 7ffff5bb8f00>)
In ./guix/build/git.scm:
     44:2  2 (git-fetch "https://github.com/zimoun/hello-example.git" ?)
In web/client.scm:
    563:0  1 (http-get "https://archive.softwareheritage.org/api/1/?" ?)
    231:6  0 (tls-wrap #<closed: file 7ffff4c17150> _ # _)

web/client.scm:231:6: In procedure tls-wrap:
Error while printing exception.
builder for `/gnu/store/cvp65m4wzmzd8pqdfvah4mrl4zkcw3vz-git-checkout.drv'
failed with exit code 1
build of /gnu/store/cvp65m4wzmzd8pqdfvah4mrl4zkcw3vz-git-checkout.drv failed
View build log at
'/var/log/guix/drvs/cv/p65m4wzmzd8pqdfvah4mrl4zkcw3vz-git-checkout.drv.bz2'.
cannot build derivation
`/gnu/store/wam9fca6vj3rifvqlix9c874vpwn5k82-hi-2.10.drv': 1
dependencies couldn't be built
guix build: error: build of
`/gnu/store/wam9fca6vj3rifvqlix9c874vpwn5k82-hi-2.10.drv' failed
--8<---------------cut here---------------end--------------->8---

Then I have tried to turn off the certificate verification with
"#:verify-certification #f" for example in "vault-fetch" or "call"
used by "define-query" but nothing works.  Well, I am a bit
circumspect.

Therefore, I am waiting for a hint or the fix. :-)

Cheers,
simon