diff options
Diffstat (limited to 'routers/api/packages')
21 files changed, 36 insertions, 9 deletions
diff --git a/routers/api/packages/alpine/alpine.go b/routers/api/packages/alpine/alpine.go index d499244dc3..c261eee2d2 100644 --- a/routers/api/packages/alpine/alpine.go +++ b/routers/api/packages/alpine/alpine.go @@ -62,7 +62,7 @@ func GetRepositoryKey(ctx *context.Context) { } func GetRepositoryFile(ctx *context.Context) { - pv, err := alpine_service.GetOrCreateRepositoryVersion(ctx.Package.Owner.ID) + pv, err := alpine_service.GetOrCreateRepositoryVersion(ctx, ctx.Package.Owner.ID) if err != nil { apiError(ctx, http.StatusInternalServerError, err) return @@ -134,6 +134,7 @@ func UploadPackageFile(ctx *context.Context) { } _, _, err = packages_service.CreatePackageOrAddFileToExisting( + ctx, &packages_service.PackageCreationInfo{ PackageInfo: packages_service.PackageInfo{ Owner: ctx.Package.Owner, @@ -227,7 +228,7 @@ func DeletePackageFile(ctx *context.Context) { return } - if err := packages_service.RemovePackageFileAndVersionIfUnreferenced(ctx.Doer, pfs[0]); err != nil { + if err := packages_service.RemovePackageFileAndVersionIfUnreferenced(ctx, ctx.Doer, pfs[0]); err != nil { if errors.Is(err, util.ErrNotExist) { apiError(ctx, http.StatusNotFound, err) } else { diff --git a/routers/api/packages/cargo/cargo.go b/routers/api/packages/cargo/cargo.go index 8c370339cd..225b6b5ade 100644 --- a/routers/api/packages/cargo/cargo.go +++ b/routers/api/packages/cargo/cargo.go @@ -214,6 +214,7 @@ func UploadPackage(ctx *context.Context) { } pv, _, err := packages_service.CreatePackageAndAddFile( + ctx, &packages_service.PackageCreationInfo{ PackageInfo: packages_service.PackageInfo{ Owner: ctx.Package.Owner, diff --git a/routers/api/packages/chef/chef.go b/routers/api/packages/chef/chef.go index 908f9fc4be..a1f5f49bd8 100644 --- a/routers/api/packages/chef/chef.go +++ b/routers/api/packages/chef/chef.go @@ -286,6 +286,7 @@ func UploadPackage(ctx *context.Context) { } _, _, err = packages_service.CreatePackageAndAddFile( + ctx, &packages_service.PackageCreationInfo{ PackageInfo: packages_service.PackageInfo{ Owner: ctx.Package.Owner, @@ -356,6 +357,7 @@ func DeletePackageVersion(ctx *context.Context) { packageVersion := ctx.Params("version") err := packages_service.RemovePackageVersionByNameAndVersion( + ctx, ctx.Doer, &packages_service.PackageInfo{ Owner: ctx.Package.Owner, @@ -390,7 +392,7 @@ func DeletePackage(ctx *context.Context) { } for _, pv := range pvs { - if err := packages_service.RemovePackageVersion(ctx.Doer, pv); err != nil { + if err := packages_service.RemovePackageVersion(ctx, ctx.Doer, pv); err != nil { apiError(ctx, http.StatusInternalServerError, err) return } diff --git a/routers/api/packages/composer/composer.go b/routers/api/packages/composer/composer.go index 75bbfdf4d3..313631d7d7 100644 --- a/routers/api/packages/composer/composer.go +++ b/routers/api/packages/composer/composer.go @@ -220,6 +220,7 @@ func UploadPackage(ctx *context.Context) { } _, _, err = packages_service.CreatePackageAndAddFile( + ctx, &packages_service.PackageCreationInfo{ PackageInfo: packages_service.PackageInfo{ Owner: ctx.Package.Owner, diff --git a/routers/api/packages/conan/conan.go b/routers/api/packages/conan/conan.go index 8edbe98b30..f440f83b24 100644 --- a/routers/api/packages/conan/conan.go +++ b/routers/api/packages/conan/conan.go @@ -408,6 +408,7 @@ func uploadFile(ctx *context.Context, fileFilter container.Set[string], fileKey } _, _, err = packages_service.CreatePackageOrAddFileToExisting( + ctx, pci, pfci, ) diff --git a/routers/api/packages/conda/conda.go b/routers/api/packages/conda/conda.go index 0bf0fc1f62..0bee7baa96 100644 --- a/routers/api/packages/conda/conda.go +++ b/routers/api/packages/conda/conda.go @@ -229,6 +229,7 @@ func UploadPackageFile(ctx *context.Context) { } _, _, err = packages_service.CreatePackageOrAddFileToExisting( + ctx, &packages_service.PackageCreationInfo{ PackageInfo: packages_service.PackageInfo{ Owner: ctx.Package.Owner, diff --git a/routers/api/packages/container/container.go b/routers/api/packages/container/container.go index 7bd5cadaaf..62eec3064c 100644 --- a/routers/api/packages/container/container.go +++ b/routers/api/packages/container/container.go @@ -653,7 +653,7 @@ func DeleteManifest(ctx *context.Context) { } for _, pv := range pvs { - if err := packages_service.RemovePackageVersion(ctx.Doer, pv); err != nil { + if err := packages_service.RemovePackageVersion(ctx, ctx.Doer, pv); err != nil { apiError(ctx, http.StatusInternalServerError, err) return } diff --git a/routers/api/packages/cran/cran.go b/routers/api/packages/cran/cran.go index 0ef6eff88d..ae43df7c9a 100644 --- a/routers/api/packages/cran/cran.go +++ b/routers/api/packages/cran/cran.go @@ -183,6 +183,7 @@ func uploadPackageFile(ctx *context.Context, compositeKey string, properties map } _, _, err = packages_service.CreatePackageOrAddFileToExisting( + ctx, &packages_service.PackageCreationInfo{ PackageInfo: packages_service.PackageInfo{ Owner: ctx.Package.Owner, diff --git a/routers/api/packages/debian/debian.go b/routers/api/packages/debian/debian.go index 869bc1e901..dc7ebab096 100644 --- a/routers/api/packages/debian/debian.go +++ b/routers/api/packages/debian/debian.go @@ -45,7 +45,7 @@ func GetRepositoryKey(ctx *context.Context) { // https://wiki.debian.org/DebianRepository/Format#A.22Release.22_files // https://wiki.debian.org/DebianRepository/Format#A.22Packages.22_Indices func GetRepositoryFile(ctx *context.Context) { - pv, err := debian_service.GetOrCreateRepositoryVersion(ctx.Package.Owner.ID) + pv, err := debian_service.GetOrCreateRepositoryVersion(ctx, ctx.Package.Owner.ID) if err != nil { apiError(ctx, http.StatusInternalServerError, err) return @@ -81,7 +81,7 @@ func GetRepositoryFile(ctx *context.Context) { // https://wiki.debian.org/DebianRepository/Format#indices_acquisition_via_hashsums_.28by-hash.29 func GetRepositoryFileByHash(ctx *context.Context) { - pv, err := debian_service.GetOrCreateRepositoryVersion(ctx.Package.Owner.ID) + pv, err := debian_service.GetOrCreateRepositoryVersion(ctx, ctx.Package.Owner.ID) if err != nil { apiError(ctx, http.StatusInternalServerError, err) return @@ -159,6 +159,7 @@ func UploadPackageFile(ctx *context.Context) { } _, _, err = packages_service.CreatePackageOrAddFileToExisting( + ctx, &packages_service.PackageCreationInfo{ PackageInfo: packages_service.PackageInfo{ Owner: ctx.Package.Owner, diff --git a/routers/api/packages/generic/generic.go b/routers/api/packages/generic/generic.go index c5866ef9c3..30854335c0 100644 --- a/routers/api/packages/generic/generic.go +++ b/routers/api/packages/generic/generic.go @@ -89,6 +89,7 @@ func UploadPackage(ctx *context.Context) { defer buf.Close() _, _, err = packages_service.CreatePackageOrAddFileToExisting( + ctx, &packages_service.PackageCreationInfo{ PackageInfo: packages_service.PackageInfo{ Owner: ctx.Package.Owner, @@ -125,6 +126,7 @@ func UploadPackage(ctx *context.Context) { // DeletePackage deletes the specific generic package. func DeletePackage(ctx *context.Context) { err := packages_service.RemovePackageVersionByNameAndVersion( + ctx, ctx.Doer, &packages_service.PackageInfo{ Owner: ctx.Package.Owner, @@ -176,7 +178,7 @@ func DeletePackageFile(ctx *context.Context) { } if len(pfs) == 1 { - if err := packages_service.RemovePackageVersion(ctx.Doer, pv); err != nil { + if err := packages_service.RemovePackageVersion(ctx, ctx.Doer, pv); err != nil { apiError(ctx, http.StatusInternalServerError, err) return } diff --git a/routers/api/packages/goproxy/goproxy.go b/routers/api/packages/goproxy/goproxy.go index bacdc4ec62..18e0074ab4 100644 --- a/routers/api/packages/goproxy/goproxy.go +++ b/routers/api/packages/goproxy/goproxy.go @@ -185,6 +185,7 @@ func UploadPackage(ctx *context.Context) { } _, _, err = packages_service.CreatePackageAndAddFile( + ctx, &packages_service.PackageCreationInfo{ PackageInfo: packages_service.PackageInfo{ Owner: ctx.Package.Owner, diff --git a/routers/api/packages/helm/helm.go b/routers/api/packages/helm/helm.go index 9097adf29e..a8daa69dc3 100644 --- a/routers/api/packages/helm/helm.go +++ b/routers/api/packages/helm/helm.go @@ -174,6 +174,7 @@ func UploadPackage(ctx *context.Context) { } _, _, err = packages_service.CreatePackageOrAddFileToExisting( + ctx, &packages_service.PackageCreationInfo{ PackageInfo: packages_service.PackageInfo{ Owner: ctx.Package.Owner, diff --git a/routers/api/packages/maven/maven.go b/routers/api/packages/maven/maven.go index 6328e226ab..52e31e8033 100644 --- a/routers/api/packages/maven/maven.go +++ b/routers/api/packages/maven/maven.go @@ -356,6 +356,7 @@ func UploadPackageFile(ctx *context.Context) { } _, _, err = packages_service.CreatePackageOrAddFileToExisting( + ctx, pvci, pfci, ) diff --git a/routers/api/packages/npm/npm.go b/routers/api/packages/npm/npm.go index d1e271f23f..dd6b3f148b 100644 --- a/routers/api/packages/npm/npm.go +++ b/routers/api/packages/npm/npm.go @@ -190,6 +190,7 @@ func UploadPackage(ctx *context.Context) { defer buf.Close() pv, _, err := packages_service.CreatePackageAndAddFile( + ctx, &packages_service.PackageCreationInfo{ PackageInfo: packages_service.PackageInfo{ Owner: ctx.Package.Owner, @@ -255,6 +256,7 @@ func DeletePackageVersion(ctx *context.Context) { packageVersion := ctx.Params("version") err := packages_service.RemovePackageVersionByNameAndVersion( + ctx, ctx.Doer, &packages_service.PackageInfo{ Owner: ctx.Package.Owner, @@ -291,7 +293,7 @@ func DeletePackage(ctx *context.Context) { } for _, pv := range pvs { - if err := packages_service.RemovePackageVersion(ctx.Doer, pv); err != nil { + if err := packages_service.RemovePackageVersion(ctx, ctx.Doer, pv); err != nil { apiError(ctx, http.StatusInternalServerError, err) return } diff --git a/routers/api/packages/nuget/nuget.go b/routers/api/packages/nuget/nuget.go index 6f63c1d4c2..769c4c1824 100644 --- a/routers/api/packages/nuget/nuget.go +++ b/routers/api/packages/nuget/nuget.go @@ -431,6 +431,7 @@ func UploadPackage(ctx *context.Context) { } _, _, err := packages_service.CreatePackageAndAddFile( + ctx, &packages_service.PackageCreationInfo{ PackageInfo: packages_service.PackageInfo{ Owner: ctx.Package.Owner, @@ -503,6 +504,7 @@ func UploadSymbolPackage(ctx *context.Context) { } _, err = packages_service.AddFileToExistingPackage( + ctx, pi, &packages_service.PackageFileCreationInfo{ PackageFileInfo: packages_service.PackageFileInfo{ @@ -529,6 +531,7 @@ func UploadSymbolPackage(ctx *context.Context) { for _, pdb := range pdbs { _, err := packages_service.AddFileToExistingPackage( + ctx, pi, &packages_service.PackageFileCreationInfo{ PackageFileInfo: packages_service.PackageFileInfo{ @@ -647,6 +650,7 @@ func DeletePackage(ctx *context.Context) { packageVersion := ctx.Params("version") err := packages_service.RemovePackageVersionByNameAndVersion( + ctx, ctx.Doer, &packages_service.PackageInfo{ Owner: ctx.Package.Owner, diff --git a/routers/api/packages/pub/pub.go b/routers/api/packages/pub/pub.go index ef07836b88..8460f861cb 100644 --- a/routers/api/packages/pub/pub.go +++ b/routers/api/packages/pub/pub.go @@ -189,6 +189,7 @@ func UploadPackageFile(ctx *context.Context) { } _, _, err = packages_service.CreatePackageAndAddFile( + ctx, &packages_service.PackageCreationInfo{ PackageInfo: packages_service.PackageInfo{ Owner: ctx.Package.Owner, diff --git a/routers/api/packages/pypi/pypi.go b/routers/api/packages/pypi/pypi.go index d97b894bbe..8c7f9bbf38 100644 --- a/routers/api/packages/pypi/pypi.go +++ b/routers/api/packages/pypi/pypi.go @@ -145,6 +145,7 @@ func UploadPackageFile(ctx *context.Context) { } _, _, err = packages_service.CreatePackageOrAddFileToExisting( + ctx, &packages_service.PackageCreationInfo{ PackageInfo: packages_service.PackageInfo{ Owner: ctx.Package.Owner, diff --git a/routers/api/packages/rpm/rpm.go b/routers/api/packages/rpm/rpm.go index 65b7c74bdd..f5d8b67e16 100644 --- a/routers/api/packages/rpm/rpm.go +++ b/routers/api/packages/rpm/rpm.go @@ -59,7 +59,7 @@ func GetRepositoryKey(ctx *context.Context) { // Gets a pre-generated repository metadata file func GetRepositoryFile(ctx *context.Context) { - pv, err := rpm_service.GetOrCreateRepositoryVersion(ctx.Package.Owner.ID) + pv, err := rpm_service.GetOrCreateRepositoryVersion(ctx, ctx.Package.Owner.ID) if err != nil { apiError(ctx, http.StatusInternalServerError, err) return @@ -123,6 +123,7 @@ func UploadPackageFile(ctx *context.Context) { } _, _, err = packages_service.CreatePackageOrAddFileToExisting( + ctx, &packages_service.PackageCreationInfo{ PackageInfo: packages_service.PackageInfo{ Owner: ctx.Package.Owner, diff --git a/routers/api/packages/rubygems/rubygems.go b/routers/api/packages/rubygems/rubygems.go index 88d70f10bd..061fb0871b 100644 --- a/routers/api/packages/rubygems/rubygems.go +++ b/routers/api/packages/rubygems/rubygems.go @@ -234,6 +234,7 @@ func UploadPackageFile(ctx *context.Context) { } _, _, err = packages_service.CreatePackageAndAddFile( + ctx, &packages_service.PackageCreationInfo{ PackageInfo: packages_service.PackageInfo{ Owner: ctx.Package.Owner, @@ -280,6 +281,7 @@ func DeletePackage(ctx *context.Context) { packageVersion := ctx.FormString("version") err := packages_service.RemovePackageVersionByNameAndVersion( + ctx, ctx.Doer, &packages_service.PackageInfo{ Owner: ctx.Package.Owner, diff --git a/routers/api/packages/swift/swift.go b/routers/api/packages/swift/swift.go index bd4b8095c2..427e262d06 100644 --- a/routers/api/packages/swift/swift.go +++ b/routers/api/packages/swift/swift.go @@ -329,6 +329,7 @@ func UploadPackageFile(ctx *context.Context) { } pv, _, err := packages_service.CreatePackageAndAddFile( + ctx, &packages_service.PackageCreationInfo{ PackageInfo: packages_service.PackageInfo{ Owner: ctx.Package.Owner, diff --git a/routers/api/packages/vagrant/vagrant.go b/routers/api/packages/vagrant/vagrant.go index 9fe7ab56f6..af9cd08a62 100644 --- a/routers/api/packages/vagrant/vagrant.go +++ b/routers/api/packages/vagrant/vagrant.go @@ -177,6 +177,7 @@ func UploadPackageFile(ctx *context.Context) { } _, _, err = packages_service.CreatePackageOrAddFileToExisting( + ctx, &packages_service.PackageCreationInfo{ PackageInfo: packages_service.PackageInfo{ Owner: ctx.Package.Owner, |