summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2024-02-20 17:29:02 +0100
committerLudovic Courtès <ludo@gnu.org>2024-03-09 18:55:49 +0100
commit2a9f817ffdf66cc4b20538eec6232bfa504dba9d (patch)
tree10f7b3aaefec9ca96c52141e4a9c40f10cf28f20
parentddd455c0dd5a527f3c7e94b8b9056155facb37e6 (diff)
downloadguix-2a9f817ffdf66cc4b20538eec6232bfa504dba9d.tar.gz
hg-download: Use ‘swh-download-directory-by-nar-hash’.
This allows content-addressed access to the checkout, which is
preferable.

* guix/hg-download.scm (hg-fetch): Add call to
‘swh-download-directory-by-nar-hash’ before ‘swh-download’ call.

Change-Id: I2afc8badc1f8bb2c8bdd3a47abbb72d455d93e64
-rw-r--r--guix/hg-download.scm10
1 files changed, 6 insertions, 4 deletions
diff --git a/guix/hg-download.scm b/guix/hg-download.scm
index 6d02de47e4..dd28d9c244 100644
--- a/guix/hg-download.scm
+++ b/guix/hg-download.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2014, 2015, 2016, 2017, 2019 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2014-2017, 2019, 2024 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2016 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2021 Xinglu Chen <public@yoctocell.xyz>
 ;;;
@@ -117,9 +117,11 @@ HASH-ALGO (a symbol).  Use NAME as the file name, or a generic name if #f."
                 (parameterize ((%verify-swh-certificate? #f))
                   (format (current-error-port)
                           "Trying to download from Software Heritage...~%")
-                  (swh-download #$(hg-reference-url ref)
-                                #$(hg-reference-changeset ref)
-                                #$output)))))))
+                  (or (swh-download-directory-by-nar-hash #$hash '#$hash-algo
+                                                          #$output)
+                      (swh-download #$(hg-reference-url ref)
+                                    #$(hg-reference-changeset ref)
+                                    #$output))))))))
 
   (mlet %store-monad ((guile (package->derivation guile system)))
     (gexp->derivation (or name "hg-checkout") build