On 2016-06-15 13:44:50, Paul Wise wrote:
> Package: apt-show-versions
> Version: 0.22.7
> Severity: wishlist
>
> I pin most packages to testing and then have progressively lower pin
> values for less desirable suites. I also pin some particular packages
> to other suites. I also pin security updates using the script in bug
> #725934 to the suite that they come from (mostly unstable). I would
> like to have an option to hide packages that are at the right version
> based on pinning. So for most packages, hide if they are the version in
> testing. For specific packages pinned to a different release, hide if
> they are the version from the pinned release. For security updates
> pinned to unstable release, hide if they are the version from unstable.

I have a similar requirement, at least I think it is. I'm running
testing and pin some packages to "unstable until it hits testing". For
example, I have this for Firefox right now:

Package: firefox-esr
Pin: release n=sid
Pin-Priority: 501

Package: firefox-esr
Pin: release n=buster
Pin: release v=60
Pin-Priority: 502

It gives me a quantum-enabled firefox in buster, from sid, but will
transition to the buster version when it makes it. I also manually
install some packages from sid that are missing from buster in the hope
they transition.

I use apt-show-versions to keep track of those transitions. This
requires me to add a filter to hide "uptodate" entries from
"buster". For example, here's the output I am looking at right now:

$ apt-show-versions  | grep -v '/buster [^ ]* uptodate'
firefox-esr:amd64/sid 60.3.0esr-1 uptodate
network-manager-iodine:amd64/sid 1.2.0-3 uptodate
network-manager-iodine-gnome:amd64/sid 1.2.0-3 uptodate
printer-driver-postscript-hp:amd64 not installed
python-hvac:amd64 0.6.4-1 installed: No available version in archive
wireguard:all/sid 0.0.20181018-1 uptodate
wireguard-dkms:all/sid 0.0.20181018-1 uptodate
wireguard-tools:amd64/sid 0.0.20181018-1 uptodate

The first three and last three are normal there: both firefox-esr,
wireguard, and nm-iodine have excuses for not migrating to testing. The
`not installed` bit doesn't belong there but that's #783781. The
python-hvac one is interesting: it's a package that is currently in WNPP
(#875603) that I've worked on. Hopefully it will get there as well.

So that's really nice, but I always forget that cute regex. I wished
there was a way to simply add an option to get that clean output. I
tried this patch:

diff --git i/apt-show-versions w/apt-show-versions
index 3df13c7..6266b10 100755
--- i/apt-show-versions
+++ w/apt-show-versions
@@ -79,6 +79,7 @@ unless (GetOptions (\%opts,
         'upgradeable|u',
         'brief|b',
         'nohold|nh',
+        'nouptodate|nu',
         'initialize|i',
         'verbose|v',
        'version|V',
@@ -143,6 +144,7 @@ Options:
  -a|--allversions           Print all available versions.
  -b|--brief                 Short output.
  -nh|--nohold               Don't treat holded packages.
+ -nu|--nouptodate           Don't display up to date packages.
  -i|--initialize            Initialize or update package cache only (as root).
  -v|--verbose               Verbose messages.
  -V|--version              Prints apt-show-versions version
@@ -458,7 +460,9 @@ sub print_package_internal {
                 ($found, @version_info) =
                    &print_version(($irelease ? $irelease : 
&get_rel_name($_->{$RELEASE})),
                                    $pkgarch, $iversion, $version, $cand);
-                push @print_info, @version_info if ($found);
+                if ($found and ($found != 1 or !$opts{'nouptodate'})) {
+                    push @print_info, @version_info;
+                }
                 $aversion = $version;
             }
             $is_upgradeable = 1 if ($found == 2);

But that doesn't give the right output:

$ ./apt-show-versions --nouptodate
python-hvac:amd64 0.6.4-1 installed: No available version in archive

Obviously, it removes just all uptodate packages, regardless of
suite. There should be a way to figure out if the found release (the
$irelease thing above) is the default release, but unfortunately
apt-show-versions does not have a good notion of what that is. It only
relies on APT::Default-Release (#875603) and that's usually not defined.

What *is* the proper way of figuring out what the default release is? Or
should we have a --ignore flag that would ignore a certain suite?

So I'm not sure if there's a clean way of fixing this.

A.

-- 
No animal has more liberty than the cat; but it buries the mess it
makes. The cat is the best anarchist. Until they learn that from the cat
I cannot respect them.
                        - For whom the bell tolls, Ernest Hemingway

Reply via email to