guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

02/04: guix build: Move '--no-grafts' to the common build options.


From: Ludovic Courtès
Subject: 02/04: guix build: Move '--no-grafts' to the common build options.
Date: Wed, 02 Mar 2016 13:55:38 +0000

civodul pushed a commit to branch master
in repository guix.

commit 7573d30ff804302eeb68edeca6ae5f3efb48b7bf
Author: Ludovic Courtès <address@hidden>
Date:   Wed Mar 2 13:43:13 2016 +0100

    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.
---
 doc/guix.texi                |   10 ++++----
 guix/scripts/archive.scm     |   51 ++++++++++++++++++++++-------------------
 guix/scripts/build.scm       |   14 ++++++-----
 guix/scripts/environment.scm |    8 ++++--
 guix/scripts/package.scm     |    5 +++-
 guix/scripts/system.scm      |    5 +++-
 6 files changed, 53 insertions(+), 40 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 5e62703..44653ef 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}).
 
address@hidden --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 address@hidden
 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.
 
address@hidden --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 16ca96b..3fb210e 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 8725dda..d6bb35c 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 0e462de..b122b4c 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 <address@hidden>
-;;; Copyright © 2015 Ludovic Courtès <address@hidden>
+;;; Copyright © 2015, 2016 Ludovic Courtès <address@hidden>
 ;;;
 ;;; 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 f658343..1d88b33 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 401aa8b..9f56a96 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]