How to tell which repositories provide which packages?
Little Girl
littlergirl at gmail.com
Thu Jan 7 20:54:40 UTC 2021
Hey there,
Ralf Mardorf via ubuntu-users wrote:
>Little Girl wrote:
>>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".
Yeah, I went back and forth about it:
This one is definitely more visually appealing because it has a sense
of balance and you can instantly tell exactly what it's looking for:
| grep -v "Installed: (none)" -| grep -i "Installed: " -B1
This one is shorter and more succinct, but isn't as visually
appealing and also requires a moment of analysis to figure out what
it's looking for:
| grep -v "(none)" -| grep -i "Installed: " -B1
I like the second one for its brevity to counteract my often
ridiculously long code, so cutting it short won out in the end over
here.
>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.
Oh, that's a shame. Is there a way to get uniques without sorting? So
far, sorting is the only way I know of to get them.
>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.
I see that. It would definitely be useful when needing to be that
specific, so I added it to my cheat sheet. Thanks.
--
Little Girl
There is no spoon.
More information about the ubuntu-users
mailing list