I've just added a new feature to the xbps-bin(8) command which helps
to find which package owns a file; say that you want to know which
package is handling the /bin/mount command, so you'll see something
like this:
$ xbps-bin find-files /bin/mount
util-linux-ng: /bin/mount (regular file)
$
You can also specify shell patterns like this:
$ xbps-bin find-files "/usr/lib/libm[ae]*"
ncursesw-devel: /usr/lib/libmenuw.a (regular file)
libmad: /usr/lib/libmad.so.0.2.1 (regular file)
libmad: /usr/lib/libmad.so (link)
libmad: /usr/lib/libmad.so.0 (link)
ncurses-devel: /usr/lib/libmenu.a (regular file)
libmatroska: /usr/lib/libmatroska.so.0 (regular file)
libmatroska: /usr/lib/libmatroska.so (link)
metacity: /usr/lib/libmetacity-private.so.0.0.0 (regular file)
metacity: /usr/lib/libmetacity-private.so (link)
metacity: /usr/lib/libmetacity-private.so.0 (link)
ncursesw: /usr/lib/libmenuw.so (link)
ncursesw: /usr/lib/libmenuw.so.5 (link)
ncurses-libs: /usr/lib/libmenu.so.5.7 (regular file)
ncurses-libs: /usr/lib/libmenu.so.5 (link)
$
The code is very fast (tested on Intel Core 2 Duo E4500 2,20GHz) thanks
to proplib and its red black tree implementation.
My system has the following binary packages installed:
$ xbps-bin list|wc -l
534
$
Even with >500 packages just showing the results for the following
pattern didn't take a second!
$ time xbps-bin find-files "/usr/{bin,sbin,lib}*" >/dev/null
real 0m0.802s
user 0m0.788s
sys 0m0.013s
$
You can see the commit and its code here:
http://groups.google.com/group/xbps-commits/browse_thread/thread/83563a99ef5992ff
Cheers!