diff options
author | Ludovic Courtès <ludo@gnu.org> | 2012-06-09 21:50:30 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2012-06-09 21:50:30 +0200 |
commit | af7f9e5f13106ccfd6c9144e40dff5071672b195 (patch) | |
tree | 8e6d89b613241d497bbf0e1f30f981a8b6043f42 | |
parent | 26b969dee0d1abb92b44998dc573dad79b76d4cd (diff) | |
download | patches-af7f9e5f13106ccfd6c9144e40dff5071672b195.tar patches-af7f9e5f13106ccfd6c9144e40dff5071672b195.tar.gz |
Sort environment variables alphabetically in `derivation'.
* guix/derivations.scm (derivation)[env-vars-with-empty-outputs]: Sort
the result alphabetically.
* tests/derivations.scm ("build derivation with 1 source"): Add
environment variables.
-rw-r--r-- | guix/derivations.scm | 9 | ||||
-rw-r--r-- | tests/derivations.scm | 4 |
2 files changed, 9 insertions, 4 deletions
diff --git a/guix/derivations.scm b/guix/derivations.scm index 5897630205..38e05b25f2 100644 --- a/guix/derivations.scm +++ b/guix/derivations.scm @@ -308,19 +308,22 @@ known in advance, such as a file download." (define (env-vars-with-empty-outputs) ;; Return a variant of ENV-VARS where each OUTPUTS is associated with an - ;; empty string, even outputs that do not appear in ENV-VARS. + ;; empty string, even outputs that do not appear in ENV-VARS. Note: the + ;; result is sorted alphabetically, as with C++ `std::map'. (let ((e (map (match-lambda ((name . val) (if (member name outputs) (cons name "") (cons name val)))) env-vars))) - (fold-right (lambda (output-name env-vars) + (sort (fold (lambda (output-name env-vars) (if (assoc output-name env-vars) env-vars (append env-vars `((,output-name . ""))))) e - outputs))) + outputs) + (lambda (e1 e2) + (string<? (car e1) (car e2)))))) (let* ((outputs (map (lambda (name) ;; Return outputs with an empty path. diff --git a/tests/derivations.scm b/tests/derivations.scm index 34098d79ca..dd4f9ee254 100644 --- a/tests/derivations.scm +++ b/tests/derivations.scm @@ -59,7 +59,9 @@ ((drv-path drv) (derivation %store "foo" "x86_64-linux" "/bin/sh" `(,builder) - '(("HOME" . "/homeless")) + '(("HOME" . "/homeless") + ("zzz" . "Z!") + ("AAA" . "A!")) `((,builder)))) ((succeeded?) (build-derivations %store (list drv-path)))) |