Gmane
From: Evan Powers <powers.161 <at> osu.edu>
Subject: Re: Cruft detecting script
Newsgroups: gmane.linux.gentoo.devel
Date: 2003-03-03 23:06:45 GMT (5 years, 24 weeks, 2 days, 3 hours and 28 minutes ago)
On Sunday 02 March 2003 11:44 am, Andy Arbon wrote:
> Has anyone written something like this, and does anyone have any reason
> why something like this wouldn't work or be useful?

I was bored so I quickly hacked this together, just to see how it would do.

time sh script-cruft.sh
...lots of output....
real    0m48.147s
user    0m33.010s
sys     0m3.810s

My first attempt was more like "real 125m48.147s", but I just wasn't very 
intelligent about that. This version actually exploits sed's capabilities. A 
15577% increase in performance for a few minutes of work isn't too shabby, if 
I may say so myself. ;-)

The script produced far more output than I would have naively expected, about 
4300 lines. There might be too much noise for the tool to be useful. On the 
other hand....

It did catch some things that surprised me. On my system there are lots of 
libraries and perl related files that aren't known to portage (though they 
correspond to software I've installed via an ebuild). For example, on my 
system there are several programs in /usr/bin which portage doesn't know 
about.

/usr/bin/amstex -> tex
/usr/bin/cont-cz -> pdfetex
/usr/bin/cont-de -> pdfetex
/usr/bin/cont-en -> pdfetex
/usr/bin/cont-nl -> pdfetex
/usr/bin/cont-uk -> pdfetex
/usr/bin/cpp
/usr/bin/cpp.orig
/usr/bin/elatex -> etex
/usr/bin/eplain -> tex
/usr/bin/frlatex -> tex
/usr/bin/lambda -> omega
/usr/bin/latex -> tex
/usr/bin/pdfelatex -> pdfetex
/usr/bin/pdflatex -> pdftex
/usr/bin/rec -> /usr/bin/play

Makes me think the app-text/tetex-1.0.7-r11 ebuild was broken; don't know if 
the current stable 1.0.7-r12 does the same thing, I'll have to look into 
that. The /usr/bin/cpp looks like a script related to sys-devel/gcc-config, 
you'd think portage would know about this too.

---script-cruft.sh---
#!/bin/sh

find / '(' -path /proc \
	-or -path /dev \
	-or -path /boot \
	-or -path /mnt \
	-or -path /tmp \
	-or -path /var/tmp \
	-or -path /root \
	-or -path /home \
	-or -path /lib/dev-state \
	-or -path /lib/modules \
	-or -path /usr/portage \
	-or -path /var/cache/edb \
	-or -path /var/db/pkg \
	')' -prune -or -print \
| sort >/tmp/allfiles

qpkg -nc -l \
| sed -n -e 's/ -> .*//' -e '1,2 d' -e '/^$/,+2! p' \
| sort \
| uniq >/tmp/portagefiles

comm -2 -3 /tmp/allfiles /tmp/portagefiles
---script-cruft.sh---

--
gentoo-dev <at> gentoo.org mailing list