unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: Timothy Sample <samplet@ngyro.com>
Cc: 47336@debbugs.gnu.org
Subject: [bug#47336] Disarchive as a fallback for downloads
Date: Thu, 29 Apr 2021 09:48:59 +0200	[thread overview]
Message-ID: <874kfpo7is.fsf@gnu.org> (raw)
In-Reply-To: <87h7jqlwnw.fsf@ngyro.com> (Timothy Sample's message of "Wed, 28 Apr 2021 03:01:55 -0400")

[-- Attachment #1: Type: text/plain, Size: 1689 bytes --]

Hi!

Timothy Sample <samplet@ngyro.com> skribis:

> And broke “guix pull”!!  (I somehow fooled myself into thinking that I
> had already tested with “guix pull --url=...” locally.)  I reverted the
> offending commit.

You can test with ‘guix pull’ (you need to make sure to specify the
right file:// URL *and* branch), or you can run “make as-derivation”.

> It turns out that adding a reference from “(guix build download)” to
> “(guix swh)” breaks “compute-guix-derivation” in
> “build-aux/build-self.scm”.  This is because “(guix swh)” references
> “(json)”, which is not available in the “compute-guix-derivation”
> environment.  I tried mimicking the “fake-git” trick, but it didn’t work
> (I guess it needs the “define-json-mapping” macro at compile time).
>
> Everything works if I remove the #:autoload for “(guix swh)” and put
>
>   ;; If we import (guix swh) directly, we introduce a compile-time
>   ;; dependency on Guile-JSON.  This breaks the "build-self" code, which
>   ;; needs to build this module without Guile-JSON.  Hence, we track
>   ;; down the following procedure at runtime.
>   (define swh-download-directory
>     (module-ref (resolve-module '(guix swh)) 'swh-download-directory))
>
> inside of “disarchive-fetch/any” (just before it’s needed).  Does this
> approach look okay?

That’s one possibility.

The patch below takes another approach.  I think it aesthetically
slightly more pleasant because we don’t have to play ‘resolve-module’
tricks for obscure reasons.  WDYT?

(It also fixes a format string argument mismatch.)

Thanks!

Ludo’.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 1552 bytes --]

diff --git a/build-aux/build-self.scm b/build-aux/build-self.scm
index 853a2f328f..f100ff4aae 100644
--- a/build-aux/build-self.scm
+++ b/build-aux/build-self.scm
@@ -250,6 +250,7 @@ interface (FFI) of Guile.")
     (match-lambda
       (('guix 'config) #f)
       (('guix 'channels) #f)
+      (('guix 'build 'download) #f)             ;autoloaded by (guix download)
       (('guix _ ...)   #t)
       (('gnu _ ...)    #t)
       (_               #f)))
diff --git a/guix/build/download.scm b/guix/build/download.scm
index 5431d7c682..ce31038b05 100644
--- a/guix/build/download.scm
+++ b/guix/build/download.scm
@@ -650,7 +650,7 @@ and write the output to FILE."
            (('swhid swhid)
             (match (string-split swhid #\:)
               (("swh" "1" "dir" id)
-               (format #t "Downloading from Software Heritage...~%" file)
+               (format #t "Downloading ~a from Software Heritage...~%" file)
                (false-if-exception*
                 (swh-download-directory id output)))
               (_ #f)))
diff --git a/guix/self.scm b/guix/self.scm
index 3154d180ac..7181205610 100644
--- a/guix/self.scm
+++ b/guix/self.scm
@@ -878,7 +878,8 @@ itself."
                    ("guix/store/schema.sql"
                     ,(local-file "../guix/store/schema.sql")))
 
-                 #:extensions (list guile-gcrypt)
+                 #:extensions (list guile-gcrypt
+                                    guile-json)   ;for (guix swh)
                  #:guile-for-build guile-for-build))
 
   (define *extra-modules*

  reply	other threads:[~2021-04-29  7:50 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <87eeg6o50b.fsf@ngyro.com>
2021-03-23  9:35 ` [bug#47336] Disarchive as a fallback for downloads zimoun
2021-03-23 14:31   ` Timothy Sample
2021-03-27 10:39     ` Ludovic Courtès
     [not found] ` <20210323045213.9419-1-samplet@ngyro.com>
2021-03-27 10:40   ` Ludovic Courtès
2021-04-10 20:52     ` Ludovic Courtès
2021-04-26  9:49     ` Ludovic Courtès
2021-04-28  2:30       ` bug#47336: " Timothy Sample
2021-04-28  7:01         ` [bug#47336] " Timothy Sample
2021-04-29  7:48           ` Ludovic Courtès [this message]
2021-04-29 17:24             ` bug#47336: " Timothy Sample
     [not found]   ` <20210323045213.9419-2-samplet@ngyro.com>
2021-03-27 10:57     ` [bug#47336] " Ludovic Courtès
2021-05-14 21:36 ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=874kfpo7is.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=47336@debbugs.gnu.org \
    --cc=samplet@ngyro.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).