1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
|
From: Christoph Fiehe <christoph.fiehe@eurodata.de>
Date: Mon, 14 Apr 2025 13:20:08 +0200
Signed-off-by: Christoph Fiehe <christoph.fiehe@eurodata.de>
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.
|