You are not logged in.

#1 2012-08-23 23:57:08

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 7,132

list installed packages dropped from repositories?

I was sure that I had seen a simple command for this but either I'm wrong or I'm unable to track it down deliberately: is there a simple way to identify all packages installed on the system which were originally installed from official repositories but are no longer available from them?

I ask because it is not always obvious when a package has been officially superseded by another (or just dropped completely). I just realised, for example, that cpufrequtils is no longer available. I had planned to switch to cpupower when cpufrequtils was dropped but now realise I had no way of knowing when that was.

I can think of ways of doing this via a script e.g. get a list of all packages; remove locally installed ones from the list (which won't include the deprecated ones?); check for each whether pacman -Ss can find it and delete from the list if so; etc. But that seems like a quite complicated way of doing it. I thought I'd seen something on the pacman wiki page but now I look, I can't see anything relevant.

A pointer would be much appreciated.


CLI Paste | How To Ask Questions

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L

Offline

#2 2012-08-24 00:19:28

mcmillan
Member
Registered: 2006-04-06
Posts: 737

Re: list installed packages dropped from repositories?

take a look at the -Qm switch, you'll need to filter out things that are installed from the AUR or otherwise built yourself, but would at least be a start.

Offline

#3 2012-08-24 00:50:56

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,533
Website

Re: list installed packages dropped from repositories?

I have this feature as a byproduct of the update check I added to my aur script.  I haven't pushed this update to github yet and it's only on my work computer, so I'll do that tomorrow morning.

The relevant part is only a couple lines though that loops through the output of pacman -Qqm and checks the aur for each one.  My script does some formatting and makes a nice display of the version currently installed, and the latest version in the AUR highlighting anything out of date.  But recently I noticed gub showed up on the list (as it was dropped from the repos) but since there is no aur entry for the same package, it only lists a local version number and not aur version.

The following should work as a template:

for pkg in `pacman -Qqm`; do
	wget https://aur.archlinux.org/packages/${pkg:0:2}/$pkg/$pkg.tar.gz >/dev/null 2>&1
	[[ $? != 0 ]] && echo "$pkg has been dropped from repos or locally installed"
	[[ -f $pkg.tar.gz ]] && rm "$pkg.tar.gz"
done

I suspect there'd be an easier way of checking whether a webpage exits than trying to download it and checking if there was an error.  But this work.

Last edited by Trilby (2012-08-24 00:56:56)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#4 2012-08-24 01:01:36

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 7,132

Re: list installed packages dropped from repositories?

Thanks, Trilby. it's nice to have confirmation dropped packages would show up with -Qm - I wasn't certain of that but suspected it must be the case.

I suppose if there's no more elegant way, I could either use aurget to check for stuff in AUR or check my package directory for AUR builds. The latter would have the advantage of catching stuff which has been moved to AUR but the disadvantage of not catching stuff if I screw up and lose package files... Though your code will probably be better when you get it to work.

I kind of expected somebody to immediately respond with, "What do you think the -XYZ option of pacman is for?" with "idiot!" in parentheses but perhaps I was overly optimistic smile.

Technically, I suppose I could track stuff which disappears from my backup of official packages but appears in my backup of unofficial packages... hmm...

And I was convinced there must be a simple solution...

Last edited by cfr (2012-08-24 01:03:10)


CLI Paste | How To Ask Questions

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L

Offline

Board footer

Powered by FluxBB