git-authenticate: Cache takes a key parameter.
* guix/git-authenticate.scm (authenticated-commit-cache-file) (cache-authenticated-commit, previously-authenticated-commits): Add 'key' parameter and honor it. * build-aux/git-authenticate.scm (git-authenticate): Pass "channels/guix" as the key.master
parent
33391ee5c1
commit
a450b4343b
|
@ -252,7 +252,7 @@
|
||||||
(filter-map (lambda (id)
|
(filter-map (lambda (id)
|
||||||
(false-if-exception
|
(false-if-exception
|
||||||
(commit-lookup repository (string->oid id))))
|
(commit-lookup repository (string->oid id))))
|
||||||
(previously-authenticated-commits)))
|
(previously-authenticated-commits "channels/guix")))
|
||||||
|
|
||||||
(define commits
|
(define commits
|
||||||
;; Commits to authenticate, excluding the closure of
|
;; Commits to authenticate, excluding the closure of
|
||||||
|
@ -274,7 +274,8 @@
|
||||||
#:default-authorizations
|
#:default-authorizations
|
||||||
%historical-authorized-signing-keys
|
%historical-authorized-signing-keys
|
||||||
#:report-progress report)))))
|
#:report-progress report)))))
|
||||||
(cache-authenticated-commit (oid->string (commit-id end-commit)))
|
(cache-authenticated-commit "channels/guix"
|
||||||
|
(oid->string (commit-id end-commit)))
|
||||||
|
|
||||||
(unless (null? stats)
|
(unless (null? stats)
|
||||||
(format #t (G_ "Signing statistics:~%"))
|
(format #t (G_ "Signing statistics:~%"))
|
||||||
|
|
|
@ -295,33 +295,33 @@ The OpenPGP keyring is loaded from KEYRING-REFERENCE in REPOSITORY."
|
||||||
;;; Caching.
|
;;; Caching.
|
||||||
;;;
|
;;;
|
||||||
|
|
||||||
(define (authenticated-commit-cache-file)
|
(define (authenticated-commit-cache-file key)
|
||||||
"Return the name of the file that contains the cache of
|
"Return the name of the file that contains the cache of
|
||||||
previously-authenticated commits."
|
previously-authenticated commits for KEY."
|
||||||
(string-append (cache-directory) "/authentication/channels/guix"))
|
(string-append (cache-directory) "/authentication/" key))
|
||||||
|
|
||||||
(define (previously-authenticated-commits)
|
(define (previously-authenticated-commits key)
|
||||||
"Return the previously-authenticated commits as a list of commit IDs (hex
|
"Return the previously-authenticated commits under KEY as a list of commit
|
||||||
strings)."
|
IDs (hex strings)."
|
||||||
(catch 'system-error
|
(catch 'system-error
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(call-with-input-file (authenticated-commit-cache-file)
|
(call-with-input-file (authenticated-commit-cache-file key)
|
||||||
read))
|
read))
|
||||||
(lambda args
|
(lambda args
|
||||||
(if (= ENOENT (system-error-errno args))
|
(if (= ENOENT (system-error-errno args))
|
||||||
'()
|
'()
|
||||||
(apply throw args)))))
|
(apply throw args)))))
|
||||||
|
|
||||||
(define (cache-authenticated-commit commit-id)
|
(define (cache-authenticated-commit key commit-id)
|
||||||
"Record in ~/.cache COMMIT-ID and its closure as authenticated (only
|
"Record in ~/.cache, under KEY, COMMIT-ID and its closure as
|
||||||
COMMIT-ID is written to cache, though)."
|
authenticated (only COMMIT-ID is written to cache, though)."
|
||||||
(define %max-cache-length
|
(define %max-cache-length
|
||||||
;; Maximum number of commits in cache.
|
;; Maximum number of commits in cache.
|
||||||
200)
|
200)
|
||||||
|
|
||||||
(let ((lst (delete-duplicates
|
(let ((lst (delete-duplicates
|
||||||
(cons commit-id (previously-authenticated-commits))))
|
(cons commit-id (previously-authenticated-commits key))))
|
||||||
(file (authenticated-commit-cache-file)))
|
(file (authenticated-commit-cache-file key)))
|
||||||
(mkdir-p (dirname file))
|
(mkdir-p (dirname file))
|
||||||
(with-atomic-file-output file
|
(with-atomic-file-output file
|
||||||
(lambda (port)
|
(lambda (port)
|
||||||
|
|
Reference in New Issue