summaryrefslogtreecommitdiff
path: root/guix/scripts
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2022-01-19 22:01:35 +0100
committerLudovic Courtès <ludo@gnu.org>2022-01-19 22:07:54 +0100
commitccda88a07039c62d5d0bfde7fccef02ef3937ccf (patch)
treebf509b8f898cde9fbcc8039e7609d7286b572873 /guix/scripts
parent09676b7c11a785ef117ad328f3eca2ffa24795e8 (diff)
package: Honor '--dry-run' when target profile is already in store.
Fixes <https://issues.guix.gnu.org/53267>. Reported by Tirifto <tirifto@posteo.cz>. Regression introduced in 65ffb9388c1c3d870cb07e4cb3ef12c9ac06a161. In the (unlikely) case where the profile we're targeting with "guix upgrade -n" or similar is already built, a new profile generation would be created and linked to despite the use of '-n'. This is because 65ffb9388c1c3d870cb07e4cb3ef12c9ac06a161 assumed that dry-run behavior would be handled solely by the build handler, which is not the case when there's nothing to build. * guix/scripts/package.scm (build-and-use-profile): Reintroduce #:dry-run? and honor it. (process-actions): Pass #:dry-run? to 'build-and-use-profile'. * tests/guix-package-net.sh: Add test.
Diffstat (limited to 'guix/scripts')
-rw-r--r--guix/scripts/package.scm5
1 files changed, 4 insertions, 1 deletions
diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm
index 4b9c5f210d..9699c70c6d 100644
--- a/guix/scripts/package.scm
+++ b/guix/scripts/package.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2012-2022 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2013 Nikita Karetnikov <nikita@karetnikov.org>
;;; Copyright © 2013, 2015 Mark H Weaver <mhw@netris.org>
;;; Copyright © 2014, 2016 Alex Kost <alezost@gmail.com>
@@ -139,6 +139,7 @@ denote ranges as interpreted by 'matching-generations'."
(define* (build-and-use-profile store profile manifest
#:key
+ dry-run?
(hooks %default-profile-hooks)
allow-collisions?
bootstrap?)
@@ -154,6 +155,7 @@ hooks\" run when building the profile."
(prof (derivation->output-path prof-drv)))
(cond
+ (dry-run? #t)
((and (file-exists? profile)
(and=> (readlink* profile) (cut string=? prof <>)))
(format (current-error-port) (G_ "nothing to be done~%")))
@@ -1069,6 +1071,7 @@ processed, #f otherwise."
trans
#:dry-run? dry-run?)
(build-and-use-profile store profile new
+ #:dry-run? dry-run?
#:allow-collisions? allow-collisions?
#:bootstrap? bootstrap?)))))