diff options
author | Ludovic Courtès <ludo@gnu.org> | 2019-07-04 23:09:11 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2019-07-05 00:51:17 +0200 |
commit | b1510fd8d252c1ab0d32a32f064513105b99cf39 (patch) | |
tree | eec62843caaa0ef298826f5f7fdefbb698249b1f /guix/derivations.scm | |
parent | 87850c05a208f7b4213f632f3f79b59e76880724 (diff) |
derivations: 'derivation-build-plan' recurses on substituables.
This fixes a bug whereby "guix build texlive -n" would report:
0.0 MB would be downloaded:
/gnu/store/…-texlive-20180414
instead of:
The following derivation would be built:
/gnu/store/…-texlive-texmf-20180414.drv
2,595.2 MB would be downloaded:
/gnu/store/…-texlive-20180414-texmf.tar.xz
/gnu/store/…-texlive-20180414
where 'texlive-texmf' is a non-substitutable dependency of 'texlive'.
* guix/derivations.scm (dependencies-of-substitutables): New procedure.
(derivation-build-plan): When 'input-substitutable-info' returns true,
append the subset of DEPS that corresponds to SUBSTITUABLES to the first
argument of 'loop'.
* guix/ui.scm (show-what-to-build): Remove half-baked traversal of
DOWNLOAD.
* tests/derivations.scm ("derivation-build-plan and substitutes,
non-substitutable dep"): New test.
Diffstat (limited to 'guix/derivations.scm')
-rw-r--r-- | guix/derivations.scm | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/guix/derivations.scm b/guix/derivations.scm index 186d7a3f8f..caa76bd16c 100644 --- a/guix/derivations.scm +++ b/guix/derivations.scm @@ -352,6 +352,16 @@ substituter many times." (#f #f) ((key . value) value))))) +(define (dependencies-of-substitutables substitutables inputs) + "Return the subset of INPUTS whose output file names is among the references +of SUBSTITUTABLES." + (let ((items (fold set-insert (set) + (append-map substitutable-references substitutables)))) + (filter (lambda (input) + (any (cut set-contains? items <>) + (derivation-input-output-paths input))) + inputs))) + (define* (derivation-build-plan store inputs #:key (mode (build-mode normal)) @@ -391,7 +401,9 @@ by 'substitution-oracle'." (() (values build substitute)) ((input rest ...) - (let ((key (derivation-input-key input))) + (let ((key (derivation-input-key input)) + (deps (derivation-inputs + (derivation-input-derivation input)))) (cond ((set-contains? visited key) (loop rest build substitute visited)) ((input-built? input) @@ -400,16 +412,17 @@ by 'substitution-oracle'." ((input-substitutable-info input) => (lambda (substitutables) - (loop rest build + (loop (append (dependencies-of-substitutables substitutables + deps) + rest) + build (append substitutables substitute) (set-insert key visited)))) (else - (let ((deps (derivation-inputs - (derivation-input-derivation input)))) - (loop (append deps rest) - (cons (derivation-input-derivation input) build) - substitute - (set-insert key visited)))))))))) + (loop (append deps rest) + (cons (derivation-input-derivation input) build) + substitute + (set-insert key visited))))))))) (define-deprecated (derivation-prerequisites-to-build store drv #:rest rest) derivation-build-plan |