[Aptitude-devel] Bug#837971: aptitude: [PATCH] Distinguish Debian-specific and upstream upgrades

Keshav Kini keshav.kini at gmail.com
Fri Sep 16 03:51:16 UTC 2016


Package: aptitude
Version: 0.8.3-1
Severity: wishlist
Tags: patch

Dear Maintainer,

When upgrading packages, aptitude users might like to know whether each
upgrade represents a newer upstream version of the package, or is merely
a Debian-specific change.  This can be determined by comparing the
current and candidate versions in the rightmost two columns of the
package listing, but I thought it might be easier to see at a glance if
these two kinds of upgrades were colored differently in the UI.

The attached patch (directly importable into git) makes upgrades that
represent a newer upstream version appear in bold, while upgrades that
represent a Debian revision bump appear as before.

Thanks,
    Keshav

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Distinguish-Debian-specific-and-upstream-upgrades.patch
Type: text/x-diff
Size: 5387 bytes
Desc: patch
URL: <http://lists.alioth.debian.org/pipermail/aptitude-devel/attachments/20160915/07adcba1/attachment.patch>
-------------- next part --------------

-- Package-specific info:
Terminal: rxvt-unicode-256color
$DISPLAY is set.
which aptitude: /usr/bin/aptitude

aptitude version information:
aptitude 0.8.3
Compiler: g++ 6.1.1 20160802
Compiled against:
  apt version 5.0.0
  NCurses version 6.0
  libsigc++ version: 2.8.0
  Gtk+ support disabled.
  Qt support disabled.

Current library versions:
  NCurses version: ncurses 6.0.20160625
  cwidget version: 0.5.17
  Apt version: 5.0.0

aptitude linkage:
  linux-vdso.so.1 (0x00007fffacf1e000)
  libapt-pkg.so.5.0 => /usr/lib/x86_64-linux-gnu/libapt-pkg.so.5.0 (0x00007f8b4cf74000)
  libncursesw.so.5 => /lib/x86_64-linux-gnu/libncursesw.so.5 (0x00007f8b4cd44000)
  libtinfo.so.5 => /lib/x86_64-linux-gnu/libtinfo.so.5 (0x00007f8b4cb1a000)
  libsigc-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libsigc-2.0.so.0 (0x00007f8b4c913000)
  libcwidget.so.3 => /usr/lib/x86_64-linux-gnu/libcwidget.so.3 (0x00007f8b4c616000)
  libsqlite3.so.0 => /usr/lib/x86_64-linux-gnu/libsqlite3.so.0 (0x00007f8b4c311000)
  libboost_iostreams.so.1.61.0 => /usr/lib/x86_64-linux-gnu/libboost_iostreams.so.1.61.0 (0x00007f8b4c0f9000)
  libboost_filesystem.so.1.61.0 => /usr/lib/x86_64-linux-gnu/libboost_filesystem.so.1.61.0 (0x00007f8b4bee0000)
  libboost_system.so.1.61.0 => /usr/lib/x86_64-linux-gnu/libboost_system.so.1.61.0 (0x00007f8b4bcdc000)
  libxapian.so.22 => /usr/lib/x86_64-linux-gnu/libxapian.so.22 (0x00007f8b4b8d8000)
  libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f8b4b6bb000)
  libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f8b4b338000)
  libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f8b4b034000)
  libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f8b4ae1d000)
  libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f8b4aa7e000)
  libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f8b4a87a000)
  libresolv.so.2 => /lib/x86_64-linux-gnu/libresolv.so.2 (0x00007f8b4a663000)
  libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f8b4a446000)
  libbz2.so.1.0 => /lib/x86_64-linux-gnu/libbz2.so.1.0 (0x00007f8b4a236000)
  liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5 (0x00007f8b4a013000)
  liblz4.so.1 => /usr/lib/x86_64-linux-gnu/liblz4.so.1 (0x00007f8b49e01000)
  librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f8b49bf9000)
  libuuid.so.1 => /lib/x86_64-linux-gnu/libuuid.so.1 (0x00007f8b499f2000)
  /lib64/ld-linux-x86-64.so.2 (0x000055a82d444000)

-- System Information:
Debian Release: stretch/sid
  APT prefers unstable
  APT policy: (990, 'unstable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.6.0-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Init: systemd (via /run/systemd/system)

Versions of packages aptitude depends on:
ii  aptitude-common            0.8.3-1
ii  libapt-pkg5.0              1.3~rc4
ii  libboost-filesystem1.61.0  1.61.0+dfsg-2.1
ii  libboost-iostreams1.61.0   1.61.0+dfsg-2.1
ii  libboost-system1.61.0      1.61.0+dfsg-2.1
ii  libc6                      2.24-1
ii  libcwidget3v5              0.5.17-4+b1
ii  libgcc1                    1:6.2.0-2
ii  libncursesw5               6.0+20160625-1
ii  libsigc++-2.0-0v5          2.8.0-2
ii  libsqlite3-0               3.14.1-1
ii  libstdc++6                 6.2.0-2
ii  libtinfo5                  6.0+20160625-1
ii  libxapian22v5              1.2.23-1

Versions of packages aptitude recommends:
ii  libparse-debianchangelog-perl  1.2.0-10
ii  sensible-utils                 0.0.9

Versions of packages aptitude suggests:
ii  apt-xapian-index                0.48
pn  aptitude-doc-en | aptitude-doc  <none>
pn  debtags                         <none>
ii  tasksel                         3.35

-- no debconf information

===File
/home/fs/src/aptitude/0001-Distinguish-Debian-specific-and-upstream-upgrades.patch===
>From a75130149a4e838d090d5af3158868d24b0b2c7d Mon Sep 17 00:00:00 2001
From: Keshav Kini <keshav.kini at gmail.com>
Date: Thu, 15 Sep 2016 20:34:35 -0700
Subject: [PATCH] Distinguish Debian-specific and upstream upgrades

When upgrading packages, aptitude users might like to know whether each
upgrade represents a newer upstream version of the package, or is merely
a Debian-specific change.  This can be determined by comparing the
current and candidate versions in the rightmost two columns of the
package listing, but I thought it might be easier to see at a glance if
these two kinds of upgrades were colored differently in the UI.

This commit makes upgrades that represent a newer upstream version
appear in bold, while upgrades that represent a Debian revision bump
appear as before.
---
 src/defaults.cc | 36 +++++++++++++++++++-----------------
 src/pkg_item.cc | 11 +++++++++--
 2 files changed, 28 insertions(+), 19 deletions(-)

diff --git a/src/defaults.cc b/src/defaults.cc
index 1747f90..f0ad047 100644
--- a/src/defaults.cc
+++ b/src/defaults.cc
@@ -107,23 +107,25 @@ static void init_keybindings()
 
 static void init_styles()
 {
-  cw::set_style("PkgNotInstalled", cw::style());
-  cw::set_style("PkgIsInstalled",  cw::style_attrs_on(A_BOLD));
-  cw::set_style("PkgToHold",       cw::style_fg(COLOR_WHITE)   + cw::style_attrs_on(A_REVERSE));
-  cw::set_style("PkgToRemove",     cw::style_fg(COLOR_MAGENTA) + cw::style_attrs_on(A_REVERSE));
-  cw::set_style("PkgBroken",       cw::style_fg(COLOR_RED)     + cw::style_attrs_on(A_REVERSE));
-  cw::set_style("PkgToInstall",    cw::style_fg(COLOR_GREEN)   + cw::style_attrs_on(A_REVERSE));
-  cw::set_style("PkgToUpgrade",    cw::style_fg(COLOR_CYAN)    + cw::style_attrs_on(A_REVERSE));
-  cw::set_style("PkgToDowngrade",  cw::style_fg(COLOR_YELLOW)  + cw::style_attrs_on(A_REVERSE));
-
-  cw::set_style("PkgNotInstalledHighlighted", cw::style_attrs_flip(A_REVERSE));
-  cw::set_style("PkgIsInstalledHighlighted",  cw::style_attrs_on(A_BOLD) + cw::style_attrs_flip(A_REVERSE));
-  cw::set_style("PkgToHoldHighlighted",       cw::style_fg(COLOR_WHITE));
-  cw::set_style("PkgToRemoveHighlighted",     cw::style_fg(COLOR_MAGENTA));
-  cw::set_style("PkgBrokenHighlighted",       cw::style_fg(COLOR_RED));
-  cw::set_style("PkgToInstallHighlighted",    cw::style_fg(COLOR_GREEN));
-  cw::set_style("PkgToUpgradeHighlighted",    cw::style_fg(COLOR_CYAN));
-  cw::set_style("PkgToDowngradeHighlighted",  cw::style_fg(COLOR_YELLOW));
+  cw::set_style("PkgNotInstalled",      cw::style());
+  cw::set_style("PkgIsInstalled",       cw::style_attrs_on(A_BOLD));
+  cw::set_style("PkgToHold",            cw::style_fg(COLOR_WHITE)   + cw::style_attrs_on(A_REVERSE));
+  cw::set_style("PkgToRemove",          cw::style_fg(COLOR_MAGENTA) + cw::style_attrs_on(A_REVERSE));
+  cw::set_style("PkgBroken",            cw::style_fg(COLOR_RED)     + cw::style_attrs_on(A_REVERSE));
+  cw::set_style("PkgToInstall",         cw::style_fg(COLOR_GREEN)   + cw::style_attrs_on(A_REVERSE));
+  cw::set_style("PkgToUpgradeUpstream", cw::style_fg(COLOR_CYAN)    + cw::style_attrs_on(A_REVERSE | A_BOLD));
+  cw::set_style("PkgToUpgradeDebian",   cw::style_fg(COLOR_CYAN)    + cw::style_attrs_on(A_REVERSE));
+  cw::set_style("PkgToDowngrade",       cw::style_fg(COLOR_YELLOW)  + cw::style_attrs_on(A_REVERSE));
+
+  cw::set_style("PkgNotInstalledHighlighted",      cw::style_attrs_flip(A_REVERSE));
+  cw::set_style("PkgIsInstalledHighlighted",       cw::style_attrs_on(A_BOLD) + cw::style_attrs_flip(A_REVERSE));
+  cw::set_style("PkgToHoldHighlighted",            cw::style_fg(COLOR_WHITE));
+  cw::set_style("PkgToRemoveHighlighted",          cw::style_fg(COLOR_MAGENTA));
+  cw::set_style("PkgBrokenHighlighted",            cw::style_fg(COLOR_RED));
+  cw::set_style("PkgToInstallHighlighted",         cw::style_fg(COLOR_GREEN));
+  cw::set_style("PkgToUpgradeUpstreamHighlighted", cw::style_fg(COLOR_CYAN) + cw::style_attrs_on(A_BOLD));
+  cw::set_style("PkgToUpgradeDebianHighlighted",   cw::style_fg(COLOR_CYAN));
+  cw::set_style("PkgToDowngradeHighlighted",       cw::style_fg(COLOR_YELLOW));
 
   cw::set_style("DepBroken", cw::style_fg(COLOR_BLACK)+cw::style_bg(COLOR_RED));
 
diff --git a/src/pkg_item.cc b/src/pkg_item.cc
index 459191e..cbefa60 100644
--- a/src/pkg_item.cc
+++ b/src/pkg_item.cc
@@ -44,6 +44,8 @@
 
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/error.h>
+#include <apt-pkg/version.h>
+#include <apt-pkg/pkgsystem.h>
 
 #include <sigc++/adaptors/bind.h>
 #include <sigc++/functors/mem_fun.h>
@@ -330,8 +332,13 @@ cw::style pkg_item::pkg_style(pkgCache::PkgIterator package, bool highlighted)
 	return cw::get_style(MAYBE_HIGHLIGHTED("PkgToRemove"));
       else if(state.InstBroken())
 	return cw::get_style(MAYBE_HIGHLIGHTED("PkgBroken"));
-      else if(state.Upgrade())
-	return cw::get_style(MAYBE_HIGHLIGHTED("PkgToUpgrade"));
+      else if(state.Upgrade()) {
+        if (_system->VS->UpstreamVersion(state.CurVersion) ==
+            _system->VS->UpstreamVersion(state.CandVersion))
+          return cw::get_style(MAYBE_HIGHLIGHTED("PkgToUpgradeDebian"));
+        else
+          return cw::get_style(MAYBE_HIGHLIGHTED("PkgToUpgradeUpstream"));
+      }
       else if(state.Downgrade())
 	return cw::get_style(MAYBE_HIGHLIGHTED("PkgToDowngrade"));
       else if(package.CurrentVer().end())
-- 
2.9.3

============================================================


More information about the Aptitude-devel mailing list