show searched packages including versions

2018-01-03 Thread Felix Miata
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?
-- 
"Wisdom is supreme; therefore get wisdom. Whatever else you
get, get wisdom." Proverbs 4:7 (New Living Translation)

 Team OS/2 ** Reg. Linux User #211409 ** a11y rocks!

Felix Miata  ***  http://fm.no-ip.com/



Re: show searched packages including versions

2018-01-03 Thread Felix Miata
bw composed on 2018-01-03 15:50 (UTC-0500):

> On Wed, 3 Jan 2018, 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?

> I don't expect any newer version of mc to be available on stretch, ever.  
> You can see the current stable with apt show mc.  If I wanted to see 
> versions of it in all releases, including backports, testing and 
> unstable, I would go to https://packages.debian.org/mc this works for all 
> packages.  I would never use another version with stable, except 
> stable-backports.
  mc was bad example. Currently booted is Jessie. Installed kernels are 3.16 and
4.8. What command shows me the newest available linux-image version available
anywhere that's been configured in sources.list?
-- 
"Wisdom is supreme; therefore get wisdom. Whatever else you
get, get wisdom." Proverbs 4:7 (New Living Translation)

 Team OS/2 ** Reg. Linux User #211409 ** a11y rocks!

Felix Miata  ***  http://fm.no-ip.com/



Re: show searched packages including versions

2018-01-03 Thread Roberto C . Sánchez
On Wed, Jan 03, 2018 at 04:15:51PM -0500, Felix Miata wrote:
>   mc was bad example. Currently booted is Jessie. Installed kernels are 3.16 
> and
> 4.8. What command shows me the newest available linux-image version available
> anywhere that's been configured in sources.list?

Assuming you are on an amd64 system, then this:

apt-cache show linux-image-amd64

The package 'linux-image-amd64' is a meta package which always depend on
the latest available linux-image-* package for the architecture (in this
case, amd64).

If you are interested in knowing which repository in your sources.list
has that package available, then you want this:

apt-cache policy linux-image-amd64

Regards,

-Roberto

-- 
Roberto C. Sánchez



Re: show searched packages including versions

2018-01-03 Thread Greg Wooledge
On Wed, Jan 03, 2018 at 04:15:51PM -0500, Felix Miata wrote:
>   mc was bad example. Currently booted is Jessie. Installed kernels are 3.16 
> and
> 4.8. What command shows me the newest available linux-image version available
> anywhere that's been configured in sources.list?

For starters, I strongly recommend you stop treating Debian like Ubuntu.
You're not *supposed* to have a billion package repositories.

That said, you may be looking for "apt-cache policy".



Re: show searched packages including versions

2018-01-03 Thread Felix Miata
Greg Wooledge composed on 2018-01-03 16:26 (UTC-0500):

> On Wed, Jan 03, 2018 at 04:15:51PM -0500, Felix Miata wrote:

>>   mc was bad example. Currently booted is Jessie. Installed kernels are 3.16 
>> and
>> 4.8. What command shows me the newest available linux-image version available
>> anywhere that's been configured in sources.list?

> For starters, I strongly recommend you stop treating Debian like Ubuntu.
> You're not *supposed* to have a billion package repositories. 
>

I don't do anything "like Buntu" intentionally on account of it. In fact:

$ grep ntu /etc/hosts
0.0.0.0 askubuntu.com
0.0.0.0 ubuntu.com
0.0.0.0 ubuntu.org

I don't like having *buntu/Canonical-speak polluting my browser history. :-D

> That said, you may be looking for "apt-cache policy". 

"policy is meant to help debug issues relating to the preferences file. With no
arguments it will print out the priorities of each source. Otherwise it prints
out detailed information about the priority selection of the named package."

apt-cache policy linux-image and apt-cache showpkg produce output that in no way
resembles my OP request (searches substring from complete package name; one line
per available package, including its version, source repo optional).
-- 
"Wisdom is supreme; therefore get wisdom. Whatever else you
get, get wisdom." Proverbs 4:7 (New Living Translation)

 Team OS/2 ** Reg. Linux User #211409 ** a11y rocks!

Felix Miata  ***  http://fm.no-ip.com/



Re: show searched packages including versions

2018-01-03 Thread Greg Wooledge
On Wed, Jan 03, 2018 at 04:51:13PM -0500, Felix Miata wrote:
> apt-cache policy linux-image and apt-cache showpkg produce output that in no 
> way
> resembles my OP request (searches substring from complete package name; one 
> line
> per available package, including its version, source repo optional).

In that case, I recommend "The C Programming Language" by Kernighan
and Ritchie.



Re: show searched packages including versions

2018-01-03 Thread Roberto C . Sánchez
On Wed, Jan 03, 2018 at 04:23:06PM -0500, Roberto C. Sánchez wrote:
> On Wed, Jan 03, 2018 at 04:15:51PM -0500, Felix Miata wrote:
> >   mc was bad example. Currently booted is Jessie. Installed kernels are 
> > 3.16 and
> > 4.8. What command shows me the newest available linux-image version 
> > available
> > anywhere that's been configured in sources.list?
> 
> Assuming you are on an amd64 system, then this:
> 
> apt-cache show linux-image-amd64
> 
> The package 'linux-image-amd64' is a meta package which always depend on
> the latest available linux-image-* package for the architecture (in this
> case, amd64).
> 
> If you are interested in knowing which repository in your sources.list
> has that package available, then you want this:
> 
> apt-cache policy linux-image-amd64
> 
You might also have a look at these commands:

root@debian:~# wajig describe linux-image-amd64
Package  Description
-===
linux-image-amd64Linux for 64-bit PCs (meta-package)


root@debian:~# wajig statusmatch linux-image
Package Installed   PreviousNow State
===-===-===-===-=
linux-image-4.14.0-2-amd64  N/A N/A 4.14.7-1
linux-image-4.14.0-2-amd64-dbg  N/A N/A 4.14.7-1
linux-image-4.14.0-2-rt-amd64   N/A N/A 4.14.7-1
linux-image-4.14.0-2-rt-amd64-dbg   N/A N/A 4.14.7-1
linux-image-4.9.0-4-grsec-amd64 N/A N/A 
4.9.65-2+grsecunoff1
linux-image-amd64   N/A N/A 4.14+88
linux-image-amd64-dbg   N/A N/A 4.14+88
linux-image-grsec-amd64 N/A N/A 13
linux-image-rt-amd64N/A N/A 4.14+88
linux-image-rt-amd64-dbgN/A N/A 4.14+88


If you look at the second command, it contains a substring that wajig
uses to match from the list of available package names.

It would like be very simple to modify wajig to provide the additional
bits of information you want.  It is written in Python and the code is
clean and easy to ready.

Regards,

-Roberto

-- 
Roberto C. Sánchez



Re: show searched packages including versions

2018-01-03 Thread Felix Miata
Greg Wooledge composed on 2018-01-03 16:56 (UTC-0500):

> On Wed, Jan 03, 2018 at 04:51:13PM -0500, Felix Miata wrote:

>> apt-cache policy linux-image and apt-cache showpkg produce output that in no 
>> way
>> resembles my OP request (searches substring from complete package name; one 
>> line
>> per available package, including its version, source repo optional).

> In that case, I recommend "The C Programming Language" by Kernighan
> and Ritchie.  

Resembles != equals. I'm four decades past learning new languages.

In simple terms, I want a search to return complete package names, base package
name with version string appended. Anything more that fits on a single line is a
bonus. Anything that routinely makes individual results require more than ~80
characters is too verbose.

Another example:

$ grep RETT /etc/os-release
PRETTY_NAME="Mageia 6"
$ urpmq -y kernel-desk
kernel-desktop-4.9.35-1.mga6
kernel-desktop-4.9.40-1.mga6
kernel-desktop-4.9.43-1.mga6
kernel-desktop-4.9.50-1.mga6
kernel-desktop-4.9.56-1.mga6
kernel-desktop-devel-4.9.35-1.mga6
kernel-desktop-devel-4.9.40-1.mga6
kernel-desktop-devel-4.9.43-1.mga6
kernel-desktop-devel-4.9.50-1.mga6
kernel-desktop-devel-4.9.56-1.mga6
kernel-desktop-devel-latest
kernel-desktop-latest
vboxadditions-kernel-desktop-latest
virtualbox-kernel-desktop-latest
xtables-addons-kernel-desktop-latest
-- 
"Wisdom is supreme; therefore get wisdom. Whatever else you
get, get wisdom." Proverbs 4:7 (New Living Translation)

 Team OS/2 ** Reg. Linux User #211409 ** a11y rocks!

Felix Miata  ***  http://fm.no-ip.com/



Re: show searched packages including versions

2018-01-03 Thread Michael Stone

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



Re: show searched packages including versions

2018-01-03 Thread Felix Miata
bw composed on 2018-01-03 18:20 (UTC-0500):

> On Wed, 3 Jan 2018, Felix Miata wrote:

>> What command shows me the newest available linux-image version available
>> anywhere that's been configured in sources.list?

> Here's a quick try at answering your question.  I'm sure there are a 
> zillion ways to get the output arranged to your liking.  but really this 
> is what man pages are for.  Give it a try they don't bite.

>  apt-cache pkgnames linux-image

Thank you! Arrangement was a red herring.

> linux-image-4.9.0-4-rt-amd64
> linux-image-4.9.0-3-amd64
> ...

apt-cache provides all I really was looking for. More, as in the openSUSE repo
or installation status ouput in OP, would simply be gravy. It's obvious from the
thread responses received so far that I did a poor job describing what I want by
using the zypper output that I did.

Worse, I should have searched efoX-eSr, to make it clear one shouldn't need to
know a package's complete and exact basename including case. This, at least on
glance, rules out Michael Stone's apt-cache madison suggestion.

The problem is discovery. Apt isn't Apt, it's apt this, apt-that, apt-foo,
apt-bar, apt-baz, etc., even simply apt! What's the name of the doc that teaches
which apt variant has the power to please? How does anyone discover the logic
reaching a desired conclusion when the information desired (here: version) in
the one of the (multiple apt) dictionaries called man pages isn't even in it?
>From (Buster's) apt-cache:

pkgnames
This command prints the name of each package APT knows. The optional
argument is a prefix match to filter the name list. The output is
suitable for use in a shell tab complete function and the output is
generated extremely quickly. This command is best used with the
--generate option.

How did *you* figure out to try apt-cache _pkgnames_ to get a search to include
packages' versions?
-- 
"Wisdom is supreme; therefore get wisdom. Whatever else you
get, get wisdom." Proverbs 4:7 (New Living Translation)

 Team OS/2 ** Reg. Linux User #211409 ** a11y rocks!

Felix Miata  ***  http://fm.no-ip.com/



Re: show searched packages including versions

2018-01-03 Thread bw


On Wed, 3 Jan 2018, Felix Miata wrote:

> 
> How did *you* figure out to try apt-cache _pkgnames_ to get a search to 
> include
> packages' versions?

well, see that's the thing.  In debian, kernel packagenames include 
the arch and ver in them.  This wouldn't work for mc for instance or other 
packages.

The criticism about the different apt commands is a good one.  I think the 
idea is to merge some of them into just 'apt' but so far all we have is 
show and search, shortcuts for apt-cache.

here's a part of manpage for apt in stretch:

> list (work-in-progress)
>   list is somewhat similar to dpkg-query --list in that it can 
>   display a list of packages satisfying certain criteria. It 
>   supports glob(7) patterns for matching package names as well 
>   as options to list installed (--installed), upgradeable 
>   (--upgradeable) or all available (--all-versions) versions.
>
>   edit-sources (work-in-progress)
>   edit-sources lets you edit your sources.list(5) files in your 
>   preferred texteditor while also providing basic sanity checks.

I didn't think about using dpkg for your problem, but it's really amazing.



Re: show searched packages including versions

2018-01-03 Thread David Wright
On Wed 03 Jan 2018 at 19:33:28 (-0500), bw wrote:
> 
> 
> On Wed, 3 Jan 2018, Felix Miata wrote:
> 
> > 
> > How did *you* figure out to try apt-cache _pkgnames_ to get a search to 
> > include
> > packages' versions?
> 
> well, see that's the thing.  In debian, kernel packagenames include 
> the arch and ver in them.  This wouldn't work for mc for instance or other 
> packages.
> 
> The criticism about the different apt commands is a good one.  I think the 
> idea is to merge some of them into just 'apt' but so far all we have is 
> show and search, shortcuts for apt-cache.

s/merge/include/

The reason some of us continue to use apt-foo and would like
continued support for them is that they are stable in what
they do and what they output.

This is not meant as a criticism of apt/aptitude, but because
it's difficult to script a moving target.

Cheers,
David.



Re: show searched packages including versions

2018-01-03 Thread Michael Stone

On Wed, Jan 03, 2018 at 07:17:11PM -0500, Felix Miata wrote:

Worse, I should have searched efoX-eSr, to make it clear one shouldn't need to
know a package's complete and exact basename including case


That part's easy--the case is lower...


How did *you* figure out to try apt-cache _pkgnames_ to get a search to include
packages' versions?


Well, that command doesn't show the version, and it only does a prefix 
search, not a substring search. It has a very specific intended purpose, 
and this doesn't really seem like the right use case.


Mike Stone



Re: show searched packages including versions

2018-01-04 Thread Brian
On Wed 03 Jan 2018 at 19:10:03 -0600, David Wright wrote:

> On Wed 03 Jan 2018 at 19:33:28 (-0500), bw wrote:
> > 
> > 
> > On Wed, 3 Jan 2018, Felix Miata wrote:
> > 
> > > 
> > > How did *you* figure out to try apt-cache _pkgnames_ to get a search to 
> > > include
> > > packages' versions?
> > 
> > well, see that's the thing.  In debian, kernel packagenames include 
> > the arch and ver in them.  This wouldn't work for mc for instance or other 
> > packages.
> > 
> > The criticism about the different apt commands is a good one.  I think the 
> > idea is to merge some of them into just 'apt' but so far all we have is 
> > show and search, shortcuts for apt-cache.
> 
> s/merge/include/

apt also includes depends, rdepends and policy in its repertoire.

> The reason some of us continue to use apt-foo and would like
> continued support for them is that they are stable in what
> they do and what they output.

apt serves the needs of many users but it is very unlikely that support
for apt-foo would diminish.

> This is not meant as a criticism of apt/aptitude, but because
> it's difficult to script a moving target.

I've never used aptitude, but its searching abilities have been promoted
to be superior to apt-cache. Whether those capabilities could be rolled
into apt (or whether it is desirable to do so) I do not know.

-- 
Brian.