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
(@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

View File

@ -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~%"))))))))))))

View File

@ -295,6 +295,8 @@ options handled by 'set-build-options-from-command-line', and listed in
(display (_ "
--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 (_ "
@ -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
@ -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\""))
(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 (_ "
@ -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)))

View File

@ -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?

View File

@ -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

View File

@ -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