Add plugin for Open Build Service (OBS)#2541
Add plugin for Open Build Service (OBS)#2541ddstreet wants to merge 6 commits intorpm-software-management:mainfrom
Conversation
|
This works around openSUSE/open-build-service#3153 by doing the HTML parsing (as mentioned in the descripion). |
Conan-Kudo
left a comment
There was a problem hiding this comment.
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)"); |
There was a problem hiding this comment.
Please consistently use OBS or Open Build Service, and not Obs.
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
Since the default is actually the openSUSE Build Service, this needs to be "The openSUSE Project"
| "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" |
| "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" |
There was a problem hiding this comment.
Fedora Project -> the openSUSE Project
|
per above comments, changed all 'Obs' -> 'OBS' in comments and strings, as well as 'Fedora' -> 'openSUSE' in strings |
|
another update to remove and adjust some code comments |
|
update to remove |
|
Technically OBS repos could, but it's hard to identify them and it's better off not worrying about it. |
|
updated the pot file |
|
Wouldn't it make sense to also add a key like It's largely formulaic after you get to the |
|
And we can assume the default for systems that we don't have this defined to be |
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. |
|
Yeah, that should be last-resort code. |
|
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. |
This is similar to the COPR plugin, but for the OBS service. Fixes: rpm-software-management#2540
I think that's outside the scope of this...there are already several dnf5-plugins in the repo, including one for COPR, and if you think they should move out of this repo I suggest you open a separate PR or issue to propose it. |
Ok I updated it to first try the download url directly, and then fallback to parsing the html. It's done via config file settings, including built-in config. I think it might be useful to also add a config param I haven't had time, but I would also like to enable anonymous api access on my OBS instance and add support for api fallback (which should be done before html fallback obviously) |
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":
[HUB/]OWNER/PROJECT [CHROOT][HUB/]PROJECT/REPONAMEThe
HUBpart 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
OWNERthat owns a specificPROJECT, and the OBS repos will also have some kind ofOWNER, 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 ofPROJECT, 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 theOWNERandPROJECT(s) together as a singlePROJECT(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
REPONAMEin 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:Finally, this of course doesn't have any translations for the plugin, although I did add a .pot file.
Fixes: #2540