summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2026-01-15 18:19:40 +0000
committerChristopher Baines <mail@cbaines.net>2026-01-28 17:45:33 +0000
commit1c230ec96e29e3f70ddf217e93c448f6f037a470 (patch)
tree11ec1ec3b7d537aac0e39968aba3d11c54d25ce5
parent86d06b4cad578bf4191bdac8544ffdd0fa35b5cf (diff)
scripts: substitute: Default to fast decompression.
This changes the behaviour for the first one or few nars the substitute script downloads, with uncompressed and zstd compressed nars prefered rather than picking by file size. * guix/scripts/substitute.scm: (%default-fast-decompression?): Change to #t. * tests/substitute.scm ("substitute, preferred nar URL is 404, other is 200"): Adjust test. Change-Id: I89202f084cd6b9d506bcb3d46f75de690c6986b5
-rwxr-xr-xguix/scripts/substitute.scm2
-rw-r--r--tests/substitute.scm22
2 files changed, 19 insertions, 5 deletions
diff --git a/guix/scripts/substitute.scm b/guix/scripts/substitute.scm
index b3a514815db..455f5a23461 100755
--- a/guix/scripts/substitute.scm
+++ b/guix/scripts/substitute.scm
@@ -223,7 +223,7 @@ Internal tool to substitute a pre-built binary to a local build.\n"))
;;;
;; Whether to initially prefer fast decompression or not
-(define %default-fast-decompression? #f)
+(define %default-fast-decompression? #t)
(define (call-with-cpu-usage-monitoring thunk)
(let ((before (times)))
diff --git a/tests/substitute.scm b/tests/substitute.scm
index 33a6d6040ae..cd75d56b981 100644
--- a/tests/substitute.scm
+++ b/tests/substitute.scm
@@ -618,16 +618,30 @@ System: mips64el-linux\n")))
(with-narinfo* (string-append %narinfo "Signature: " (signature-field %narinfo))
%main-substitute-directory
+ (define (compress input output compression)
+ (call-with-output-file output
+ (lambda (port)
+ (call-with-compressed-output-port compression port
+ (lambda (port)
+ (call-with-input-file input
+ (lambda (input)
+ (dump-port input port))))))))
+
+ ;; This test is dependent on which nar the substitute script picks to
+ ;; request first
(with-http-server `((200 ,(string-append %narinfo "Signature: "
(signature-field %narinfo)
"\n"
"URL: example.nar.lz\n"
"Compression: lzip\n"))
(404 "Sorry, nar.lz is missing!")
- (200 ,(call-with-input-file
- (string-append %main-substitute-directory
- "/example.nar")
- get-bytevector-all)))
+ (200 ,(let ((nar (string-append
+ %main-substitute-directory
+ "/example.nar")))
+ (compress nar (string-append nar ".lz") 'lzip)
+ (call-with-input-file
+ (string-append nar ".lz")
+ get-bytevector-all))))
(dynamic-wind
(const #t)
(lambda ()