Skip to content

feat(zypper): add repository discovery, add, and remove support - #238

Open
Xarianne wants to merge 1 commit into
ripytide:mainfrom
Xarianne:main
Open

feat(zypper): add repository discovery, add, and remove support#238
Xarianne wants to merge 1 commit into
ripytide:mainfrom
Xarianne:main

Conversation

@Xarianne

Copy link
Copy Markdown
Contributor

Add Zypper repository support

Summary

Implements full repository lifecycle support for the Zypper backend. Previously metapac only listed Zypper packages; it could not discover, add, or remove Zypper repositories. This change makes Zypper behave consistently with other backend repository implementations while respecting Zypper-specific conventions such as $releasever/$basearch variables and GPG key handling.

Changes

  • src/backends/zypper.rs

    • Repository discovery now uses zypper repos --show-enabled-only --export -, which returns INI-style .repo definitions.
    • Discovered repositories are keyed by their Zypper alias.
    • Default openSUSE:* repositories are filtered out of unmanaged output.
    • ZypperRepoOptions gained an optional gpgkey field so exported signing-key configuration is preserved.
    • add_repos now supports two forms:
      • Direct .repo file URLs (e.g. Brave's official brave-browser.repo).
      • Regular baseurl repositories with an explicit gpgkey, which are recreated via a temporary .repo definition.
    • remove_repos removes repositories by alias using zypper removerepo.
    • Installed-package parsing now recognises the il (locked but explicitly installed) status in addition to i+, preventing locked packages such as kernel-default from appearing as missing.
  • README.md

    • Replaced the Zypper "Standard usage." section with repository documentation and a PackMan/Brave example.
    • Removed a misleading $releasever paragraph.
  • Tests

    • Added parser tests for exported repository definitions including gpgkey extraction.
    • Added a regression test for locked user-installed packages.

Example group file

zypper = {
  repos = [
    {
      name = "packman",
      options = {
        url = "https://ftp.fau.de/packman/suse/openSUSE_Tumbleweed/"
      }
    },
    {
      name = "brave-browser",
      options = {
        url = "https://brave-browser-rpm-release.s3.brave.com/brave-browser.repo"
      }
    }
  ],
  packages = [
    "brave-browser",
  ]
}

Notes for reviewers

  • Discovery intentionally filters aliases starting with openSUSE: because these are distribution repositories managed by the openSUSE service. This is conceptually similar to DNF only listing COPR repos with dnf copr list; Zypper has no equivalent "third-party only" command, so a prefix filter is used to avoid cluttering unmanaged output with default repos.
  • --non-interactive is only passed when no_confirm is set, matching existing backend conventions. Interactive metapac sync therefore lets Zypper prompt for new GPG keys.
  • For discovered repositories with a gpgkey, metapac writes a temporary .repo file and passes that to zypper addrepo, because the addrepo command accepts either a plain URL plus alias or a full .repo file, not individual settings like gpgkey.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant