aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--guix/pki.scm11
-rw-r--r--guix/scripts/archive.scm4
2 files changed, 9 insertions, 6 deletions
diff --git a/guix/pki.scm b/guix/pki.scm
index 6f5e95b0ab..3cd9763fdf 100644
--- a/guix/pki.scm
+++ b/guix/pki.scm
@@ -30,6 +30,7 @@
public-keys->acl
acl->public-keys
authorized-key?
+ write-acl
signature-sexp
signature-subject
@@ -83,9 +84,13 @@ element in KEYS must be a canonical sexp with type 'public-key'."
(mkdir-p (dirname %acl-file))
(with-atomic-file-output %acl-file
(lambda (port)
- (display (canonical-sexp->string
- (public-keys->acl (list public-key)))
- port)))))))
+ (write-acl (public-keys->acl (list public-key))
+ port)))))))
+
+(define (write-acl acl port)
+ "Write ACL to PORT in canonical-sexp format."
+ (let ((sexp (sexp->canonical-sexp acl)))
+ (display (canonical-sexp->string sexp) port)))
(define (current-acl)
"Return the current ACL."
diff --git a/guix/scripts/archive.scm b/guix/scripts/archive.scm
index 90dc844281..0a2e186da6 100644
--- a/guix/scripts/archive.scm
+++ b/guix/scripts/archive.scm
@@ -288,9 +288,7 @@ the input port."
(let ((acl (public-keys->acl (cons key (acl->public-keys acl)))))
(mkdir-p (dirname %acl-file))
(with-atomic-file-output %acl-file
- (lambda (port)
- (display (canonical-sexp->string (sexp->canonical-sexp acl))
- port))))))
+ (cut write-acl acl <>)))))
(define (guix-archive . args)
(define (parse-options)