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
fb4bf72be3.
Reported by Mark H Weaver <mhw@netris.org>.
* 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.
			
			
This commit is contained in:
		
							parent
							
								
									1ac94ae166
								
							
						
					
					
						commit
						71e2065a38
					
				
					 3 changed files with 10 additions and 9 deletions
				
			
		|  | @ -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 | they are signed by a key authorized by the system administrator | ||||||
| (@pxref{Substitutes}). | (@pxref{Substitutes}). | ||||||
| 
 | 
 | ||||||
|  | When @var{urls} is the empty string, substitutes are effectively | ||||||
|  | disabled. | ||||||
|  | 
 | ||||||
| @item --no-substitutes | @item --no-substitutes | ||||||
| Do not use substitutes for build products.  That is, always build things | Do not use substitutes for build products.  That is, always build things | ||||||
| locally instead of allowing downloads of pre-built binaries | locally instead of allowing downloads of pre-built binaries | ||||||
|  |  | ||||||
|  | @ -953,14 +953,8 @@ substitutes may be unavailable\n"))))) | ||||||
| found." | found." | ||||||
|   (assoc-ref (daemon-options) option)) |   (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 | (define %cache-urls | ||||||
|   (match (and=> (or* (find-daemon-option "untrusted-substitute-urls") ;client |   (match (and=> (or (find-daemon-option "untrusted-substitute-urls") ;client | ||||||
|                     (find-daemon-option "substitute-urls"))          ;admin |                     (find-daemon-option "substitute-urls"))          ;admin | ||||||
|                 string-tokenize) |                 string-tokenize) | ||||||
|     ((urls ...) |     ((urls ...) | ||||||
|  |  | ||||||
|  | @ -450,7 +450,11 @@ | ||||||
|            (with-store s                        ;the right one again |            (with-store s                        ;the right one again | ||||||
|              (set-build-options s #:use-substitutes? #t |              (set-build-options s #:use-substitutes? #t | ||||||
|                                 #:substitute-urls (%test-substitute-urls)) |                                 #: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" | (test-assert "substitute" | ||||||
|   (with-store s |   (with-store s | ||||||
|  |  | ||||||
		Reference in a new issue