[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Suggestion for change to debian package format

On Mon, Mar 29, 1999 at 01:09:20PM +0100, BENJAMIN FARRELL wrote:
> I assume that most of the dependences are going to be librarys, mybe it
> could be possible to have dpkg purge out any librarys that don't have
> anything depending on them. (or mybe some debian person could come up with
> some cmd line option for dpkg to do this :).

Doing it automatically is dangerous -- you might be writing your own
programs that use some particular library, that isn't used by any .deb's
you happen to have installed. So it's probably better just to get a list
of probably deletable packages and let a human who presumably knows what
s/he's doing actually do the listing.

So, in the spirit of generosity, and because I like really weird shell
one liners:

	dpkg --get-selections | grep lib | grep -v -- "-dev" |
		sed -n 's/[[:space:]]*install$//p' | 
		while read pkg; do 
			X=`apt-cache showpkg $pkg | 
			awk '/^Reverse Depends:/ {RD=1} /^Dependencies:/ {RD=0} /.*/ {if(RD)X++} END {print X}'`; 
			if [ "$X" = "1" ]; then echo $pkg; fi; 

You need to have Apt installed for this to work, and quite possibly a
fairly recent version of it. I was using 0.3.3.

This will tell you how many packages with `lib' in the name (but not -dev)
aren't depended on by anything else. You can get rid of the grep's on the
first line to look for all packages that aren't depended on by anything
else, if you're in the mood.


Anthony Towns <aj@humbug.org.au> <http://azure.humbug.org.au/~aj/>
I don't speak for anyone save myself. PGP encrypted mail preferred.

``Like the ski resort of girls looking for husbands and husbands looking
  for girls, the situation is not as symmetrical as it might seem.''

Attachment: pgpnuI1gdKNb0.pgp
Description: PGP signature

Reply to: