guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

02/03: guix package: '--upgrade' preserves package order.


From: guix-commits
Subject: 02/03: guix package: '--upgrade' preserves package order.
Date: Tue, 15 Jan 2019 06:06:24 -0500 (EST)

civodul pushed a commit to branch master
in repository guix.

commit 35225dc57996ebc7a5a55462e0e52d85239195d9
Author: Ludovic Courtès <address@hidden>
Date:   Tue Jan 15 11:31:16 2019 +0100

    guix package: '--upgrade' preserves package order.
    
    Fixes <https://bugs.gnu.org/31142>.
    Reported by Chris Marusich <address@hidden>.
    
    * guix/scripts/package.scm (options->installable)[upgraded]: Use 'fold'
    instead of 'fold-right'.  This reverts
    eca16a3d1d9e6b2c064e0105c1015258bf2755f2.
    * tests/guix-package-net.sh: Add 'guix package u' test.
---
 guix/scripts/package.scm  | 12 ++++++------
 tests/guix-package-net.sh | 33 ++++++++++++++++++++++++++++++++-
 2 files changed, 38 insertions(+), 7 deletions(-)

diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm
index 7ff6bfd..5a8fd20 100644
--- a/guix/scripts/package.scm
+++ b/guix/scripts/package.scm
@@ -604,12 +604,12 @@ and upgrades."
     (options->upgrade-predicate opts))
 
   (define upgraded
-    (fold-right (lambda (entry transaction)
-                  (if (upgrade? (manifest-entry-name entry))
-                      (transaction-upgrade-entry entry transaction)
-                      transaction))
-                transaction
-                (manifest-entries manifest)))
+    (fold (lambda (entry transaction)
+            (if (upgrade? (manifest-entry-name entry))
+                (transaction-upgrade-entry entry transaction)
+                transaction))
+          transaction
+          (manifest-entries manifest)))
 
   (define to-install
     (filter-map (match-lambda
diff --git a/tests/guix-package-net.sh b/tests/guix-package-net.sh
index 927c856..82c346d 100644
--- a/tests/guix-package-net.sh
+++ b/tests/guix-package-net.sh
@@ -1,5 +1,5 @@
 # GNU Guix --- Functional package management for GNU
-# Copyright © 2012, 2013, 2014, 2015, 2017 Ludovic Courtès <address@hidden>
+# Copyright © 2012, 2013, 2014, 2015, 2017, 2019 Ludovic Courtès 
<address@hidden>
 # Copyright © 2013 Nikita Karetnikov <address@hidden>
 #
 # This file is part of GNU Guix.
@@ -167,6 +167,37 @@ then false; fi
 guix package -p "$profile" -p "$profile_alt" --search-paths \
      | grep "LIBRARY_PATH.*$profile/lib.$profile_alt/lib"
 
+# Simulate an upgrade and make sure the package order is preserved.
+module_dir="t-guix-package-net-$$"
+trap 'rm -rf "$module_dir"' EXIT
+
+mkdir "$module_dir"
+cat > "$module_dir/new.scm" <<EOF
+(define-module (new)
+  #:use-module (guix)
+  #:use-module (gnu packages bootstrap))
+
+(define-public new-guile
+  (package (inherit %bootstrap-guile)
+           (version (string-append "42." (getenv "V_MINOR")))))
+(define-public new-gcc
+  (package (inherit %bootstrap-gcc)
+           (version (string-append "77." (getenv "V_MINOR")))))
+EOF
+
+guix package --bootstrap -p "$profile" -i gcc-bootstrap
+installed="`guix package -p "$profile" -I | cut -f1`"
+
+for i in 1 2
+do
+    V_MINOR="$i"
+    export V_MINOR
+
+    guix package -p "$profile" --bootstrap -L "$module_dir" -u .
+    post_upgrade="`guix package -p "$profile" -I | cut -f1`"
+    test "$post_upgrade" = "$installed"
+done
+
 #
 # Try with the default profile.
 #



reply via email to

[Prev in Thread] Current Thread [Next in Thread]