(zilch nix drv): remove impure derivation support
This commit is contained in:
parent
c9e48ff1ba
commit
c7acae633f
1 changed files with 4 additions and 23 deletions
|
|
@ -24,7 +24,7 @@
|
|||
drv-is-fod
|
||||
|
||||
derivation-serialize derivation-path-references derivation-path derivation-read read-drv-path
|
||||
make-fixed-output-derivation make-input-addressed-derivation make-impure-derivation make-ca-derivation
|
||||
make-fixed-output-derivation make-input-addressed-derivation make-ca-derivation
|
||||
modulo-hash-drv-contents)
|
||||
|
||||
(begin
|
||||
|
|
@ -58,7 +58,7 @@
|
|||
(derivation-output-recursive drvout)))
|
||||
|
||||
(define (derivation-output-placeholder? drvout)
|
||||
(member (derivation-output-hash drvout) '(floating impure)))
|
||||
(member (derivation-output-hash drvout) '(floating)))
|
||||
|
||||
(define (derivation-output-path-length drv output-name)
|
||||
; /nix/store/a0a3n97c93ckfg3a920aqnycxdznbbmi-module-output
|
||||
|
|
@ -179,9 +179,6 @@
|
|||
(define first-output-is-hash (bytevector? (derivation-output-hash (cdr first-output))))
|
||||
(and (= (length outs) 1) (string=? first-output-id "out") first-output-is-hash))
|
||||
|
||||
(define (drv-is-impure drv)
|
||||
(eq? (derivation-output-hash (cdr (car (derivation-outputs drv)))) 'impure))
|
||||
|
||||
(define (env-pair< left right)
|
||||
(string<? (car left) (car right)))
|
||||
|
||||
|
|
@ -191,8 +188,6 @@
|
|||
((drv-is-fod drv)
|
||||
(let ((out (cdar (derivation-outputs drv))))
|
||||
(string->utf8 (string-append "fixed:out:" (if (derivation-output-recursive out) "r:" "") (derivation-output-algo out) ":" (hex (derivation-output-hash out)) ":" (derivation-output-path out)))))
|
||||
((drv-is-impure drv)
|
||||
(string->utf8 "impure"))
|
||||
(else
|
||||
(let ((remapped-input-drvs '())
|
||||
(output-port (open-output-bytevector))
|
||||
|
|
@ -200,7 +195,7 @@
|
|||
; TODO: this needs to merge output names too (depending on two distinct drvs with the same output hash requires merging their output names.)
|
||||
(for-each (lambda (l)
|
||||
(let* ((new-hash (hex (modulo-hash-drv (car l)))))
|
||||
(set! is-deferred (or is-deferred (derivation-metadata-is-deferred (derivation-metadata (car l))) (drv-is-impure (car l))))
|
||||
(set! is-deferred (or is-deferred (derivation-metadata-is-deferred (derivation-metadata (car l)))))
|
||||
(unless (assoc new-hash remapped-input-drvs) (set! remapped-input-drvs (cons (cons new-hash (cdr l)) remapped-input-drvs)))))
|
||||
(derivation-input-drvs drv))
|
||||
(set! remapped-input-drvs (list-sort env-pair< remapped-input-drvs))
|
||||
|
|
@ -274,19 +269,6 @@
|
|||
(sanity-check-drv drv)
|
||||
drv)
|
||||
|
||||
;; Creates an impure addressed derivation with specified parameters.
|
||||
(define (make-impure-derivation name platform input-drvs input-srcs builder nenv noutputs)
|
||||
(define compat-env (if (%derivation-compatible) `(("name" . ,name) ("builder" . ,(car builder)) ("system" . ,platform)) '()))
|
||||
|
||||
(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< (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-metadata #f #f #t #f #f)))
|
||||
(define pathhash (string-copy (derivation-path drv) (+ 1 (string-length (%store-dir))) (+ 33 (string-length (%store-dir)))))
|
||||
(for-each (lambda (pair) (set-derivation-output-path! (cdr pair) (make-upstream-output-placeholder pathhash name (car pair)))) (derivation-outputs drv))
|
||||
drv)
|
||||
|
||||
;; Creates a content-addressed derivation with specified parameters.
|
||||
(define (make-ca-derivation name platform input-drvs input-srcs builder nenv noutputs)
|
||||
(define compat-env (if (%derivation-compatible) `(("name" . ,name) ("builder" . ,(car builder)) ("system" . ,platform)) '()))
|
||||
|
|
@ -305,11 +287,10 @@
|
|||
(define output (cdr pair))
|
||||
(write-paren-list write-quoted-string
|
||||
(list output-name
|
||||
(if (member (derivation-output-hash output) '(impure floating)) "" (or (derivation-output-path output) ""))
|
||||
(if (member (derivation-output-hash output) '(floating)) "" (or (derivation-output-path output) ""))
|
||||
(string-append (if (derivation-output-recursive output) "r:" "") (or (derivation-output-algo output) ""))
|
||||
(cond
|
||||
((bytevector? (derivation-output-hash output)) (hex (derivation-output-hash output)))
|
||||
((eq? (derivation-output-hash output) 'impure) "impure")
|
||||
((eq? (derivation-output-hash output) 'floating) "")
|
||||
((not (derivation-output-hash output)) "")
|
||||
(else (error "unknown derivation output hash type"))))))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue