mirror of
https://git.savannah.gnu.org/git/guix.git
synced 2026-04-06 13:10:33 +02:00
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
This commit is contained in:
@@ -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)))
|
||||
|
||||
@@ -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 ()
|
||||
|
||||
Reference in New Issue
Block a user