emacs: Disable grafts when dry-run is enabled.

* emacs/guix-main.scm (process-package-actions): Set grafting according
to 'dry-run?'.
* guix/scripts.scm (build-package): Disable grafts when 'dry-run?' is #t.

Co-authored-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
Alex Kost 2016-07-27 14:55:50 +03:00
parent 6661db4e97
commit a82a201a8d
No known key found for this signature in database
GPG Key ID: 82460C082A0EE98F
2 changed files with 17 additions and 12 deletions

View File

@ -46,6 +46,7 @@
(guix) (guix)
(guix combinators) (guix combinators)
(guix git-download) (guix git-download)
(guix grafts)
(guix packages) (guix packages)
(guix profiles) (guix profiles)
(guix licenses) (guix licenses)
@ -930,15 +931,16 @@ OUTPUTS is a list of package outputs (may be an empty list)."
(new-manifest (manifest-perform-transaction (new-manifest (manifest-perform-transaction
manifest transaction))) manifest transaction)))
(unless (and (null? install) (null? remove)) (unless (and (null? install) (null? remove))
(with-store store (parameterize ((%graft? (not dry-run?)))
(set-build-options store (with-store store
#:print-build-trace #f (set-build-options store
#:use-substitutes? use-substitutes?) #:print-build-trace #f
(show-manifest-transaction store manifest transaction #:use-substitutes? use-substitutes?)
#:dry-run? dry-run?) (show-manifest-transaction store manifest transaction
(build-and-use-profile store profile new-manifest #:dry-run? dry-run?)
#:use-substitutes? use-substitutes? (build-and-use-profile store profile new-manifest
#:dry-run? dry-run?))))) #:use-substitutes? use-substitutes?
#:dry-run? dry-run?))))))
(define (delete-generations* profile generations) (define (delete-generations* profile generations)
"Delete GENERATIONS from PROFILE. "Delete GENERATIONS from PROFILE.

View File

@ -1,7 +1,7 @@
;;; GNU Guix --- Functional package management for GNU ;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2013, 2014, 2015 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2013, 2014, 2015 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2014 Deck Pickard <deck.r.pickard@gmail.com> ;;; Copyright © 2014 Deck Pickard <deck.r.pickard@gmail.com>
;;; Copyright © 2015 Alex Kost <alezost@gmail.com> ;;; Copyright © 2015, 2016 Alex Kost <alezost@gmail.com>
;;; ;;;
;;; This file is part of GNU Guix. ;;; This file is part of GNU Guix.
;;; ;;;
@ -19,6 +19,7 @@
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
(define-module (guix scripts) (define-module (guix scripts)
#:use-module (guix grafts)
#:use-module (guix utils) #:use-module (guix utils)
#:use-module (guix ui) #:use-module (guix ui)
#:use-module (guix store) #:use-module (guix store)
@ -105,11 +106,13 @@ true."
#:rest build-options) #:rest build-options)
"Build PACKAGE using BUILD-OPTIONS acceptable by 'set-build-options'. "Build PACKAGE using BUILD-OPTIONS acceptable by 'set-build-options'.
Show what and how will/would be built." Show what and how will/would be built."
(mbegin %store-monad (mlet %store-monad ((grafting? ((lift0 %graft? %store-monad))))
(apply set-build-options* (apply set-build-options*
#:use-substitutes? use-substitutes? #:use-substitutes? use-substitutes?
(strip-keyword-arguments '(#:dry-run?) build-options)) (strip-keyword-arguments '(#:dry-run?) build-options))
(mlet %store-monad ((derivation (package->derivation package))) (mlet %store-monad ((derivation (package->derivation
package #:graft? (and (not dry-run?)
grafting?))))
(mbegin %store-monad (mbegin %store-monad
(maybe-build (list derivation) (maybe-build (list derivation)
#:use-substitutes? use-substitutes? #:use-substitutes? use-substitutes?