Subject: [bug#52701] [PATCH 1/5] packages: Display superseded package version.

From: Brice Waegeneire <[email-masked]>
Date: Tue, 21 Dec 2021 14:05:39 +0100

* gnu/packages.scm (%find-package): Display package versions in warning
  message.
* guix/scripts/package.scm (transaction-upgrade-entry): Display package
  versions in warning message.
---
 gnu/packages.scm         |  6 ++++--
 guix/scripts/package.scm | 24 ++++++++++++++----------
 2 files changed, 18 insertions(+), 12 deletions(-)

diff --git a/gnu/packages.scm b/gnu/packages.scm
index ccfc83dd11..ad0d75db94 100644
--- a/gnu/packages.scm
+++ b/gnu/packages.scm
@@ -4,6 +4,7 @@
 ;;; Copyright © 2014 Eric Bavier <[email-masked]>
 ;;; Copyright © 2016, 2017 Alex Kost <[email-masked]>
 ;;; Copyright © 2016 Mathieu Lirzin <[email-masked]>
+;;; Copyright © 2021 Brice Waegeneire <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -483,8 +484,9 @@ (define* (%find-package spec name version)
                 (location->string (package-location pkg))))
      (match (package-superseded pkg)
        ((? package? new)
-        (info (G_ "package '~a' has been superseded by '~a'~%")
-              (package-name pkg) (package-name new))
+        (info (G_ "package '~a@~a' has been superseded by '~a@~a'~%")
+              (package-name pkg) (package-version pkg)
+              (package-name new) (package-version new))
         new)
        (#f
         pkg)))
diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm
index 4b9c5f210d..d6a8333ac6 100644
--- a/guix/scripts/package.scm
+++ b/guix/scripts/package.scm
@@ -10,6 +10,7 @@
 ;;; Copyright © 2020 Ricardo Wurmus <[email-masked]>
 ;;; Copyright © 2020 Simon Tournier <[email-masked]>
 ;;; Copyright © 2018 Steve Sprang <[email-masked]>
+;;; Copyright © 2021 Brice Waegeneire <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -213,16 +214,19 @@ (define (lower-manifest-entry* entry)
       (lower-manifest-entry entry (%current-system))))
 
   (define (supersede old new)
-    (info (G_ "package '~a' has been superseded by '~a'~%")
-          (manifest-entry-name old) (package-name new))
-    (manifest-transaction-install-entry
-     (package->manifest-entry* new (manifest-entry-output old))
-     (manifest-transaction-remove-pattern
-      (manifest-pattern
-        (name (manifest-entry-name old))
-        (version (manifest-entry-version old))
-        (output (manifest-entry-output old)))
-      transaction)))
+    (let ((old-name (manifest-entry-name old))
+          (old-version (manifest-entry-version old)))
+      (info (G_ "package '~a@~a' has been superseded by '~a@~a'~%")
+            old-name old-version
+            (package-name new) (package-version new))
+      (manifest-transaction-install-entry
+       (package->manifest-entry* new (manifest-entry-output old))
+       (manifest-transaction-remove-pattern
+        (manifest-pattern
+          (name old-name)
+          (version old-version)
+          (output (manifest-entry-output old)))
+        transaction))))
 
   (define (upgrade entry transform)
     (match entry
-- 
2.34.0