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
This commit is contained in:
Ludovic Courtès 2024-05-01 12:22:04 +02:00
parent e2ba58a67f
commit 5d2d081af0
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5

View file

@ -90,6 +90,12 @@ (define guile-lzlib
(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 @@ (define build
((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 @@ (define guile-lzlib
(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 @@ (define build
(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