utils: Add sri-hash.

* modules/rosenthal/utils/packages.scm (sri-hash): New macro.
This commit is contained in:
Hilton Chain committed 2026-10-30 14:00:41 +08:00
1 parent 55d68222f4
commit e0db50c276
1 file changed
+17 -1
+17 -1
View File
@@ -23,7 +23,9 @@
#:use-module (gnu packages base)
#:replace (%patch-path
search-patch)
#:export (rosenthal-patches
#:export (sri-hash
rosenthal-patches
%rosenthal-package-module-path
all-rosenthal-packages
@@ -39,6 +41,20 @@
binary-package
mapping-for-system))
(define-syntax sri-hash
(lambda (stx)
(syntax-case stx ()
((_ str)
(let ((str (syntax->datum #'str)))
(and (string? str)
(string-index str #\-)))
(let* ((str (syntax->datum #'str))
(dash (string-index str #\-))
(algo (substring str 0 dash))
(hash (substring str (1+ dash))))
(with-syntax ((algorithm (datum->syntax #'stx (string->symbol algo))))
#`(content-hash (base64 #,hash) algorithm)))))))
(define %rosenthal-root-directory
;; This is like %distro-root-directory from (gnu packages), with adjusted
;; paths.