LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Debian (https://www.linuxquestions.org/questions/debian-26/)
-   -   list all mirrored packages by name and version (https://www.linuxquestions.org/questions/debian-26/list-all-mirrored-packages-by-name-and-version-4175736555/)

mrmazda 04-29-2024 11:15 PM

list all mirrored packages by name and version
 
Google appears to be incapable of providing an answer to this, apparently only able to show what's already been installed, or names absent package versions, or multi-page, multi-line complete package descriptions, while man pages like apt-cache seem to have masked any evidence such options exist. In openSUSE, the following produces desired results for a specific package named "kernel-default":
Code:

# zypper se -sx kernel-default | grep -v src
Loading repository data...
Reading installed packages...

S  | Name          | Type      | Version                | Arch  | Repository
---+----------------+------------+------------------------+--------+-----------
il | kernel-default | package    | 5.14.21-150500.55.52.1 | x86_64 | UpdateSLE
il | kernel-default | package    | 5.14.21-150500.55.49.1 | x86_64 | UpdateSLE
il | kernel-default | package    | 5.14.21-150500.55.44.1 | x86_64 | UpdateSLE
vl | kernel-default | package    | 5.14.21-150500.55.39.1 | x86_64 | UpdateSLE
vl | kernel-default | package    | 5.14.21-150500.55.36.1 | x86_64 | UpdateSLE
vl | kernel-default | package    | 5.14.21-150500.55.31.1 | x86_64 | UpdateSLE
vl | kernel-default | package    | 5.14.21-150500.55.28.1 | x86_64 | UpdateSLE
vl | kernel-default | package    | 5.14.21-150500.55.19.1 | x86_64 | UpdateSLE
vl | kernel-default | package    | 5.14.21-150500.55.12.1 | x86_64 | UpdateSLE
vl | kernel-default | package    | 5.14.21-150500.55.7.1  | x86_64 | UpdateSLE
il | kernel-default | package    | 5.14.21-150500.53.2    | x86_64 | OSS
vR | kernel-default | package    | 5.14.21-150500.55.22.1 | x86_64 | UpdateSLE
#

What apt* incantations are required or available in Debian to produce similar results for such software as firefox-esr, firmware or linux-image-amd64?

Note: se is zypper shorthand for search. I don't type all that in SUSE. I have it and more aliased to zypse (substring search) and zypsex (exact match).

pan64 04-29-2024 11:56 PM

if I understand well it is apt-cache policy (?)

lvm_ 05-01-2024 12:47 AM

apt-cache madison

Quote:

Originally Posted by mrmazda (Post 6498969)
Google appears to be incapable of providing an answer to this

I didn't believe it and I was right. https://www.google.co.uk/search?q=apt+show+versions - the very first link. And the second. And the third.

mrmazda 05-02-2024 12:00 AM

I knew about madison, but never found any way to get it to work for substrings, so that the exact package name doesn't need to be known ahead of time, or accurately typed:
Code:

# inxi -S
System:
  Host: p5bse Kernel: 6.6.15-amd64 arch: x86_64 bits: 64
  Console: pty pts/0 Distro: Debian GNU/Linux trixie/sid
# dpkg-query -W | grep linux-ima
linux-image-6.4.0-2-amd64      6.4.4-3
linux-image-6.5.0-1-amd64      6.5.3-1
linux-image-6.5.0-5-amd64      6.5.13-1
linux-image-6.6.15-amd64        6.6.15-2
linux-image-amd64      6.6.15-2
# apt-cache madison linux-ima
N: Unable to locate package linux-ima
#

In some in environments, aptitude is better than nothing:
Code:

# aptitude search linux-ima
i A linux-image-6.4.0-2-amd64        - Linux 6.4 for 64-bit PCs (signed)
i A linux-image-6.5.0-1-amd64        - Linux 6.5 for 64-bit PCs (signed)
i A linux-image-6.5.0-5-amd64        - Linux 6.5 for 64-bit PCs (signed)
i A linux-image-6.6.15-amd64        - Linux 6.6 for 64-bit PCs (signed)
p  linux-image-6.6.15-amd64-dbg    - Debug symbols for linux-image-6.6.15-amd64
p  linux-image-6.6.15-amd64-unsigne - Linux 6.6 for 64-bit PCs
p  linux-image-6.6.15-cloud-amd64  - Linux 6.6 for x86-64 cloud (signed)
p  linux-image-6.6.15-cloud-amd64-d - Debug symbols for linux-image-6.6.15-cloud
p  linux-image-6.6.15-cloud-amd64-u - Linux 6.6 for x86-64 cloud
p  linux-image-6.6.15-rt-amd64      - Linux 6.6 for 64-bit PCs (signed), PREEMPT
p  linux-image-6.6.15-rt-amd64-dbg  - Debug symbols for linux-image-6.6.15-rt-am
p  linux-image-6.6.15-rt-amd64-unsi - Linux 6.6 for 64-bit PCs, PREEMPT_RT
i  linux-image-amd64                - Linux for 64-bit PCs (meta-package)
p  linux-image-amd64-dbg            - Debugging symbols for Linux amd64 configur
p  linux-image-amd64-signed-templat - Template for signed linux-image packages f
p  linux-image-cloud-amd64          - Linux for x86-64 cloud (meta-package)
p  linux-image-cloud-amd64-dbg      - Debugging symbols for Linux cloud-amd64 co
v  linux-image-generic              -
p  linux-image-rt-amd64            - Linux for 64-bit PCs (meta-package)
p  linux-image-rt-amd64-dbg        - Debugging symbols for Linux rt-amd64 confi
#

In others, it's useless:
Code:

# inxi -S
System:
  Host: p5bse Kernel: 6.5.0-28-generic arch: x86_64 bits: 64
  Console: pty pts/0 Distro: Ubuntu 22.04.4 LTS (Jammy Jellyfish)
# aptitude search initramfs-too
i  initramfs-tools                  - generic modular initramfs generator (autom
i  initramfs-tools-bin              - binaries used by initramfs-tools
p  initramfs-tools-bin-dbgsym      - debug symbols for initramfs-tools-bin
i A initramfs-tools-core            - generic modular initramfs generator (core
p  initramfs-tools-devices          - Common initramfs scripts for Ubuntu Core a
v  linux-initramfs-tool            -
p  live-boot-initramfs-tools        - Live System Boot Components (initramfs-too
p  tpm2-initramfs-tool              - Tool used in initramfs to seal/unseal FDE
p  tpm2-initramfs-tool-dbgsym      - debug symbols for tpm2-initramfs-tool
#


lvm_ 05-02-2024 12:44 AM

apt-cache search accepts regexes

boughtonp 05-02-2024 08:55 AM

Quote:

Originally Posted by mrmazda (Post 6499406)
# dpkg-query -W | grep linux-ima

No need for grep: "dpkg-query -W linux-ima\*"

Using --list (-l) option instead of --show (-W) gives tabular output like in your first post, however with --show one can use --showformat (-f) to change the fields and delimiters used.


mrmazda 05-05-2024 12:34 AM

Quote:

Originally Posted by lvm_ (Post 6499413)
apt-cache search accepts regexes

What syntax reports all versions available on the mirrors? I have no problem seeing what version is installed. The question is what are available, especially when more than one version is available?
Code:

# apt-cache search linux* | wc -l
5772
#apt-cache search linux | wc -l
5768
#

Obviously that many hits can't be what someone wanting a list of kernels can be wanting.
Code:

# apt-cache madison linux*
N: Unable to locate package linux*
# apt-cache madison linux
N: Unable to locate package linux
# apt-cache madison linux-image
# apt-cache madison linux-image-generic
linux-image-generic | 6.8.0-31.31 | http://us.archive.ubuntu.com/ubuntu noble/main amd64 Packages
#

Quote:

Originally Posted by boughtonp (Post 6499474)
Using --list (-l) option instead of --show (-W) gives tabular output like in your first post, however with --show one can use --showformat (-f) to change the fields and delimiters used.

I don't understand how this can help? I'm not looking for any help identifying installed packages, only packages that may be available. Are you suggesting dpkg-query can list both uninstalled and installed packages complete with versions?
Code:

# dpkg-query --show linux-image
linux-image
# dpkg-query --show *esr*
firefox-esr
# dpkg-query --show linux-image*
linux-image
linux-image-6.6.0-14-generic    6.6.0-14.14
linux-image-6.8.0-11-generic    6.8.0-11.11
linux-image-6.8.0-31-generic    6.8.0-31.31
linux-image-generic    6.8.0-31.31
linux-image-unsigned-6.6.0-14-generic
linux-image-unsigned-6.8.0-11-generic
linux-image-unsigned-6.8.0-31-generic
#

The only versions in the output above is for installed packages.

pan64 05-05-2024 03:04 AM

what about apt policy linux-image* (or similar?)

lvm_ 05-05-2024 05:01 AM

Quote:

Originally Posted by mrmazda (Post 6499914)
What syntax reports all versions available on the mirrors?

apt-cache madison. Going in circles, aren't we? Or does combining the two pose an insurmountable task for you?

Quote:

Originally Posted by mrmazda (Post 6499914)
I have no problem seeing what version is installed. The question is what are available, especially when more than one version is available?
Code:

# apt-cache search linux* | wc -l
5772
#apt-cache search linux | wc -l
5768
#

Obviously that many hits can't be what someone wanting a list of kernels can be wanting.

Why don't you stop trying commands at random and read the man page? Hint: it's regex, not a glob pattern, and there are options...

mrmazda 05-05-2024 11:01 PM

Quote:

Originally Posted by lvm_ (Post 6499926)
Why don't you stop trying commands at random and read the man page?

That begs the underlying question in Debian and derivatives: which man page, aka which package management binary, is relevant to the desired goal?
Code:

# ls -lgG /usr/bin/apt* /usr/sbin/dpkg* /usr/bin/dpkg*
-rwxr-xr-x 1  18752 Apr 22 13:36 /usr/bin/apt
-rwxr-xr-x 1  96648 Apr 22 13:36 /usr/bin/apt-cache
-rwxr-xr-x 1  22920 Apr 22 13:36 /usr/bin/apt-cdrom
-rwxr-xr-x 1  26944 Apr 22 13:36 /usr/bin/apt-config
-rwxr-xr-x 1  22928 Apr 22 13:36 /usr/bin/apt-extracttemplates
-rwxr-xr-x 1  289168 Apr 22 13:36 /usr/bin/apt-ftparchive
-rwxr-xr-x 1  51592 Apr 22 13:36 /usr/bin/apt-get
lrwxrwxrwx 1      26 Jun 24  2018 /usr/bin/aptitude -> /etc/alternatives/aptitude
-rwxr-xr-x 1    542 Mar 23 05:38 /usr/bin/aptitude-changelog-parser
-rwxr-xr-x 1    1939 Mar 23 05:38 /usr/bin/aptitude-create-state-bundle
-rwxr-xr-x 1 4462792 Mar 23 05:38 /usr/bin/aptitude-curses
-rwxr-xr-x 1    2850 Mar 23 05:38 /usr/bin/aptitude-run-state-bundle
-rwxr-xr-x 1  28463 Apr 22 13:36 /usr/bin/apt-key
-rwxr-xr-x 1  12242 Sep 10  2023 /usr/bin/apt-listchanges
-rwxr-xr-x 1  67976 Apr 22 13:36 /usr/bin/apt-mark
-rwxr-xr-x 1  51528 Apr 22 13:36 /usr/bin/apt-sortpkgs
-rwxr-xr-x 1  318096 Mar 10 15:21 /usr/bin/dpkg
-rwxr-xr-x 1  174624 Mar 10 15:21 /usr/bin/dpkg-deb
-rwxr-xr-x 1  158264 Mar 10 15:21 /usr/bin/dpkg-divert
-rwxr-xr-x 1  21205 Mar 10 15:21 /usr/bin/dpkg-maintscript-helper
-rwxr-xr-x 1  166480 Mar 10 15:21 /usr/bin/dpkg-query
-rwxr-xr-x 1    4185 Mar 10 15:21 /usr/bin/dpkg-realpath
-rwxr-xr-x 1  129520 Mar 10 15:21 /usr/bin/dpkg-split
-rwxr-xr-x 1  67920 Mar 10 15:21 /usr/bin/dpkg-statoverride
-rwxr-xr-x 1  88560 Mar 10 15:21 /usr/bin/dpkg-trigger
-rwxr-xr-x 1    4356 Feb 13 04:35 /usr/sbin/dpkg-preconfigure
-rwxr-xr-x 1    4536 Feb 13 04:35 /usr/sbin/dpkg-reconfigure
#

A man page is required for choosing the appropriate man page.

I've tried man apt-cache multiple times. If the answer I need is in it, its well disguised, which leads back to the underlying question, is apt-cache appropriate to task, and if not, which binary is, or, does one even exist?

pan64 05-06-2024 01:28 AM

did you try apt policy already? without cache

mrmazda 05-06-2024 04:19 AM

Quote:

Originally Posted by pan64 (Post 6500084)
did you try apt policy already? without cache

No man page found to describe how to make it suited to task.
Code:

# apt policy fileco*
filecommander:
  Installed: 2.50.vgit-1847-buster1
  Candidate: 2.50.vgit-1847-buster1
  Version table:
 *** 2.50.vgit-1847-buster1 500
        500 http://silk.apana.org.au/debian buster/unstable-dev amd64 Packages
        100 /var/lib/dpkg/status
#

Build 1847 is the newest on the mirrors, but the mirrors have too many to count of 2.50 builds going back over two years.
Code:

# apt policy llvm
llvm:
  Installed: (none)
  Candidate: 1:14.0-55.7~deb12u1
  Version table:
    1:14.0-55.7~deb12u1 500
        500 http://ftp.debian.org/debian bookworm/main amd64 Packages
# aptitude search llvm | wc -l
56
# dpkg-query -W | grep llvm
libllvm15:amd64 1:15.0.6-4+b1
# apt policy llvm | grep date:
  Candidate: 1:14.0-55.7~deb12u1
#

:confused:

pan64 05-06-2024 04:28 AM

Quote:

Originally Posted by mrmazda (Post 6500104)
Build 1847 is the newest on the mirrors, but the mirrors have too many to count of 2.50 builds going back over two years.

1847 is the only one which is available right now (using the currently specified repos).

boughtonp 05-06-2024 08:16 AM


 
You seem to be jumping all over the place. Do you have a real problem to solve, or are you simply Apt bashing?


If all you're trying to do is say "look at how Apt sucks" then, yes, it sucks in a lot of ways. (So does every package manager I've used.)

If you can explain what you want in terms of other package managers, then Arch maintain a package management rosetta stone that may help.

If you want to know which versions of packages are available online, //tracker.debian.org/pkg/PACKAGE-NAME gives you that - e.g. //tracker.debian.org/pkg/firefox-esr or //tracker.debian.org/pkg/linux-image-amd64 - yes knowing the package name first is still required.

I doubt a complete version list is obtainable through Apt because there's no reason for Debian Stable to care about (e.g.) v6.7.12+1 of linux-signed-amd64 because that version will never be in the Stable repositories.

However, once you know a package what you can do is read the download location (through apt info or the first icon in the "versioned links" section of the tracker page) and then browse to the relevant directory in the shared pool, i.e: //deb.debian.org/debian/pool/main/f/firefox-esr/ which for Firefox contains a lot of crap, but can be filtered on the .dsc files to see which versions are there.

For non-Debian repositories if they have followed Debian's lead with browsable directories then you can do the same. If they block it, as Brian Havard's repo appears to, then it doesn't help - but then how would any potential Apt command get at that information, if the repo owner has blocked it...?


mrmazda 05-06-2024 04:00 PM

Quote:

Originally Posted by boughtonp (Post 6500125)
Do you have a real problem to solve, or are you simply Apt bashing?

Surely as long as Debian has existed there must by now be some simple enough formula to generate a packages list similar in content to that of zypper in comment #1:
Quote:

# zypper se -sx kernel-default | grep -v src
  1. zypper: wrapper command in openSUSE and SLE which is to rpm as in Fedora DNF or YUM is to rpm, or in Debian apt or apt-* or aptitude is to dpkg
  2. se: short form of search (query) command; Search for packages matching any of the given search strings. * and ? wildcard characters can be used within search strings. If the search string is enclosed in / (e.g. /^k.*e$/) it’s interpreted as a regular expression.
  3. -s: aka --details; Show all available versions of matching packages, each version in each repository on a separate line.
  4. (-)x: aka --match-exact; Searches for an exact name of the package.
  5. kernel-default: string to search for
  6. | grep -v src: exclude source packages
I routinely use zypper se through one of the following:
Code:

> cat /usr/local/bin/zypse
#!/bin/bash
zypper --no-refresh se -s $*  | grep -Ev '32bit|debug|devel|srcp|openSUSE-20' | grep -E 'x86|noarch'| sort
>

or
Code:

> cat /usr/local/bin/zypsei # -i option: is installed
#!/bin/bash
zypper --no-refresh se -s -i $*  | grep -Ev 'debug|devel|srcp|openSUSE-20' | grep -E 'x86|noarch'| sort
>

If I wish to know something about a group of installed packages related to audio configuration:
Code:

> zypsei gstr puls pipew wirep alsa
i  | alsa                    | package | 1.2.8-150500.1.1    | x86_64 | OSS
i  | alsa-ucm-conf            | package | 1.2.8-150500.1.1    | noarch | OSS
i  | alsa-utils              | package | 1.2.8-150500.1.2    | x86_64 | OSS
i  | libpipewire-0_3-0        | package | 0.3.64-150500.3.5.2 | x86_64 | UpdateSLE
i  | libpulse0                | package | 15.0-150400.4.4.1  | x86_64 | UpdateSLE
i  | libwireplumber-0_4-0    | package | 0.4.13-150500.3.2.1 | x86_64 | UpdateSLE
i  | pipewire                | package | 0.3.64-150500.3.5.2 | x86_64 | UpdateSLE
i  | pipewire-modules-0_3    | package | 0.3.64-150500.3.5.2 | x86_64 | UpdateSLE
i  | pipewire-spa-plugins-0_2 | package | 0.3.64-150500.3.5.2 | x86_64 | UpdateSLE
i  | pipewire-spa-tools      | package | 0.3.64-150500.3.5.2 | x86_64 | UpdateSLE
i  | pipewire-tools          | package | 0.3.64-150500.3.5.2 | x86_64 | UpdateSLE
i  | wireplumber              | package | 0.4.13-150500.3.2.1 | x86_64 | UpdateSLE
i+ | alsa-firmware            | package | 1.2.4-1.41          | noarch | OSS
i+ | alsa-oss                | package | 1.1.8-150300.12.3.2 | x86_64 | OSS
i+ | apulse                  | package | 0.1.13-bp155.2.12  | x86_64 | OSS
i+ | pipewire-alsa            | package | 0.3.64-150500.3.5.2 | x86_64 | UpdateSLE
i+ | wireplumber-audio        | package | 0.4.13-150500.3.2.1 | noarch | UpdateSLE
#

If I wish to see what's available to try to revert to:
Code:

> zypse ire-too
i | pipewire-tools | package | 0.3.64-150500.3.5.2 | x86_64 | UpdateSLE
v | pipewire-tools | package | 0.3.64-150500.1.2  | x86_64 | OSS
v | pipewire-tools | package | 0.3.64-150500.3.3.1 | x86_64 | UpdateSLE
#

In my Debians, I have in .bashrc:
Code:

alias Dq='echo dpkg-query -l ; dpkg-query -l | sort | grep ' # output includes version
alias Ds='echo apt-cache search | apt-cache search ' # no version(s) shown :(

What I'm looking for apparently is/are Debian equivalent(s) to zypper's -s option for searches. By implication, only one output line permitted per listed package, which rules out apt-cache policy.


All times are GMT -5. The time now is 05:25 AM.