diff options
author | Ludovic Courtès <ludo@gnu.org> | 2019-12-12 12:56:55 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2020-01-05 11:40:01 +0100 |
commit | 09763444ce748487640c95d4e1a2cf9645c4e250 (patch) | |
tree | e3c7e883a4ebdc58db9c3f1fe5e0366e575e0afc | |
parent | 947c4a16899bc6673e3e04e6f7c50c2c63ad43e5 (diff) | |
download | guix-09763444ce748487640c95d4e1a2cf9645c4e250.tar.gz |
derivations: Add #:skip-dependencies? parameter to 'derivation-input-fold'.
* guix/derivations.scm (derivation-input-fold): Add #:skip-dependencies?.
-rw-r--r-- | guix/derivations.scm | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/guix/derivations.scm b/guix/derivations.scm index 480a65c78b..0ee325d489 100644 --- a/guix/derivations.scm +++ b/guix/derivations.scm @@ -305,10 +305,13 @@ result is the set of prerequisites of DRV not already in valid." sub-drvs)))) (define* (derivation-input-fold proc seed inputs - #:key (cut? (const #f))) + #:key + (cut? (const #f)) + (skip-dependencies? (const #f))) "Perform a breadth-first traversal of INPUTS, calling PROC on each input -with the current result, starting from SEED. Skip recursion on inputs that -match CUT?." +with the current result, starting from SEED. Skip inputs that match CUT? as +well as all their dependencies; skip the dependencies of inputs that match +SKIP-DEPENDENCIES?, but not the input itself." (let loop ((inputs inputs) (result seed) (visited (set))) @@ -323,7 +326,9 @@ match CUT?." (loop rest result (set-insert key visited))) (else (let ((drv (derivation-input-derivation input))) - (loop (append (derivation-inputs drv) rest) + (loop (if (skip-dependencies? input) + rest + (append (derivation-inputs drv) rest)) (proc input result) (set-insert key visited)))))))))) |