21

I am thinking on some like Contents-<arch>.gz on Debian. A network service were also okay. Does it exist?

Simple elaboration: For example, we need a binary named exampletool, which we know very good from other distributions or operation systems. We want to install that, for example, with zypper. But zypper can only install a package. To find out, in which package can we find the required exampletool binary, we need to do practically a search, and ideally a fast, indexed search in the file list of the currently not installed, but in the repositories available packages. On debian, there is an index file in the package repositories named Contents-amd64.gz, in which we can find the required package with a single zgrep command. I am looking for some similar, single-command solution for OpenSUSE, too. If there is none, a web service were also okay for the same functionality.

peterh
  • 9,488
  • 16
  • 59
  • 88

6 Answers6

15

To search from all available packages to find a particular file, you can use the option wp or se --provides --match-exact as an example:

zypper se --provides --match-exact hg

You will see output similiar to the following:

Loading repository data...
Reading installed packages...

S | Name      | Summary                  | Type   
--+-----------+--------------------------+--------
  | mercurial | Scalable Distributed SCM | package

From that point you can install the package through a standard zypper install

zypper in mercurial

It should be noted that zypper wp is obsolete and may no longer be available.

SailorCire
  • 2,423
  • 1
  • 15
  • 23
  • 1
    This is not always reliable. I don't know why but file names such as `zypper search --provides [--match-exact] getenforce` do not return results, while `zypper search --provides nslookup` does. – Lester Jan 31 '20 at 14:15
  • I believe that `provides` are symbolic and set manually by the packager, but I don't know much about how openSUSE creates packages. As such, they don't necessarily reflect package file contents. – ZeroKnight May 07 '21 at 23:50
9

To the googlers of the future: next to @SailorCire 's wonderful solution :-), there is also a tool named scout, which is able to search in practically everything, we can find rpm-s for a binary just as we can find the jars for a given java class.

For example, we can use scout's bin command to find out what package provides the hg executable:

scout bin hg

The result of this search is the mercurial package:

 repository      | package   | path     | binary
-----------------+-----------+----------+--------
 zypp (repo-oss) | mercurial | /usr/bin | hg    
hugomg
  • 5,543
  • 4
  • 35
  • 53
peterh
  • 9,488
  • 16
  • 59
  • 88
  • Can you please be a little more specific about the `scout` tool ? Can you give its' complete name or URL to its' code ? – SebMa Nov 04 '19 at 15:29
  • @SebMa It was downloadable from rpm, probably by zypper. It is possible, that it was in a non-standard repo. I can't remember very well :-( I don't use SuSE any more. But it is quite possible that I will be, then I will check it and explain what I found. It is possible, that SuSE has changed a lot since then. – peterh Nov 04 '19 at 15:33
  • On my Jolla1 device (SailFishOS), `zypper wp scout` says `No matching items found.` – SebMa Nov 04 '19 at 15:38
  • @SebMa Googling for "scout tool rpm" I found [this](https://fedora.pkgs.org/30/fedora-x86_64/scout-0.4-23.fc30.noarch.rpm.html) link on the spot, in the current moment I can't help more. Probably you will need to install it from some non-standard repository. – peterh Nov 04 '19 at 15:58
  • On the link you've provided, it says : "Scout is an interface to Tomboy notes or Gnote that uses DBus to communicate." I'm not sure that's the tool we are looking for. – SebMa Nov 04 '19 at 17:09
  • On the other hand, thanks to the second result of "scout tool rpm", I found this [scout](https://github.com/openSUSE/scout/). Is this the one ? – SebMa Nov 04 '19 at 17:11
1

I'm using Gecko Linux XFCE. I opened Yast2 and installed gnome-search-tool and gnome-shell-search-provider-nautilus. It works fine, just like Catfish.

1

I am late to this party, but to add my grain of salt.

Currently, there is not a reliable way to do this in OpenSUSE. In theory, the package maintainers must add all the files it "provides" in the Provides section in the spec package. But this is seldom used.

Alternatively, if you have an idea in which package the wanted file it is you could individually inspect the files inside the rpm as in this answer https://stackoverflow.com/a/57397745/2420872

Vicente Bolea
  • 174
  • 1
  • 8
  • 2
    I think the provides is a very different thing (not sure in OpenSUSE any more). The last what would be reliable if it depends on what the package maintainers manually say. The question asks for what actually lists the files in all packages in the remote repository, and searches in them. How about the other answers? zypper was quite a reliable solution for me (at the time - I do not use opensuse any more). – peterh Feb 26 '21 at 12:35
1

Even later to the party than @Vicente Bolea, but I have found a solution by checking the documentation of zypper se, which was suggested by @SailorCire:

zypper search --file-list <filename>

or its short version

zypper se -f <filename>

searches in the file lists of the available packages

FelEnd
  • 111
  • 2
1

My first shot would always be cnf aka command-not-found:

cnf yelp

The program 'yelp' can be found in following packages:

  • yelp [ path: /usr/bin/yelp, repository: zypp (openSUSE-Leap-15.4-1) ]
  • yelp [ path: /usr/bin/yelp, repository: zypp (repo-oss) ]

Try installing with: sudo zypper install yelp

To further check on available versions and repos, use opi, the OBS Package Installer (CLI), to search and install almost all packages available for openSUSE and SLES:

$ opi yelp

  1. yelp
  2. yelp-xsl
  3. yelp-tools
  4. libyelp0
  5. yelp-lang
  6. yelp-devel Pick a number (0 to quit):

1

You have selected package name: yelp

  1. GNOME:STABLE:41 ? | 41.2 | x86_64 Pick a number (0 to quit):

Picking 1 will first add the repo, if required, enable it, and download and install the package.

The advantages of opi become obvious when there are multiple versions to choose from:

$ opi php8

You have selected package name: php8

  1. devel:languages:php:php82 ? | 8.2.4 | x86_64
  2. devel:languages:php ? | 8.1.17 | x86_64
  3. devel:languages:php:php81 ? | 8.1.13 | x86_64
  4. devel:languages:php:php80 ? | 8.0.28 | x86_64
  5. home:13ilya ! | 8.2.4 | x86_64
  6. home:mmanu84:php8:php82 ! | 8.2.4 | x86_64
  7. home:SCNOPS:php81 ! | 8.1.17 | x86_64
  8. home:illuusio:php-next ! | 8.1.17 | x86_64 Pick a number (0 to quit):

Which will allow you to select between PHP 8.0.28, 8.1.13, 8.1.17, and 8.2.4. Note that there's no stable package yet, all are either labeled devel or home.

duise
  • 21
  • 3