summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2024-04-21 10:42:26 +0100
committerGuix Patches Tester <>2024-04-21 11:53:13 +0200
commit70d14c3836d08aac5216918abc2897c8357e6b61 (patch)
tree3d9973a5cecc7afc6c37989690511628e9cc875c
parentda7cee5fef2da600dd1c95f52d131b59e7519f70 (diff)
downloadguix-patches-70d14c3836d08aac5216918abc2897c8357e6b61.tar
guix-patches-70d14c3836d08aac5216918abc2897c8357e6b61.tar.gz
store: Add text-output-path and text-output-path-from-hash.
* guix/store.scm (text-output-path, text-output-path-from-hash): New procedures. Change-Id: I38c3aaa0b304dd4f97a222a1065eb1b7f55bbfad
-rw-r--r--guix/store.scm16
1 files changed, 16 insertions, 0 deletions
diff --git a/guix/store.scm b/guix/store.scm
index 578e46507e..b83f205096 100644
--- a/guix/store.scm
+++ b/guix/store.scm
@@ -196,6 +196,8 @@
store-path
output-path
fixed-output-path
+ text-output-path
+ text-output-path-from-hash
store-path?
direct-store-path?
derivation-path?
@@ -2280,6 +2282,20 @@ HASH-ALGO, of the derivation NAME. RECURSIVE? has the same meaning as for
(sha256 (string->utf8 tag))
name))))
+(define (text-output-path name text references)
+ (text-output-path-from-hash
+ name
+ (sha256 (string->utf8 text))
+ references))
+
+(define* (text-output-path-from-hash name text-hash references)
+ (store-path
+ (string-append "text" (string-join (sort references string<?)
+ ":"
+ 'prefix))
+ text-hash
+ name))
+
(define (store-path? path)
"Return #t if PATH is a store path."
;; This is a lightweight check, compared to using a regexp, but this has to