You are not logged in.

#1 2009-03-27 06:04:15

Registered: 2006-10-27
Posts: 50

pacreview 3, a script inspired by debfoster

Every once in a while, I like to uninstall all packages I don't need anymore, to reduce clutter and possibly reduce the incidence of problems.

I used to really like the debfoster tool from debian, so I made a similar (but simpler) tool for arch.
I posted an older version here:

My new version now also lists what packages an unrequired package is an optional dependency of.
Requires perl and perl-term-readkey.

Example use transcript:

Requires pacman 3.x and needs to be run as root.
Instantly removes packages.

Building reverse Optional Deps database...

Remove unrequired package acpi? [k,r,i,q,h=help]: keep

Remove unrequired package acpid? [k,r,i,q,h=help]: keep

Remove unrequired package alsa-utils? [k,r,i,q,h=help]: keep

Remove unrequired package aspell-en? [k,r,i,q,h=help]: keep

Remove unrequired package bc? [k,r,i,q,h=help]: keep

Remove unrequired package bcprov? [k,r,i,q,h=help]: keep

Remove unrequired package cellwriter? [k,r,i,q,h=help]: keep

Remove unrequired package cmus? [k,r,i,q,h=help]: keep

Remove unrequired package cpio? [k,r,i,q,h=help]: keep

crda is an optional dependency of: kernel26
Remove unrequired package crda? [k,r,i,q,h=help]: keep

Remove unrequired package cryptsetup? [k,r,i,q,h=help]:

It looks a bit better than that; package names are bold, and as soon as you hit the 'k' key it prints out "keep" and goes on to the next one...

Here's the code for it:


#2 2009-03-27 11:04:50

Forum Fellow
From: Boston, MA
Registered: 2008-02-24
Posts: 1,244

Re: pacreview 3, a script inspired by debfoster

Since you're parsing the output of a tool, you should probably set $ENV{LC_ALL} = 'en_US.utf8';
query_orph could use some love from the new given/when construct, IMO
You should "or die" on all the open() calls as well.
Instead of printing a warning that you need to be root, why not check if you are root, and if not, error out?

Other than that, it looks like a nice script

Last edited by Daenyth (2009-03-27 11:05:42)


#3 2009-03-27 20:38:14

Registered: 2006-10-27
Posts: 50

Re: pacreview 3, a script inspired by debfoster

Thanks for the tips.

Perl is kinda new for me. Also, I was unsure of elegant ways to handle exceptional conditions, and I sort of figured that you either have root and pacman or nothing happens anyways... I'll probably find time this weekend to increase its robustness with your tips and an idea or two of mine.

Oh and I just discovered your pacman scripts due to your sig, you've written some nice stuff.


#4 2009-07-05 21:59:10

Registered: 2009-01-03
Posts: 4

Re: pacreview 3, a script inspired by debfoster

I find the script quite elegant, but the point of debfoster was that it actually put the "kept" packages in a file and didn't question you again about it. You also could ingore packages, so they came up again next time.

EDIT: "the point" is not quite the correct word, a better word would be "smart thing". In german I would use "Clou".

Last edited by jojo4u (2009-07-05 22:01:11)


Board footer

Powered by FluxBB