From e783cd51ba9c5e347bc9f778beafaf3cc2e1e6c5 Mon Sep 17 00:00:00 2001 From: John Soo Date: Thu, 12 Nov 2020 21:47:36 -0800 Subject: pack: Expose some bindings for third-party use. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * guix/scripts/pack.scm (compressor-name, compressor-extension, compressor-command, %compressors, %formats): Export. Signed-off-by: Ludovic Courtès --- guix/scripts/pack.scm | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'guix') diff --git a/guix/scripts/pack.scm b/guix/scripts/pack.scm index 06509ace2d..0b29997200 100644 --- a/guix/scripts/pack.scm +++ b/guix/scripts/pack.scm @@ -59,11 +59,16 @@ #:use-module (srfi srfi-37) #:use-module (ice-9 match) #:export (compressor? + compressor-name + compressor-extenstion + compressor-command + %compressors lookup-compressor self-contained-tarball docker-image squashfs-image + %formats guix-pack)) ;; Type of a compression tool. -- cgit v1.2.3 From 0cdc13ce43fac7987adcd4af3c9660544eb94e86 Mon Sep 17 00:00:00 2001 From: John Soo Date: Thu, 12 Nov 2020 21:54:45 -0800 Subject: guix build: Expose log-url for third parties. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * guix/scripts/build.scm (log-url): Expose it. Signed-off-by: Ludovic Courtès --- guix/scripts/build.scm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'guix') diff --git a/guix/scripts/build.scm b/guix/scripts/build.scm index e9de97c881..cc020632af 100644 --- a/guix/scripts/build.scm +++ b/guix/scripts/build.scm @@ -51,7 +51,9 @@ #:use-module ((guix progress) #:select (current-terminal-columns)) #:use-module ((guix build syscalls) #:select (terminal-columns)) #:use-module (guix transformations) - #:export (%standard-build-options + #:export (log-url + + %standard-build-options set-build-options-from-command-line set-build-options-from-command-line* show-build-options-help -- cgit v1.2.3 From 630602831dd93e7bc9a8e64fba958300e8cb0474 Mon Sep 17 00:00:00 2001 From: Maxim Cournoyer Date: Tue, 10 Nov 2020 16:59:13 -0500 Subject: publish: Harmonize buffer size values and configuration. This change harmonizes the way we configure the buffer sizes and the socket options, so that we don't forget to change it at one place like it happened in commit 5e3d169945935b53325e6b738a307ba286751259. * guix/scripts/publish.scm (%default-buffer-size) (%default-socket-options): New variables. * guix/scripts/publish.scm (configure-socket): New procedure. (compress-nar): Use %default-buffer-size for the buffer size, increased from 128 to 208 KiB. (nar-response-port): Likewise, increased from 64 to 208 KiB. (http-write): Use configure-socket to set socket options. (open-server-socket): Likewise. --- guix/scripts/publish.scm | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) (limited to 'guix') diff --git a/guix/scripts/publish.scm b/guix/scripts/publish.scm index a976a9ac60..f1a9970a7f 100644 --- a/guix/scripts/publish.scm +++ b/guix/scripts/publish.scm @@ -2,6 +2,7 @@ ;;; Copyright © 2015 David Thompson ;;; Copyright © 2020 by Amar M. Singh ;;; Copyright © 2015, 2016, 2017, 2018, 2019, 2020 Ludovic Courtès +;;; Copyright © 2020 Maxim Cournoyer ;;; ;;; This file is part of GNU Guix. ;;; @@ -250,6 +251,21 @@ usage." ("WantMassQuery" . 0) ("Priority" . 100))) +;;; A common buffer size value used for the TCP socket SO_SNDBUF option and +;;; the gzip compressor buffer size. +(define %default-buffer-size + (* 208 1024)) + +(define %default-socket-options + ;; List of options passed to 'setsockopt' when transmitting files. + (list (list SO_SNDBUF %default-buffer-size))) + +(define* (configure-socket socket #:key (level SOL_SOCKET) + (options %default-socket-options)) + "Apply multiple option tuples in OPTIONS to SOCKET, using LEVEL." + (for-each (cut apply setsockopt socket level <>) + options)) + (define (signed-string s) "Sign the hash of the string S with the daemon's key. Return a canonical sexp for the signature." @@ -569,7 +585,7 @@ requested using POOL." (lambda (port) (write-file item port)) #:level (compression-level compression) - #:buffer-size (* 128 1024)) + #:buffer-size %default-buffer-size) (rename-file (string-append nar ".tmp") nar)) ('lzip ;; Note: the file port gets closed along with the lzip port. @@ -866,7 +882,7 @@ or if EOF is reached." ;; 'make-gzip-output-port' wants a file port. (make-gzip-output-port (response-port response) #:level level - #:buffer-size (* 64 1024))) + #:buffer-size %default-buffer-size)) (($ 'lzip level) (make-lzip-output-port (response-port response) #:level level)) @@ -891,8 +907,7 @@ blocking." client)) (port (begin (force-output client) - (setsockopt client SOL_SOCKET - SO_SNDBUF (* 128 1024)) + (configure-socket client) (nar-response-port response compression)))) ;; XXX: Given our ugly workaround for in ;; 'render-nar', BODY here is just the file name of the store item. @@ -922,7 +937,7 @@ blocking." size) client)) (output (response-port response))) - (setsockopt client SOL_SOCKET SO_SNDBUF (* 128 1024)) + (configure-socket client) (if (file-port? output) (sendfile output input size) (dump-port input output)) @@ -1067,7 +1082,8 @@ methods, return the applicable compression." (define (open-server-socket address) "Return a TCP socket bound to ADDRESS, a socket address." (let ((sock (socket (sockaddr:fam address) SOCK_STREAM 0))) - (setsockopt sock SOL_SOCKET SO_REUSEADDR 1) + (configure-socket sock #:options (cons (list SO_REUSEADDR 1) + %default-socket-options)) (bind sock address) sock)) -- cgit v1.2.3 From b720cf90e77f3143d7e46f2d9b25ada0355f13f9 Mon Sep 17 00:00:00 2001 From: Danny Milosavljevic Date: Mon, 16 Nov 2020 10:26:46 +0100 Subject: utils: Add 'cxx-for-target'. * guix/utils.scm (cxx-for-target): New procedure. --- guix/utils.scm | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'guix') diff --git a/guix/utils.scm b/guix/utils.scm index b816c355dc..a591b62f30 100644 --- a/guix/utils.scm +++ b/guix/utils.scm @@ -78,6 +78,7 @@ target-arm? target-64bit? cc-for-target + cxx-for-target version-compare version>? @@ -542,6 +543,11 @@ a character other than '@'." (string-append target "-gcc") "gcc")) +(define* (cxx-for-target #:optional (target (%current-target-system))) + (if target + (string-append target "-g++") + "g++")) + (define version-compare (let ((strverscmp (let ((sym (or (dynamic-func "strverscmp" (dynamic-link)) -- cgit v1.2.3 From 98750a9d9967b84a077735a2e4e6d5526256a5fd Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Mon, 16 Nov 2020 11:40:53 +0100 Subject: self: Limit the number of threads used when translating manuals. * guix/self.scm (translate-texi-manuals)[build](parallel-jobs): New variable. Use it as first argument to 'n-par-for-each'. --- guix/self.scm | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'guix') diff --git a/guix/self.scm b/guix/self.scm index bbfd2f1b95..026dcd9c1a 100644 --- a/guix/self.scm +++ b/guix/self.scm @@ -400,6 +400,12 @@ a list of extra files, such as '(\"contributing\")." (find-files directory "\\.[a-z]{2}(_[A-Z]{2})?\\.po$"))) + (define parallel-jobs + ;; Limit thread creation by 'n-par-for-each'. Going beyond can + ;; lead libgc 8.0.4 to abort with: + ;; mmap(PROT_NONE) failed + (min (parallel-job-count) 4)) + (mkdir #$output) (copy-recursively #$documentation "." #:log (%make-void-port "w")) @@ -415,14 +421,14 @@ a list of extra files, such as '(\"contributing\")." (setenv "LC_ALL" "en_US.UTF-8") (setlocale LC_ALL "en_US.UTF-8") - (n-par-for-each (parallel-job-count) + (n-par-for-each parallel-jobs (match-lambda ((language . po) (translate-texi "guix" po language #:extras '("contributing")))) (available-translations "." "guix-manual")) - (n-par-for-each (parallel-job-count) + (n-par-for-each parallel-jobs (match-lambda ((language . po) (translate-texi "guix-cookbook" po language))) -- cgit v1.2.3 From 29ed17d6345d30b0646f0a9b63ab201e0e6871ec Mon Sep 17 00:00:00 2001 From: Florian Pelz Date: Sat, 14 Nov 2020 23:36:52 +0100 Subject: pull: Do not suggest running `guix pull --news' on the first run. * guix/scripts/pull.scm (display-channel-news-headlines): If there are no news to display, return false instead of . --- guix/scripts/pull.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'guix') diff --git a/guix/scripts/pull.scm b/guix/scripts/pull.scm index bb1b560a22..7fd8b3f1a4 100644 --- a/guix/scripts/pull.scm +++ b/guix/scripts/pull.scm @@ -385,7 +385,7 @@ previous generation. Return true if there are news to display." (and=> (relative-generation profile -1) (cut generation-file-name profile <>))) - (when previous + (and previous (let ((old-channels (profile-channels previous)) (new-channels (profile-channels profile))) ;; Find the channels present in both PROFILE and PREVIOUS, and print -- cgit v1.2.3 From 41f27bf8702838f19b1dc5ffee8eec1d4315d4e6 Mon Sep 17 00:00:00 2001 From: Maxim Cournoyer Date: Wed, 11 Nov 2020 23:48:12 -0500 Subject: guix: system: Make disk-image root file system non-volatile by default. And add a new '--volatile' option to have it volatile otherwise. * guix/scripts/system.scm (%options)[volatile-root?]: New boolean option. (%default-options): Set its default value to #f. (show-help): Add help doc. * guix/scripts/system.scm (perform-action): Propagate option... (system-derivation-for-action): ...here. Use it to set the volatile-root? field of the image object passed to SYSTEM-IMAGE. * doc/guix.texi (Invoking guix system): Document it. --- doc/guix.texi | 6 ++++-- guix/scripts/system.scm | 21 +++++++++++++++++---- 2 files changed, 21 insertions(+), 6 deletions(-) (limited to 'guix') diff --git a/doc/guix.texi b/doc/guix.texi index 104e771562..cca57140d6 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -31029,10 +31029,12 @@ the @option{--image-size} option is ignored in the case of @cindex disk-image, creating disk images The @code{disk-image} command can produce various image types. The -image type can be selected using the @command{--image-type} option. It +image type can be selected using the @option{--image-type} option. It defaults to @code{raw}. When its value is @code{iso9660}, the @option{--label} option can be used to specify a volume ID with -@code{disk-image}. When using @code{disk-image}, the bootloader +@code{disk-image}. By default, the root file system of a disk image is +mounted non-volatile; the @option{--volatile} option can be provided to +make it volatile instead. When using @code{disk-image}, the bootloader installed on the generated image is taken from the provided @code{operating-system} definition. The following example demonstrates how to generate an image that uses the @code{grub-efi-bootloader} diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm index ad998156c2..db80e0be8f 100644 --- a/guix/scripts/system.scm +++ b/guix/scripts/system.scm @@ -674,7 +674,8 @@ checking this by themselves in their 'check' procedure." (define* (system-derivation-for-action os action #:key image-size image-type full-boot? container-shared-network? - mappings label) + mappings label + volatile-root?) "Return as a monadic value the derivation for OS according to ACTION." (mlet %store-monad ((target (current-target-system))) (case action @@ -706,7 +707,8 @@ checking this by themselves in their 'check' procedure." base-image)) (target (or base-target target)) (size image-size) - (operating-system os)))))) + (operating-system os) + (volatile-root? volatile-root?)))))) ((docker-image) (system-docker-image os #:shared-network? container-shared-network?))))) @@ -761,6 +763,7 @@ and TARGET arguments." dry-run? derivations-only? use-substitutes? bootloader-target target image-size image-type + volatile-root? full-boot? label container-shared-network? (mappings '()) (gc-root #f)) @@ -768,7 +771,8 @@ and TARGET arguments." bootloader; BOOTLOADER-TAGET is the target for the bootloader; TARGET is the target root directory; IMAGE-SIZE is the size of the image to be built, for the 'vm-image' and 'disk-image' actions. IMAGE-TYPE is the type of image to -be built. +be built. When VOLATILE-ROOT? is #t, the root file system is mounted +volatile. FULL-BOOT? is used for the 'vm' action; it determines whether to boot directly to the kernel or to the bootloader. CONTAINER-SHARED-NETWORK? @@ -816,6 +820,7 @@ static checks." #:label label #:image-type image-type #:image-size image-size + #:volatile-root? volatile-root? #:full-boot? full-boot? #:container-shared-network? container-shared-network? #:mappings mappings)) @@ -974,6 +979,8 @@ Some ACTIONS support additional ARGS.\n")) --image-size=SIZE for 'vm-image', produce an image of SIZE")) (display (G_ " --no-bootloader for 'init', do not install a bootloader")) + (display (G_ " + --volatile for 'disk-image', make the root file system volatile")) (display (G_ " --label=LABEL for 'disk-image', label disk image with LABEL")) (display (G_ " @@ -1048,6 +1055,9 @@ Some ACTIONS support additional ARGS.\n")) (option '("no-bootloader" "no-grub") #f #f (lambda (opt name arg result) (alist-cons 'install-bootloader? #f result))) + (option '("volatile") #f #f + (lambda (opt name arg result) + (alist-cons 'volatile-root? #t result))) (option '("label") #t #f (lambda (opt name arg result) (alist-cons 'label arg result))) @@ -1109,7 +1119,8 @@ Some ACTIONS support additional ARGS.\n")) (image-type . raw) (image-size . guess) (install-bootloader? . #t) - (label . #f))) + (label . #f) + (volatile-root? . #f))) (define (verbosity-level opts) "Return the verbosity level based on OPTS, the alist of parsed options." @@ -1206,6 +1217,8 @@ resulting from command-line parsing." #:image-type (lookup-image-type-by-name (assoc-ref opts 'image-type)) #:image-size (assoc-ref opts 'image-size) + #:volatile-root? + (assoc-ref opts 'volatile-root?) #:full-boot? (assoc-ref opts 'full-boot?) #:container-shared-network? (assoc-ref opts 'container-shared-network?) -- cgit v1.2.3 From 9b5e1cc11fa758fb40913f901b16402b66b59162 Mon Sep 17 00:00:00 2001 From: Miguel Ángel Arruga Vivas Date: Wed, 18 Nov 2020 20:33:45 +0100 Subject: guix: refresh: Do not use argument jumping with ngettext. * guix/scripts/refresh.scm (list-dependents)[lst]: Use ~d for the singular format string, as the argument jumping would trigger an error during en@boldquot.mo generation. --- guix/scripts/refresh.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'guix') diff --git a/guix/scripts/refresh.scm b/guix/scripts/refresh.scm index 4a71df28d1..fb6c52a567 100644 --- a/guix/scripts/refresh.scm +++ b/guix/scripts/refresh.scm @@ -440,7 +440,7 @@ releases for ~a~%") (full-name x))) (lst (format (current-output-port) - (N_ "Building the following ~*package would ensure ~d \ + (N_ "Building the following ~d package would ensure ~d \ dependent packages are rebuilt: ~{~a~^ ~}~%" "Building the following ~d packages would ensure ~d \ dependent packages are rebuilt: ~{~a~^ ~}~%" -- cgit v1.2.3