store: (direct-store-path? (%store-prefix)) returns #f.

* guix/store.scm (direct-store-path?): Return #f if PATH
  is (%store-prefix).
* tests/store.scm ("direct-store-path?"): Add test.
This commit is contained in:
Ludovic Courtès 2014-04-26 16:38:38 +02:00
parent 02100028bb
commit eee2127109
2 changed files with 3 additions and 1 deletions

View File

@ -839,6 +839,7 @@ be used internally by the daemon's build hook."
This predicate is sometimes needed because files *under* a store path are not This predicate is sometimes needed because files *under* a store path are not
valid inputs." valid inputs."
(and (store-path? path) (and (store-path? path)
(not (string=? path (%store-prefix)))
(let ((len (+ 1 (string-length (%store-prefix))))) (let ((len (+ 1 (string-length (%store-prefix)))))
(not (string-index (substring path len) #\/))))) (not (string-index (substring path len) #\/)))))

View File

@ -85,7 +85,8 @@
(not (direct-store-path? (not (direct-store-path?
(string-append (string-append
(%store-prefix) (%store-prefix)
"/283gqy39v3g9dxjy26rynl0zls82fmcg-guile-2.0.7/bin/guile"))))) "/283gqy39v3g9dxjy26rynl0zls82fmcg-guile-2.0.7/bin/guile")))
(not (direct-store-path? (%store-prefix)))))
(test-skip (if %store 0 13)) (test-skip (if %store 0 13))