Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 9939 - Better ``whatprovides'' querying
Summary: Better ``whatprovides'' querying
Status: RESOLVED INVALID
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Documentation (show other bugs)
Hardware: All Linux
: Low enhancement (vote)
Assignee: Daniel Robbins (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-10-29 21:40 UTC by Ashvin Mysore
Modified: 2011-10-30 22:32 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.