From 0744a9f0029b2f78cc86b193214004b4501fa847 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Mon, 2 Jul 2018 23:50:38 +0200 Subject: store: Add 'query-path-info*'. * guix/scripts/size.scm (query-path-info*): Move to... * guix/store.scm (query-path-info*): ... here. --- guix/scripts/size.scm | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) (limited to 'guix/scripts') diff --git a/guix/scripts/size.scm b/guix/scripts/size.scm index b7b53e43f..344be4088 100644 --- a/guix/scripts/size.scm +++ b/guix/scripts/size.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2015, 2016, 2017 Ludovic Courtès +;;; Copyright © 2015, 2016, 2017, 2018 Ludovic Courtès ;;; ;;; This file is part of GNU Guix. ;;; @@ -53,15 +53,6 @@ (define substitutable-path-info* (store-lift substitutable-path-info)) -(define (query-path-info* item) - "Monadic version of 'query-path-info' that returns #f when ITEM is not in -the store." - (lambda (store) - (guard (c ((nix-protocol-error? c) - ;; ITEM is not in the store; return #f. - (values #f store))) - (values (query-path-info store item) store)))) - (define (file-size item) "Return the size in bytes of ITEM, resorting to information from substitutes if ITEM is not in the store." -- cgit v1.3 From 71bf6cb700965cfe5b8f3661315017b022d0aca1 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Mon, 2 Jul 2018 23:59:52 +0200 Subject: guix system: init: Check the available space before copying. * guix/scripts/system.scm (copy-closure): Call 'query-path-info*' on TO-COPY and REFS. Compute the total size. Call 'check-available-space'. --- guix/scripts/system.scm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'guix/scripts') diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm index 14aedceac..92e92237b 100644 --- a/guix/scripts/system.scm +++ b/guix/scripts/system.scm @@ -148,12 +148,18 @@ REFERENCES as its set of references." "Copy ITEM and all its dependencies to the store under root directory TARGET, and register them." (mlet* %store-monad ((to-copy (topologically-sorted* (list item))) - (refs (mapm %store-monad references* to-copy))) + (refs (mapm %store-monad references* to-copy)) + (info (mapm %store-monad query-path-info* + (delete-duplicates + (append to-copy (concatenate refs))))) + (size -> (reduce + 0 (map path-info-nar-size info)))) (define progress-bar (progress-reporter/bar (length to-copy) (format #f (G_ "copying to '~a'...") target))) + (check-available-space size target) + (call-with-progress-reporter progress-bar (lambda (report) (let ((void (%make-void-port "w"))) -- cgit v1.3 From f3f1d0a5578b4ad6d85494283eedfaa62b28fe2c Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Tue, 3 Jul 2018 11:24:32 +0200 Subject: guix system: Make 'init' idempotent again. This fixes a regression introduced in df2f6400b1fbc282ef4d6dd7124ea1c17adc23c2: since the new 'register-path' (actually 'reset-timestamps') would make files read-only, 'delete-file-recursively' would fail to delete them. Thus, re-running 'guix system init' on an already-populated store would fail with a 'delete-file' EPERM. * guix/scripts/system.scm (copy-item): Use 'lstat' instead of 'file-exists?'. Call 'make-file-writable' on each directory below DEST. --- guix/scripts/system.scm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'guix/scripts') diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm index 92e92237b..69bd05b51 100644 --- a/guix/scripts/system.scm +++ b/guix/scripts/system.scm @@ -126,7 +126,11 @@ REFERENCES as its set of references." ;; Remove DEST if it exists to make sure that (1) we do not fail badly ;; while trying to overwrite it (see ), and ;; (2) we end up with the right contents. - (when (file-exists? dest) + (when (false-if-exception (lstat dest)) + (for-each make-file-writable + (find-files dest (lambda (file stat) + (eq? 'directory (stat:type stat))) + #:directories? #t)) (delete-file-recursively dest)) (copy-recursively item dest -- cgit v1.3 From 5adb2df0a2584d49f1fde7671c81ba54f7e43d51 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Thu, 5 Jul 2018 13:35:21 +0200 Subject: pack: Use guile-for-build for the target system. Until now, running "guix pack -s i686-linux" on an x86_64-linux machine, for instance, would use an x86_64 guile for module derivations. This was OK until now, but would break when passing "--localstatedir" due to the introduction of guile-sqlite3: we'd be using the i686 guile-sqlite3 along with the x86_64 guile. * guix/scripts/pack.scm (guix-pack): Pass the 'system option from OPTS to 'package-derivation'. --- guix/scripts/pack.scm | 1 + 1 file changed, 1 insertion(+) (limited to 'guix/scripts') diff --git a/guix/scripts/pack.scm b/guix/scripts/pack.scm index 7f087a3a3..6d5d745bc 100644 --- a/guix/scripts/pack.scm +++ b/guix/scripts/pack.scm @@ -722,6 +722,7 @@ Create a bundle of PACKAGE.\n")) (if (assoc-ref opts 'bootstrap?) %bootstrap-guile (canonical-package guile-2.2)) + (assoc-ref opts 'system) #:graft? (assoc-ref opts 'graft?)))) (let* ((dry-run? (assoc-ref opts 'dry-run?)) (relocatable? (assoc-ref opts 'relocatable?)) -- cgit v1.3 From 7a369f6d2f3509d39f5f702aa2ced44d8d3636af Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Sat, 7 Jul 2018 01:18:21 -0400 Subject: weather: Fix pasto in --version output. * guix/scripts/weather.scm (%options): Correct the command name passed to show-version-and-exit. Signed-off-by: Ludovic Courtès --- guix/scripts/weather.scm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'guix/scripts') diff --git a/guix/scripts/weather.scm b/guix/scripts/weather.scm index d7c2fbea1..98b7338fb 100644 --- a/guix/scripts/weather.scm +++ b/guix/scripts/weather.scm @@ -1,6 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2017, 2018 Ludovic Courtès ;;; Copyright © 2017 Ricardo Wurmus +;;; Copyright © 2018 Kyle Meyer ;;; ;;; This file is part of GNU Guix. ;;; @@ -269,7 +270,7 @@ Report the availability of substitutes.\n")) (exit 0))) (option '(#\V "version") #f #f (lambda args - (show-version-and-exit "guix challenge"))) + (show-version-and-exit "guix weather"))) (option '("substitute-urls") #t #f (lambda (opt name arg result . rest) -- cgit v1.3 From 7ede577a5f90a459b731eeb025af450ff891603c Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Sat, 7 Jul 2018 00:41:34 -0400 Subject: scripts: Add missing -V option to commands that document it. * guix/scripts/container.scm (guix-container): * guix/scripts/import.scm (guix-import): * guix/scripts/substitute.scm (guix-substitute): Add -V as the short option for --version to match show-help's description. Signed-off-by: Ludovic Courtès --- guix/scripts/container.scm | 3 ++- guix/scripts/import.scm | 3 ++- guix/scripts/substitute.scm | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) (limited to 'guix/scripts') diff --git a/guix/scripts/container.scm b/guix/scripts/container.scm index 10aed2be7..8041d64b6 100644 --- a/guix/scripts/container.scm +++ b/guix/scripts/container.scm @@ -1,5 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2015 David Thompson +;;; Copyright © 2018 Kyle Meyer ;;; ;;; This file is part of GNU Guix. ;;; @@ -54,7 +55,7 @@ Build and manipulate Linux containers.\n")) ((or ("-h") ("--help")) (show-help) (exit 0)) - (("--version") + ((or ("-V") ("--version")) (show-version-and-exit "guix container")) ((action args ...) (if (member action %actions) diff --git a/guix/scripts/import.scm b/guix/scripts/import.scm index 67bc7a755..f8cb85700 100644 --- a/guix/scripts/import.scm +++ b/guix/scripts/import.scm @@ -1,6 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2012, 2013, 2014 Ludovic Courtès ;;; Copyright © 2014 David Thompson +;;; Copyright © 2018 Kyle Meyer ;;; ;;; This file is part of GNU Guix. ;;; @@ -104,7 +105,7 @@ Run IMPORTER with ARGS.\n")) ((or ("-h") ("--help")) (show-help) (exit 0)) - (("--version") + ((or ("-V") ("--version")) (show-version-and-exit "guix import")) ((importer args ...) (if (member importer importers) diff --git a/guix/scripts/substitute.scm b/guix/scripts/substitute.scm index d0beacc8e..7634bb37f 100755 --- a/guix/scripts/substitute.scm +++ b/guix/scripts/substitute.scm @@ -1,6 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018 Ludovic Courtès ;;; Copyright © 2014 Nikita Karetnikov +;;; Copyright © 2018 Kyle Meyer ;;; ;;; This file is part of GNU Guix. ;;; @@ -1108,7 +1109,7 @@ default value." (process-substitution store-path destination #:cache-urls (substitute-urls) #:acl (current-acl)))) - (("--version") + ((or ("-V") ("--version")) (show-version-and-exit "guix substitute")) (("--help") (show-help)) -- cgit v1.3