[bug#70494,08/23] store: Add text-output-path and text-output-path-from-hash.
Commit Message
* guix/store.scm (text-output-path, text-output-path-from-hash): New
procedures.
Change-Id: I38c3aaa0b304dd4f97a222a1065eb1b7f55bbfad
---
guix/store.scm | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
Comments
Christopher Baines <mail@cbaines.net> skribis:
> * guix/store.scm (text-output-path, text-output-path-from-hash): New
> procedures.
>
> Change-Id: I38c3aaa0b304dd4f97a222a1065eb1b7f55bbfad
OK. (Eventually should go to (guix store files).)
@@ -196,6 +196,8 @@ (define-module (guix store)
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 @@ (define* (fixed-output-path name hash
(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