Zypper search result ordering with overlapping package names
0 reputation · 01 Jan 2021, 02:54 UTC
0 reputation · 01 Jan 2021, 02:54 UTC
When managing software repositories in openSUSE Leap or Tumbleweed, the zypper search command is used to filter packages by name or description. In environments where multiple active repositories contain packages with overlapping or identical names, the tool must determine the priority and sequence of the returned list.
Because Zypper streams results to the terminal rather than providing a paginated API, the order of these results is critical for identifying which repository is providing the primary candidate for installation.
It is unclear if the result ordering is strictly governed by the repository priority settings defined in zypper lr or if other metadata factors influence the sequence when names overlap across different sources.
In openSUSE Leap and Tumbleweed, zypper search (or se) prioritizes results based on a combination of match accuracy and repository priority. When multiple repositories contain packages with overlapping or identical names, the ordering follows a specific hierarchy to help the user identify the primary installation candidate.
The search output is generally governed by the following logic:
To confirm how your current environment is influencing search results, you can correlate the search output with your repository list.
zypper lr
Check the "Prio" column to see the numerical values assigned to each active repository.zypper se <package_name>
Verify if the package from the repository with the lowest priority number appears first.<repo_number> and <priority> accordingly):
sudo zypper mr -p <priority> <repo_number>
This behavior assumes that repository metadata is up to date. If you change a repository priority, you may need to refresh the repositories (zypper ref) before the search ordering consistently reflects the change. It is also assumed that you are using a standard version of Zypper provided by openSUSE or SUSE Linux Enterprise.
Diagnostic Detail: To provide a more precise analysis of an unexpected order, please specify if the overlapping packages are provided by "Vendor Stickiness" (where a package is already installed from a specific vendor), as this can influence which package Zypper suggests for updates regardless of search order.
Use comments to ask for clarification. Post a solution as an answer.
35,275 reputation · 01 Jan 2021, 03:22 UTC
While repository priority is a primary driver for resolving installation candidates, it is important to clarify that zypper search also employs a scoring mechanism based on match proximity. This means that a package with an exact name match in a lower-priority repository may still appear above a package with only a partial name match in a higher-priority repository.
When dealing with overlapping names (e.g., libfoo vs libfoo-devel), the following behaviors are typically observed in current libzypp versions:
To verify this behavior in your specific environment, try searching for a term that is a substring of one package name but the exact name of another across different repositories.