From 7573d30ff804302eeb68edeca6ae5f3efb48b7bf Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Wed, 2 Mar 2016 13:43:13 +0100 Subject: 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. --- 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 ++++- 5 files changed, 48 insertions(+), 35 deletions(-) (limited to 'guix') 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 @@ -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))) 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 -;;; Copyright © 2015 Ludovic Courtès +;;; Copyright © 2015, 2016 Ludovic Courtès ;;; ;;; 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 -- cgit v1.2.3