unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: 38518@debbugs.gnu.org
Cc: "Ludovic Courtès" <ludo@gnu.org>
Subject: [bug#38518] [PATCH 3/7] challenge: Report the best narinfo URI.
Date: Sun,  8 Dec 2019 12:26:33 +0100	[thread overview]
Message-ID: <20191208112637.5534-3-ludo@gnu.org> (raw)
In-Reply-To: <20191208112637.5534-1-ludo@gnu.org>

* 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

  parent reply	other threads:[~2019-12-08 11:27 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-07 21:42 [bug#38518] [PATCH 0/7] 'guix challenge' can diff archives directly Ludovic Courtès
2019-12-08 11:20 ` zimoun
2019-12-08 11:34   ` Ludovic Courtès
2019-12-08 11:48     ` zimoun
2019-12-08 11:26 ` [bug#38518] [PATCH 1/7] serialization: Add 'fold-archive' Ludovic Courtès
2019-12-08 11:26   ` [bug#38518] [PATCH 2/7] guix archive: Add '--list' Ludovic Courtès
2019-12-08 11:26   ` Ludovic Courtès [this message]
2019-12-08 11:26   ` [bug#38518] [PATCH 4/7] serialization: Remove unused procedure Ludovic Courtès
2019-12-08 11:26   ` [bug#38518] [PATCH 5/7] progress: Add 'progress-report-port' Ludovic Courtès
2019-12-08 11:26   ` [bug#38518] [PATCH 6/7] challenge: Add "--diff" Ludovic Courtès
2019-12-08 11:26   ` [bug#38518] [PATCH 7/7] challenge: Support "--diff=diffoscope" Ludovic Courtès
2019-12-12 17:21 ` bug#38518: [PATCH 0/7] 'guix challenge' can diff archives directly Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191208112637.5534-3-ludo@gnu.org \
    --to=ludo@gnu.org \
    --cc=38518@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).