Search for packages with the zypper-onlinesearch plugin

Thanks to the openSUSE Build Service infrastructure, tons of free software is packaged by third part users and made available to every openSUSE user.

All these packages can be found using the web interface at the software.opensuse.org, and what Zypper-Onlinesearch does, working as a front-end for that service is bring the software search on the terminal.

A quick look at the openSUSE Build Service

One of the features that value the openSUSE project is the openSUSE Build Service platform which helps contributors from around the world to package any application out there and make it available to everyone.

To achieve that, it provides an environment based on:

  • a web interface to handle the issues and the general settings;
  • virtual machines that effectively compile the RPM spec directives and provide the required dependencies;
  • a command line toolkit to upload the sources and the files required to create the package.

To complete the picture a search engine allows one to search for their name or within their description through a minimal but effective web interface.

What this script does is create a link between the command line and the web interface, and allows for navigating the results in a non-interactive mode to take advantage of them also from within a third-party script.

Bring the research to the terminal

While looking for a package the first action to do is search for a particular word that might be included in the package name or description.

That can be achieved easily using the --search switch, which is the starting point for our research:

$ onlinesearch -s qmmp

The result is a table for each engine used, and each one has a header and a list of results.

The header remembers the various parameters set up to accomplish the request, in that case, the search string, and the cache status with a datetime field remembering us how old is the stored data for that query.

Each row of the list is preceded by a consecutive number, and contains a page name and a short description, which will help us to understand the content of the page itself.

Browsing the page

To list all the relevant provided by the application page we can use the -p switch followed by the page name:

$ onlinesearch -p qmmp

As we can see in the image above we get a third section between the header and the rows that contain a summary and a longer description.

Also, the header provides some more details like the architecture and the OS name. This two info are used as a filter to display the relevant results for the current machine.

The rows have as columns:

  1. a consecutive number;
  2. the package version;
  3. the repository name
  4. the OS version.

Being the results pointing by default to the current OS version, the last column seems repetitive, but this makes sense when, using the --all-distributions option, we get all the available results.

The different colors highlight the two types of repositories: experimental (yellow) and community (red). The unsupported distributions have a red background.

The number that prepends any row is very important here: it will be used in the next step to list all the links that every repository contains.

In certain cases, we might find it useful to have a different view to read those long strings, the option --report comes to the rescue.

In this last step, we can grab all the links we can get from the page.

To do that the package page and the repository number seen above are required.

So to get the links from the multimedia:apps repository in the qmmp page must type:

$ onlinesearch -l qmmp,3

As a first result, we get the ymp file which is the format used by One Click Installer to add the repositories and install a package automatically.

We can also isolate the URL to use it together with another command, for example, to use directly the ymp file:

$ sudo OneClickInstallCLI `onlinesearch -l qmmp,3 --format ymp --urls`

or add the repo like that:

$ sudo zypper addrepo `onlinesearch -l qmmp,3 --format repo --urls`

Final thoughts

Zypper-Onlinesearch is part of a collection of scripts related to the package installation area (search, install, upgrade) that I wrote for myself and published lately to be used by everyone.

Bringing some functionality to the terminal became essential to save some time for me, but nothing prevents to rewrite these scripts as a YaST addon in the future.

An overview of the whole project is available on my Github projects page.


Creative Commons License This work is licensed under a Creative Commons Attribution-NoCommercial-ShareAlike 4.0 International License


This article covers a personal project, further info is provided at the Zypper-Onlinesearch project page.

Leave a Comment