diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bfa48f3432..0567f04fb0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,7 +27,7 @@ jobs: strategy: fail-fast: true matrix: - go: [1.14, 1.15, 1.16] + go: [1.15, 1.16] run_long_tests: [no] allow_failure: [false] include: diff --git a/deb/deb.go b/deb/deb.go index b0ff3fe302..8ce1371f4e 100644 --- a/deb/deb.go +++ b/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 string) (Stanza, error) { } 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, packageFile string) ([]string, error) { 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) } diff --git a/deb/deb_test.go b/deb/deb_test.go index 1892a73c69..146a252159 100644 --- a/deb/deb_test.go +++ b/deb/deb_test.go @@ -11,7 +11,7 @@ import ( ) type DebSuite struct { - debFile, debFile2, debFileWithXzControl, dscFile, dscFileNoSign string + debFile, debFile2, debFileWithXzControl, debFileWithZstdControl, dscFile, dscFileNoSign string } var _ = Suite(&DebSuite{}) @@ -21,6 +21,7 @@ func (s *DebSuite) SetUpSuite(c *C) { s.debFile = filepath.Join(filepath.Dir(_File), "../system/files/libboost-program-options-dev_1.49.0.1_i386.deb") s.debFile2 = filepath.Join(filepath.Dir(_File), "../system/changes/hardlink_0.2.1_amd64.deb") s.debFileWithXzControl = filepath.Join(filepath.Dir(_File), "../system/changes/libqt5concurrent5-dbgsym_5.9.1+dfsg-2+18.04+bionic+build4_amd64.ddeb") + s.debFileWithZstdControl = filepath.Join(filepath.Dir(_File), "../system/changes/libqt5concurrent5-dbgsym_5.15.2+dfsg-12_amd64.ddeb") s.dscFile = filepath.Join(filepath.Dir(_File), "../system/files/pyspi_0.6.1-1.3.dsc") s.dscFileNoSign = filepath.Join(filepath.Dir(_File), "../system/files/pyspi-0.6.1-1.3.stripped.dsc") } @@ -47,6 +48,14 @@ func (s *DebSuite) TestGetControlFileFromDebWithXzControl(c *C) { c.Check(st["Package"], Equals, "libqt5concurrent5-dbgsym") } +func (s *DebSuite) TestGetControlFileFromDebWithZstdControl(c *C) { + // Has control.tar.zstd archive inside. + st, err := GetControlFileFromDeb(s.debFileWithZstdControl) + c.Check(err, IsNil) + c.Check(st["Version"], Equals, "5.15.2+dfsg-12") + c.Check(st["Package"], Equals, "libqt5concurrent5-dbgsym") +} + func (s *DebSuite) TestGetControlFileFromDsc(c *C) { verifier := &pgp.GoVerifier{} diff --git a/go.mod b/go.mod index 81f0e500f9..9e3cbc54ff 100644 --- a/go.mod +++ b/go.mod @@ -16,6 +16,7 @@ require ( github.com/h2non/filetype v1.0.5 github.com/jlaffaye/ftp v0.0.0-20180404123514-2403248fa8cc // indirect github.com/kjk/lzma v0.0.0-20161016003348-3fd93898850d + github.com/klauspost/compress v1.13.6 github.com/mattn/go-colorable v0.1.2 // indirect github.com/mattn/go-runewidth v0.0.2 // indirect github.com/mattn/go-shellwords v1.0.2 diff --git a/go.sum b/go.sum index de0298a0ef..dec229bb38 100644 --- a/go.sum +++ b/go.sum @@ -52,6 +52,8 @@ github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af h1:pmfjZENx5i github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/kjk/lzma v0.0.0-20161016003348-3fd93898850d h1:RnWZeH8N8KXfbwMTex/KKMYMj0FJRCF6tQubUuQ02GM= github.com/kjk/lzma v0.0.0-20161016003348-3fd93898850d/go.mod h1:phT/jsRPBAEqjAibu1BurrabCBNTYiVI+zbmyCZJY6Q= +github.com/klauspost/compress v1.13.6 h1:P76CopJELS0TiO2mebmnzgWaajssP/EszplttgQxcgc= +github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= diff --git a/system/changes/libqt5concurrent5-dbgsym_5.15.2+dfsg-12_amd64.ddeb b/system/changes/libqt5concurrent5-dbgsym_5.15.2+dfsg-12_amd64.ddeb new file mode 100644 index 0000000000..1f040f543b Binary files /dev/null and b/system/changes/libqt5concurrent5-dbgsym_5.15.2+dfsg-12_amd64.ddeb differ