(zilch nix drv): finally fix overlapping environment variables
Having an `out` environment variable now correctly gets it ignored entirely, rather than behave unexpectedly.
This commit is contained in:
parent
3f2e90543e
commit
355af66489
1 changed files with 8 additions and 6 deletions
|
|
@ -234,14 +234,16 @@
|
|||
(error "Derivation output path mismatch: " (make-output-path "sha256" modulo-hash (car output) name) " vs " (derivation-output-path (cdr output)))))
|
||||
(derivation-outputs orig-drv)))
|
||||
|
||||
(define (filter-environment env-list output)
|
||||
(for-each (lambda (kv) (unless (assoc (car kv) output string=?) (set! output (cons kv output)))) env-list)
|
||||
output)
|
||||
|
||||
;; Creates an input-addressed derivation with specified parameters.
|
||||
(define (make-input-addressed-derivation name platform input-drvs input-srcs builder env outputs)
|
||||
(define compat-env (if (%derivation-compatible) `(("name" . ,name) ("builder" . ,(car builder)) ("system" . ,platform)) '()))
|
||||
|
||||
(define tmp-outputs (list-sort env-pair< (map (lambda (l) (cons l (make-derivation-output #f #f #f #f))) outputs)))
|
||||
(define tmp-env (list-sort env-pair< (apply append (list (map (lambda (l) (cons l "")) outputs)
|
||||
compat-env
|
||||
env))))
|
||||
(define tmp-env (list-sort env-pair< (filter-environment env (append compat-env (map (lambda (l) (cons l "")) outputs)))))
|
||||
|
||||
(define tmp-drv (make-derivation name tmp-outputs input-drvs input-srcs platform (car builder) (cdr builder) tmp-env (make-derivation-cached-data #f #f #f #f)))
|
||||
(define modulo-hash (modulo-hash-drv tmp-drv))
|
||||
|
|
@ -249,7 +251,7 @@
|
|||
|
||||
(define new-outputs (list-sort env-pair< (map (lambda (l) (cons l (make-derivation-output
|
||||
(if is-deferred #f (make-output-path "sha256" modulo-hash l name)) #f #f #f))) outputs)))
|
||||
(define new-env (list-sort env-pair< (apply append (list (map (lambda (l) (cons l (make-output-path "sha256" modulo-hash l name))) outputs) compat-env env))))
|
||||
(define new-env (list-sort env-pair< (filter-environment env (append compat-env (map (lambda (l) (cons l (make-output-path "sha256" modulo-hash l name))) outputs)))))
|
||||
|
||||
(define drv (make-derivation name new-outputs input-drvs input-srcs platform (car builder) (cdr builder) new-env (make-derivation-cached-data #f #f (derivation-cached-data-is-deferred (derivation-cached-data tmp-drv)) #f)))
|
||||
(sanity-check-drv drv)
|
||||
|
|
@ -261,7 +263,7 @@
|
|||
|
||||
(define outputs (list-sort env-pair< (map (lambda (l) (cons l (make-derivation-output
|
||||
#f 'impure "sha256" #t))) noutputs)))
|
||||
(define env (list-sort env-pair< (apply append (list (map (lambda (l) (cons (car l) (make-placeholder (car l)))) outputs) compat-env nenv))))
|
||||
(define env (list-sort env-pair< (filter-environment env (append compat-env (map (lambda (l) (cons (car l) (make-placeholder (car l)))) outputs)))))
|
||||
|
||||
(define drv (make-derivation name outputs input-drvs input-srcs platform (car builder) (cdr builder) env (make-derivation-cached-data #f #f #t #f)))
|
||||
(define pathhash (string-copy (derivation-path drv) (+ 1 (string-length (%store-dir))) (+ 33 (string-length (%store-dir)))))
|
||||
|
|
@ -274,7 +276,7 @@
|
|||
|
||||
(define outputs (list-sort env-pair< (map (lambda (l) (cons l (make-derivation-output
|
||||
#f 'floating "sha256" #t))) noutputs)))
|
||||
(define env (list-sort env-pair< (apply append (list (map (lambda (l) (cons (car l) (make-placeholder (car l)))) outputs) compat-env nenv))))
|
||||
(define env (list-sort env-pair< (filter-environment nenv (append compat-env (map (lambda (l) (cons (car l) (make-placeholder (car l)))) outputs)))))
|
||||
|
||||
(define drv (make-derivation name outputs input-drvs input-srcs platform (car builder) (cdr builder) env (make-derivation-cached-data #f #f #t #f)))
|
||||
(define pathhash (string-copy (derivation-path drv) (+ 1 (string-length (%store-dir))) (+ 33 (string-length (%store-dir)))))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue