From 16eb115ef4986f319e6aebb04cefce12bc851e01 Mon Sep 17 00:00:00 2001 From: nebuli Date: Sun, 30 Nov 2014 17:47:22 +0100 Subject: guix: scripts: Add GUIX_BUILD_OPTIONS environment handling. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * doc/guix.texi (Invoking guix build): Mention 'GUIX_BUILD_OPTIONS'. * guix/scripts/archive.scm: (append args (environment-build-options)). * guix/scripts/build.scm: Ditto. * guix/scripts/environment.scm: Ditto. * guix/scripts/package.scm: Ditto. * guix/scripts/system.scm: Ditto. * guix/ui.scm (environment-build-options): New function. * guix/utils.scm (arguments-from-environment-variable): New function. * tests/guix-build.sh: Add tests. * test-env.in: Unset GUIX_BUILD_OPTIONS. Co-authored-by: Ludovic Courtès --- guix/utils.scm | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'guix/utils.scm') diff --git a/guix/utils.scm b/guix/utils.scm index 9b802b6fb3..d0d2e8a3d4 100644 --- a/guix/utils.scm +++ b/guix/utils.scm @@ -72,6 +72,7 @@ package-name->name+version string-tokenize* string-replace-substring + arguments-from-environment-variable file-extension file-sans-extension call-with-temporary-output-file @@ -627,6 +628,15 @@ REPLACEMENT." (substring str start index) pieces)))))))) +(define (arguments-from-environment-variable variable) + "Retrieve value of environment variable denoted by string VARIABLE in the +form of a list of strings (`char-set:graphic' tokens) suitable for consumption +by `args-fold', if VARIABLE is defined, otherwise return an empty list." + (let ((env (getenv variable))) + (if env + (string-tokenize env char-set:graphic) + '()))) + (define (call-with-temporary-output-file proc) "Call PROC with a name of a temporary file and open output port to that file; close the file and delete it when leaving the dynamic extent of this -- cgit v1.2.3