Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 9939

Summary: Better ``whatprovides'' querying
Product: Portage Development Reporter: Ashvin Mysore <ashvin>
Component: DocumentationAssignee: Daniel Robbins (RETIRED) <drobbins>
Status: RESOLVED INVALID    
Severity: enhancement    
Priority: Low    
Version: 2.0   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Ashvin Mysore 2002-10-29 21:40:58 UTC
It's often desirable to know which package provides a certain file. This can be
done under the current system, of course. I the following script:

#!/bin/zsh
# Usage: whatprovides <filename>

if [[ $1 != "" ]] {
  foreach file (`find /var/db/pkg/ -name CONTENTS \
    -exec /bin/grep -l \`/usr/bin/md5sum $1\`  \{\} \;`) {
    grep -l "$1" $file | awk -F / '{ print $5 "/" $6 }'
  }
}

So,

whatprovides /usr/lib/libIDL-2.a

returns

dev-libs/libIDL-0.8.0

Which is nice and all, and pretty useful at times, too. Unfortunately, it's
pretty ugly, and grepping through Portage's internal package database feels like
something of a hack. It would be nice if emerge provided this functionality
(``emerge whatprovides ...''), even if it was just a wrapper of something like
the above.
Comment 1 SpanKY gentoo-dev 2002-10-29 21:47:36 UTC
heres something i emerge-d (gentoolkit)

root@rux0r linux-2.4.19 # qpkg -f /usr/lib/libz.so
sys-libs/zlib *
Comment 2 Ashvin Mysore 2002-10-29 21:54:50 UTC
Wow. Discover something new every day :-)

Thanks, that's a wonderfully useful toolkit.