diff options
author | Ludovic Courtès <ludo@gnu.org> | 2012-12-10 00:44:17 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2012-12-10 00:44:17 +0100 |
commit | 200dc93761d74ec5646603d67176841b602344d4 (patch) | |
tree | 6ee9ad44367efcce10853a453c91ca8bdb262666 /guix | |
parent | 3259877d3563ac022633fbd8b73134a10567331e (diff) |
derivations: Distinguish direct store paths from files within a store path.
* guix/derivations.scm (derivation)[direct-store-path?]: New procedure.
Use it to determine which inputs must be added to the store.
Diffstat (limited to 'guix')
-rw-r--r-- | guix/derivations.scm | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/guix/derivations.scm b/guix/derivations.scm index b1f54232bc..6fbce14da0 100644 --- a/guix/derivations.scm +++ b/guix/derivations.scm @@ -364,6 +364,15 @@ the derivation called NAME with hash HASH." store path and <derivation> object. When HASH, HASH-ALGO, and HASH-MODE are given, a fixed-output derivation is created---i.e., one whose result is known in advance, such as a file download." + (define direct-store-path? + (let ((len (+ 1 (string-length (%store-prefix))))) + (lambda (p) + ;; Return #t if P is a store path, and not a sub-directory of a + ;; store path. This predicate is needed because files *under* a + ;; store path are not valid inputs. + (and (store-path? p) + (not (string-index (substring p len) #\/)))))) + (define (add-output-paths drv) ;; Return DRV with an actual store path for each of its output and the ;; corresponding environment variable. @@ -411,9 +420,9 @@ known in advance, such as a file download." (make-derivation-output "" hash-algo hash))) outputs)) (inputs (map (match-lambda - (((? store-path? input)) + (((? direct-store-path? input)) (make-derivation-input input '("out"))) - (((? store-path? input) sub-drvs ...) + (((? direct-store-path? input) sub-drvs ...) (make-derivation-input input sub-drvs)) ((input . _) (let ((path (add-to-store store |