From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:470:142:3::10]:34233) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iduiN-0004cA-KR for guix-patches@gnu.org; Sun, 08 Dec 2019 06:27:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iduiM-0004sW-Kr for guix-patches@gnu.org; Sun, 08 Dec 2019 06:27:03 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:44613) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iduiM-0004rJ-GC for guix-patches@gnu.org; Sun, 08 Dec 2019 06:27:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iduiM-0007t8-Cv for guix-patches@gnu.org; Sun, 08 Dec 2019 06:27:02 -0500 Subject: [bug#38518] [PATCH 3/7] challenge: Report the best narinfo URI. Resent-Message-ID: From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Date: Sun, 8 Dec 2019 12:26:33 +0100 Message-Id: <20191208112637.5534-3-ludo@gnu.org> In-Reply-To: <20191208112637.5534-1-ludo@gnu.org> References: <20191208112637.5534-1-ludo@gnu.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: 38518@debbugs.gnu.org Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= * guix/scripts/substitute.scm (select-uri): Rename to... (narinfo-best-uri): ... this, and make public. Update callers. * guix/scripts/challenge.scm (summarize-report): Use 'narinfo-best-uri' instead of (first (narinfo-uris ...)). --- guix/scripts/challenge.scm | 2 +- guix/scripts/substitute.scm | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/guix/scripts/challenge.scm b/guix/scripts/challenge.scm index 17e87f0291..aabb2ee549 100644 --- a/guix/scripts/challenge.scm +++ b/guix/scripts/challenge.scm @@ -192,7 +192,7 @@ inconclusive reports." (report (G_ " no local build for '~a'~%") item)) (for-each (lambda (narinfo) (report (G_ " ~50a: ~a~%") - (uri->string (first (narinfo-uris narinfo))) + (uri->string (narinfo-best-uri narinfo)) (hash->string (narinfo-hash->sha256 (narinfo-hash narinfo))))) narinfos)) diff --git a/guix/scripts/substitute.scm b/guix/scripts/substitute.scm index b6034a75d2..4802fbd1fe 100755 --- a/guix/scripts/substitute.scm +++ b/guix/scripts/substitute.scm @@ -80,6 +80,7 @@ narinfo-signature narinfo-hash->sha256 + narinfo-best-uri lookup-narinfos lookup-narinfos/diverse @@ -913,7 +914,7 @@ expected by the daemon." (for-each (cute format #t "~a/~a~%" (%store-prefix) <>) (narinfo-references narinfo)) - (let-values (((uri compression file-size) (select-uri narinfo))) + (let-values (((uri compression file-size) (narinfo-best-uri narinfo))) (format #t "~a\n~a\n" (or file-size 0) (or (narinfo-size narinfo) 0)))) @@ -967,7 +968,7 @@ this is a rough approximation." (_ (or (string=? compression2 "none") (string=? compression2 "gzip"))))) -(define (select-uri narinfo) +(define (narinfo-best-uri narinfo) "Select the \"best\" URI to download NARINFO's nar, and return three values: the URI, its compression method (a string), and the compressed file size." (define choices @@ -1008,7 +1009,7 @@ DESTINATION as a nar file. Verify the substitute against ACL." store-item)) (let-values (((uri compression file-size) - (select-uri narinfo))) + (narinfo-best-uri narinfo))) ;; Tell the daemon what the expected hash of the Nar itself is. (format #t "~a~%" (narinfo-hash narinfo)) -- 2.24.0