mirror of
https://github.com/hashicorp/packer.git
synced 2026-05-28 04:35:38 -04:00
Bump github.com/pierrec/lz4 to v4.1.18
This commit is contained in:
parent
7eb6a45cd4
commit
d56db70a57
5 changed files with 29 additions and 7 deletions
3
go.mod
3
go.mod
|
|
@ -38,7 +38,7 @@ require (
|
|||
github.com/mitchellh/panicwrap v1.0.0
|
||||
github.com/mitchellh/prefixedio v0.0.0-20151214002211-6e6954073784
|
||||
github.com/packer-community/winrmcp v0.0.0-20180921211025-c76d91c1e7db // indirect
|
||||
github.com/pierrec/lz4 v2.6.1+incompatible
|
||||
github.com/pierrec/lz4 v2.6.1+incompatible // indirect
|
||||
github.com/pkg/sftp v1.13.2 // indirect
|
||||
github.com/posener/complete v1.2.3
|
||||
github.com/stretchr/testify v1.8.2
|
||||
|
|
@ -70,6 +70,7 @@ require (
|
|||
github.com/hashicorp/packer-plugin-vmware v1.0.7
|
||||
github.com/hashicorp/packer-plugin-vsphere v1.1.1
|
||||
github.com/oklog/ulid v1.3.1
|
||||
github.com/pierrec/lz4/v4 v4.1.18
|
||||
github.com/shirou/gopsutil/v3 v3.23.4
|
||||
)
|
||||
|
||||
|
|
|
|||
2
go.sum
2
go.sum
|
|
@ -643,6 +643,8 @@ github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi
|
|||
github.com/pierrec/lz4 v2.5.2+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY=
|
||||
github.com/pierrec/lz4 v2.6.1+incompatible h1:9UY3+iC23yxF0UfGaYrGplQ+79Rg+h/q9FV9ix19jjM=
|
||||
github.com/pierrec/lz4 v2.6.1+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY=
|
||||
github.com/pierrec/lz4/v4 v4.1.18 h1:xaKrnTkyoqfh1YItXl56+6KJNVYWlEEPuAQW9xsplYQ=
|
||||
github.com/pierrec/lz4/v4 v4.1.18/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4=
|
||||
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pkg/errors v0.8.1-0.20171018195549-f15c970de5b7/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ import (
|
|||
|
||||
"github.com/biogo/hts/bgzf"
|
||||
"github.com/klauspost/pgzip"
|
||||
"github.com/pierrec/lz4"
|
||||
"github.com/pierrec/lz4/v4"
|
||||
"github.com/ulikunitz/xz"
|
||||
)
|
||||
|
||||
|
|
@ -190,7 +190,7 @@ func (c *Compressor) BenchmarkPGZIPReader(b *testing.B) {
|
|||
func (c *Compressor) BenchmarkLZ4Writer(b *testing.B) {
|
||||
cw := lz4.NewWriter(c.w)
|
||||
// cw.Header.HighCompression = true
|
||||
cw.Header.NoChecksum = true
|
||||
cw.Apply(lz4.ChecksumOption(false))
|
||||
b.ResetTimer()
|
||||
|
||||
_, err := io.Copy(cw, c.r)
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ import (
|
|||
"github.com/hashicorp/packer-plugin-sdk/template/config"
|
||||
"github.com/hashicorp/packer-plugin-sdk/template/interpolate"
|
||||
"github.com/klauspost/pgzip"
|
||||
"github.com/pierrec/lz4"
|
||||
"github.com/pierrec/lz4/v4"
|
||||
"github.com/ulikunitz/xz"
|
||||
)
|
||||
|
||||
|
|
@ -333,8 +333,27 @@ func makeBZIP2Writer(output io.Writer, compressionLevel int) (io.WriteCloser, er
|
|||
|
||||
func makeLZ4Writer(output io.WriteCloser, compressionLevel int) (io.WriteCloser, error) {
|
||||
lzwriter := lz4.NewWriter(output)
|
||||
if compressionLevel > 0 {
|
||||
lzwriter.Header.CompressionLevel = compressionLevel
|
||||
if compressionLevel < 0 {
|
||||
return lzwriter, nil
|
||||
}
|
||||
levels := map[int]lz4.CompressionLevel{
|
||||
0: lz4.Fast,
|
||||
1: lz4.Level1,
|
||||
2: lz4.Level2,
|
||||
3: lz4.Level3,
|
||||
4: lz4.Level4,
|
||||
5: lz4.Level5,
|
||||
6: lz4.Level6,
|
||||
7: lz4.Level7,
|
||||
8: lz4.Level8,
|
||||
9: lz4.Level9,
|
||||
}
|
||||
level, ok := levels[compressionLevel]
|
||||
if !ok {
|
||||
return nil, ErrInvalidCompressionLevel
|
||||
}
|
||||
if err := lzwriter.Apply(lz4.CompressionLevelOption(level)); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return lzwriter, nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ import (
|
|||
packersdk "github.com/hashicorp/packer-plugin-sdk/packer"
|
||||
"github.com/hashicorp/packer-plugin-sdk/template"
|
||||
"github.com/hashicorp/packer/builder/file"
|
||||
"github.com/pierrec/lz4"
|
||||
"github.com/pierrec/lz4/v4"
|
||||
)
|
||||
|
||||
func TestDetectFilename(t *testing.T) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue