Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
15 changes: 15 additions & 0 deletions deb/deb.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down Expand Up @@ -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)
}
Expand Down Expand Up @@ -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)
}
Expand Down
11 changes: 10 additions & 1 deletion deb/deb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
)

type DebSuite struct {
debFile, debFile2, debFileWithXzControl, dscFile, dscFileNoSign string
debFile, debFile2, debFileWithXzControl, debFileWithZstdControl, dscFile, dscFileNoSign string
}

var _ = Suite(&DebSuite{})
Expand All @@ -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")
}
Expand All @@ -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{}

Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
Binary file not shown.