You are not logged in.

#1 2008-06-12 18:52:19

mschmarck
Member
From: A country south of Germany
Registered: 2008-06-02
Posts: 13

Which package provides a file?

Hello.

How do I find out, which package I need to install to get a certain file?

Example: I'd like to know what to install to get the rexec (/usr/bin/rexec) binary. Or /usr/**/*knode* (ie. any file containing "knode" anywhere underneath /usr). I want to know this for packages which I do NOT have installed. For installed packages/files, I could of course simply use

pacman -Qo /usr/bin/rexec

But how do that for not installed packages, ie. for sync databases?

Thanks,
Michael

Offline

#2 2008-06-12 19:04:43

Spider.007
Member
Registered: 2004-06-20
Posts: 1,175

Re: Which package provides a file?

It's impossible to search for a filename in a repository. It is only possible via some sort of hack; or finding the list that i know someone has posted on these forums of all the files that are in all the packages

Offline

#3 2008-06-12 19:08:09

DonVla
Member
From: Bonn, Germany
Registered: 2007-06-07
Posts: 997

Re: Which package provides a file?

Offline

#4 2008-06-12 19:18:17

mschmarck
Member
From: A country south of Germany
Registered: 2008-06-02
Posts: 13

Re: Which package provides a file?

Hello!

Spider.007 wrote:

It's impossible to search for a filename in a repository.

Yes, I know. I was hoping, that someone had some sort of web accessible database listing all the files and relating it to the respective package.

Something like PortageFileList (PFL) for Gentoo Linux, or Canoe Dissent for Blastwave (Solaris).

This should obviously be some sort of "community effort", so that it's also possible to cover all the AUR packages. All that would be required, is that somebody collects all the pacman -Ql listings of as many users as possible.

Long question short: Something like this doesn't exist for Arch, at least as of yet?

Thanks,
Micahel

PS: What package provides knode?

Offline

#5 2008-06-12 19:26:39

shining
Pacman Developer
Registered: 2006-05-10
Posts: 2,043

Re: Which package provides a file?


pacman roulette : pacman -S $(pacman -Slq | LANG=C sort -R | head -n $((RANDOM % 10)))

Offline

#6 2008-06-13 06:26:38

mschmarck
Member
From: A country south of Germany
Registered: 2008-06-02
Posts: 13

Re: Which package provides a file?

THAT is exactly, what I was looking for! big_smile

However, the script did not work, because the files stored on eg. http://dev.archlinux.org/~pierre/test-r … os/x86_64/ have been renamed. So I rewrote the script posted on the mailing list.

#! /usr/bin/env bash

store="$HOME/.local/share/pac-file"            # default location
repos=(core extra community)                # Default "stable" repos
#repos+=(testing unstable)                # Additional repos
arch=$(uname -m)
arch="i686"                        # Force an architecture
url="http://dev.archlinux.org/~pierre/test-repo"

usage() {
    echo "usage: $0 {-S|--sync|-h|--help|-?|<pattern>}"
    echo "-S / --sync: Synchronize \"$store\""
    echo "  with $url"
    echo "-h / --help / -?: Display this usage information"
    echo "<pattern>: Search in \"$store\" for the"
    echo "  given pattern."
    echo "  Pattern can be an extended regular expression."
    echo "  This will list which package provides a certain file (ie."
    echo "  which matches the pattern."
    echo
    echo "Example:"
    echo " $0 knode"
    echo "  -> Show all the packages which contain file(s) with \"knode\""
    echo "     in the filename/path"
    echo " $0 '.*kn'"
    echo "  -> Show all the packages matching the regexp .*kn. Care should"
    echo "     be taken to quote/unescape special characters like *."
    echo
}

if [[ "$arch" != "i686" && "$arch" != "x86_64" ]]; then
    echo "Unsupported architecture \"$arch\"."
    echo "It must be either i686 or x86_64."
    echo
    usage
    exit 1
fi

[[ -r "$HOME/.config/pac-file.conf" ]] && source "$HOME/.config/pac-file.conf"

case $1 in
  -S|--sync)
    echo "Synchronising file cache \"$store\""
    echo "with ${url}..."
    echo

    [[ -d "$store" ]] || mkdir -p "$store"
    cd "$store"
    for repo in ${repos[@]}
    do
        repo_filename="$repo.files.tar.gz"
        repo_url=$url/$repo/os/$arch/$repo_filename
        repo_file="$store/$repo_filename"
        repo_dir="$store/$repo"
        
        echo "$repo: Fetching from $repo_url"
        
        rm -fr "$repo_file" "$repo_dir"
        mkdir -p "$repo_dir"
        wget -qO - $repo_url | tee "$repo_file" | ( cd "$repo_dir" ; gzip -cd | tar xf - )
    done
    echo "sync complete."
    ;;
  -h|--help|-?)
    usage
    ;;
  *)
      if [[ $# < 1 ]]; then
          echo "Not enough parameters!"
          echo
          usage
          exit 1
      fi
      if [[ ! -d "$store" ]]; then
          echo "Local storage \"$store\" does not exist!"
          echo "Did you already run \"$0\" --sync ?"
          echo
          usage
          exit 1
      fi
    cd $store
    grep -Re "$@" . | sed "s/\.\/\(.*\)\/files:/\1 /g"
    ;;
esac
exit 0

# EOF #

Thanks a lot!

Cheers,
Michael

Last edited by mschmarck (2008-06-13 06:50:13)

Offline

#7 2008-06-30 18:05:15

mschmarck
Member
From: A country south of Germany
Registered: 2008-06-02
Posts: 13

Re: Which package provides a file?

Good evening!

mschmarck wrote:

THAT is exactly, what I was looking for! big_smile

But sadly, the tool stopped working, because pierre no longer offers these package listings (or at least not at that URL :[ ).

Would somebody maybe know of a working alternative?

Thanks a lot,
Michael

Offline

#8 2008-06-30 19:26:12

mmmasterluke
Member
Registered: 2007-12-07
Posts: 49

Re: Which package provides a file?

http://www.archlinux.de/?page=Packages

Type the file you're interested in into the box ("Schlüsselwörter" = keywords). Select the "Datei" (file) radio button and hit "Suchen" (search). Unfortunately, it doesn't work with absolute path names.

Hope that helps.

Offline

#9 2008-06-30 19:37:53

Daenyth
Forum Fellow
From: Boston, MA
Registered: 2008-02-24
Posts: 1,244

Re: Which package provides a file?

I wrote a fairly decent tool called pkgfile to do exactly this. It's available in the pkgtools package on AUR. http://aur.archlinux.org/packages.php?ID=17941

Offline

#10 2008-06-30 19:42:50

shining
Pacman Developer
Registered: 2006-05-10
Posts: 2,043

Re: Which package provides a file?

mschmarck wrote:

Good evening!

mschmarck wrote:

THAT is exactly, what I was looking for! big_smile

But sadly, the tool stopped working, because pierre no longer offers these package listings (or at least not at that URL :[ ).

Would somebody maybe know of a working alternative?

Thanks a lot,
Michael

Pierre no longer offer them because they are now on every mirrors, so that is even better.

At the moment, one tool was proposed on pacman-dev, for inclusion either in pacman or pacman-contrib packages, but nobody reviewed it seriously yet :
http://www.archlinux.org/pipermail/pacm … 12245.html

So help (for testing, reviewing, improving it) is welcome smile

Daenyth, if the tool you proposed is different, you should compare both to see what the differences are, and offer your opinion on pacman-dev ML.


pacman roulette : pacman -S $(pacman -Slq | LANG=C sort -R | head -n $((RANDOM % 10)))

Offline

#11 2008-06-30 20:10:40

Daenyth
Forum Fellow
From: Boston, MA
Registered: 2008-02-24
Posts: 1,244

Re: Which package provides a file?

Hmm.. His script has a few ideas that mine doesn't, but mine offers more functionality. I'll work on adding the other things to mine.

Offline

#12 2008-06-30 22:48:57

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: Which package provides a file?

The problem is, you're using the wrong distro wink

In Fedora 9:

$ yum provides /usr/bin/mutt
mutt.x86_64 : A text mode mail user agent

Offline

#13 2008-06-30 23:10:58

Misfit138
Misfit Emeritus
From: USA
Registered: 2006-11-27
Posts: 4,189

Re: Which package provides a file?

brebs wrote:

The problem is, you're using the wrong distro wink

In Fedora 9:

$ yum provides /usr/bin/mutt
mutt.x86_64 : A text mode mail user agent

Now that's just downright mean.

Offline

#14 2008-07-01 07:17:15

mschmarck
Member
From: A country south of Germany
Registered: 2008-06-02
Posts: 13

Re: Which package provides a file?

mmmasterluke wrote:

http://www.archlinux.de/?page=Packages

Type the file you're interested in into the box ("Schlüsselwörter" = keywords). Select the "Datei" (file) radio button and hit "Suchen" (search). Unfortunately, it doesn't work with absolute path names.

Hope that helps.

Hm. Yes, this sort of works, thanks. But the results are hard to "parse". Eg. I searched for "dig" (as in /usr/bin/dig) and it of course found "dnsutils" all right, but I nearly missed that package in the huge list of returned packages. It would be nice if the resultlist would also show the hit directly. Eg. in the way PFL does.

But I suppose that package search is better than nothing smile

Thanks a lot, I really appreciated it!

Michael

Offline

#15 2008-07-01 07:25:32

mschmarck
Member
From: A country south of Germany
Registered: 2008-06-02
Posts: 13

Re: Which package provides a file?

shining wrote:

Pierre no longer offer them because they are now on every mirrors, so that is even better.

True enough smile

At the moment, one tool was proposed on pacman-dev, for inclusion either in pacman or pacman-contrib packages, but nobody reviewed it seriously yet :
http://www.archlinux.org/pipermail/pacm … 12245.html

Great pointer!

So help (for testing, reviewing, improving it) is welcome smile

Will do so.

Thanks a lot,
Michael

Offline

Board footer

Powered by FluxBB