1
0
mirror of https://git.savannah.gnu.org/git/guix.git synced 2026-04-06 21:20:33 +02:00

inferior: Allow caching of unauthenticated channels.

* guix/inferior.scm (cached-channel-instance): Distinguish
keys for authenticated and unauthenticated channel instances.
Allow caching unauthenticated channels.

Change-Id: I25cec6bff99579e8859fdb474514bcd4d41c6d95
Signed-off-by: Rutherther <rutherther@ditigal.xyz>
Merges: #3024
This commit is contained in:
Rutherther
2026-01-05 10:10:10 +01:00
parent cebff095e9
commit b7510ecaf1

View File

@@ -918,7 +918,9 @@ X.509 host certificate; otherwise, warn about the problem and keep going."
(define (key commits)
(bytevector->base32-string
(sha256
(string->utf8 (string-concatenate commits)))))
(string->utf8 (string-append
(if authenticate? "" "unauthenticated:")
(string-concatenate commits))))))
(define (cached commits)
(string-append cache-directory "/" (key commits)))
@@ -990,15 +992,12 @@ X.509 host certificate; otherwise, warn about the problem and keep going."
;; what's going to be built.
(built-derivations (list profile))
;; Cache if and only if AUTHENTICATE? is true.
(if authenticate?
(mbegin %store-monad
(symlink* (derivation->output-path profile) (cached commits))
(add-indirect-root* (cached commits))
(return (cached commits)))
(mbegin %store-monad
(add-temp-root* (derivation->output-path profile))
(return (derivation->output-path profile)))))))))))
;; This is safe, since we are using a different key for
;; unauthenticated commits.
(mbegin %store-monad
(symlink* (derivation->output-path profile) (cached commits))
(add-indirect-root* (cached commits))
(return (cached commits))))))))))
(define* (inferior-for-channels channels
#:key