(zilch magic): store resolved paths for CA drvs in meta
The non-Ninja implementations have a lot more derivation-realising churn; we don't need to realise every single "extract a file from a zip file" helper again for each file.
This commit is contained in:
parent
78b41236ab
commit
c7a92cb052
1 changed files with 30 additions and 18 deletions
|
|
@ -388,9 +388,34 @@
|
||||||
(define (do-build conn item)
|
(define (do-build conn item)
|
||||||
(call/cc
|
(call/cc
|
||||||
(lambda (cc)
|
(lambda (cc)
|
||||||
|
(define (build-done)
|
||||||
|
; Notify our dependencies that we're done.
|
||||||
|
(mutex-lock! pending-count-mutex)
|
||||||
|
(unless (eq? pending-count 'error)
|
||||||
|
(set! pending-count (- pending-count 1)))
|
||||||
|
|
||||||
|
; Notify the derivation that it is built.
|
||||||
|
(let* ((meta (derivation-meta (pending-item-ca-drv item)))
|
||||||
|
(post-build (and meta (assoc 'post-build meta))))
|
||||||
|
(when post-build ((cdr post-build) (pending-item-resolved-paths item))))
|
||||||
|
(mutex-unlock! pending-count-mutex)
|
||||||
|
(mutex-lock! pending-mutex)
|
||||||
|
(set-pending-item-awaiting-count! item 'built)
|
||||||
|
(for-each
|
||||||
|
(lambda (depends-on)
|
||||||
|
(set-pending-item-awaiting-count! depends-on (- (pending-item-awaiting-count depends-on) 1))
|
||||||
|
(wake-up depends-on))
|
||||||
|
(pending-item-awaited-by item))
|
||||||
|
(mutex-unlock! pending-mutex))
|
||||||
|
|
||||||
(define fallback-drv
|
(define fallback-drv
|
||||||
(let* ((meta (derivation-meta (pending-item-ca-drv item)))
|
(let* ((meta (derivation-meta (pending-item-ca-drv item)))
|
||||||
(fallback (and meta (assoc 'fallback meta))))
|
(fallback (and meta (assoc 'fallback meta)))
|
||||||
|
(result-paths (and meta (assoc 'built-paths meta))))
|
||||||
|
(when result-paths
|
||||||
|
(set-pending-item-resolved-paths! item (cdr result-paths))
|
||||||
|
(build-done)
|
||||||
|
(cc #f))
|
||||||
(and fallback (cdr fallback))))
|
(and fallback (cdr fallback))))
|
||||||
; Rewrite CA drv to IA drv using the known inputs
|
; Rewrite CA drv to IA drv using the known inputs
|
||||||
(define new-drvs (list))
|
(define new-drvs (list))
|
||||||
|
|
@ -472,24 +497,11 @@
|
||||||
(cons o ca-store-path))
|
(cons o ca-store-path))
|
||||||
outputs)))
|
outputs)))
|
||||||
|
|
||||||
; Notify our dependencies that we're done.
|
(set-derivation-meta! (pending-item-ca-drv item)
|
||||||
(mutex-lock! pending-count-mutex)
|
(cons (cons 'built-paths (pending-item-resolved-paths item))
|
||||||
(unless (eq? pending-count 'error)
|
(or (derivation-meta (pending-item-ca-drv item)) '())))
|
||||||
(set! pending-count (- pending-count 1)))
|
(build-done))))
|
||||||
|
|
||||||
; Notify the derivation that it is built.
|
|
||||||
(let* ((meta (derivation-meta ca-drv))
|
|
||||||
(post-build (and meta (assoc 'post-build meta))))
|
|
||||||
(when post-build ((cdr post-build) (pending-item-resolved-paths item))))
|
|
||||||
(mutex-unlock! pending-count-mutex)
|
|
||||||
(mutex-lock! pending-mutex)
|
|
||||||
(set-pending-item-awaiting-count! item 'built)
|
|
||||||
(for-each
|
|
||||||
(lambda (depends-on)
|
|
||||||
(set-pending-item-awaiting-count! depends-on (- (pending-item-awaiting-count depends-on) 1))
|
|
||||||
(wake-up depends-on))
|
|
||||||
(pending-item-awaited-by item))
|
|
||||||
(mutex-unlock! pending-mutex))))
|
|
||||||
(mutex-lock! pending-mutex)
|
(mutex-lock! pending-mutex)
|
||||||
(define root-pend (get-item input-drv))
|
(define root-pend (get-item input-drv))
|
||||||
(mutex-unlock! pending-mutex)
|
(mutex-unlock! pending-mutex)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue