guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

02/02: substitute: Honor client-provided empty URL list.


From: Ludovic Courtès
Subject: 02/02: substitute: Honor client-provided empty URL list.
Date: Wed, 16 Mar 2016 17:41:59 +0000

civodul pushed a commit to branch master
in repository guix.

commit 71e2065a38cf2641b7eb8c557b0f043f5a42a649
Author: Ludovic Courtès <address@hidden>
Date:   Wed Mar 16 18:13:02 2016 +0100

    substitute: Honor client-provided empty URL list.
    
    Before that, 'guix build --substitute-urls=""' would lead to using the
    daemon's own URL list instead of the empty list.  The 'or*' hack, which
    is to blame, had become unnecessary since commit
    fb4bf72be3fbc23bca35ba4b842b7e1517ef0e3a.
    
    Reported by Mark H Weaver <address@hidden>.
    
    * guix/scripts/substitute.scm (or*): Remove.
    (%cache-urls): Use 'or' instead of 'or*'.
    * tests/store.scm ("substitute query, alternating URLs"): Add test with
    empty URL list.
    * doc/guix.texi (Common Build Options): Mention the empty string.
---
 doc/guix.texi               |    3 +++
 guix/scripts/substitute.scm |   10 ++--------
 tests/store.scm             |    6 +++++-
 3 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 05ce785..ba4fe1a 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -3983,6 +3983,9 @@ This means that substitutes may be downloaded from 
@var{urls}, provided
 they are signed by a key authorized by the system administrator
 (@pxref{Substitutes}).
 
+When @var{urls} is the empty string, substitutes are effectively
+disabled.
+
 @item --no-substitutes
 Do not use substitutes for build products.  That is, always build things
 locally instead of allowing downloads of pre-built binaries
diff --git a/guix/scripts/substitute.scm b/guix/scripts/substitute.scm
index b707acc..1ab18d0 100755
--- a/guix/scripts/substitute.scm
+++ b/guix/scripts/substitute.scm
@@ -953,15 +953,9 @@ substitutes may be unavailable\n")))))
 found."
   (assoc-ref (daemon-options) option))
 
-(define-syntax-rule (or* a b)
-  (let ((first a))
-    (if (or (not first) (string-null? first))
-        b
-        first)))
-
 (define %cache-urls
-  (match (and=> (or* (find-daemon-option "untrusted-substitute-urls") ;client
-                     (find-daemon-option "substitute-urls"))          ;admin
+  (match (and=> (or (find-daemon-option "untrusted-substitute-urls") ;client
+                    (find-daemon-option "substitute-urls"))          ;admin
                 string-tokenize)
     ((urls ...)
      urls)
diff --git a/tests/store.scm b/tests/store.scm
index 3d32d52..f7db7df 100644
--- a/tests/store.scm
+++ b/tests/store.scm
@@ -450,7 +450,11 @@
            (with-store s                        ;the right one again
              (set-build-options s #:use-substitutes? #t
                                 #:substitute-urls (%test-substitute-urls))
-             (has-substitutes? s o))))))
+             (has-substitutes? s o))
+           (with-store s                        ;empty list of URLs
+             (set-build-options s #:use-substitutes? #t
+                                #:substitute-urls '())
+             (not (has-substitutes? s o)))))))
 
 (test-assert "substitute"
   (with-store s



reply via email to

[Prev in Thread] Current Thread [Next in Thread]