civodul pushed a commit to branch master
in repository guix.

commit 5d2d081af0dfebb2f9af367a39e6696618f12dcf
Author: Ludovic Courtès <[email protected]>
AuthorDate: Wed May 1 12:22:04 2024 +0200

    svn-download: Add dependency on tar+gzip for SWH retrieval.
    
    Fixes a bug whereby ‘swh-download-directory-by-nar-hash’ would fail due
    to ‘tar’ not being found in $PATH:
    
      $ GUIX_DOWNLOAD_METHODS=swh guix build -S texlive-geometry --check
      In execvp of tar: No such file or directory
      SWH: found directory with nar-sha256 hash 
217e1c8d33aa6fd063f205453a946509b059b85fa7e8d32b7e80054d5e6e5c26 at 
'swh:1:dir:ccb56476fb36b2ba0298e57f2b2e69c735ac0a2f'
      […]
    
    * guix/svn-download.scm (svn-fetch)[tar+gzip]: New variable.
    [build]: Use it.
    (svn-multi-fetch): Likewise.
    
    Change-Id: I37ba9824a5feb6d38f85743519cbd2b2c3e1a9e8
---
 guix/svn-download.scm | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/guix/svn-download.scm b/guix/svn-download.scm
index 17a7f4f957..bdd9c39eb5 100644
--- a/guix/svn-download.scm
+++ b/guix/svn-download.scm
@@ -90,6 +90,12 @@ HASH-ALGO (a symbol).  Use NAME as the file name, or a 
generic name if #f."
   (define guile-gnutls
     (module-ref (resolve-interface '(gnu packages tls)) 'guile-gnutls))
 
+  (define tar+gzip                                ;for (guix swh)
+    (list (module-ref (resolve-interface '(gnu packages compression))
+                      'gzip)
+          (module-ref (resolve-interface '(gnu packages base))
+                      'tar)))
+
   (define build
     (with-imported-modules
         (source-module-closure '((guix build svn)
@@ -104,9 +110,14 @@ HASH-ALGO (a symbol).  Use NAME as the file name, or a 
generic name if #f."
                          ((guix build download)
                           #:select (download-method-enabled?))
                          (guix build download-nar)
+                         (guix build utils)
                          (guix swh)
                          (ice-9 match))
 
+            ;; Add tar and gzip to $PATH so
+            ;; 'swh-download-directory-by-nar-hash' can invoke them.
+            (set-path-environment-variable "PATH" '("bin") '(#+@tar+gzip))
+
             (or (and (download-method-enabled? 'upstream)
                      (svn-fetch (getenv "svn url")
                                 (string->number (getenv "svn revision"))
@@ -185,6 +196,12 @@ HASH-ALGO (a symbol).  Use NAME as the file name, or a 
generic name if #f."
   (define guile-gnutls
     (module-ref (resolve-interface '(gnu packages tls)) 'guile-gnutls))
 
+  (define tar+gzip                                ;for (guix swh)
+    (list (module-ref (resolve-interface '(gnu packages compression))
+                      'gzip)
+          (module-ref (resolve-interface '(gnu packages base))
+                      'tar)))
+
   (define build
     (with-imported-modules
         (source-module-closure '((guix build svn)
@@ -204,6 +221,10 @@ HASH-ALGO (a symbol).  Use NAME as the file name, or a 
generic name if #f."
                          (srfi srfi-1)
                          (ice-9 match))
 
+            ;; Add tar and gzip to $PATH so
+            ;; 'swh-download-directory-by-nar-hash' can invoke them.
+            (set-path-environment-variable "PATH" '("bin") '(#+@tar+gzip))
+
             (or (every
                  (lambda (location)
                    ;; The directory must exist if we are to fetch only a

Reply via email to