How to tell which repositories provide which packages?
Ralf Mardorf
kde.lists at yahoo.com
Thu Jan 7 07:49:40 UTC 2021
On Wed, 6 Jan 2021 23:07:09 -0500, Little Girl wrote:
>Hey there,
>
>Ralf Mardorf via ubuntu-users wrote:
>
>>PS: The assumption of "0" for packages without an epoch describes the
>>sort order of the package management. But if we use the grep command
>>to recognize, to distinguish, if the package version is "(none)" or
>>an existing package, with real versioning, without using grep's
>>inverted match option, the "0" is just imaginary, it doesn't exist
>>for grep.
>
>True. Also, since it's commonly not specified in version numbers, it
>wouldn't be a very us:eful way of filtering the results.
>
>>The inverted match seems to be the best thing to do, since "(" is
>>definitively no valid versioning char. To keep the script human
>>readable it makes sense to use "(none)" instead of "(" only.
>
>That makes sense, and also gives the user a better idea of what's
>being matched and why. I also kind of prefer to use just "(none)"
>rather than "Installed: (none)" since it's shorter on some of those
>horrendously long commands.
I agree, there's no discription or anything else"apt-cache
policy" returns, that could include "(none)". It's at least unlikely
that the PPA does include "(none)",
"500 http://ppa.launchpad.net/(none)/foo/ubuntu xenial/main amd64 Packages".
There's still a minor pitfall. A false positive, if the repository
provides the same package name/s for 64 as well as 32 bit architecture.
We can not ignore the architecture and do an unique sort, if we want
correct output.
[weremouse at moonstudio ~]$ ls -l /var/lib/apt/lists/*obsproject*_Packages
-rw-r--r-- 1 root root 1645 Apr 27 2020 /var/lib/apt/lists/ppa.launchpad.net_obsproject_obs-studio_ubuntu_dists_xenial_main_binary-amd64_Packages
-rw-r--r-- 1 root root 1643 Apr 27 2020 /var/lib/apt/lists/ppa.launchpad.net_obsproject_obs-studio_ubuntu_dists_xenial_main_binary-i386_Packages
[weremouse at moonstudio ~]$ apt-cache policy obs-studio
obs-studio:
Installed: 25.0.8-0obsproject1~xenial
Candidate: 25.0.8-0obsproject1~xenial
Version table:
*** 25.0.8-0obsproject1~xenial 500
500 http://ppa.launchpad.net/obsproject/obs-studio/ubuntu xenial/main amd64 Packages
100 /var/lib/dpkg/status
[weremouse at moonstudio ~]$ apt-cache policy $(awk '$1 == "Package:" { print $2 }' /var/lib/apt/lists/*obsproject*amd64_Packages)|grep -v "(none)"|grep "Installed: " -B1
obs-studio:
Installed: 25.0.8-0obsproject1~xenial
[weremouse at moonstudio ~]$ apt-cache policy $(awk '$1 == "Package:" { print $2 }' /var/lib/apt/lists/*obsproject*i386_Packages)|grep -v "(none)"|grep "Installed: " -B1
obs-studio:
Installed: 25.0.8-0obsproject1~xenial
[weremouse at moonstudio ~]$ apt-cache policy $(awk '$1 == "Package:" { print $2 }' /var/lib/apt/lists/*obsproject*Packages)|grep -v "(none)"|grep "Installed: " -B1
obs-studio:
Installed: 25.0.8-0obsproject1~xenial
--
obs-studio:
Installed: 25.0.8-0obsproject1~xenial
[weremouse at moonstudio ~]$ apt-cache policy $(awk '$1 == "Package:" { print $2 }' /var/lib/apt/lists/*obsproject*Packages)|grep -v "(none)"|grep "Installed: " -B1|sort -u
--
Installed: 25.0.8-0obsproject1~xenial
obs-studio:
A workaround:
[weremouse at moonstudio ~]$ apt-cache policy $(awk '$1 == "Package:" { print $2 }' /var/lib/apt/lists/*obsproject*i386_Packages)|grep -v "(none)"|grep "Installed: " -B1 -A4
obs-studio:
Installed: 25.0.8-0obsproject1~xenial
Candidate: 25.0.8-0obsproject1~xenial
Version table:
*** 25.0.8-0obsproject1~xenial 500
500 http://ppa.launchpad.net/obsproject/obs-studio/ubuntu xenial/main amd64 Packages
It does check *i386_Packages of the PPA, but the output shows
"xenial/main amd64 Packages", so the user needs to verify it, by using
grep with the "-A" option.
More information about the ubuntu-users
mailing list