diff options
author | KN4CK3R <admin@oldschoolhack.me> | 2024-01-19 12:37:10 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-19 11:37:10 +0000 |
commit | 461d8b53c2e51a8a6a1715ba40ac61d7e9f93971 (patch) | |
tree | 2bad0b2908f9f3e76d9a195c4fe1c66016b8bcbf /routers/web/user | |
parent | 075c4c89ee28590bd4ab8f6cf7338d723c4696eb (diff) | |
download | gitea-461d8b53c2e51a8a6a1715ba40ac61d7e9f93971.tar.gz gitea-461d8b53c2e51a8a6a1715ba40ac61d7e9f93971.zip |
Fix some RPM registry flaws (#28782)
Related #26984
(https://github.com/go-gitea/gitea/pull/26984#issuecomment-1889588912)
Fix admin cleanup message.
Fix models `Get` not respecting default values.
Rebuild RPM repository files after cleanup.
Do not add RPM group to package version name.
Force stable sorting of Alpine/Debian/RPM repository data.
Fix missing deferred `Close`.
Add tests for multiple RPM groups.
Removed non-cached `ReplaceAllStringRegex`.
If there are multiple groups available, it's stated in the package
installation screen:
![grafik](https://github.com/go-gitea/gitea/assets/1666336/8f132760-882c-4ab8-9678-77e47dfc4415)
Diffstat (limited to 'routers/web/user')
-rw-r--r-- | routers/web/user/package.go | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/routers/web/user/package.go b/routers/web/user/package.go index d8da6a192e..708af3e43c 100644 --- a/routers/web/user/package.go +++ b/routers/web/user/package.go @@ -19,6 +19,7 @@ import ( "code.gitea.io/gitea/modules/log" alpine_module "code.gitea.io/gitea/modules/packages/alpine" debian_module "code.gitea.io/gitea/modules/packages/debian" + rpm_module "code.gitea.io/gitea/modules/packages/rpm" "code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/modules/util" "code.gitea.io/gitea/modules/web" @@ -195,9 +196,9 @@ func ViewPackageVersion(ctx *context.Context) { } } - ctx.Data["Branches"] = branches.Values() - ctx.Data["Repositories"] = repositories.Values() - ctx.Data["Architectures"] = architectures.Values() + ctx.Data["Branches"] = util.Sorted(branches.Values()) + ctx.Data["Repositories"] = util.Sorted(repositories.Values()) + ctx.Data["Architectures"] = util.Sorted(architectures.Values()) case packages_model.TypeDebian: distributions := make(container.Set[string]) components := make(container.Set[string]) @@ -216,9 +217,26 @@ func ViewPackageVersion(ctx *context.Context) { } } - ctx.Data["Distributions"] = distributions.Values() - ctx.Data["Components"] = components.Values() - ctx.Data["Architectures"] = architectures.Values() + ctx.Data["Distributions"] = util.Sorted(distributions.Values()) + ctx.Data["Components"] = util.Sorted(components.Values()) + ctx.Data["Architectures"] = util.Sorted(architectures.Values()) + case packages_model.TypeRpm: + groups := make(container.Set[string]) + architectures := make(container.Set[string]) + + for _, f := range pd.Files { + for _, pp := range f.Properties { + switch pp.Name { + case rpm_module.PropertyGroup: + groups.Add(pp.Value) + case rpm_module.PropertyArchitecture: + architectures.Add(pp.Value) + } + } + } + + ctx.Data["Groups"] = util.Sorted(groups.Values()) + ctx.Data["Architectures"] = util.Sorted(architectures.Values()) } var ( |