From c6e948592485fecfb1d290afb3a5bf4045bc6a9c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= <ludo@gnu.org>
Date: Tue, 1 Apr 2014 22:56:33 +0200
Subject: [PATCH] substitute-binary: Avoid reloading the ACL repeatedly.

* guix/scripts/substitute-binary.scm (guix-substitute-binary) <--query>:
  Cache the result of (current-acl); pass it to 'valid-narinfo?' calls.
  This saves 12% wall-clock time for "guix build emacs -n".
---
 guix/scripts/substitute-binary.scm | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/guix/scripts/substitute-binary.scm b/guix/scripts/substitute-binary.scm
index 8e08bf11723..f61d06a05c7 100755
--- a/guix/scripts/substitute-binary.scm
+++ b/guix/scripts/substitute-binary.scm
@@ -630,9 +630,10 @@ (define (guix-substitute-binary . args)
    (with-error-handling                           ; for signature errors
      (match args
        (("--query")
-        (let ((cache (delay (open-cache %cache-url))))
+        (let ((cache (delay (open-cache %cache-url)))
+              (acl   (current-acl)))
           (define (valid? obj)
-            (and (narinfo? obj) (valid-narinfo? obj)))
+            (and (narinfo? obj) (valid-narinfo? obj acl)))
 
           (let loop ((command (read-line)))
             (or (eof-object? command)
-- 
GitLab