Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assign a distribution to yum #25304

Closed
ExplodingDragon opened this issue Jun 16, 2023 · 10 comments · Fixed by #26984
Closed

Assign a distribution to yum #25304

ExplodingDragon opened this issue Jun 16, 2023 · 10 comments · Fixed by #26984
Labels
topic/packages type/feature Completely new functionality. Can only be merged if feature freeze is not active. type/proposal The new feature has not been accepted yet but needs to be discussed first.

Comments

@ExplodingDragon
Copy link
Contributor

ExplodingDragon commented Jun 16, 2023

Feature Description

Sometimes we need to compile RPM packages for multiple distributions (el7, el9, f34 ...) All packages are put together and sometimes a package does not work on a particular distribution, which may lead to incorrect installation of a package not compiled for that distribution.

图片

图片

图片

After uploading:

图片

Screenshots

@ExplodingDragon ExplodingDragon added type/feature Completely new functionality. Can only be merged if feature freeze is not active. type/proposal The new feature has not been accepted yet but needs to be discussed first. labels Jun 16, 2023
@ExplodingDragon ExplodingDragon changed the title Assign a distribution to yum. Assign a distribution to yum Jun 16, 2023
@KN4CK3R
Copy link
Member

KN4CK3R commented Jun 16, 2023

How does YUM/DNF decide which file to download? Debian for example uses a different configuration for such parameters.

@nephatrine
Copy link
Contributor

Normally a repository would have different paths for different versions (el7, el8, etc.) and in the yum/dnf config you'd use the $releasever in the baseurl to select the right repo for you. For instance within https://download.docker.com/linux/centos/ you can see they have a separate directory for each release version. Each combination of release version and architecture is essentially its own standalone repository but you can just use one repo file with a line like this to address the correct one for your system:

baseurl=https://download.docker.com/linux/centos/$releasever/$basearch/stable

That stable on the end is similar to the {component} configuration shown in the debian config you linked and it would be nice to support having multiple RPM package sets in a similar way to what gitea is already apparently doing for Debian.

@nephatrine
Copy link
Contributor

nephatrine commented Jun 17, 2023

I did some testing on my own using AlmaLinux 9 and dnf was smart enough to pick the right architecture binaries even if those are all mixed together in one repo - but it is very confused if you have packages for different distro versions in one repo. I think you just need to be able to provide a {distribution} and perhaps {component} in the same way as Debian and publish packages using a path like this:

https://gitea.example.com/api/packages/{owner}/rpm/{distribution}/{component}/upload

The .repo file downloaded could then would just have $releasever where {distribution} is like https://gitea.example.com/api/packages/{owner}/rpm/$releasever/{component}. Each of those URLs would have to be presented as its own repository root. I suppose each {component} would need its own .repo file as well or they'd all have to be listed as separate repositories in one master .repo file. It's not like debian where you can just list a bunch of "tags" after the url for various components unfortunately. I'm not sure how you'd want to handle that.

I'm also not sure how you'd handle packages users have already uploaded in 1.20.0 using the current way it works so you would probably need to continue supporting distributionless componentless packages to not break those.

@ExplodingDragon
Copy link
Contributor Author

ExplodingDragon commented Jun 18, 2023

1.20.0 was not released stable, and including incompatible changes might not have much impact.
Or include an index of all RPM packages under the organization at the old address.

@delvh
Copy link
Member

delvh commented Jun 18, 2023

1.20.0 was not released stable

Yes, but we are already in feature freeze for 1.20.
This means that we won't add new features (or breaking changes) for it anymore.

@KN4CK3R
Copy link
Member

KN4CK3R commented Jun 19, 2023

I looked into the RPM tags and it looks like there is no way (?) to read the distribution from a RPM file. There are RPMTAG_DISTTAG and RPMTAG_DISTRIBUTION but both were always empty in my tests. So the distribution must be specified when uploading a package. I don't currently know if we want to support a component level. Some use them, others don't. If we decide to support it, we basicaly force everyone to use it because otherwise the api routing gets painful. Since the users are free to choose whatever they like as distribution and architecture we can't provide helper variables like $releasever and $basearch in the repo file because they may never match. A repo file with different "endpoints" looks nice but may therefore not usable and we would have to provide multiple repo files for every combination.

If we decide to change the current "flat" logic I would just make it a breaking change. Reuploading existing packages with the correct distribution should not be as hard as supporting a "legacy" api.

@nephatrine
Copy link
Contributor

nephatrine commented Jun 20, 2023

I'm certainly not arguing we need "components" and agree that we can skip them if need be, I only mentioned them for the sake of debian parity. A way to specify distribution is the critical necessity. While every RPM repo I've seen in the wild does split it out by architecture as well, I'm not sure there is a genuine technical need for that since that information is stored in the RPM... but I've only done limited testing so there may be some instance where it is useful or even necessary.

This might be a stretch, but would it be possible to allow the user-provided "distribution" to include "/"? Then a user could specify the arch or even component with just that one token so you could have just "8" or "8/aarch64" or "8/aarch64/edge" etc. depending on the needs of the project? Or would that be too complex or open to abuse?

@ExplodingDragon
Copy link
Contributor Author

ExplodingDragon commented Jun 22, 2023

but would it be possible to allow the user-provided "distribution" to include "/"? Then a user could specify the arch or even component with just that one token so you could have just "8" or "8/aarch64" or "8/aarch64/edge" etc.

There is no need to be so complicated, YUM/DNF can recognize packages of different architectures under mixed repositories, even src.rpm .

Similar to

dnf config-manager --add-repo https://gitea.example.com/api/packages/{owner}/rpm/{distribution}.repo 

to make the distinction.

EDIT: The distribution here is provided by the user, e.g. centos-core, rocky-9-nonfree, and does not represent the final Linux distribution.

@nephatrine
Copy link
Contributor

Yeah I suppose if the distribution is just arbitrary and not supposed to be a releasever, then that absolutely works. Does gitea handle src rpms? I must say I didn't even try that yet.

@ExplodingDragon
Copy link
Contributor Author

Any progress?

hybrid yum repository is simply not available for production environments.

ExplodingDragon added a commit to ExplodingDragon/gitea that referenced this issue Jul 13, 2023
lunny pushed a commit that referenced this issue Jan 12, 2024
The current rpm repository places all packages in the same repository,
and different systems (el7,f34) may hit packages that do not belong to
this distribution ( #25304 ) , which now supports grouping of rpm.

![图片](https://github.com/go-gitea/gitea/assets/33776693/d1e1d99f-7799-4b2b-a19b-cb2a5c692914)

Fixes #25304 .
Fixes #27056 .

Refactor: [#25866](#25866)
fuxiaohei pushed a commit to fuxiaohei/gitea that referenced this issue Jan 17, 2024
The current rpm repository places all packages in the same repository,
and different systems (el7,f34) may hit packages that do not belong to
this distribution ( go-gitea#25304 ) , which now supports grouping of rpm.

![图片](https://github.com/go-gitea/gitea/assets/33776693/d1e1d99f-7799-4b2b-a19b-cb2a5c692914)

Fixes go-gitea#25304 .
Fixes go-gitea#27056 .

Refactor: [go-gitea#25866](go-gitea#25866)
silverwind pushed a commit to silverwind/gitea that referenced this issue Feb 20, 2024
The current rpm repository places all packages in the same repository,
and different systems (el7,f34) may hit packages that do not belong to
this distribution ( go-gitea#25304 ) , which now supports grouping of rpm.

![图片](https://github.com/go-gitea/gitea/assets/33776693/d1e1d99f-7799-4b2b-a19b-cb2a5c692914)

Fixes go-gitea#25304 .
Fixes go-gitea#27056 .

Refactor: [go-gitea#25866](go-gitea#25866)
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
topic/packages type/feature Completely new functionality. Can only be merged if feature freeze is not active. type/proposal The new feature has not been accepted yet but needs to be discussed first.
Projects
None yet
4 participants