Archived
1
0
Fork 0

perform-download: Allow use of ‘download-nar’ for ‘--check’ builds.

Previously, the nar fallback would always fail on ‘--check’ build
because the output directory in that case is different from the store
file name.  This change fixes that.

* guix/build/git.scm (git-fetch-with-fallback): Add #:item parameter and
pass it to ‘download-nar’.
* guix/scripts/perform-download.scm (perform-git-download): Pass #:item
to ‘git-fetch-with-fallback’.

Change-Id: I30fc948718e99574005150bba5215a51ef153c49
This commit is contained in:
Ludovic Courtès 2024-02-23 14:34:13 +01:00
parent 3e9bea7ee3
commit abd0cca2a9
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5
2 changed files with 11 additions and 6 deletions

View file

@ -92,19 +92,21 @@ fetched, recursively. Return #t on success, #f otherwise."
(define* (git-fetch-with-fallback url commit directory (define* (git-fetch-with-fallback url commit directory
#:key (git-command "git") #:key (item directory)
(git-command "git")
hash hash-algorithm hash hash-algorithm
lfs? recursive?) lfs? recursive?)
"Like 'git-fetch', fetch COMMIT from URL into DIRECTORY, but fall back to "Like 'git-fetch', fetch COMMIT from URL into DIRECTORY, but fall back to
alternative methods when fetching from URL fails: attempt to download a nar, alternative methods when fetching from URL fails: attempt to download a nar
and if that also fails, download from the Software Heritage archive. When for ITEM, and if that also fails, download from the Software Heritage archive.
HASH and HASH-ALGORITHM are provided, they are interpreted as the nar hash of When HASH and HASH-ALGORITHM are provided, they are interpreted as the nar
the directory of interested and are used as its content address at SWH." hash of the directory of interested and are used as its content address at
SWH."
(or (git-fetch url commit directory (or (git-fetch url commit directory
#:lfs? lfs? #:lfs? lfs?
#:recursive? recursive? #:recursive? recursive?
#:git-command git-command) #:git-command git-command)
(download-nar directory) (download-nar item directory)
;; As a last resort, attempt to download from Software Heritage. ;; As a last resort, attempt to download from Software Heritage.
;; Disable X.509 certificate verification to avoid depending ;; Disable X.509 certificate verification to avoid depending

View file

@ -114,10 +114,13 @@ Note: OUTPUT may differ from the 'out' value of DRV, notably for 'bmCheck' or
;; on ambient authority, hence the PATH value below. ;; on ambient authority, hence the PATH value below.
(setenv "PATH" "/run/current-system/profile/bin:/bin:/usr/bin") (setenv "PATH" "/run/current-system/profile/bin:/bin:/usr/bin")
;; Note: When doing a '--check' build, DRV-OUTPUT and OUTPUT are
;; different, hence the #:item argument below.
(git-fetch-with-fallback url commit output (git-fetch-with-fallback url commit output
#:hash hash #:hash hash
#:hash-algorithm algo #:hash-algorithm algo
#:recursive? recursive? #:recursive? recursive?
#:item (derivation-output-path drv-output)
#:git-command %git)))) #:git-command %git))))
(define (assert-low-privileges) (define (assert-low-privileges)