summaryrefslogtreecommitdiff
path: root/guix/scripts/weather.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2019-05-31 16:26:08 +0200
committerLudovic Courtès <ludo@gnu.org>2019-06-02 22:01:57 +0200
commitb90ae065b5a5fab4ed475bf2faa3a84476389a02 (patch)
tree306c6a49fbeb2e87d77dd2d023cc0c2a94a34afd /guix/scripts/weather.scm
parentb8fa86adfc01205f1d942af8cb57515eb3726c52 (diff)
downloadpatches-b90ae065b5a5fab4ed475bf2faa3a84476389a02.tar
patches-b90ae065b5a5fab4ed475bf2faa3a84476389a02.tar.gz
substitute: Select the best compression methods.
When a server publishes several URLs with different compression methods, 'guix substitute' can now choose the best one among the compression methods that it supports. * guix/scripts/substitute.scm (<narinfo>)[uri]: Replace with... [uris]: ... this. [compression]: Replace with... [compressions]: ... this. [file-size]: Replace with... [file-sizes]: ... this. [file-hash]: Replace with... [file-hashes]: ... this. (narinfo-maker): Adjust accordingly. Ensure 'file-sizes' and 'file-hashes' have the right length. (assert-valid-signature, valid-narinfo?): Use the first element of 'narinfo-uris' in error messages. (read-narinfo): Expect "URL", "Compression", "FileSize", and "FileHash" to occur multiple times. (display-narinfo-data): Call 'select-uri' to determine the file size. (%compression-methods): New variable. (supported-compression?, compresses-better?, select-uri): New procedures. (process-substitution): Call 'select-uri' to select the URI and compression. * guix/scripts/weather.scm (report-server-coverage): Account for all the values returned by 'narinfo-file-sizes'. * tests/substitute.scm ("substitute, narinfo with several URLs"): New test.
Diffstat (limited to 'guix/scripts/weather.scm')
-rw-r--r--guix/scripts/weather.scm5
1 files changed, 4 insertions, 1 deletions
diff --git a/guix/scripts/weather.scm b/guix/scripts/weather.scm
index 78b8674e0c..1701772bc1 100644
--- a/guix/scripts/weather.scm
+++ b/guix/scripts/weather.scm
@@ -175,7 +175,10 @@ about the derivations queued, as is the case with Hydra."
(requested (length items))
(missing (lset-difference string=?
items (map narinfo-path narinfos)))
- (sizes (filter-map narinfo-file-size narinfos))
+ (sizes (append-map (lambda (narinfo)
+ (filter integer?
+ (narinfo-file-sizes narinfo)))
+ narinfos))
(time (+ (time-second time)
(/ (time-nanosecond time) 1e9))))
(format #t (G_ " ~2,1f% substitutes available (~h out of ~h)~%")