zypper search-packages

I found this article, and it made me wonder, is this only for sles or also for openSUSE?

https://www.zdnet.com/article/suse-releases-major-linux-update/

Extended Package Search. By using the new Zypper, SUSE’s command line package manager, command option – zypper search-packages – sysadmins can now search across all SUSE repositories, even unenabled ones. This makes it easier for administrators to find required software packages.

Hi
I only see it on SLES and SLED…

Just checked both a LEAP and openSUSE…the “zypper search-packages” command is not supported.

In any case from a description I found elsewhere, the command is only supposed to support searching disabled repos in addition to enabled which to me is only an incremental benefit since the repo would have to already be added to the system.

IMO the capability which would be big news is what was discussed years ago but never became reality, the ability to do a command line search that would be identical to what is now done at the “software.opensuse.org/search” website.

To me, this would not be too difficult to do, and would be implemented as follows…
The only decision that would need to be made is whether to implement the translation from zypper commands to the website functions on the client running zypper or on the server, either is possible and I’d expect wouldn’t matter much since since I’d expect there isn’t a determining factor like load, latency, complexity or security to be significant.
In the following architecture, the actual search is still done on the webserver, and the result is returned to the client.

I’d recommend JSON but can be any XML based message that carries the query from client to server and returns the result.
On the Server, create an API that exposes the specific functionality you want to support.
I’d expect that REST would be the web services implementation which would support the necessary requirements, there is no need to implement SOAP which is unnecessarily complex.
On the client side, create a zypper extension that supports the REST connection to the server, it should also contain a translation configuration supporting command options you want to support.

Someone could almost do this entirely on their own, but I don’t think the “software search” website code is published publicly (I could be wrong).
Zypper is published on github, so is available.
This would be a nice little project for someone ambitious, IMO would be gladly be accepted and make you famous forever!

An alternative approach to the above would require almost no technical knowledge but would be a lot more bloated…
Simply scrape the website page where you enter the package name to be searched, create a zypper command that injects the package name, and then figure out how you want to display the result.

In both of the above, I’m guessing that the package results page is built from a database query result that might be almost exactly what you need to build a command line result and more useful than the webpage so might be easier for a website maintainer or designer to help.

TSU

Hi
The easiest way is via OBS and osc search on you machine, can’t beat it, also the fact that you can say ahh ok I want that package and again with osc download the binary and install… Create a binaries repo to download them to, refresh and install…

Thank you guys. I have had my share of searching for missing dependencies.

Maybe I need to make it a feature request ?
It would be rather awesome, if we could search repositories we have not added yet. ( search all of SUSE :stuck_out_tongue: )

I had overlooked the part its only for disabled repositories on sles / sled.

That not what I had in mind :slight_smile:

Hi
Yes, the repos for SLE are module based, some free some not…


zypper se tilda
Loading repository data...
Reading installed packages...

S  | Name       | Summary                                           | Type
---+------------+---------------------------------------------------+--------
   | tilda      | A Gtk based drop down terminal for Linux and Unix | package
 l | tilda-lang | Translations for package tilda                    | package


For an extended search including not yet activated remote resources you may run
'zypper search-packages' at any time.
Do you want to run 'zypper search-packages' now? [yes/no/always/never] (no): yes

Following packages were found in following modules:

Package     Module or Repository                       SUSEConnect Activation Command              
----------  -----------------------------------------  --------------------------------------------
tilda       SUSE Package Hub (PackageHub/15.2/x86_64)  SUSEConnect --product PackageHub/15.2/x86_64
tilda-lang  SUSE Package Hub (PackageHub/15.2/x86_64)  SUSEConnect --product PackageHub/15.2/x86_64

To activate the respective module or product, use SUSEConnect --product.
Use SUSEConnect --help for more details.

Interesting :slight_smile:

Well openSUSE has ‘opi’, the OBS Package Installer. Simply install opi, and f.e. run

opi firefox

But it has more, as I found reading the code ( it’s a Perl script ). I was really pleased to see this:

knurpht@Tuxedo-laptop:~> opi packman codecs
Do you want to install codecs from Packman repository? (Y/n) 



After any install of a package it asks whether one wants to keep the repo active

I must be clueless, but I can’t find it. Could you help, please?

I think I located it.
Interesting that it isn’t in the software search site…
I haven’t used it so can’t vouch for how well it works. I assume but have not inspected the code to verify it builds on libzypp so don’t know if it works outside of, or is integrated with zypper/rpm.

https://github.com/openSUSE/opi

Although he hasn’t updated his README.md, there are also 15.2 RPMs which can be downloaded.

TSU

Hi
Please do your research… for Tumbleweed…


cnf opi
                     
The program 'opi' can be found in the following package:
  * opi  path: /usr/bin/opi, repository: zypp (download.opensuse.org-oss) ]

Try installing with:
    sudo zypper install opi

zypper if opi

Information for package opi:
----------------------------
Repository     : Main Repository (OSS)
Name           : opi
Version        : 0.9.0-2.1
Arch           : noarch
Vendor         : openSUSE
Installed Size : 165.0 KiB
Installed      : No
Status         : not installed
Source package : opi-0.9.0-2.1.src
Summary        : OBS Package Installer (CLI)
Description    : 
    OBS Package Installer (CLI)

Hello,

Like Malcolm said, opi (for TW) is in Main Repository:

zypper -vvv in opi
Verbosity: 3
Non-option program arguments: 'opi' 
Initializing Target
Checking whether to refresh metadata for Main Repository (NON-OSS)
Checking whether to refresh metadata for Main Repository (OSS)
Checking whether to refresh metadata for Main Update Repository
............................................
Loading repository data...
Reading installed packages...
Force resolution: No
Selecting 'opi-0.9.0-2.1.noarch' from repository 'Main Repository (OSS)' for installation.
Resolving package dependencies...
Force resolution: No


The following 5 items are locked and will not be changed by any action:
 Available:
  btrfsmaintenance pattern:games pidgin polari yast2


The following 6 NEW packages are going to be installed:
  opi                      
    0.9.0-2.1   noarch  Main Repository (OSS)  openSUSE
  perl-Config-Tiny         
    2.24-1.5    noarch  Main Repository (OSS)  openSUSE
  perl-XML-LibXML          
    2.0206-1.2  x86_64  Main Repository (OSS)  openSUSE
  perl-XML-NamespaceSupport
    1.12-1.11   noarch  Main Repository (OSS)  openSUSE
  perl-XML-SAX             
    1.02-1.5    noarch  Main Repository (OSS)  openSUSE
  perl-XML-SAX-Base        
    1.09-1.12   noarch  Main Repository (OSS)  openSUSE


6 new packages to install.
Overall download size: 732.2 KiB. Already cached: 0 B. After the operation,
additional 2.1 MiB will be used.
Continue? [y/n/v/...? shows all options] (y): n