mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-11-07 07:26:13 -05:00
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
This commit is contained in:
parent
d83d4488da
commit
06b9c1260c
2 changed files with 27 additions and 23 deletions
|
@ -635,8 +635,9 @@ (define* (process-substitution/fallback port narinfo destination
|
||||||
(let loop ((cache-urls cache-urls))
|
(let loop ((cache-urls cache-urls))
|
||||||
(match cache-urls
|
(match cache-urls
|
||||||
(()
|
(()
|
||||||
(leave (G_ "failed to find alternative substitute for '~a'~%")
|
(report-error (G_ "failed to find alternative substitute for '~a'~%")
|
||||||
(narinfo-path narinfo)))
|
(narinfo-path narinfo))
|
||||||
|
(display "not-found\n" port))
|
||||||
((cache-url rest ...)
|
((cache-url rest ...)
|
||||||
(match (lookup-narinfos cache-url
|
(match (lookup-narinfos cache-url
|
||||||
(list (narinfo-path narinfo))
|
(list (narinfo-path narinfo))
|
||||||
|
|
|
@ -662,28 +662,31 @@ (define-syntax-rule (with-narinfo* narinfo directory body ...)
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(false-if-exception (delete-file "substitute-retrieved")))))))
|
(false-if-exception (delete-file "substitute-retrieved")))))))
|
||||||
|
|
||||||
(test-quit "substitute, narinfo is available but nar is missing"
|
(test-equal "substitute, narinfo is available but nar is missing"
|
||||||
"failed to find alternative substitute"
|
"not-found\n"
|
||||||
(with-narinfo*
|
(let ((port (open-output-string)))
|
||||||
(string-append %narinfo "Signature: "
|
(parameterize ((current-output-port port))
|
||||||
(signature-field
|
(with-narinfo*
|
||||||
%narinfo
|
(string-append %narinfo "Signature: "
|
||||||
#:public-key %wrong-public-key))
|
(signature-field
|
||||||
%main-substitute-directory
|
%narinfo
|
||||||
|
#:public-key %wrong-public-key))
|
||||||
|
%main-substitute-directory
|
||||||
|
|
||||||
(with-http-server `((200 ,(string-append %narinfo "Signature: "
|
(with-http-server `((200 ,(string-append %narinfo "Signature: "
|
||||||
(signature-field %narinfo)))
|
(signature-field %narinfo)))
|
||||||
(404 "Sorry, nar is missing!"))
|
(404 "Sorry, nar is missing!"))
|
||||||
(parameterize ((substitute-urls
|
(parameterize ((substitute-urls
|
||||||
(list (%local-url)
|
(list (%local-url)
|
||||||
(string-append "file://"
|
(string-append "file://"
|
||||||
%main-substitute-directory))))
|
%main-substitute-directory))))
|
||||||
(delete-file (string-append %main-substitute-directory
|
(delete-file (string-append %main-substitute-directory
|
||||||
"/example.nar"))
|
"/example.nar"))
|
||||||
(request-substitution (string-append (%store-prefix)
|
(request-substitution (string-append (%store-prefix)
|
||||||
"/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-foo")
|
"/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-foo")
|
||||||
"substitute-retrieved")
|
"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"
|
(test-equal "substitute, first narinfo is unsigned and has wrong hash"
|
||||||
"Substitutable data."
|
"Substitutable data."
|
||||||
|
|
Loading…
Reference in a new issue