summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2016-03-02 13:43:13 +0100
committerLudovic Courtès <ludo@gnu.org>2016-03-02 14:47:07 +0100
commit7573d30ff804302eeb68edeca6ae5f3efb48b7bf (patch)
treed31a92b4672e04f0b598ddcf1184d66fc9a372b7
parent1cbdf82d3ba5b257e44144788244139ae15689c8 (diff)
downloadguix-7573d30ff804302eeb68edeca6ae5f3efb48b7bf.tar.gz
guix build: Move '--no-grafts' to the common build options.
* guix/scripts/build.scm (%options): Move --no-grafts to...
(%standard-build-options): ... here.
(show-help, show-build-options-help): Adjust accordingly.
* guix/scripts/archive.scm (%default-options): Add 'graft?'.
(guix-archive): Parametrize '%graft?'.
* guix/scripts/environment.scm (%default-options): Add 'graft?'.
(guix-environment): Parametrize '%graft?'.
* guix/scripts/package.scm (%default-options): Add 'graft?'.
(guix-package): Parametrize '%graft?'.
* guix/scripts/system.scm (%default-options): Add 'graft?'.
(guix-system): Parametrize 'graft?'.
* doc/guix.texi (Additional Build Options): Move --no-grafts to...
(Common Build Options): ... here.
-rw-r--r--doc/guix.texi10
-rw-r--r--guix/scripts/archive.scm51
-rw-r--r--guix/scripts/build.scm14
-rw-r--r--guix/scripts/environment.scm8
-rw-r--r--guix/scripts/package.scm5
-rw-r--r--guix/scripts/system.scm5
6 files changed, 53 insertions, 40 deletions
diff --git a/doc/guix.texi b/doc/guix.texi
index 5e62703380..44653efc6a 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -3912,6 +3912,11 @@ Do not use substitutes for build products.  That is, always build things
 locally instead of allowing downloads of pre-built binaries
 (@pxref{Substitutes}).
 
+@item --no-grafts
+Do not ``graft'' packages.  In practice, this means that package updates
+available as grafts are not applied.  @xref{Security Updates}, for more
+information on grafts.
+
 @item --rounds=@var{n}
 Build each derivation @var{n} times in a row, and raise an error if
 consecutive build results are not bit-for-bit identical.
@@ -4175,11 +4180,6 @@ substitutes are genuine (@pxref{Substitutes}), or whether the build result
 of a package is deterministic.  @xref{Invoking guix challenge}, for more
 background information and tools.
 
-@item --no-grafts
-Do not ``graft'' packages.  In practice, this means that package updates
-available as grafts are not applied.  @xref{Security Updates}, for more
-information on grafts.
-
 @item --derivations
 @itemx -d
 Return the derivation paths, not the output paths, of the given
diff --git a/guix/scripts/archive.scm b/guix/scripts/archive.scm
index 16ca96bdf5..3fb210ee91 100644
--- a/guix/scripts/archive.scm
+++ b/guix/scripts/archive.scm
@@ -22,6 +22,7 @@
   #:use-module ((guix build utils) #:select (mkdir-p))
   #:use-module ((guix serialization) #:select (restore-file))
   #:use-module (guix store)
+  #:use-module (guix grafts)
   #:use-module (guix packages)
   #:use-module (guix derivations)
   #:use-module (guix monads)
@@ -50,6 +51,7 @@
   ;; Alist of default option values.
   `((system . ,(%current-system))
     (substitutes? . #t)
+    (graft? . #t)
     (max-silent-time . 3600)
     (verbosity . 0)))
 
@@ -318,27 +320,28 @@ the input port."
     ;; user to 'read-derivation' are absolute when it returns.
     (with-fluids ((%file-port-name-canonicalization 'absolute))
       (let ((opts (parse-command-line args %options (list %default-options))))
-        (cond ((assoc-ref opts 'generate-key)
-               =>
-               generate-key-pair)
-              ((assoc-ref opts 'authorize)
-               (authorize-key))
-              (else
-               (with-store store
-                 (cond ((assoc-ref opts 'export)
-                        (export-from-store store opts))
-                       ((assoc-ref opts 'import)
-                        (import-paths store (current-input-port)))
-                       ((assoc-ref opts 'missing)
-                        (let* ((files   (lines (current-input-port)))
-                               (missing (remove (cut valid-path? store <>)
-                                                files)))
-                          (format #t "~{~a~%~}" missing)))
-                       ((assoc-ref opts 'extract)
-                        =>
-                        (lambda (target)
-                          (restore-file (current-input-port) target)))
-                       (else
-                        (leave
-                         (_ "either '--export' or '--import' \
-must be specified~%")))))))))))
+        (parameterize ((%graft? (assoc-ref opts 'graft?)))
+          (cond ((assoc-ref opts 'generate-key)
+                 =>
+                 generate-key-pair)
+                ((assoc-ref opts 'authorize)
+                 (authorize-key))
+                (else
+                 (with-store store
+                   (cond ((assoc-ref opts 'export)
+                          (export-from-store store opts))
+                         ((assoc-ref opts 'import)
+                          (import-paths store (current-input-port)))
+                         ((assoc-ref opts 'missing)
+                          (let* ((files   (lines (current-input-port)))
+                                 (missing (remove (cut valid-path? store <>)
+                                                  files)))
+                            (format #t "~{~a~%~}" missing)))
+                         ((assoc-ref opts 'extract)
+                          =>
+                          (lambda (target)
+                            (restore-file (current-input-port) target)))
+                         (else
+                          (leave
+                           (_ "either '--export' or '--import' \
+must be specified~%"))))))))))))
diff --git a/guix/scripts/build.scm b/guix/scripts/build.scm
index 8725ddad88..d6bb35c99a 100644
--- a/guix/scripts/build.scm
+++ b/guix/scripts/build.scm
@@ -296,6 +296,8 @@ options handled by 'set-build-options-from-command-line', and listed in
       --substitute-urls=URLS
                          fetch substitute from URLS if they are authorized"))
   (display (_ "
+      --no-grafts        do not graft packages"))
+  (display (_ "
       --no-build-hook    do not attempt to offload builds via the build hook"))
   (display (_ "
       --max-silent-time=SECONDS
@@ -379,6 +381,12 @@ options handled by 'set-build-options-from-command-line', and listed in
                                      (string-tokenize arg)
                                      (alist-delete 'substitute-urls result))
                          rest)))
+        (option '("no-grafts") #f #f
+                (lambda (opt name arg result . rest)
+                  (apply values
+                         (alist-cons 'graft? #f
+                                     (alist-delete 'graft? result eq?))
+                         rest)))
         (option '("no-build-hook") #f #f
                 (lambda (opt name arg result . rest)
                   (apply values
@@ -452,8 +460,6 @@ Build the given PACKAGE-OR-DERIVATION and return their output paths.\n"))
   (display (_ "
       --target=TRIPLET   cross-build for TRIPLET--e.g., \"armel-linux-gnu\""))
   (display (_ "
-      --no-grafts        do not graft packages"))
-  (display (_ "
   -d, --derivations      return the derivation paths of the given packages"))
   (display (_ "
       --check            rebuild items to check for non-determinism issues"))
@@ -531,10 +537,6 @@ must be one of 'package', 'all', or 'transitive'~%")
          (option '("log-file") #f #f
                  (lambda (opt name arg result)
                    (alist-cons 'log-file? #t result)))
-         (option '("no-grafts") #f #f
-                 (lambda (opt name arg result)
-                   (alist-cons 'graft? #f
-                               (alist-delete 'graft? result eq?))))
 
          (append %transformation-options
                  %standard-build-options)))
diff --git a/guix/scripts/environment.scm b/guix/scripts/environment.scm
index 0e462de4bf..b122b4cd40 100644
--- a/guix/scripts/environment.scm
+++ b/guix/scripts/environment.scm
@@ -1,6 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2014, 2015 David Thompson <davet@gnu.org>
-;;; Copyright © 2015 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2015, 2016 Ludovic Courtès <ludo@gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -20,6 +20,7 @@
 (define-module (guix scripts environment)
   #:use-module (guix ui)
   #:use-module (guix store)
+  #:use-module (guix grafts)
   #:use-module (guix derivations)
   #:use-module (guix packages)
   #:use-module (guix profiles)
@@ -176,9 +177,9 @@ COMMAND or an interactive shell in that environment.\n"))
   (show-bug-report-information))
 
 (define %default-options
-  ;; Default to opening a new shell.
   `((system . ,(%current-system))
     (substitutes? . #t)
+    (graft? . #t)
     (max-silent-time . 3600)
     (verbosity . 0)))
 
@@ -525,7 +526,8 @@ message if any test fails."
 
       (with-store store
         ;; Use the bootstrap Guile when requested.
-        (parameterize ((%guile-for-build
+        (parameterize ((%graft? (assoc-ref opts 'graft?))
+                       (%guile-for-build
                         (package-derivation
                          store
                          (if bootstrap?
diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm
index f65834386b..1d88b33996 100644
--- a/guix/scripts/package.scm
+++ b/guix/scripts/package.scm
@@ -22,6 +22,7 @@
 (define-module (guix scripts package)
   #:use-module (guix ui)
   #:use-module (guix store)
+  #:use-module (guix grafts)
   #:use-module (guix derivations)
   #:use-module (guix packages)
   #:use-module (guix profiles)
@@ -319,6 +320,7 @@ ENTRIES, a list of manifest entries, in the context of PROFILE."
   ;; Alist of default option values.
   `((max-silent-time . 3600)
     (verbosity . 0)
+    (graft? . #t)
     (substitutes? . #t)))
 
 (define (show-help)
@@ -837,7 +839,8 @@ processed, #f otherwise."
                                   #:argument-handler handle-argument)))
     (with-error-handling
       (or (process-query opts)
-          (parameterize ((%store (open-connection)))
+          (parameterize ((%store  (open-connection))
+                         (%graft? (assoc-ref opts 'graft?)))
             (set-build-options-from-command-line (%store) opts)
 
             (parameterize ((%guile-for-build
diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm
index 401aa8b60a..9f56a96ca0 100644
--- a/guix/scripts/system.scm
+++ b/guix/scripts/system.scm
@@ -21,6 +21,7 @@
   #:use-module (guix config)
   #:use-module (guix ui)
   #:use-module (guix store)
+  #:use-module (guix grafts)
   #:use-module (guix gexp)
   #:use-module (guix derivations)
   #:use-module (guix packages)
@@ -685,6 +686,7 @@ Build the operating system declared in FILE according to ACTION.\n"))
   ;; Alist of default option values.
   `((system . ,(%current-system))
     (substitutes? . #t)
+    (graft? . #t)
     (build-hook? . #t)
     (max-silent-time . 3600)
     (verbosity . 0)
@@ -812,6 +814,7 @@ argument list and OPTS is the option alist."
                                          parse-sub-command))
            (args     (option-arguments opts))
            (command  (assoc-ref opts 'action)))
-      (process-command command args opts))))
+      (parameterize ((%graft? (assoc-ref opts 'graft?)))
+        (process-command command args opts)))))
 
 ;;; system.scm ends here