From abebdb94a5acb2288164d1fb38b884037b0b2c1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Delafond?= Date: Mon, 28 Apr 2025 15:30:38 +0200 Subject: [PATCH] Do not re-publish unchanged files to S3 every single time (Closes: #1104299) --- debian/patches/0005-Fixes-Issue-1435.patch | 49 ++++++++++++++++++++++ debian/patches/series | 1 + 2 files changed, 50 insertions(+) create mode 100644 debian/patches/0005-Fixes-Issue-1435.patch diff --git a/debian/patches/0005-Fixes-Issue-1435.patch b/debian/patches/0005-Fixes-Issue-1435.patch new file mode 100644 index 00000000..af2524ad --- /dev/null +++ b/debian/patches/0005-Fixes-Issue-1435.patch @@ -0,0 +1,49 @@ +From: Christoph Fiehe +Date: Mon, 14 Apr 2025 13:20:08 +0200 +Signed-off-by: Christoph Fiehe +Description: Fixes Issue#1435. + Do not re-publish unchanged files to S3 every single time. +Origin: commit:https://github.com/aptly-dev/aptly/commit/67bd15487d5760fccae32516061d57d1ccbb0ebf +Applied-Upstream: 1.6.2 +Bug: https://github.com/aptly-dev/aptly/issues/1435 +Bug-Debian: https://bugs.debian.org/1104299 +--- + s3/public.go | 4 ++-- + s3/public_test.go | 2 +- + 2 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/s3/public.go b/s3/public.go +index 47623a0..234a4b2 100644 +--- a/s3/public.go ++++ b/s3/public.go +@@ -338,7 +338,7 @@ func (storage *PublishedStorage) LinkFromPool(publishedPrefix, publishedRelPath, + poolPath := filepath.Join(storage.prefix, relPath) + + if storage.pathCache == nil { +- paths, md5s, err := storage.internalFilelist(filepath.Join(storage.prefix, publishedPrefix, "pool"), true) ++ paths, md5s, err := storage.internalFilelist(filepath.Join(publishedPrefix, "pool"), true) + if err != nil { + return errors.Wrap(err, "error caching paths under prefix") + } +@@ -346,7 +346,7 @@ func (storage *PublishedStorage) LinkFromPool(publishedPrefix, publishedRelPath, + storage.pathCache = make(map[string]string, len(paths)) + + for i := range paths { +- storage.pathCache[paths[i]] = md5s[i] ++ storage.pathCache[filepath.Join("pool", paths[i])] = md5s[i] + } + } + +diff --git a/s3/public_test.go b/s3/public_test.go +index 83605e3..a6631da 100644 +--- a/s3/public_test.go ++++ b/s3/public_test.go +@@ -370,7 +370,7 @@ func (s *PublishedStorageSuite) TestLinkFromPoolCache(c *C) { + + // Check only one listing request was done to the server + s.checkGetRequestsEqual(c, "/test?", []string{ +- "/test?list-type=2&max-keys=1000&prefix=lala%2Flala%2Fpool%2F", ++ "/test?list-type=2&max-keys=1000&prefix=lala%2Fpool%2F", + }) + + // Publish two packages at a prefixed storage plus a publish prefix. diff --git a/debian/patches/series b/debian/patches/series index 53e8cff3..600547df 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1,3 +1,4 @@ 0001-disable-swagger.patch 0002-disable-new-azure-sdk.patch 0004-tests-no-upstream-s-etcd-install-as-it-s-arch-specif.patch +0005-Fixes-Issue-1435.patch