store: Make derivation-path? use direct-store-path?.

* guix/store.scm (derivation-path?): Use direct-store-path? instead of
store-path?.
* tests/store.scm (derivation-path?): New test.

Change-Id: Ib54b9e2045f19f26039cf072eeb79dab8f0195be
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Merges: #6192
This commit is contained in:
Yarl Baudig
2026-02-07 02:16:01 +01:00
committed by Ludovic Courtès
parent afcfe2bc3c
commit a06c9b0ff7
2 changed files with 13 additions and 1 deletions

View File

@@ -1980,7 +1980,7 @@ valid inputs."
(define (derivation-path? path) (define (derivation-path? path)
"Return #t if PATH is a derivation path." "Return #t if PATH is a derivation path."
(and (store-path? path) (string-suffix? ".drv" path))) (and (direct-store-path? path) (string-suffix? ".drv" path)))
(define (store-path-base path) (define (store-path-base path)
"Return the base path of a path in the store." "Return the base path of a path in the store."

View File

@@ -109,6 +109,18 @@
"/283gqy39v3g9dxjy26rynl0zls82fmcg-guile-2.0.7/bin/guile"))) "/283gqy39v3g9dxjy26rynl0zls82fmcg-guile-2.0.7/bin/guile")))
(not (direct-store-path? (%store-prefix))))) (not (direct-store-path? (%store-prefix)))))
(test-assert "derivation-path?"
(and (derivation-path?
(string-append (%store-prefix)
"/283gqy39v3g9dxjy26rynl0zls82fmcg-guile-2.0.7.drv"))
(not (derivation-path?
(string-append (%store-prefix)
"/283gqy39v3g9dxjy26rynl0zls82fmcg-guile-2.0.7")))
(not (derivation-path?
(string-append
(%store-prefix)
"/283gqy39v3g9dxjy26rynl0zls82fmcg-guile-2.0.7/guile.drv")))))
(test-skip (if %store 0 18)) (test-skip (if %store 0 18))
(test-equal "substitute-urls, default" (test-equal "substitute-urls, default"