From 121191f23ae89415dfbbd3052c7342188cded135 Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Mon, 2 Mar 2020 20:13:39 +0000 Subject: substitute: Use the same port for multiple request batches. In http-multiple-get. * guix/scripts/substitute.scm (http-multiple-get): Switch port to p in one occurrence. --- guix/scripts/substitute.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'guix') diff --git a/guix/scripts/substitute.scm b/guix/scripts/substitute.scm index 95b47a7816..2cb240c2a0 100755 --- a/guix/scripts/substitute.scm +++ b/guix/scripts/substitute.scm @@ -538,7 +538,7 @@ initial connection on which HTTP requests are sent." (() (reverse result)) (remainder - (connect port remainder result)))) + (connect p remainder result)))) ((head tail ...) (let* ((resp (read-response p)) (body (response-body-port resp)) -- cgit v1.2.3 From d5abb3049ee4e97865f691eba4c59f5b51de3271 Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Mon, 2 Mar 2020 20:17:18 +0000 Subject: substitute: Make http-multiple-get batch size configurable. * guix/scripts/substitute.scm (http-multiple-get): Add batch-size parameter. --- guix/scripts/substitute.scm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'guix') diff --git a/guix/scripts/substitute.scm b/guix/scripts/substitute.scm index 2cb240c2a0..0777aa3d3e 100755 --- a/guix/scripts/substitute.scm +++ b/guix/scripts/substitute.scm @@ -494,7 +494,8 @@ MAX-LENGTH first elements." (loop (+ 1 len) tail (cons head result))))))) (define* (http-multiple-get base-uri proc seed requests - #:key port (verify-certificate? #t)) + #:key port (verify-certificate? #t) + (batch-size 1000)) "Send all of REQUESTS to the server at BASE-URI. Call PROC for each response, passing it the request object, the response, a port from which to read the response body, and the previous result, starting with SEED, à la @@ -504,7 +505,7 @@ initial connection on which HTTP requests are sent." (requests requests) (result seed)) (define batch - (at-most 1000 requests)) + (at-most batch-size requests)) ;; (format (current-error-port) "connecting (~a requests left)..." ;; (length requests)) -- cgit v1.2.3 From 928dc1bb1c1e96e6dfbe03dac2185ecf41a7b4f5 Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Mon, 2 Mar 2020 20:20:40 +0000 Subject: substitute: Close port at the end of http-multiple-get. * guix/scripts/substitute.scm (http-multiple-get): Add close-port call. --- guix/scripts/substitute.scm | 1 + 1 file changed, 1 insertion(+) (limited to 'guix') diff --git a/guix/scripts/substitute.scm b/guix/scripts/substitute.scm index 0777aa3d3e..ba2b2d2d4e 100755 --- a/guix/scripts/substitute.scm +++ b/guix/scripts/substitute.scm @@ -537,6 +537,7 @@ initial connection on which HTTP requests are sent." (() (match (drop requests processed) (() + (close-port p) (reverse result)) (remainder (connect p remainder result)))) -- cgit v1.2.3 From ef674a24c527eaf54801707d34dbf5d12ec139cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Wed, 22 Apr 2020 15:43:43 +0200 Subject: profiles: Add lowerable record type. * guix/profiles.scm (): New record type. * tests/profiles.scm (""): New test. --- guix/profiles.scm | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'guix') diff --git a/guix/profiles.scm b/guix/profiles.scm index 88606fa4ce..ab265cce62 100644 --- a/guix/profiles.scm +++ b/guix/profiles.scm @@ -125,6 +125,15 @@ profile-derivation profile-search-paths + profile + profile? + profile-name + profile-content + profile-hooks + profile-locales? + profile-allow-collisions? + profile-relative-symlinks? + generation-number generation-profile generation-numbers @@ -1656,6 +1665,33 @@ are cross-built for TARGET." . ,(length (manifest-entries manifest)))))))) +;; Declarative profile. +(define-record-type* profile make-profile + profile? + (name profile-name (default "profile")) ;string + (content profile-content) ; + (hooks profile-hooks ;list of procedures + (default %default-profile-hooks)) + (locales? profile-locales? ;Boolean + (default #t)) + (allow-collisions? profile-allow-collisions? ;Boolean + (default #f)) + (relative-symlinks? profile-relative-symlinks? ;Boolean + (default #f))) + +(define-gexp-compiler (profile-compiler (profile ) system target) + "Compile PROFILE to a derivation." + (match profile + (($ name manifest hooks + locales? allow-collisions? relative-symlinks?) + (profile-derivation manifest + #:name name + #:hooks hooks + #:locales? locales? + #:allow-collisions? allow-collisions? + #:relative-symlinks? relative-symlinks? + #:system system #:target target)))) + (define* (profile-search-paths profile #:optional (manifest (profile-manifest profile)) #:key (getenv (const #f))) -- cgit v1.2.3 From 45c84c8f6f979c84d08b205ed3fb3d6769c4ae3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Wed, 22 Apr 2020 16:11:25 +0200 Subject: pack: Use a declarative profile. * guix/scripts/pack.scm (guix-pack): Use a declarative profile instead of 'profile-derivation'. --- guix/scripts/pack.scm | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) (limited to 'guix') diff --git a/guix/scripts/pack.scm b/guix/scripts/pack.scm index 6d63fb4b90..f3d1b41c6f 100644 --- a/guix/scripts/pack.scm +++ b/guix/scripts/pack.scm @@ -1071,7 +1071,21 @@ Create a bundle of PACKAGE.\n")) (localstatedir? (assoc-ref opts 'localstatedir?)) (entry-point (assoc-ref opts 'entry-point)) (profile-name (assoc-ref opts 'profile-name)) - (gc-root (assoc-ref opts 'gc-root))) + (gc-root (assoc-ref opts 'gc-root)) + (profile (profile + (content manifest) + + ;; Always produce relative symlinks for + ;; Singularity (see + ;; ). + (relative-symlinks? + (or relocatable? + (eq? 'squashfs pack-format))) + + (hooks (if bootstrap? + '() + %default-profile-hooks)) + (locales? (not bootstrap?))))) (define (lookup-package package) (manifest-lookup manifest (manifest-pattern (name package)))) @@ -1085,22 +1099,7 @@ Create a bundle of PACKAGE.\n")) to your package list."))) (run-with-store store - (mlet* %store-monad ((profile (profile-derivation - manifest - - ;; Always produce relative - ;; symlinks for Singularity (see - ;; ). - #:relative-symlinks? - (or relocatable? - (eq? 'squashfs pack-format)) - - #:hooks (if bootstrap? - '() - %default-profile-hooks) - #:locales? (not bootstrap?) - #:target target)) - (drv (build-image name profile + (mlet* %store-monad ((drv (build-image name profile #:target target #:compressor -- cgit v1.2.3 From ccbc427f9ac8f63478f1692686b042a22c4df2c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Sun, 26 Apr 2020 22:12:32 +0200 Subject: channels: Use a declarative profile. * guix/channels.scm (package-cache-file): Use 'profile' instead of 'profile-derivation'. --- guix/channels.scm | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'guix') diff --git a/guix/channels.scm b/guix/channels.scm index 785b97722e..041fae2a9c 100644 --- a/guix/channels.scm +++ b/guix/channels.scm @@ -568,9 +568,7 @@ channel instances." (define (package-cache-file manifest) "Build a package cache file for the instance in MANIFEST. This is meant to be used as a profile hook." - (mlet %store-monad ((profile (profile-derivation manifest - #:hooks '()))) - + (let ((profile (profile (content manifest) (hooks '())))) (define build #~(begin (use-modules (gnu packages)) -- cgit v1.2.3 From 5fbc753ab524809cd81e3e5c54b3d0acbe33792d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Mon, 27 Apr 2020 22:17:53 +0200 Subject: import: crate: Gracefully handle non-existent crates. Fixes . Reported by Hartmut Goebel . * guix/import/crate.scm (crate->guix-package): Wrap value of 'version-number' and 'version*' in (and crate ...). --- guix/import/crate.scm | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'guix') diff --git a/guix/import/crate.scm b/guix/import/crate.scm index 0b4482e876..e3ec11d7f8 100644 --- a/guix/import/crate.scm +++ b/guix/import/crate.scm @@ -201,14 +201,16 @@ latest version of CRATE-NAME." (lookup-crate crate-name)) (define version-number - (or version - (crate-latest-version crate))) + (and crate + (or version + (crate-latest-version crate)))) (define version* - (find (lambda (version) - (string=? (crate-version-number version) - version-number)) - (crate-versions crate))) + (and crate + (find (lambda (version) + (string=? (crate-version-number version) + version-number)) + (crate-versions crate)))) (and crate version* (let* ((dependencies (crate-version-dependencies version*)) -- cgit v1.2.3 From 47f82b310e320ed6c0282c89748485d1f9212d2c Mon Sep 17 00:00:00 2001 From: Raghav Gururajan Date: Wed, 22 Apr 2020 20:55:40 -0400 Subject: guix: edit: Make nano the default editor. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * guix/scripts/edit.scm: Make nano the default editor. Nano is sensible default, as it is installed by base system. For development, user can set custom value for $EDITOR. Signed-off-by: Ludovic Courtès --- guix/scripts/edit.scm | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'guix') diff --git a/guix/scripts/edit.scm b/guix/scripts/edit.scm index a6fd1d2751..43f3011869 100644 --- a/guix/scripts/edit.scm +++ b/guix/scripts/edit.scm @@ -56,10 +56,9 @@ Start $VISUAL or $EDITOR to edit the definitions of PACKAGE...\n")) (show-bug-report-information)) (define %editor - ;; XXX: It would be better to default to something more likely to be - ;; pre-installed on an average GNU system. Since Nano is not suited for - ;; editing Scheme, Emacs is used instead. - (make-parameter (or (getenv "VISUAL") (getenv "EDITOR") "emacs"))) + ;; Nano is sensible default, as it is installed by base system. + ;; For development, user can set custom value for $EDITOR. + (make-parameter (or (getenv "VISUAL") (getenv "EDITOR") "nano"))) (define (search-path* path file) "Like 'search-path' but exit if FILE is not found." -- cgit v1.2.3