Skip to content

Conversation

@ddstreet
Copy link

@ddstreet ddstreet commented Dec 4, 2025

This adds a 'obs' plugin to allow adding repos provided by the Open Build Service (OBS), i.e. https://build.opensuse.org/

The user interface is very similar to the COPR plugin; the same commands are provided (enable, disable, remove, list, debug). The main difference is the format of the repository "id":

  • for COPR, the format is [HUB/]OWNER/PROJECT [CHROOT]
  • for OBS the format is [HUB/]PROJECT/REPONAME

The HUB part is the same for both of them, i.e. the hostname (or shortname) of the webui/api of the service; if not specified the default (build.opensuse.org) is used, just like the COPR plugin.

The COPR repos will always have a OWNER that owns a specific PROJECT, and the OBS repos will also have some kind of OWNER, but the field doesn't have any fixed format; it can be "home:user" or "system:systemd" or other formats. The OBS repos also can have any number of levels of PROJECT, including none at all (e.g. "home:user" can have a repo, "home:user:subproject1" can have a repo also, "home:user:subproject1:subsubproject2" can also, etc.). It makes more sense, to me at least, to simply roll the OWNER and PROJECT(s) together as a single PROJECT (with each level delimited by colons; and this is how OBS presents it to users).

The OBS plugin also differs from COPR by including the actual repo name as the REPONAME in the id. The repo name roughly corresponds to the COPR "chroot" (e.g. "fedora-rawhide-ppc64le"), but the repo isn't arch-specific (technically it is, but OBS repos aren't separated by arch like COPR repos are, so most repos have multiple archs enabled), and the repo name isn't guessable based on the local system. Users can name their repos whatever they want.

One other note; when the plugin is provided a repo spec (i.e. PROJECT/REPONAME), it forms a URL to the OBS repo's "repository state" HTML web page, and downloads it, and then parses it (using libxml2 HTML parsing) to extract the HREF to the repo download URL. I don't think this is ideal, but it's required because of 2 reasons:

  1. While the OBS does have an API, none of its methods are usable anonymously (at least, not in any of my testing using the standard api.opensuse.org). Even if this was changed, the plugin should still work with other "hubs" (i.e. other instances of OBS), which may not allow anonymous API access.
  2. The URL to the repos is unfortunately not predictable, as it's up to the specific configuration of each OBS instance. The main OBS instance uses an entirely different hostname (https://download.opensuse.org) while other instances of OBS most likely just use the same hostname with a dedicated path to the download area.

Finally, this of course doesn't have any translations for the plugin, although I did add a .pot file.

Fixes: #2540

@ddstreet ddstreet requested a review from a team as a code owner December 4, 2025 05:41
@ddstreet ddstreet requested review from m-blaha and removed request for a team December 4, 2025 05:41
@ddstreet
Copy link
Author

ddstreet commented Dec 4, 2025

This works around openSUSE/open-build-service#3153 by doing the HTML parsing (as mentioned in the descripion).

Copy link
Member

@Conan-Kudo Conan-Kudo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a great start (though scraping the web page is gross, it is the only way for now...), this is just a first glance of things to fix.

#include <libdnf5/utils/bgettext/bgettext-mark-domain.h>

static const char * const OBS_COMMAND_DESCRIPTION =
_("Manage Obs repositories (add-ons provided by users/community/third-party)");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please consistently use OBS or Open Build Service, and not Obs.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated, i think i got all of them but please let me know if i missed any

_("Enabling a Obs repository. Please note that this repository is not part\n"
"of the main distribution, and quality may vary.\n"
"\n"
"The Fedora Project does not exercise any power over the contents of\n"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the default is actually the openSUSE Build Service, this needs to be "The openSUSE Project"

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

"this repository, and packages are not held to any quality or security\n"
"level.\n"
"\n"
"Please do not file bug reports about these packages in Fedora\n"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fedora->openSUSE.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

"the main Obs repository (they provide runtime dependencies).\n"
"\n"
"Be aware that the note about quality and bug-reporting\n"
"above applies here too, Fedora Project doesn't control the\n"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fedora Project -> the openSUSE Project

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

@ddstreet
Copy link
Author

ddstreet commented Dec 4, 2025

per above comments, changed all 'Obs' -> 'OBS' in comments and strings, as well as 'Fedora' -> 'openSUSE' in strings

@ddstreet
Copy link
Author

ddstreet commented Dec 4, 2025

another update to remove and adjust some code comments

@ddstreet
Copy link
Author

ddstreet commented Dec 4, 2025

update to remove OBS_EXTERNAL_DEPS_WARNING which was leftover from copying the code from the copr plugin; it's not needed since OBS repos don't have external deps. Also adjust the plugin description string.

@Conan-Kudo
Copy link
Member

Technically OBS repos could, but it's hard to identify them and it's better off not worrying about it.

@ddstreet
Copy link
Author

ddstreet commented Dec 4, 2025

updated the pot file

@Conan-Kudo
Copy link
Member

Wouldn't it make sense to also add a key like download_url_prefix to the config where this can be set instead of scraping the web site for this?

It's largely formulaic after you get to the https://download.opensuse.org/repositories/ part. This also makes it far less messy for third-party OBS instances.

@Conan-Kudo
Copy link
Member

And we can assume the default for systems that we don't have this defined to be http://<hostname>:82/, since that's the default for the OBS appliance.

@ddstreet
Copy link
Author

ddstreet commented Dec 4, 2025

Wouldn't it make sense to also add a key like download_url_prefix to the config where this can be set instead of scraping the web site for this?

It's largely formulaic after you get to the https://download.opensuse.org/repositories/ part. This also makes it far less messy for third-party OBS instances.

good point, i'll add that in. with that (and the hostname:82 default) we can probably skip the html parsing completely, or at least move it to a fallback attempt.

@Conan-Kudo
Copy link
Member

Yeah, that should be last-resort code.

@ppisar
Copy link
Contributor

ppisar commented Dec 5, 2025

I'm glad you find DNF5 attractive to write new plugins for it. But this code looks more focused on Open Build Service than on DNF5. I.e. I foresee future changes in this code because of OBS rather than because of DNF5. Also testing this plugin will be probably tightly coupled to real OBS which DNF5 project cannot provide.

In my opinion, this plugin should be maintained in a separate repository. (I have the same opinion about a COPR plugin.) At the end, that's the point of plugins, to be maintained separately. It would be also healthy for the DNF5 project because it will forced DNF5 to maintain API/ABI properly.

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.

Open Build Service repo management plugin (equivalent to copr plugin)

3 participants