mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-06-15 07:00:52 +00:00
Rediff patches
Add 0003-tests-no-upstream-s-etcd-install-as-it-s-arch-specif.patch: <REASON> Drop 0004-tests-no-upstream-s-etcd-install-as-it-s-arch-specif.patch: <REASON> Drop 0005-Fixes-Issue-1435.patch: <REASON>
This commit is contained in:
+3
-3
@@ -18,10 +18,10 @@ This can be enabled once the following modules make it into Debian:
|
||||
create mode 100644 docs/index.go.disabled
|
||||
|
||||
diff --git a/api/router.go b/api/router.go
|
||||
index 3536ab0..7dbf16e 100644
|
||||
index 3cd7d42..cf53cd2 100644
|
||||
--- a/api/router.go
|
||||
+++ b/api/router.go
|
||||
@@ -12,9 +12,9 @@
|
||||
@@ -11,9 +11,9 @@
|
||||
"github.com/prometheus/client_golang/prometheus/promhttp"
|
||||
"github.com/rs/zerolog/log"
|
||||
|
||||
@@ -34,7 +34,7 @@ index 3536ab0..7dbf16e 100644
|
||||
)
|
||||
|
||||
var context *ctx.AptlyContext
|
||||
@@ -68,14 +68,14 @@ func Router(c *ctx.AptlyContext) http.Handler {
|
||||
@@ -63,14 +63,14 @@ func Router(c *ctx.AptlyContext) http.Handler {
|
||||
|
||||
router.Use(gin.Recovery(), gin.ErrorLogger())
|
||||
|
||||
|
||||
+32
-29
@@ -188,7 +188,7 @@ index 3f12678..b313f90 100644
|
||||
return err
|
||||
}
|
||||
diff --git a/azure/package_pool.go b/azure/package_pool.go
|
||||
index ad32a11..167ab6b 100644
|
||||
index 97be8e6..6d7af1a 100644
|
||||
--- a/azure/package_pool.go
|
||||
+++ b/azure/package_pool.go
|
||||
@@ -5,6 +5,7 @@
|
||||
@@ -258,7 +258,7 @@ index ad32a11..167ab6b 100644
|
||||
+ return nil, errors.Wrap(err, "error creating temporary file for blob download")
|
||||
}
|
||||
+
|
||||
defer os.Remove(temp.Name())
|
||||
defer func () { _ = os.Remove(temp.Name()) }()
|
||||
|
||||
- _, err = pool.az.client.DownloadFile(context.TODO(), pool.az.container, path, temp, nil)
|
||||
+ err = azblob.DownloadBlobToFile(context.Background(), blob, 0, 0, temp, azblob.DownloadFromBlobOptions{})
|
||||
@@ -304,7 +304,7 @@ index ad32a11..167ab6b 100644
|
||||
return "", err
|
||||
@@ -158,7 +161,7 @@ func (pool *PackagePool) Import(srcPath, basename string, checksums *utils.Check
|
||||
}
|
||||
defer source.Close()
|
||||
defer func() { _ = source.Close() }()
|
||||
|
||||
- err = pool.az.putFile(path, source, checksums.MD5)
|
||||
+ err = pool.az.putFile(blob, source, checksums.MD5)
|
||||
@@ -312,7 +312,7 @@ index ad32a11..167ab6b 100644
|
||||
return "", err
|
||||
}
|
||||
diff --git a/azure/package_pool_test.go b/azure/package_pool_test.go
|
||||
index a32bbff..58949ec 100644
|
||||
index ef562cb..6b1341d 100644
|
||||
--- a/azure/package_pool_test.go
|
||||
+++ b/azure/package_pool_test.go
|
||||
@@ -7,7 +7,7 @@
|
||||
@@ -338,10 +338,10 @@ index a32bbff..58949ec 100644
|
||||
|
||||
s.prefixedPool, err = NewPackagePool(s.accountName, s.accountKey, container, prefix, s.endpoint)
|
||||
diff --git a/azure/public.go b/azure/public.go
|
||||
index 8792ee2..50a8202 100644
|
||||
index 6775e14..efd2e7a 100644
|
||||
--- a/azure/public.go
|
||||
+++ b/azure/public.go
|
||||
@@ -3,21 +3,20 @@
|
||||
@@ -3,22 +3,21 @@
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
@@ -362,13 +362,14 @@ index 8792ee2..50a8202 100644
|
||||
|
||||
// PublishedStorage abstract file system with published files (actually hosted on Azure)
|
||||
type PublishedStorage struct {
|
||||
// FIXME: unused ???? prefix string
|
||||
+ container azblob.ContainerURL
|
||||
prefix string
|
||||
az *azContext
|
||||
pathCache map[string]map[string]string
|
||||
}
|
||||
@@ -67,7 +66,7 @@ func (storage *PublishedStorage) PutFile(path string, sourceFilename string) err
|
||||
}
|
||||
defer source.Close()
|
||||
defer func() { _ = source.Close() }()
|
||||
|
||||
- err = storage.az.putFile(path, source, sourceMD5)
|
||||
+ err = storage.az.putFile(storage.az.blobURL(path), source, sourceMD5)
|
||||
@@ -418,14 +419,14 @@ index 8792ee2..50a8202 100644
|
||||
storage.pathCache = make(map[string]map[string]string)
|
||||
@@ -160,7 +159,7 @@ func (storage *PublishedStorage) LinkFromPool(publishedPrefix, publishedRelPath,
|
||||
}
|
||||
defer source.Close()
|
||||
defer func() { _ = source.Close() }()
|
||||
|
||||
- err = storage.az.putFile(relFilePath, source, sourceMD5)
|
||||
+ err = storage.az.putFile(storage.az.blobURL(relFilePath), source, sourceMD5)
|
||||
if err == nil {
|
||||
pathCache[relFilePath] = sourceMD5
|
||||
} else {
|
||||
@@ -177,58 +176,57 @@ func (storage *PublishedStorage) Filelist(prefix string) ([]string, error) {
|
||||
@@ -177,60 +176,59 @@ func (storage *PublishedStorage) Filelist(prefix string) ([]string, error) {
|
||||
}
|
||||
|
||||
// Internal copy or move implementation
|
||||
@@ -440,21 +441,23 @@ index 8792ee2..50a8202 100644
|
||||
- blobLeaseClient, err := lease.NewBlobClient(srcBlobClient, &lease.BlobClientOptions{LeaseID: to.Ptr(leaseID)})
|
||||
- if err != nil {
|
||||
- return fmt.Errorf("error acquiring lease on source blob %s", src)
|
||||
- }
|
||||
-
|
||||
- _, err = blobLeaseClient.AcquireLease(context.Background(), leaseDuration, nil)
|
||||
- if err != nil {
|
||||
- return fmt.Errorf("error acquiring lease on source blob %s", src)
|
||||
+ dstBlobURL := storage.az.blobURL(dst)
|
||||
+ srcBlobURL := storage.az.blobURL(src)
|
||||
+ leaseResp, err := srcBlobURL.AcquireLease(context.Background(), "", leaseDuration, azblob.ModifiedAccessConditions{})
|
||||
+ if err != nil || leaseResp.StatusCode() != http.StatusCreated {
|
||||
+ return fmt.Errorf("error acquiring lease on source blob %s", srcBlobURL)
|
||||
}
|
||||
+ defer srcBlobURL.BreakLease(context.Background(), azblob.LeaseBreakNaturally, azblob.ModifiedAccessConditions{})
|
||||
defer func() {
|
||||
- _, _ = blobLeaseClient.BreakLease(context.Background(), &lease.BlobBreakOptions{BreakPeriod: to.Ptr(int32(60))})
|
||||
+ _, _ = srcBlobURL.BreakLease(context.Background(), azblob.LeaseBreakNaturally, azblob.ModifiedAccessConditions{})
|
||||
}()
|
||||
+ srcBlobLeaseID := leaseResp.LeaseID()
|
||||
|
||||
- _, err = blobLeaseClient.AcquireLease(context.Background(), leaseDuration, nil)
|
||||
- if err != nil {
|
||||
- return fmt.Errorf("error acquiring lease on source blob %s", src)
|
||||
- }
|
||||
- defer blobLeaseClient.BreakLease(context.Background(), &lease.BlobBreakOptions{BreakPeriod: to.Ptr(int32(60))})
|
||||
-
|
||||
- dstBlobClient := containerClient.NewBlobClient(dst)
|
||||
- copyResp, err := dstBlobClient.StartCopyFromURL(context.Background(), srcBlobClient.URL(), &blob.StartCopyFromURLOptions{
|
||||
- Metadata: metadata,
|
||||
@@ -517,7 +520,7 @@ index 8792ee2..50a8202 100644
|
||||
}
|
||||
} else {
|
||||
return fmt.Errorf("error copying %s -> %s in %s: %s", dst, src, storage, copyStatus)
|
||||
@@ -243,9 +241,7 @@ func (storage *PublishedStorage) RenameFile(oldName, newName string) error {
|
||||
@@ -245,9 +243,7 @@ func (storage *PublishedStorage) RenameFile(oldName, newName string) error {
|
||||
|
||||
// SymLink creates a copy of src file and adds link information as meta data
|
||||
func (storage *PublishedStorage) SymLink(src string, dst string) error {
|
||||
@@ -528,7 +531,7 @@ index 8792ee2..50a8202 100644
|
||||
}
|
||||
|
||||
// HardLink using symlink functionality as hard links do not exist
|
||||
@@ -255,33 +251,28 @@ func (storage *PublishedStorage) HardLink(src string, dst string) error {
|
||||
@@ -257,33 +253,28 @@ func (storage *PublishedStorage) HardLink(src string, dst string) error {
|
||||
|
||||
// FileExists returns true if path exists
|
||||
func (storage *PublishedStorage) FileExists(path string) (bool, error) {
|
||||
@@ -575,11 +578,11 @@ index 8792ee2..50a8202 100644
|
||||
+ return resp.NewMetadata()["SymLink"], nil
|
||||
}
|
||||
diff --git a/azure/public_test.go b/azure/public_test.go
|
||||
index 3acd767..767f249 100644
|
||||
index 5c912c5..f58ad51 100644
|
||||
--- a/azure/public_test.go
|
||||
+++ b/azure/public_test.go
|
||||
@@ -7,11 +7,8 @@
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"os"
|
||||
"path/filepath"
|
||||
- "bytes"
|
||||
@@ -619,9 +622,9 @@ index 3acd767..767f249 100644
|
||||
+ blob := s.storage.az.container.NewBlobURL(path)
|
||||
+ resp, err := blob.Download(context.Background(), 0, azblob.CountToEnd, azblob.BlobAccessConditions{}, false, azblob.ClientProvidedKeyOptions{})
|
||||
c.Assert(err, IsNil)
|
||||
- data, err := ioutil.ReadAll(resp.Body)
|
||||
- data, err := io.ReadAll(resp.Body)
|
||||
+ body := resp.Body(azblob.RetryReaderOptions{MaxRetryRequests: 3})
|
||||
+ data, err := ioutil.ReadAll(body)
|
||||
+ data, err := io.ReadAll(body)
|
||||
c.Assert(err, IsNil)
|
||||
return data
|
||||
}
|
||||
@@ -673,7 +676,7 @@ index 3acd767..767f249 100644
|
||||
err = s.prefixedStorage.LinkFromPool("", filepath.Join("pool", "main", "m/mars-invaders"), "mars-invaders_1.03.deb", pool, "wrong-looks-like-pathcache-doesnt-work", cksum1, false)
|
||||
c.Check(err, IsNil)
|
||||
diff --git a/context/context.go b/context/context.go
|
||||
index 5df5bbf..f9deaf3 100644
|
||||
index 0ffc3f7..503cad2 100644
|
||||
--- a/context/context.go
|
||||
+++ b/context/context.go
|
||||
@@ -100,6 +100,7 @@ func (context *AptlyContext) config() *utils.ConfigStructure {
|
||||
@@ -685,7 +688,7 @@ index 5df5bbf..f9deaf3 100644
|
||||
if os.IsPermission(err) || os.IsNotExist(err) {
|
||||
continue
|
||||
diff --git a/deb/list.go b/deb/list.go
|
||||
index 28644e4..14a311c 100644
|
||||
index 25a2d28..9eda528 100644
|
||||
--- a/deb/list.go
|
||||
+++ b/deb/list.go
|
||||
@@ -598,6 +598,7 @@ func (l *PackageList) Filter(options FilterOptions) (*PackageList, error) {
|
||||
@@ -697,10 +700,10 @@ index 28644e4..14a311c 100644
|
||||
if options.DependencyOptions&DepVerboseResolve == DepVerboseResolve && options.Progress != nil {
|
||||
options.Progress.ColoredPrintf("@{y}Already satisfied dependency@|: %s with %s", &dep, result.Search(dep, true, true))
|
||||
diff --git a/go.mod b/go.mod
|
||||
index 2f1de40..2d42ce6 100644
|
||||
index 53c5e78..d7f145a 100644
|
||||
--- a/go.mod
|
||||
+++ b/go.mod
|
||||
@@ -4,6 +4,7 @@ go 1.22.7
|
||||
@@ -4,6 +4,7 @@ go 1.24
|
||||
|
||||
require (
|
||||
github.com/AlekSi/pointer v1.1.0
|
||||
@@ -744,7 +747,7 @@ index 2f1de40..2d42ce6 100644
|
||||
github.com/aws/aws-sdk-go-v2 v1.32.5
|
||||
github.com/aws/aws-sdk-go-v2/config v1.28.5
|
||||
diff --git a/go.sum b/go.sum
|
||||
index 1e03143..6927ade 100644
|
||||
index 502f4b2..453a288 100644
|
||||
--- a/go.sum
|
||||
+++ b/go.sum
|
||||
@@ -1,17 +1,20 @@
|
||||
@@ -847,7 +850,7 @@ index 1e03143..6927ade 100644
|
||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||
golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4=
|
||||
golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU=
|
||||
@@ -333,14 +340,14 @@ golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
|
||||
@@ -333,14 +340,14 @@ golang.org/x/mod v0.23.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY=
|
||||
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
|
||||
+7
-6
@@ -4,26 +4,27 @@ Subject: tests: no upstream's etcd install as it's arch-specific,
|
||||
and no swagger-related or modules tasks
|
||||
|
||||
---
|
||||
Makefile | 9 ++-------
|
||||
1 file changed, 2 insertions(+), 7 deletions(-)
|
||||
Makefile | 11 +++--------
|
||||
1 file changed, 3 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/Makefile b/Makefile
|
||||
index 680c738..a50983c 100644
|
||||
index ffe2e8a..91f96a8 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -84,17 +84,12 @@ install:
|
||||
@@ -89,17 +89,12 @@ install:
|
||||
# go install -v
|
||||
@out=`mktemp`; if ! go install -v > $$out 2>&1; then cat $$out; rm -f $$out; echo "\nBuild failed\n"; exit 1; else rm -f $$out; fi
|
||||
|
||||
-test: prepare swagger etcd-install ## Run unit tests
|
||||
-test: prepare swagger etcd-install ## Run unit tests (add TEST=regex to specify which tests to run)
|
||||
- @echo "\e[33m\e[1mStarting etcd ...\e[0m"
|
||||
- @mkdir -p /tmp/aptly-etcd-data; system/t13_etcd/start-etcd.sh > /tmp/aptly-etcd-data/etcd.log 2>&1 &
|
||||
+test: ## Run unit tests
|
||||
@echo "\e[33m\e[1mRunning go test ...\e[0m"
|
||||
go test -v ./... -gocheck.v=true -coverprofile=unit.out; echo $$? > .unit-test.ret
|
||||
- faketime "$(TEST_FAKETIME)" go test -v ./... -gocheck.v=true -check.f "$(TEST)" -coverprofile=unit.out; echo $$? > .unit-test.ret
|
||||
- @echo "\e[33m\e[1mStopping etcd ...\e[0m"
|
||||
- @pid=`cat /tmp/etcd.pid`; kill $$pid
|
||||
- @rm -f /tmp/aptly-etcd-data/etcd.log
|
||||
+ go test -v ./... -gocheck.v=true -coverprofile=unit.out; echo $$? > .unit-test.ret
|
||||
@ret=`cat .unit-test.ret`; if [ "$$ret" = "0" ]; then echo "\n\e[32m\e[1mUnit Tests SUCCESSFUL\e[0m"; else echo "\n\e[31m\e[1mUnit Tests FAILED\e[0m"; fi; rm -f .unit-test.ret; exit $$ret
|
||||
|
||||
-system-test: prepare swagger etcd-install ## Run system tests
|
||||
-49
@@ -1,49 +0,0 @@
|
||||
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.
|
||||
Vendored
+1
-2
@@ -1,4 +1,3 @@
|
||||
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
|
||||
0003-tests-no-upstream-s-etcd-install-as-it-s-arch-specif.patch
|
||||
|
||||
Reference in New Issue
Block a user