diff options
| author | Ludovic Courtès <ludo@gnu.org> | 2014-10-09 13:38:16 +0200 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2014-10-09 23:51:19 +0200 |
| commit | 4938b0eead9b1f34883c166a16c769a5db03edd9 (patch) | |
| tree | 6dca363040a808a928086c927106dac177efd898 | |
| parent | 9176607ec4cffb85b46e71af49bbc8a330aec5c3 (diff) | |
substitute-binary: Ignore $GUIX_BINARY_SUBSTITUTE_URL.
* guix/scripts/substitute-binary.scm (%cache-url): Ignore the
'GUIX_BINARY_SUBSTITUTE_URL' environment variable.
* test-env.in: Invoke 'guix-daemon' with '--substitute-urls'.
* tests/substitute-binary.scm: Set '%cache-url' to the value of
'GUIX_BINARY_SUBSTITUTE_URL'.
| -rwxr-xr-x | guix/scripts/substitute-binary.scm | 27 | ||||
| -rw-r--r-- | test-env.in | 3 | ||||
| -rw-r--r-- | tests/substitute-binary.scm | 3 |
3 files changed, 18 insertions, 15 deletions
diff --git a/guix/scripts/substitute-binary.scm b/guix/scripts/substitute-binary.scm index 7a286426a1c..a2d0cab727c 100755 --- a/guix/scripts/substitute-binary.scm +++ b/guix/scripts/substitute-binary.scm | |||
| @@ -625,20 +625,19 @@ found." | |||
| 625 | (assoc-ref (daemon-options) option)) | 625 | (assoc-ref (daemon-options) option)) |
| 626 | 626 | ||
| 627 | (define %cache-url | 627 | (define %cache-url |
| 628 | (or (getenv "GUIX_BINARY_SUBSTITUTE_URL") | 628 | (match (and=> (find-daemon-option "substitute-urls") |
| 629 | (match (and=> (find-daemon-option "substitute-urls") | 629 | string-tokenize) |
| 630 | string-tokenize) | 630 | ((url) |
| 631 | ((url) | 631 | url) |
| 632 | url) | 632 | ((head tail ..1) |
| 633 | ((head tail ..1) | 633 | ;; Currently we don't handle multiple substitute URLs. |
| 634 | ;; Currently we don't handle multiple substitute URLs. | 634 | (warning (_ "these substitute URLs will not be used:~{ ~a~}~%") |
| 635 | (warning (_ "these substitute URLs will not be used:~{ ~a~}~%") | 635 | tail) |
| 636 | tail) | 636 | head) |
| 637 | head) | 637 | (#f |
| 638 | (#f | 638 | ;; This can only happen when this script is not invoked by the |
| 639 | ;; This can only happen when this script is not invoked by the | 639 | ;; daemon. |
| 640 | ;; daemon. | 640 | "http://hydra.gnu.org"))) |
| 641 | "http://hydra.gnu.org")))) | ||
| 642 | 641 | ||
| 643 | (define (guix-substitute-binary . args) | 642 | (define (guix-substitute-binary . args) |
| 644 | "Implement the build daemon's substituter protocol." | 643 | "Implement the build daemon's substituter protocol." |
diff --git a/test-env.in b/test-env.in index 302118bb6f2..792830c29b9 100644 --- a/test-env.in +++ b/test-env.in | |||
| @@ -81,7 +81,8 @@ then | |||
| 81 | # Launch the daemon without chroot support because is may be | 81 | # Launch the daemon without chroot support because is may be |
| 82 | # unavailable, for instance if we're not running as root. | 82 | # unavailable, for instance if we're not running as root. |
| 83 | "@abs_top_builddir@/pre-inst-env" \ | 83 | "@abs_top_builddir@/pre-inst-env" \ |
| 84 | "@abs_top_builddir@/guix-daemon" --disable-chroot & | 84 | "@abs_top_builddir@/guix-daemon" --disable-chroot \ |
| 85 | --substitute-urls="$GUIX_BINARY_SUBSTITUTE_URL" & | ||
| 85 | 86 | ||
| 86 | daemon_pid=$! | 87 | daemon_pid=$! |
| 87 | trap "kill $daemon_pid ; rm -rf $NIX_STATE_DIR" EXIT | 88 | trap "kill $daemon_pid ; rm -rf $NIX_STATE_DIR" EXIT |
diff --git a/tests/substitute-binary.scm b/tests/substitute-binary.scm index 8bde7f6aaf4..163cd745936 100644 --- a/tests/substitute-binary.scm +++ b/tests/substitute-binary.scm | |||
| @@ -166,6 +166,9 @@ a file for NARINFO." | |||
| 166 | (define-syntax-rule (with-narinfo narinfo body ...) | 166 | (define-syntax-rule (with-narinfo narinfo body ...) |
| 167 | (call-with-narinfo narinfo (lambda () body ...))) | 167 | (call-with-narinfo narinfo (lambda () body ...))) |
| 168 | 168 | ||
| 169 | ;; Transmit these options to 'guix substitute-binary'. | ||
| 170 | (set! (@@ (guix scripts substitute-binary) %cache-url) | ||
| 171 | (getenv "GUIX_BINARY_SUBSTITUTE_URL")) | ||
| 169 | 172 | ||
| 170 | (test-equal "query narinfo without signature" | 173 | (test-equal "query narinfo without signature" |
| 171 | "" ; not substitutable | 174 | "" ; not substitutable |
