mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-07-16 12:08:04 +00:00
Refresh patches (and remove not relevant patches)
This commit is contained in:
@@ -1,57 +0,0 @@
|
|||||||
From: Shengjing Zhu <zhsj@debian.org>
|
|
||||||
Date: Tue, 26 Mar 2019 15:49:40 +0800
|
|
||||||
Subject: Fix UUID struct field not encoded in msgpack
|
|
||||||
|
|
||||||
Upstream uses the old codec library, so there's no problem.
|
|
||||||
Bug-Debian: https://bugs.debian.org/923866
|
|
||||||
Forwarded: no
|
|
||||||
---
|
|
||||||
deb/local.go | 4 ++--
|
|
||||||
deb/snapshot.go | 6 +++---
|
|
||||||
2 files changed, 5 insertions(+), 5 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/deb/local.go b/deb/local.go
|
|
||||||
index 229f6e1..5b8eb2a 100644
|
|
||||||
--- a/deb/local.go
|
|
||||||
+++ b/deb/local.go
|
|
||||||
@@ -15,7 +15,7 @@ import (
|
|
||||||
// LocalRepo is a collection of packages created locally
|
|
||||||
type LocalRepo struct {
|
|
||||||
// Permanent internal ID
|
|
||||||
- UUID string `json:"-"`
|
|
||||||
+ UUID string `codec:"UUID" json:"-"`
|
|
||||||
// User-assigned name
|
|
||||||
Name string
|
|
||||||
// Comment
|
|
||||||
@@ -25,7 +25,7 @@ type LocalRepo struct {
|
|
||||||
// DefaultComponent
|
|
||||||
DefaultComponent string `codec:",omitempty"`
|
|
||||||
// Uploaders configuration
|
|
||||||
- Uploaders *Uploaders `code:",omitempty" json:"-"`
|
|
||||||
+ Uploaders *Uploaders `codec:"Uploaders,omitempty" json:"-"`
|
|
||||||
// "Snapshot" of current list of packages
|
|
||||||
packageRefs *PackageRefList
|
|
||||||
}
|
|
||||||
diff --git a/deb/snapshot.go b/deb/snapshot.go
|
|
||||||
index 307433a..aef19ae 100644
|
|
||||||
--- a/deb/snapshot.go
|
|
||||||
+++ b/deb/snapshot.go
|
|
||||||
@@ -19,15 +19,15 @@ import (
|
|
||||||
// Snapshot is immutable state of repository: list of packages
|
|
||||||
type Snapshot struct {
|
|
||||||
// Persisten internal ID
|
|
||||||
- UUID string `json:"-"`
|
|
||||||
+ UUID string `codec:"UUID" json:"-"`
|
|
||||||
// Human-readable name
|
|
||||||
Name string
|
|
||||||
// Date of creation
|
|
||||||
CreatedAt time.Time
|
|
||||||
|
|
||||||
// Source: kind + ID
|
|
||||||
- SourceKind string `json:"-"`
|
|
||||||
- SourceIDs []string `json:"-"`
|
|
||||||
+ SourceKind string `codec:"SourceKind" json:"-"`
|
|
||||||
+ SourceIDs []string `codec:"SourceIDs" json:"-"`
|
|
||||||
// Description of how snapshot was created
|
|
||||||
Description string
|
|
||||||
|
|
||||||
+10
-10
@@ -10,11 +10,11 @@ Forwarded: https://github.com/aptly-dev/aptly/pull/830
|
|||||||
deb/snapshot.go | 3 ++-
|
deb/snapshot.go | 3 ++-
|
||||||
2 files changed, 4 insertions(+), 2 deletions(-)
|
2 files changed, 4 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
diff --git a/deb/remote.go b/deb/remote.go
|
Index: aptly/deb/remote.go
|
||||||
index 72165ba..316636d 100644
|
===================================================================
|
||||||
--- a/deb/remote.go
|
--- aptly.orig/deb/remote.go
|
||||||
+++ b/deb/remote.go
|
+++ aptly/deb/remote.go
|
||||||
@@ -662,7 +662,8 @@ func (repo *RemoteRepo) Decode(input []byte) error {
|
@@ -688,7 +688,8 @@ func (repo *RemoteRepo) Decode(input []b
|
||||||
decoder := codec.NewDecoderBytes(input, &codec.MsgpackHandle{})
|
decoder := codec.NewDecoderBytes(input, &codec.MsgpackHandle{})
|
||||||
err := decoder.Decode(repo)
|
err := decoder.Decode(repo)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -24,11 +24,11 @@ index 72165ba..316636d 100644
|
|||||||
// probably it is broken DB from go < 1.2, try decoding w/o time.Time
|
// probably it is broken DB from go < 1.2, try decoding w/o time.Time
|
||||||
var repo11 struct { // nolint: maligned
|
var repo11 struct { // nolint: maligned
|
||||||
UUID string
|
UUID string
|
||||||
diff --git a/deb/snapshot.go b/deb/snapshot.go
|
Index: aptly/deb/snapshot.go
|
||||||
index aef19ae..cefe82e 100644
|
===================================================================
|
||||||
--- a/deb/snapshot.go
|
--- aptly.orig/deb/snapshot.go
|
||||||
+++ b/deb/snapshot.go
|
+++ aptly/deb/snapshot.go
|
||||||
@@ -140,7 +140,8 @@ func (s *Snapshot) Decode(input []byte) error {
|
@@ -152,7 +152,8 @@ func (s *Snapshot) Decode(input []byte)
|
||||||
decoder := codec.NewDecoderBytes(input, &codec.MsgpackHandle{})
|
decoder := codec.NewDecoderBytes(input, &codec.MsgpackHandle{})
|
||||||
err := decoder.Decode(s)
|
err := decoder.Decode(s)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Vendored
-106
@@ -1,106 +0,0 @@
|
|||||||
Description: fix etag issue with s3 backend
|
|
||||||
The S3 backend relies on ETag S3 returns being equal to the MD5 of
|
|
||||||
the object, but it’s not necessarily true. For that purpose we store
|
|
||||||
the MD5 object in a separate metadata field as well to make sure it
|
|
||||||
isn’t lost. When the value returned clearly doesn’t look like a valid
|
|
||||||
MD5 hash (length isn’t exactly 32 characters), attempt to retrieve
|
|
||||||
the MD5 hash possibly stored in the metadata.
|
|
||||||
.
|
|
||||||
We cannot always do this since user-defined metadata isn’t returned
|
|
||||||
by the ListObjects call, so verifying it for each object is
|
|
||||||
expensive as it requires one HEAD request per each object.
|
|
||||||
Author: Andrej Shadura <andrew.shadura@collabora.co.uk>
|
|
||||||
Origin: upstream
|
|
||||||
Bug: https://github.com/aptly-dev/aptly/issues/923
|
|
||||||
Bug-Debian: 983877
|
|
||||||
Applied-Upstream: commit:2422d3a
|
|
||||||
Reviewed-by: Sebastien Delafond <sdelafond@gmail.com>
|
|
||||||
Last-Update: 2021-03-02
|
|
||||||
---
|
|
||||||
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
|
|
||||||
---
|
|
||||||
diff --git a/s3/public.go b/s3/public.go
|
|
||||||
index a3e85a99..d6c161ad 100644
|
|
||||||
--- a/s3/public.go
|
|
||||||
+++ b/s3/public.go
|
|
||||||
@@ -142,7 +142,7 @@ func (storage *PublishedStorage) PutFile(path string, sourceFilename string) err
|
|
||||||
}
|
|
||||||
defer source.Close()
|
|
||||||
|
|
||||||
- err = storage.putFile(path, source)
|
|
||||||
+ err = storage.putFile(path, source, "")
|
|
||||||
if err != nil {
|
|
||||||
err = errors.Wrap(err, fmt.Sprintf("error uploading %s to %s", sourceFilename, storage))
|
|
||||||
}
|
|
||||||
@@ -150,8 +150,22 @@ func (storage *PublishedStorage) PutFile(path string, sourceFilename string) err
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
+// getMD5 retrieves MD5 stored in the metadata, if any
|
|
||||||
+func (storage *PublishedStorage) getMD5(path string) (string, error) {
|
|
||||||
+ params := &s3.HeadObjectInput{
|
|
||||||
+ Bucket: aws.String(storage.bucket),
|
|
||||||
+ Key: aws.String(filepath.Join(storage.prefix, path)),
|
|
||||||
+ }
|
|
||||||
+ output, err := storage.s3.HeadObject(params)
|
|
||||||
+ if err != nil {
|
|
||||||
+ return "", err
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ return aws.StringValue(output.Metadata["Md5"]), nil
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
// putFile uploads file-like object to
|
|
||||||
-func (storage *PublishedStorage) putFile(path string, source io.ReadSeeker) error {
|
|
||||||
+func (storage *PublishedStorage) putFile(path string, source io.ReadSeeker, sourceMD5 string) error {
|
|
||||||
|
|
||||||
params := &s3.PutObjectInput{
|
|
||||||
Bucket: aws.String(storage.bucket),
|
|
||||||
@@ -165,6 +179,11 @@ func (storage *PublishedStorage) putFile(path string, source io.ReadSeeker) erro
|
|
||||||
if storage.encryptionMethod != "" {
|
|
||||||
params.ServerSideEncryption = aws.String(storage.encryptionMethod)
|
|
||||||
}
|
|
||||||
+ if sourceMD5 != "" {
|
|
||||||
+ params.Metadata = map[string]*string{
|
|
||||||
+ "Md5": aws.String(sourceMD5),
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
|
|
||||||
_, err := storage.s3.PutObject(params)
|
|
||||||
if err != nil {
|
|
||||||
@@ -177,7 +196,7 @@ func (storage *PublishedStorage) putFile(path string, source io.ReadSeeker) erro
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
- return storage.putFile(strings.Replace(path, "+", " ", -1), source)
|
|
||||||
+ return storage.putFile(strings.Replace(path, "+", " ", -1), source, sourceMD5)
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
@@ -298,6 +317,17 @@ func (storage *PublishedStorage) LinkFromPool(publishedDirectory, fileName strin
|
|
||||||
sourceMD5 := sourceChecksums.MD5
|
|
||||||
|
|
||||||
if exists {
|
|
||||||
+ if len(destinationMD5) != 32 {
|
|
||||||
+ // doesn’t look like a valid MD5,
|
|
||||||
+ // attempt to fetch one from the metadata
|
|
||||||
+ var err error
|
|
||||||
+ destinationMD5, err = storage.getMD5(relPath)
|
|
||||||
+ if err != nil {
|
|
||||||
+ err = errors.Wrap(err, fmt.Sprintf("error verifying MD5 for %s: %s", storage, poolPath))
|
|
||||||
+ return err
|
|
||||||
+ }
|
|
||||||
+ storage.pathCache[relPath] = destinationMD5
|
|
||||||
+ }
|
|
||||||
if sourceMD5 == "" {
|
|
||||||
return fmt.Errorf("unable to compare object, MD5 checksum missing")
|
|
||||||
}
|
|
||||||
@@ -318,7 +348,7 @@ func (storage *PublishedStorage) LinkFromPool(publishedDirectory, fileName strin
|
|
||||||
}
|
|
||||||
defer source.Close()
|
|
||||||
|
|
||||||
- err = storage.putFile(relPath, source)
|
|
||||||
+ err = storage.putFile(relPath, source, sourceMD5)
|
|
||||||
if err == nil {
|
|
||||||
storage.pathCache[relPath] = sourceMD5
|
|
||||||
} else {
|
|
||||||
Vendored
+1
-3
@@ -1,4 +1,2 @@
|
|||||||
Fix-UUID-struct-field-not-encoded-in-msgpack.patch
|
|
||||||
Fix-time.Time-msgpack-decoding-backwards-compatibili.patch
|
Fix-time.Time-msgpack-decoding-backwards-compatibili.patch
|
||||||
s3-etag.patch
|
|
||||||
zstd.patch
|
|
||||||
|
|||||||
Vendored
-45
@@ -1,45 +0,0 @@
|
|||||||
Description: Add support for zst compression
|
|
||||||
Origin: https://github.com/aptly-dev/aptly/pull/1050/files/e686753656b340abbb80c593f43879bfc9806cfd
|
|
||||||
Reviewed-By: Anton Gladky <gladk@debian.org>
|
|
||||||
Last-Update: 2022-04-29
|
|
||||||
|
|
||||||
Index: aptly/deb/deb.go
|
|
||||||
===================================================================
|
|
||||||
--- aptly.orig/deb/deb.go
|
|
||||||
+++ aptly/deb/deb.go
|
|
||||||
@@ -16,6 +16,7 @@ import (
|
|
||||||
|
|
||||||
"github.com/aptly-dev/aptly/pgp"
|
|
||||||
"github.com/kjk/lzma"
|
|
||||||
+ "github.com/klauspost/compress/zstd"
|
|
||||||
"github.com/smira/go-xz"
|
|
||||||
)
|
|
||||||
|
|
||||||
@@ -74,6 +75,13 @@ func GetControlFileFromDeb(packageFile s
|
|
||||||
}
|
|
||||||
defer unxz.Close()
|
|
||||||
tarInput = unxz
|
|
||||||
+ case "control.tar.zst":
|
|
||||||
+ unzstd, err := zstd.NewReader(bufReader)
|
|
||||||
+ if err != nil {
|
|
||||||
+ return nil, errors.Wrapf(err, "unable to unzstd %s from %s", header.Name, packageFile)
|
|
||||||
+ }
|
|
||||||
+ defer unzstd.Close()
|
|
||||||
+ tarInput = unzstd
|
|
||||||
default:
|
|
||||||
return nil, fmt.Errorf("unsupported tar compression in %s: %s", packageFile, header.Name)
|
|
||||||
}
|
|
||||||
@@ -189,6 +197,13 @@ func GetContentsFromDeb(file io.Reader,
|
|
||||||
unlzma := lzma.NewReader(bufReader)
|
|
||||||
defer unlzma.Close()
|
|
||||||
tarInput = unlzma
|
|
||||||
+ case "data.tar.zst":
|
|
||||||
+ unzstd, err := zstd.NewReader(bufReader)
|
|
||||||
+ if err != nil {
|
|
||||||
+ return nil, errors.Wrapf(err, "unable to unzstd %s from %s", header.Name, packageFile)
|
|
||||||
+ }
|
|
||||||
+ defer unzstd.Close()
|
|
||||||
+ tarInput = unzstd
|
|
||||||
default:
|
|
||||||
return nil, fmt.Errorf("unsupported tar compression in %s: %s", packageFile, header.Name)
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user