summaryrefslogtreecommitdiffstats
path: root/models/packages
diff options
context:
space:
mode:
authorKN4CK3R <admin@oldschoolhack.me>2023-05-05 22:33:37 +0200
committerGitHub <noreply@github.com>2023-05-05 20:33:37 +0000
commit05209f0d1d4b996b8beb6633880b8fe12c15932b (patch)
treed8409611a63809641f34dfdfe48b5a239f8e5029 /models/packages
parent8f314c679309e5a64928ef70443ddddaae6a803a (diff)
downloadgitea-05209f0d1d4b996b8beb6633880b8fe12c15932b.tar.gz
gitea-05209f0d1d4b996b8beb6633880b8fe12c15932b.zip
Add RPM registry (#23380)
Fixes #20751 This PR adds a RPM package registry. You can follow [this tutorial](https://opensource.com/article/18/9/how-build-rpm-packages) to build a *.rpm package for testing. This functionality is similar to the Debian registry (#22854) and therefore shares some methods. I marked this PR as blocked because it should be merged after #22854. ![grafik](https://user-images.githubusercontent.com/1666336/223806549-d8784fd9-9d79-46a2-9ae2-f038594f636a.png)
Diffstat (limited to 'models/packages')
-rw-r--r--models/packages/descriptor.go3
-rw-r--r--models/packages/package.go6
-rw-r--r--models/packages/package_file.go2
3 files changed, 10 insertions, 1 deletions
diff --git a/models/packages/descriptor.go b/models/packages/descriptor.go
index 9256dd5630..1cac2eb022 100644
--- a/models/packages/descriptor.go
+++ b/models/packages/descriptor.go
@@ -25,6 +25,7 @@ import (
"code.gitea.io/gitea/modules/packages/nuget"
"code.gitea.io/gitea/modules/packages/pub"
"code.gitea.io/gitea/modules/packages/pypi"
+ "code.gitea.io/gitea/modules/packages/rpm"
"code.gitea.io/gitea/modules/packages/rubygems"
"code.gitea.io/gitea/modules/packages/swift"
"code.gitea.io/gitea/modules/packages/vagrant"
@@ -163,6 +164,8 @@ func GetPackageDescriptor(ctx context.Context, pv *PackageVersion) (*PackageDesc
metadata = &pub.Metadata{}
case TypePyPI:
metadata = &pypi.Metadata{}
+ case TypeRpm:
+ metadata = &rpm.VersionMetadata{}
case TypeRubyGems:
metadata = &rubygems.Metadata{}
case TypeSwift:
diff --git a/models/packages/package.go b/models/packages/package.go
index cc860b9a90..a817ab6ff1 100644
--- a/models/packages/package.go
+++ b/models/packages/package.go
@@ -44,6 +44,7 @@ const (
TypeNuGet Type = "nuget"
TypePub Type = "pub"
TypePyPI Type = "pypi"
+ TypeRpm Type = "rpm"
TypeRubyGems Type = "rubygems"
TypeSwift Type = "swift"
TypeVagrant Type = "vagrant"
@@ -64,6 +65,7 @@ var TypeList = []Type{
TypeNuGet,
TypePub,
TypePyPI,
+ TypeRpm,
TypeRubyGems,
TypeSwift,
TypeVagrant,
@@ -100,6 +102,8 @@ func (pt Type) Name() string {
return "Pub"
case TypePyPI:
return "PyPI"
+ case TypeRpm:
+ return "RPM"
case TypeRubyGems:
return "RubyGems"
case TypeSwift:
@@ -141,6 +145,8 @@ func (pt Type) SVGName() string {
return "gitea-pub"
case TypePyPI:
return "gitea-python"
+ case TypeRpm:
+ return "gitea-rpm"
case TypeRubyGems:
return "gitea-rubygems"
case TypeSwift:
diff --git a/models/packages/package_file.go b/models/packages/package_file.go
index 28e2a0111a..1c2c9ac072 100644
--- a/models/packages/package_file.go
+++ b/models/packages/package_file.go
@@ -118,7 +118,7 @@ func DeleteFileByID(ctx context.Context, fileID int64) error {
// PackageFileSearchOptions are options for SearchXXX methods
type PackageFileSearchOptions struct {
OwnerID int64
- PackageType string
+ PackageType Type
VersionID int64
Query string
CompositeKey string