summary refs log tree commit diff
path: root/tests/profiles.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2015-02-08 18:52:00 +0100
committerLudovic Courtès <ludo@gnu.org>2015-02-08 19:00:39 +0100
commit46b23e1a436d209d6b96daee4bc398f102267502 (patch)
tree99903e4f5167d515c017a5002d014b5aa0f07b26 /tests/profiles.scm
parent77ee4a96f4a128d2a139a1908f7b8c5d0d97d9a8 (diff)
downloadguix-46b23e1a436d209d6b96daee4bc398f102267502.tar.gz
profiles: Distinguish downgrades from upgrades.
Fixes <http://bugs.gnu.org/19764>.

* guix/profiles.scm (manifest-transaction-effects): Return downgraded
  packages as a fourth value.
* guix/ui.scm (show-manifest-transaction): Adjust accordingly.
* tests/profiles.scm ("manifest-transaction-effects and downgrades"):
  New test.
Diffstat (limited to 'tests/profiles.scm')
-rw-r--r--tests/profiles.scm14
1 files changed, 11 insertions, 3 deletions
diff --git a/tests/profiles.scm b/tests/profiles.scm
index d816248994..c210123f74 100644
--- a/tests/profiles.scm
+++ b/tests/profiles.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2013, 2014 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2013, 2014, 2015 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2014 Alex Kost <alezost@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
@@ -155,12 +155,20 @@
          (t  (manifest-transaction
               (install (list guile-2.0.9 glibc))
               (remove (list (manifest-pattern (name "coreutils")))))))
-    (let-values (((remove install upgrade)
+    (let-values (((remove install upgrade downgrade)
                   (manifest-transaction-effects m0 t)))
-      (and (null? remove)
+      (and (null? remove) (null? downgrade)
            (equal? (list glibc) install)
            (equal? (list (cons guile-1.8.8 guile-2.0.9)) upgrade)))))
 
+(test-assert "manifest-transaction-effects and downgrades"
+  (let* ((m0 (manifest (list guile-2.0.9)))
+         (t  (manifest-transaction (install (list guile-1.8.8)))))
+    (let-values (((remove install upgrade downgrade)
+                  (manifest-transaction-effects m0 t)))
+      (and (null? remove) (null? install) (null? upgrade)
+           (equal? (list (cons guile-2.0.9 guile-1.8.8)) downgrade)))))
+
 (test-assertm "profile-derivation"
   (mlet* %store-monad
       ((entry ->   (package->manifest-entry %bootstrap-guile))