From dc884e6052242457569bfb8131ec097e777c1175 Mon Sep 17 00:00:00 2001 From: Itay Porezky Date: Sun, 29 Jun 2025 21:55:27 +0300 Subject: [PATCH] Removing non related actions from mirror update --- AUTHORS | 1 + Makefile | 4 +++- api/mirror.go | 49 +-------------------------------------- system/t12_api/mirrors.py | 1 - 4 files changed, 5 insertions(+), 50 deletions(-) diff --git a/AUTHORS b/AUTHORS index e9bb9f38..8eef529d 100644 --- a/AUTHORS +++ b/AUTHORS @@ -69,3 +69,4 @@ List of contributors, in chronological order: * Leigh London (https://github.com/leighlondon) * Gordian Schoenherr (https://github.com/schoenherrg) * Silke Hofstra (https://github.com/silkeh) +* Itay Porezky (https://github.com/itayporezky) \ No newline at end of file diff --git a/Makefile b/Makefile index ffe2e8a3..4692dfde 100644 --- a/Makefile +++ b/Makefile @@ -7,6 +7,8 @@ COVERAGE_DIR?=$(shell mktemp -d) GOOS=$(shell go env GOHOSTOS) GOARCH=$(shell go env GOHOSTARCH) +# Setting TZ for certificates +export TZ=UTC # Unit Tests and some sysmte tests rely on expired certificates, turn back the time export TEST_FAKETIME := 2025-01-02 03:04:05 @@ -200,7 +202,7 @@ docker-system-test: ## Run system tests in docker container (add TEST=t04_mirro azurite-stop docker-serve: ## Run development server (auto recompiling) on http://localhost:3142 - @docker run -it --rm -p 3142:3142 -v ${PWD}:/work/src aptly-dev /work/src/system/docker-wrapper serve || true + @docker run -it --rm -p 3142:3142 -v ${PWD}:/work/src -v /tmp/cache-go-aptly:/var/lib/aptly/.cache/go-build aptly-dev /work/src/system/docker-wrapper serve || true docker-lint: ## Run golangci-lint in docker container @docker run -it --rm -v ${PWD}:/work/src aptly-dev /work/src/system/docker-wrapper lint diff --git a/api/mirror.go b/api/mirror.go index f3dd123a..77de795c 100644 --- a/api/mirror.go +++ b/api/mirror.go @@ -333,26 +333,8 @@ func apiMirrorsPackages(c *gin.Context) { type mirrorUpdateParams struct { // Change mirror name to `Name` Name string ` json:"Name" example:"mirror1"` - // Url of the archive to mirror - ArchiveURL string ` json:"ArchiveURL" example:"http://deb.debian.org/debian"` - // Package query that is applied to mirror packages - Filter string ` json:"Filter" example:"xserver-xorg"` - // Limit mirror to those architectures, if not specified aptly would fetch all architectures - Architectures []string ` json:"Architectures" example:"amd64"` - // Components to mirror, if not specified aptly would fetch all components - Components []string ` json:"Components" example:"main"` // Gpg keyring(s) for verifing Release file Keyrings []string ` json:"Keyrings" example:"trustedkeys.gpg"` - // Set "true" to include dependencies of matching packages when filtering - FilterWithDeps bool ` json:"FilterWithDeps"` - // Set "true" to mirror source packages - DownloadSources bool ` json:"DownloadSources"` - // Set "true" to mirror udeb files - DownloadUdebs bool ` json:"DownloadUdebs"` - // Set "true" to skip checking if the given components are in the Release file - SkipComponentCheck bool ` json:"SkipComponentCheck"` - // Set "true" to skip checking if the given architectures are in the Release file - SkipArchitectureCheck bool ` json:"SkipArchitectureCheck"` // Set "true" to ignore checksum errors IgnoreChecksums bool ` json:"IgnoreChecksums"` // Set "true" to skip the verification of Release file signatures @@ -394,14 +376,6 @@ func apiMirrorsUpdate(c *gin.Context) { } b.Name = remote.Name - b.DownloadUdebs = remote.DownloadUdebs - b.DownloadSources = remote.DownloadSources - b.SkipComponentCheck = remote.SkipComponentCheck - b.SkipArchitectureCheck = remote.SkipArchitectureCheck - b.FilterWithDeps = remote.FilterWithDeps - b.Filter = remote.Filter - b.Architectures = remote.Architectures - b.Components = remote.Components b.IgnoreSignatures = context.Config().GpgDisableVerify log.Info().Msgf("%s: Starting mirror update", b.Name) @@ -418,27 +392,6 @@ func apiMirrorsUpdate(c *gin.Context) { } } - if b.DownloadUdebs != remote.DownloadUdebs { - if remote.IsFlat() && b.DownloadUdebs { - AbortWithJSONError(c, 400, fmt.Errorf("unable to update: flat mirrors don't support udebs")) - return - } - } - - if b.ArchiveURL != "" { - remote.SetArchiveRoot(b.ArchiveURL) - } - - remote.Name = b.Name - remote.DownloadUdebs = b.DownloadUdebs - remote.DownloadSources = b.DownloadSources - remote.SkipComponentCheck = b.SkipComponentCheck - remote.SkipArchitectureCheck = b.SkipArchitectureCheck - remote.FilterWithDeps = b.FilterWithDeps - remote.Filter = b.Filter - remote.Architectures = b.Architectures - remote.Components = b.Components - verifier, err := getVerifier(b.Keyrings) if err != nil { AbortWithJSONError(c, 400, fmt.Errorf("unable to initialize GPG verifier: %s", err)) @@ -461,7 +414,7 @@ func apiMirrorsUpdate(c *gin.Context) { } } - err = remote.DownloadPackageIndexes(out, downloader, verifier, collectionFactory, b.IgnoreSignatures, b.SkipComponentCheck) + err = remote.DownloadPackageIndexes(out, downloader, verifier, collectionFactory, b.IgnoreSignatures, remote.SkipComponentCheck) if err != nil { return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, fmt.Errorf("unable to update: %s", err) } diff --git a/system/t12_api/mirrors.py b/system/t12_api/mirrors.py index 6352b2ca..76104f39 100644 --- a/system/t12_api/mirrors.py +++ b/system/t12_api/mirrors.py @@ -56,7 +56,6 @@ class MirrorsAPITestCreateUpdate(APITest): resp = self.get("/api/mirrors/" + mirror_name + "/packages") self.check_equal(resp.status_code, 404) - mirror_desc["Name"] = self.random_name() resp = self.put_task("/api/mirrors/" + mirror_name, json=mirror_desc) self.check_task(resp) _id = resp.json()['ID']