From patchwork Thu Apr 29 07:48:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 28977 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 3F45F27BC7D; Thu, 29 Apr 2021 08:50:09 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 01DE327BC7C for ; Thu, 29 Apr 2021 08:50:09 +0100 (BST) Received: from localhost ([::1]:42742 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lc1R2-0007lx-2W for patchwork@mira.cbaines.net; Thu, 29 Apr 2021 03:50:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42288) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lc1Qw-0007lj-0i for guix-patches@gnu.org; Thu, 29 Apr 2021 03:50:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:43206) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lc1Qv-0000JA-PO for guix-patches@gnu.org; Thu, 29 Apr 2021 03:50:01 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lc1Qv-00048J-O6 for guix-patches@gnu.org; Thu, 29 Apr 2021 03:50:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#47336] Disarchive as a fallback for downloads Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 29 Apr 2021 07:50:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 47336 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: To: Timothy Sample Cc: 47336@debbugs.gnu.org Received: via spool by 47336-submit@debbugs.gnu.org id=B47336.161968254815808 (code B ref 47336); Thu, 29 Apr 2021 07:50:01 +0000 Received: (at 47336) by debbugs.gnu.org; 29 Apr 2021 07:49:08 +0000 Received: from localhost ([127.0.0.1]:54752 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lc1Q4-00046u-0A for submit@debbugs.gnu.org; Thu, 29 Apr 2021 03:49:08 -0400 Received: from eggs.gnu.org ([209.51.188.92]:33872) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lc1Q2-00046e-VE for 47336@debbugs.gnu.org; Thu, 29 Apr 2021 03:49:07 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:37902) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lc1Px-0008Ar-M5; Thu, 29 Apr 2021 03:49:01 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=60830 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1lc1Pw-0006jK-HO; Thu, 29 Apr 2021 03:49:00 -0400 From: Ludovic =?utf-8?q?Court=C3=A8s?= References: <87eeg6o50b.fsf@ngyro.com> <20210323045213.9419-1-samplet@ngyro.com> <87a6qo2835.fsf_-_@gnu.org> <87v989e5oc.fsf_-_@gnu.org> <87o8dzkunk.fsf_-_@ngyro.com> <87h7jqlwnw.fsf@ngyro.com> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 10 =?utf-8?q?Flor=C3=A9al?= an 229 de la =?utf-8?q?R?= =?utf-8?q?=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Thu, 29 Apr 2021 09:48:59 +0200 In-Reply-To: <87h7jqlwnw.fsf@ngyro.com> (Timothy Sample's message of "Wed, 28 Apr 2021 03:01:55 -0400") Message-ID: <874kfpo7is.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches Hi! Timothy Sample 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’. 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*