Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #190633

Re: show searched packages including versions

From Michael Stone <mstone@debian.org>
Newsgroups linux.debian.user
Subject Re: show searched packages including versions
Date 2018-01-04 00:10 +0100
Message-ID <v40ky-5wp-21@gated-at.bofh.it> (permalink)
References <v3XPH-3C0-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed, Jan 03, 2018 at 03:28:45PM -0500, Felix Miata wrote:
>I've had no luck finding a way to search in Debian that lists versions along
>with names. In openSUSE, this is somewhat simple to discover, as zypper includes
>everything in one man page rather than having various names to learn along with
>separate (or not) man pages, such as apt-cache, apt-get, apt-mark, apt-file,
>apt-key, aptitude and dpkg. Generally my searches are seeking whether newer
>version is yet available. ATM, the goal is finding whether mc-4.8.17 or older
>can readily be replaced by the current version, mc-4.8.20. Output I would like
>in a form similar to what follows (from openSUSE):
>
># zypper se -sx firefox-esr
>
>S  | Name        | Type       | Version      | Arch   | Repository
>---+-------------+------------+--------------+--------+--------------
>vl | firefox-esr | package    | 52.5.3-1.1   | i586   | Mozilla131
>vl | firefox-esr | package    | 45.8.0-1.3   | i586   | MozillaLegacy
>vl | firefox-esr | package    | 38.8.0-1.22  | i586   | MozillaLegacy
>vl | firefox-esr | package    | 31.8.0-1.30  | i586   | MozillaLegacy
>vl | firefox-esr | package    | 17.0.11-1.49 | i586   | MozillaLegacy
>vl | firefox-esr | package    | 52.5.3-1.1   | i586   | Mozilla
>
>Even better would show packages sorted first by version and skipping arch.
>
>Can any similar output be provided in Debian? If yes, is there a config option
>to make it default?

Try "apt-cache madison firefox-esr". It's also pretty simple to write a 
python script to tweak the exact output and parameters, something like:

import apt_pkg
import sys
import re

apt_pkg.init()
cache = apt_pkg.Cache()
for pkg in sorted(cache.packages):
    if re.search(sys.argv[1], pkg.name):
        for version in sorted(pkg.version_list):
            print("%s\t%s\t%s" % (pkg.name, pkg.architecture, version.ver_str))

Which would show something like:

> /scratch/pyaptvers.py 'firefox-esr$'
Reading package lists... Done
Building dependency tree       
Reading state information... Done
firefox-esr     amd64   52.5.0esr-1~deb9u1
firefox-esr     amd64   52.5.2esr-1~deb9u1

Mike Stone

Back to linux.debian.user | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

show searched packages including versions Felix Miata <mrmazda@earthlink.net> - 2018-01-03 21:30 +0100
  Re: show searched packages including versions bw <bwtnguy@yahoo.com> - 2018-01-03 22:00 +0100
    Re: show searched packages including versions Felix Miata <mrmazda@earthlink.net> - 2018-01-03 22:20 +0100
      Re: show searched packages including versions Greg Wooledge <wooledg@eeg.ccf.org> - 2018-01-03 22:30 +0100
        Re: show searched packages including versions Greg Wooledge <wooledg@eeg.ccf.org> - 2018-01-03 23:00 +0100
          Re: show searched packages including versions Felix Miata <mrmazda@earthlink.net> - 2018-01-04 00:10 +0100
        Re: show searched packages including versions Felix Miata <mrmazda@earthlink.net> - 2018-01-03 23:00 +0100
      Re: show searched packages including versions Roberto C. Sánchez <roberto@debian.org> - 2018-01-03 22:30 +0100
        Re: show searched packages including versions Roberto C. Sánchez <roberto@debian.org> - 2018-01-03 23:10 +0100
      Re: show searched packages including versions bw <bwtnguy@yahoo.com> - 2018-01-04 00:30 +0100
        Re: show searched packages including versions Felix Miata <mrmazda@earthlink.net> - 2018-01-04 01:20 +0100
          Re: show searched packages including versions bw <bwtnguy@yahoo.com> - 2018-01-04 01:40 +0100
            Re: show searched packages including versions David Wright <deblis@lionunicorn.co.uk> - 2018-01-04 02:20 +0100
              Re: show searched packages including versions Brian <ad44@cityscape.co.uk> - 2018-01-04 21:00 +0100
          Re: show searched packages including versions Michael Stone <mstone@debian.org> - 2018-01-04 04:30 +0100
  Re: show searched packages including versions Michael Stone <mstone@debian.org> - 2018-01-04 00:10 +0100

csiph-web