mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-11-07 07:26:13 -05:00
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.
This commit is contained in:
parent
26b969dee0
commit
af7f9e5f13
2 changed files with 9 additions and 4 deletions
|
@ -308,19 +308,22 @@ (define (add-output-paths drv)
|
|||
|
||||
(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.
|
||||
|
|
|
@ -59,7 +59,9 @@ (define %store
|
|||
((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))))
|
||||
|
|
Loading…
Reference in a new issue