mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-11-07 15:36:20 -05:00
challenge: Report the best narinfo URI.
* 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 ...)).
This commit is contained in:
parent
044277f610
commit
4736d06f78
2 changed files with 5 additions and 4 deletions
|
@ -192,7 +192,7 @@ (define (report-hashes item local narinfos)
|
|||
(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))
|
||||
|
|
|
@ -80,6 +80,7 @@ (define-module (guix scripts substitute)
|
|||
narinfo-signature
|
||||
|
||||
narinfo-hash->sha256
|
||||
narinfo-best-uri
|
||||
|
||||
lookup-narinfos
|
||||
lookup-narinfos/diverse
|
||||
|
@ -913,7 +914,7 @@ (define (display-narinfo-data narinfo)
|
|||
(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 @@ (define (compresses-better? compression1 compression2)
|
|||
(_ (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 @@ (define narinfo
|
|||
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))
|
||||
|
||||
|
|
Loading…
Reference in a new issue