Zypper search result ordering with overlapping package names
26.5K 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.
Technical Uncertainty
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.
- Does the search output consistently prioritize packages from higher-priority repositories?
- What determines the sort order for packages with identical names across repositories of the same priority level?
1 answer
1 question comment
Use comments to ask for clarification. Post a solution as an answer.
26,525 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:
- Exactness: Exact matches are scored highest and prioritized regardless of repository priority.
- Prefix Matching: Packages sharing a prefix are generally sorted by name length and alphabetical order if they originate from repositories of the same priority.
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.