summaryrefslogtreecommitdiffstats
path: root/models/packages/descriptor.go
diff options
context:
space:
mode:
authorKN4CK3R <admin@oldschoolhack.me>2023-04-28 23:51:36 +0200
committerGitHub <noreply@github.com>2023-04-28 17:51:36 -0400
commitbf77e2163b670797d5bf7199da88789968e47c61 (patch)
tree9cd8d0af2d05df59aa2169abeaa99ea7f6be45e3 /models/packages/descriptor.go
parentbc4e06109dae33edc0a9a918f244563f05a1a353 (diff)
downloadgitea-bf77e2163b670797d5bf7199da88789968e47c61.tar.gz
gitea-bf77e2163b670797d5bf7199da88789968e47c61.zip
Add Debian package registry (#22854)
Co-authored-by: @awkwardbunny This PR adds a Debian package registry. You can follow [this tutorial](https://www.baeldung.com/linux/create-debian-package) to build a *.deb package for testing. Source packages are not supported at the moment and I did not find documentation of the architecture "all" and how these packages should be treated. --------- Co-authored-by: Brian Hong <brian@hongs.me> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Diffstat (limited to 'models/packages/descriptor.go')
-rw-r--r--models/packages/descriptor.go26
1 files changed, 19 insertions, 7 deletions
diff --git a/models/packages/descriptor.go b/models/packages/descriptor.go
index 974c5b2c36..9256dd5630 100644
--- a/models/packages/descriptor.go
+++ b/models/packages/descriptor.go
@@ -18,6 +18,7 @@ import (
"code.gitea.io/gitea/modules/packages/conan"
"code.gitea.io/gitea/modules/packages/conda"
"code.gitea.io/gitea/modules/packages/container"
+ "code.gitea.io/gitea/modules/packages/debian"
"code.gitea.io/gitea/modules/packages/helm"
"code.gitea.io/gitea/modules/packages/maven"
"code.gitea.io/gitea/modules/packages/npm"
@@ -127,13 +128,9 @@ func GetPackageDescriptor(ctx context.Context, pv *PackageVersion) (*PackageDesc
return nil, err
}
- pfds := make([]*PackageFileDescriptor, 0, len(pfs))
- for _, pf := range pfs {
- pfd, err := GetPackageFileDescriptor(ctx, pf)
- if err != nil {
- return nil, err
- }
- pfds = append(pfds, pfd)
+ pfds, err := GetPackageFileDescriptors(ctx, pfs)
+ if err != nil {
+ return nil, err
}
var metadata interface{}
@@ -150,6 +147,8 @@ func GetPackageDescriptor(ctx context.Context, pv *PackageVersion) (*PackageDesc
metadata = &conda.VersionMetadata{}
case TypeContainer:
metadata = &container.Metadata{}
+ case TypeDebian:
+ metadata = &debian.Metadata{}
case TypeGeneric:
// generic packages have no metadata
case TypeHelm:
@@ -210,6 +209,19 @@ func GetPackageFileDescriptor(ctx context.Context, pf *PackageFile) (*PackageFil
}, nil
}
+// GetPackageFileDescriptors gets the package file descriptors for the package files
+func GetPackageFileDescriptors(ctx context.Context, pfs []*PackageFile) ([]*PackageFileDescriptor, error) {
+ pfds := make([]*PackageFileDescriptor, 0, len(pfs))
+ for _, pf := range pfs {
+ pfd, err := GetPackageFileDescriptor(ctx, pf)
+ if err != nil {
+ return nil, err
+ }
+ pfds = append(pfds, pfd)
+ }
+ return pfds, nil
+}
+
// GetPackageDescriptors gets the package descriptions for the versions
func GetPackageDescriptors(ctx context.Context, pvs []*PackageVersion) ([]*PackageDescriptor, error) {
pds := make([]*PackageDescriptor, 0, len(pvs))