From 175edbdeebae97eb784b8d2223c2392c9a5d250a Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Tue, 3 Jun 2025 22:26:17 +0100 Subject: store: Encode store paths using base32 instead of base16. * ravanan/store.scm: Import (guix base16) and (guix base32). (intern-file): Encode store paths using base32 instead of base16. --- ravanan/store.scm | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/ravanan/store.scm b/ravanan/store.scm index 00d26e6..f9d1939 100644 --- a/ravanan/store.scm +++ b/ravanan/store.scm @@ -19,6 +19,8 @@ (define-module (ravanan store) #:use-module (srfi srfi-26) #:use-module (ice-9 filesystem) + #:use-module (guix base16) + #:use-module (guix base32) #:use-module (ravanan work command-line-tool) #:use-module (ravanan work monads) #:use-module (ravanan work vectors) @@ -95,8 +97,9 @@ interned path and location." (checksum (assoc-ref file "checksum")) (sha1 (if (and checksum (string-prefix? "sha1$" checksum)) - (string-drop checksum (string-length "sha1$")) - (sha1-hash path))) + (base16-string->bytevector + (string-drop checksum (string-length "sha1$"))) + (sha1-hash-bytes path))) (interned-path (if (string-prefix? store path) ;; If file is already a store path, return it as is. @@ -107,7 +110,7 @@ interned path and location." (let ((interned-path (expand-file-name (file-name-join* %store-files-directory - (string-append sha1 + (string-append (bytevector->base32-string sha1) "-" (basename path)) (basename path)) -- cgit v1.2.3