me
/
guix
Archived
1
0
Fork 0

substitute: Do not exit when failing to find a nar.

Fixes <https://issues.guix.gnu.org/67575>.

* guix/scripts/substitute.scm (process-substitution/fallback): Use
‘report-error’ instead of ‘leave’.  Write status line to PORT.
* tests/substitute.scm ("substitute, narinfo is available but nar is
missing"): Adjust accordingly.

Change-Id: Ic7297dbd563c007111ec2167c8d52505a07d4822
Ludovic Courtès 2023-12-02 12:04:23 +01:00
parent d83d4488da
commit 06b9c1260c
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
2 changed files with 27 additions and 23 deletions

View File

@ -635,8 +635,9 @@ way to download the nar."
(let loop ((cache-urls cache-urls))
(match cache-urls
(()
(leave (G_ "failed to find alternative substitute for '~a'~%")
(narinfo-path narinfo)))
(report-error (G_ "failed to find alternative substitute for '~a'~%")
(narinfo-path narinfo))
(display "not-found\n" port))
((cache-url rest ...)
(match (lookup-narinfos cache-url
(list (narinfo-path narinfo))

View File

@ -662,8 +662,10 @@ System: mips64el-linux\n")))
(lambda ()
(false-if-exception (delete-file "substitute-retrieved")))))))
(test-quit "substitute, narinfo is available but nar is missing"
"failed to find alternative substitute"
(test-equal "substitute, narinfo is available but nar is missing"
"not-found\n"
(let ((port (open-output-string)))
(parameterize ((current-output-port port))
(with-narinfo*
(string-append %narinfo "Signature: "
(signature-field
@ -683,7 +685,8 @@ System: mips64el-linux\n")))
(request-substitution (string-append (%store-prefix)
"/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-foo")
"substitute-retrieved")
(not (file-exists? "substitute-retrieved"))))))
(and (not (file-exists? "substitute-retrieved"))
(get-output-string port))))))))
(test-equal "substitute, first narinfo is unsigned and has wrong hash"
"Substitutable data."