Gentoo Archives: gentoo-dev

From: Daniel Pielmeier <billie@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] [RFC][NEW] Utility to find orphaned files
Date: Sun, 25 Apr 2010 13:43:42
In Reply to: [gentoo-dev] [RFC][NEW] Utility to find orphaned files by Angelo Arrifano
1 Angelo Arrifano schrieb am 25.04.2010 13:18:
2 > Hello developers developers and developers,
3 >
4 > Ever wondered how much crap is left in your X-years old Gentoo box?
5 >
6 > I just developed a python utility to efficiently find orphaned files in
7 > the system. By orphaned files I mean the files that are present on
8 > system directories and don't belong to any installed package.
9 >
10 > The package builds a virtual filesystem (cache) on the RAM using python
11 > hash tables. Then it uses the cache to find the ownership of files
12 > inside user-specified dirs.
13 >
14 > Building the cache takes less than 10 seconds here in a system with 1366
15 > installed packages.
16 >
17 > This is not intended to be a finished program yet, I'm looking forward
18 > for your constructive commentaries.
20 What about searching the complete file system but using an exclude file where
21 you can put directories and files which should not be searched. It is tedious to
22 tell every path on the command-line. Also for instance if you specify /lib it
23 will also search under /lib/modules and I am sure you do not consider all
24 contents there as unneeded.
26 You also need to consider that your tool will return other false positives like
27 byte compiled python modules and perl header files. In general everything an
28 ebuild does in phases where it adds files to file-system but files are not
29 stored to CONTENTS (pkg_{pre,post}inst). At this point the files are needed but
30 not recognized by the package manager. If the ebuild does not take care of this
31 files when removing (pkg_{pre,post}rm) the package they will remain on the
32 file-system and are now unneeded.
34 I have written something in perl which I recently tried to implement in python
35 (not the same functionality like the perl version yet). I am not a good perl or
36 python programmer but it fits my needs especially the perl version as I know a
37 bit more perl than python.
39 I attach both versions and a sample exclude file. Maybe it will be of help.
41 --
42 Daniel Pielmeier


File name MIME type
cruft.tar.bz2 application/x-bzip2
signature.asc application/pgp-signature


Subject Author
Re: [gentoo-dev] [RFC][NEW] Utility to find orphaned files Enrico Weigelt <weigelt@×××××.de>