mirror of
https://codeberg.org/guix/guix.git
synced 2025-10-02 02:15:12 +00:00
substitute: Honor "substitute-urls" option passed by "untrusted" clients.
* guix/scripts/substitute.scm (or*): New macro. (%cache-url): Honor "untrusted-substitute-urls". * guix/tests.scm (%test-substitute-urls): New variable. (open-connection-for-tests): Use it. * tests/derivations.scm ("derivation-prerequisites-to-build and substitutes", "derivation-prerequisites-to-build and substitutes, non-substitutable build", "derivation-prerequisites-to-build and substitutes, local build"): Pass it to 'set-build-options'. * tests/guix-daemon.sh: Likewise. * tests/store.scm ("substitute query, alternating URLs"): New test. ("substitute query", "substitute", "substitute + build-things with output path", "substitute, corrupt output hash", "substitute --fallback"): Pass #:substitute-urls to 'set-build-options'.
This commit is contained in:
parent
895d1eda54
commit
24f5aaaf24
5 changed files with 71 additions and 19 deletions
|
@ -1,5 +1,5 @@
|
|||
# GNU Guix --- Functional package management for GNU
|
||||
# Copyright © 2012, 2014 Ludovic Courtès <ludo@gnu.org>
|
||||
# Copyright © 2012, 2014, 2015 Ludovic Courtès <ludo@gnu.org>
|
||||
#
|
||||
# This file is part of GNU Guix.
|
||||
#
|
||||
|
@ -54,11 +54,12 @@ EOF
|
|||
rm -f "$XDG_CACHE_HOME/guix/substitute/$hash_part"
|
||||
|
||||
# Make sure we see the substitute.
|
||||
guile -c '
|
||||
guile -c "
|
||||
(use-modules (guix))
|
||||
(define store (open-connection))
|
||||
(set-build-options store #:use-substitutes? #t)
|
||||
(exit (has-substitutes? store "'"$out"'"))'
|
||||
(set-build-options store #:use-substitutes? #t
|
||||
#:substitute-urls (list \"$GUIX_BINARY_SUBSTITUTE_URL\"))
|
||||
(exit (has-substitutes? store \"$out\"))"
|
||||
|
||||
# Now, run guix-daemon --no-substitutes.
|
||||
socket="$NIX_STATE_DIR/alternate-socket"
|
||||
|
@ -72,6 +73,7 @@ guile -c "
|
|||
(define store (open-connection \"$socket\"))
|
||||
|
||||
;; This setting MUST NOT override the daemon's --no-substitutes.
|
||||
(set-build-options store #:use-substitutes? #t)
|
||||
(set-build-options store #:use-substitutes? #t
|
||||
#:substitute-urls (list \"$GUIX_BINARY_SUBSTITUTE_URL\"))
|
||||
|
||||
(exit (not (has-substitutes? store \"$out\")))"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue