Friday, April 16, 2010

What package contain this file?

Hi,
We have a file we want to use, but we don't know which package contain this file. How can we find the package containing this file? Read on....

Lets install equery.
So lets search and see if there is a package named equery:
$ eix equery
Well yes,
No matches found
So let us try search the description of packages for equery:
$ eix -S equery
[I] app-shells/gentoo-bashcomp
     Available versions:  20090613 ~20091225
     Installed versions:  20090613(14:24:23 01/04/10)
     Homepage:            http://www.gentoo.org/
     Description:         Gentoo-specific bash command-line completions (emerge, ebuild, equery, repoman, layman, etc)
Bash completion is not what we need.
So we left with using equery to search for equery ;-)
equery utility is installed in my computer so lets use it.
Let's run equery alone:
$ equery       
!!! No command or unknown command given
Usage: equery <global-opts> command <local-opts>
where <global-opts> is one of
 -q, --quiet   - minimal output
 -C, --nocolor - turn off colours
 -h, --help    - this help screen
 -V, --version - display version info
 -N, --no-pipe - turn off pipe detection
where command(short) is one of
 belongs(b) <local-opts> files... - list all packages owning files...
 changes(c)  - not implemented yet
 check(k) pkgspec - check MD5sums and timestamps of pkgspec's files
 depends(d) <local-opts> pkgspec - list all direct dependencies matching pkgspec
 depgraph(g) <local-opts> pkgspec - display a dependency tree for pkgspec
 files(f) <local-opts> pkgspec - list files owned by pkgspec
 glsa(a)  - not implemented yet
 hasuse(h) <local-opts> useflag - list all packages with useflag
 list(l) <local-opts> pkgspec - list all packages matching pkgspec
 size(s) <local-opts> pkgspec - print size of files contained in package pkgspec
 stats(t)  - not implemented yet
 uses(u) <local-opts> pkgspec - display USE flags for pkgspec
 which(w) pkgspec - print full path to ebuild for package pkgspec
The line:
belongs(b) <local-opts> files... - list all packages owning files...
Is what we want to use to search what package installs the utility equery. Perfect!
So we run:
$ equery belongs $(which equery)
[ Searching for file(s) /usr/bin/equery in *... ]
app-portage/gentoolkit-0.2.4.6.1-r1 (/usr/bin/equery)
Oh, ok, now we know that /usr/bin/equery is installed by app-portage/gentoolkit.
Now to use it, just
$ emerge -av app-portage/gentoolkit
and enjoy :-)

Kfir

5 comments:

  1. Maybe equery worked this way at the time of this blog, but no longer.

    If a package is NOT installed, then 'equery belongs file' will not detect the package.

    If a package is installed, then 'equery belongs file' will detect the package, just as it did for Kfir's search for equery.

    ReplyDelete
  2. equery will not search for a file that is not installed, as it is not in the DB.
    pfl is a project that does exactly that.
    http://www.portagefilelist.de will do the file search and show the packages it belongs to.

    Regards,
    Kfir

    ReplyDelete
  3. What a kind of useless article. Every not dumb man, who doesn't know about equery but knows linux and a bit of portage can do for example "grep -l mencoder /var/db/pkg/*/*/CONTENTS". But what men realy need, is how to find not installed package that contains needed file. So thanks for the link to portagefilelist.de, that is what I came for.

    ReplyDelete
    Replies
    1. Ok, so you were looking for a solution of your problem, and you found it here (portagefilelist.de), which is great. Now, what is useless is your attitude about underestimating other people's problems. Internet is for everyone, not only for yourself and your own problems, you know?

      Delete
  4. how could starting newbie know about grep **/**/* & grep -l /*/*/xyz

    What is it and where it is written?

    ReplyDelete