I wrote a little tool to help track which package owns each file in a gentoo system. I'm calling it pdb for now, for lack of a better name. It is currently only in the gentoo-src CVS tree. The heart of the tool is a python module gentoo-src/portage/pym/portagedb.py I guess this needs to be copied somewhere that python can find it in order to use it. There are two front-ends, both in gentoo-src/portage/bin, named 'pdb' and 'pdb.cgi'. The first is a command-line tool, described below. The second is a CGI (surprise!) that provides the same functionality as the command-line tool, but through a web interface. Each of these front-ends has a small config section at the top that you will probably want to modify before using. To start using pdb locally, you must first store the packages you want to be able to look up: $ pdb --local --store foo/bar-1.2.3 This uses the CONTENTS file in the specified /var/db/pkg dir to populate the local database. To store all your packages, you could: $ cd /var/db/pkg; pdb -l -s */* To look up a file, use the --query command. For now, you may only give one query at a time, and it must be the full path a file. Multiple queries, wildcards, and other features may be added later if it seems worth it at that point. $ pdb --local --query /usr/lib/libnsl.a sys-libs/glibc-2.2.4-r1 obj /usr/lib/libnsl.a B0C142667130D58EC72530CDB9FFBAD3 999228261 As you can see, this simply returns which package the file belongs to, and the related CONTENTS line. Where this really gets fun is if we set up a central server running the CGI version. Not only can this be accessed through a web browser, but also through the command-line tool. If you leave off the '--local' or '-l' switches in any of the above examples, the local tool will try to connect to the server listed in it's config lines, instead of working with a local database. This would allow you to query for files that you have not yet installed For example, if you are trying to make an ebuild and the ./configure script whines about not being able to find 'libfoobar.so', just do: $ pdb -q /usr/lib/libfoobar.so ...and if anyone has stored that package to the server, you should get back the name of the package you need to install. --Chouser http://lists.gentoo.org/pipermail/gentoo-dev/2001-September/006980.html
doesnt qpkg already do this ? (part of gentoolkit) i dont think it stores hashes, but it maps packages onto files and files onto packages
If we provided an up-to-date manifest for all packages online somewhere, it could consult that db if the local one doesn't have any matches. If so, a long-standing nuisance with qpkg would be solved. I guess it'll take a while before I'm going to address this one
If this is still relevant, please can you add another bug with an ebuild for pdb? It should be part of the app-portage group.