diff options
author | Ludovic Courtès <ludo@gnu.org> | 2023-01-09 10:27:54 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2023-01-09 17:40:53 +0100 |
commit | 007e69756087234de4d9ea896e013e5d0232bd25 (patch) | |
tree | 7267d32f4d9df44695b94fcfb657224acf32dd00 | |
parent | 47c1de22df30aa6c4a2f0d8249be93c3c7bc0022 (diff) | |
download | guix-007e69756087234de4d9ea896e013e5d0232bd25.tar.gz |
substitute: Parse '_NIX_OPTIONS' once.
* guix/scripts/substitute.scm (find-daemon-option): Arrange to call 'daemon-options' only once.
-rwxr-xr-x | guix/scripts/substitute.scm | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/guix/scripts/substitute.scm b/guix/scripts/substitute.scm index 0efa61b0d7..fedb33019d 100755 --- a/guix/scripts/substitute.scm +++ b/guix/scripts/substitute.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2013-2022 Ludovic Courtès <ludo@gnu.org> +;;; Copyright © 2013-2023 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2014 Nikita Karetnikov <nikita@karetnikov.org> ;;; Copyright © 2018 Kyle Meyer <kyle@kyleam.com> ;;; Copyright © 2020 Christopher Baines <mail@cbaines.net> @@ -706,10 +706,12 @@ substitutes may be unavailable\n"))))) (string-drop option=value (+ 1 equal-sign)))))) (string-tokenize newline-separated %not-newline))))) -(define (find-daemon-option option) - "Return the value of build daemon option OPTION, or #f if it could not be +(define find-daemon-option + (let ((options (delay (daemon-options)))) + (lambda (option) + "Return the value of build daemon option OPTION, or #f if it could not be found." - (assoc-ref (daemon-options) option)) + (assoc-ref (force options) option)))) (define %default-substitute-urls (match (and=> (or (find-daemon-option "untrusted-substitute-urls") ;client |