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.
This commit is contained in:
Ludovic Courtès 2016-03-02 13:43:13 +01:00
parent 1cbdf82d3b
commit 7573d30ff8
6 changed files with 53 additions and 40 deletions

View File

@ -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 locally instead of allowing downloads of pre-built binaries
(@pxref{Substitutes}). (@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} @item --rounds=@var{n}
Build each derivation @var{n} times in a row, and raise an error if Build each derivation @var{n} times in a row, and raise an error if
consecutive build results are not bit-for-bit identical. 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 of a package is deterministic. @xref{Invoking guix challenge}, for more
background information and tools. 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 @item --derivations
@itemx -d @itemx -d
Return the derivation paths, not the output paths, of the given Return the derivation paths, not the output paths, of the given

View File

@ -22,6 +22,7 @@
#:use-module ((guix build utils) #:select (mkdir-p)) #:use-module ((guix build utils) #:select (mkdir-p))
#:use-module ((guix serialization) #:select (restore-file)) #:use-module ((guix serialization) #:select (restore-file))
#:use-module (guix store) #:use-module (guix store)
#:use-module (guix grafts)
#:use-module (guix packages) #:use-module (guix packages)
#:use-module (guix derivations) #:use-module (guix derivations)
#:use-module (guix monads) #:use-module (guix monads)
@ -50,6 +51,7 @@
;; Alist of default option values. ;; Alist of default option values.
`((system . ,(%current-system)) `((system . ,(%current-system))
(substitutes? . #t) (substitutes? . #t)
(graft? . #t)
(max-silent-time . 3600) (max-silent-time . 3600)
(verbosity . 0))) (verbosity . 0)))
@ -318,27 +320,28 @@ the input port."
;; user to 'read-derivation' are absolute when it returns. ;; user to 'read-derivation' are absolute when it returns.
(with-fluids ((%file-port-name-canonicalization 'absolute)) (with-fluids ((%file-port-name-canonicalization 'absolute))
(let ((opts (parse-command-line args %options (list %default-options)))) (let ((opts (parse-command-line args %options (list %default-options))))
(cond ((assoc-ref opts 'generate-key) (parameterize ((%graft? (assoc-ref opts 'graft?)))
=> (cond ((assoc-ref opts 'generate-key)
generate-key-pair) =>
((assoc-ref opts 'authorize) generate-key-pair)
(authorize-key)) ((assoc-ref opts 'authorize)
(else (authorize-key))
(with-store store (else
(cond ((assoc-ref opts 'export) (with-store store
(export-from-store store opts)) (cond ((assoc-ref opts 'export)
((assoc-ref opts 'import) (export-from-store store opts))
(import-paths store (current-input-port))) ((assoc-ref opts 'import)
((assoc-ref opts 'missing) (import-paths store (current-input-port)))
(let* ((files (lines (current-input-port))) ((assoc-ref opts 'missing)
(missing (remove (cut valid-path? store <>) (let* ((files (lines (current-input-port)))
files))) (missing (remove (cut valid-path? store <>)
(format #t "~{~a~%~}" missing))) files)))
((assoc-ref opts 'extract) (format #t "~{~a~%~}" missing)))
=> ((assoc-ref opts 'extract)
(lambda (target) =>
(restore-file (current-input-port) target))) (lambda (target)
(else (restore-file (current-input-port) target)))
(leave (else
(_ "either '--export' or '--import' \ (leave
must be specified~%"))))))))))) (_ "either '--export' or '--import' \
must be specified~%"))))))))))))

View File

@ -295,6 +295,8 @@ options handled by 'set-build-options-from-command-line', and listed in
(display (_ " (display (_ "
--substitute-urls=URLS --substitute-urls=URLS
fetch substitute from URLS if they are authorized")) fetch substitute from URLS if they are authorized"))
(display (_ "
--no-grafts do not graft packages"))
(display (_ " (display (_ "
--no-build-hook do not attempt to offload builds via the build hook")) --no-build-hook do not attempt to offload builds via the build hook"))
(display (_ " (display (_ "
@ -379,6 +381,12 @@ options handled by 'set-build-options-from-command-line', and listed in
(string-tokenize arg) (string-tokenize arg)
(alist-delete 'substitute-urls result)) (alist-delete 'substitute-urls result))
rest))) 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 (option '("no-build-hook") #f #f
(lambda (opt name arg result . rest) (lambda (opt name arg result . rest)
(apply values (apply values
@ -451,8 +459,6 @@ Build the given PACKAGE-OR-DERIVATION and return their output paths.\n"))
-s, --system=SYSTEM attempt to build for SYSTEM--e.g., \"i686-linux\"")) -s, --system=SYSTEM attempt to build for SYSTEM--e.g., \"i686-linux\""))
(display (_ " (display (_ "
--target=TRIPLET cross-build for TRIPLET--e.g., \"armel-linux-gnu\"")) --target=TRIPLET cross-build for TRIPLET--e.g., \"armel-linux-gnu\""))
(display (_ "
--no-grafts do not graft packages"))
(display (_ " (display (_ "
-d, --derivations return the derivation paths of the given packages")) -d, --derivations return the derivation paths of the given packages"))
(display (_ " (display (_ "
@ -531,10 +537,6 @@ must be one of 'package', 'all', or 'transitive'~%")
(option '("log-file") #f #f (option '("log-file") #f #f
(lambda (opt name arg result) (lambda (opt name arg result)
(alist-cons 'log-file? #t 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 (append %transformation-options
%standard-build-options))) %standard-build-options)))

View File

@ -1,6 +1,6 @@
;;; GNU Guix --- Functional package management for GNU ;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2014, 2015 David Thompson <davet@gnu.org> ;;; 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. ;;; This file is part of GNU Guix.
;;; ;;;
@ -20,6 +20,7 @@
(define-module (guix scripts environment) (define-module (guix scripts environment)
#:use-module (guix ui) #:use-module (guix ui)
#:use-module (guix store) #:use-module (guix store)
#:use-module (guix grafts)
#:use-module (guix derivations) #:use-module (guix derivations)
#:use-module (guix packages) #:use-module (guix packages)
#:use-module (guix profiles) #:use-module (guix profiles)
@ -176,9 +177,9 @@ COMMAND or an interactive shell in that environment.\n"))
(show-bug-report-information)) (show-bug-report-information))
(define %default-options (define %default-options
;; Default to opening a new shell.
`((system . ,(%current-system)) `((system . ,(%current-system))
(substitutes? . #t) (substitutes? . #t)
(graft? . #t)
(max-silent-time . 3600) (max-silent-time . 3600)
(verbosity . 0))) (verbosity . 0)))
@ -525,7 +526,8 @@ message if any test fails."
(with-store store (with-store store
;; Use the bootstrap Guile when requested. ;; Use the bootstrap Guile when requested.
(parameterize ((%guile-for-build (parameterize ((%graft? (assoc-ref opts 'graft?))
(%guile-for-build
(package-derivation (package-derivation
store store
(if bootstrap? (if bootstrap?

View File

@ -22,6 +22,7 @@
(define-module (guix scripts package) (define-module (guix scripts package)
#:use-module (guix ui) #:use-module (guix ui)
#:use-module (guix store) #:use-module (guix store)
#:use-module (guix grafts)
#:use-module (guix derivations) #:use-module (guix derivations)
#:use-module (guix packages) #:use-module (guix packages)
#:use-module (guix profiles) #:use-module (guix profiles)
@ -319,6 +320,7 @@ ENTRIES, a list of manifest entries, in the context of PROFILE."
;; Alist of default option values. ;; Alist of default option values.
`((max-silent-time . 3600) `((max-silent-time . 3600)
(verbosity . 0) (verbosity . 0)
(graft? . #t)
(substitutes? . #t))) (substitutes? . #t)))
(define (show-help) (define (show-help)
@ -837,7 +839,8 @@ processed, #f otherwise."
#:argument-handler handle-argument))) #:argument-handler handle-argument)))
(with-error-handling (with-error-handling
(or (process-query opts) (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) (set-build-options-from-command-line (%store) opts)
(parameterize ((%guile-for-build (parameterize ((%guile-for-build

View File

@ -21,6 +21,7 @@
#:use-module (guix config) #:use-module (guix config)
#:use-module (guix ui) #:use-module (guix ui)
#:use-module (guix store) #:use-module (guix store)
#:use-module (guix grafts)
#:use-module (guix gexp) #:use-module (guix gexp)
#:use-module (guix derivations) #:use-module (guix derivations)
#:use-module (guix packages) #:use-module (guix packages)
@ -685,6 +686,7 @@ Build the operating system declared in FILE according to ACTION.\n"))
;; Alist of default option values. ;; Alist of default option values.
`((system . ,(%current-system)) `((system . ,(%current-system))
(substitutes? . #t) (substitutes? . #t)
(graft? . #t)
(build-hook? . #t) (build-hook? . #t)
(max-silent-time . 3600) (max-silent-time . 3600)
(verbosity . 0) (verbosity . 0)
@ -812,6 +814,7 @@ argument list and OPTS is the option alist."
parse-sub-command)) parse-sub-command))
(args (option-arguments opts)) (args (option-arguments opts))
(command (assoc-ref opts 'action))) (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 ;;; system.scm ends here