Skip to content

Commit 8e6af84

Browse files
authored
refactor: update go-rpm library (#5215)
Bump go-rpm to new version and update path go-rpm library was moved to github.com/cavaliergopher/rpm. The checksum assertion has been removed as the method doesn't actually return the checksum but it's hardcoded to return the string sha256.
1 parent 6aa581c commit 8e6af84

File tree

4 files changed

+10
-52
lines changed

4 files changed

+10
-52
lines changed

NOTICE.txt

+3-31
Original file line numberDiff line numberDiff line change
@@ -139,12 +139,12 @@ THE SOFTWARE.
139139

140140

141141
--------------------------------------------------------------------------------
142-
Dependency : github.com/cavaliercoder/go-rpm
143-
Version: v0.0.0-20190131055624-7a9c54e3d83e
142+
Dependency : github.com/cavaliergopher/rpm
143+
Version: v1.2.0
144144
Licence type (autodetected): BSD-3-Clause
145145
--------------------------------------------------------------------------------
146146

147-
Contents of probable licence file $GOMODCACHE/github.com/cavaliercoder/go-rpm@v0.0.0-20190131055624-7a9c54e3d83e/LICENSE:
147+
Contents of probable licence file $GOMODCACHE/github.com/cavaliergopher/rpm@v1.2.0/LICENSE:
148148

149149
Copyright (c) 2017 Ryan Armstrong. All rights reserved.
150150

@@ -20632,34 +20632,6 @@ SOFTWARE.
2063220632

2063320633

2063420634

20635-
--------------------------------------------------------------------------------
20636-
Dependency : github.com/cavaliercoder/badio
20637-
Version: v0.0.0-20160213150051-ce5280129e9e
20638-
Licence type (autodetected): MIT
20639-
--------------------------------------------------------------------------------
20640-
20641-
Contents of probable licence file $GOMODCACHE/github.com/cavaliercoder/badio@v0.0.0-20160213150051-ce5280129e9e/LICENSE:
20642-
20643-
Copyright (c) 2015 Ryan Armstrong
20644-
20645-
Permission is hereby granted, free of charge, to any person obtaining a copy of
20646-
this software and associated documentation files (the "Software"), to deal in
20647-
the Software without restriction, including without limitation the rights to
20648-
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
20649-
the Software, and to permit persons to whom the Software is furnished to do so,
20650-
subject to the following conditions:
20651-
20652-
The above copyright notice and this permission notice shall be included in all
20653-
copies or substantial portions of the Software.
20654-
20655-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20656-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
20657-
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
20658-
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
20659-
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20660-
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20661-
20662-
2066320635
--------------------------------------------------------------------------------
2066420636
Dependency : github.com/cespare/xxhash/v2
2066520637
Version: v2.3.0

dev-tools/packaging/package_test.go

+4-15
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import (
3030
"testing"
3131

3232
"github.com/blakesmith/ar"
33-
"github.com/cavaliercoder/go-rpm"
33+
"github.com/cavaliergopher/rpm"
3434
"github.com/stretchr/testify/assert"
3535
"github.com/stretchr/testify/require"
3636
"gopkg.in/yaml.v3"
@@ -112,7 +112,7 @@ func TestDocker(t *testing.T) {
112112
// Sub-tests
113113

114114
func checkRPM(t *testing.T, file string) {
115-
p, rpmPkg, err := readRPM(file)
115+
p, _, err := readRPM(file)
116116
if err != nil {
117117
t.Error(err)
118118
return
@@ -130,7 +130,6 @@ func checkRPM(t *testing.T, file string) {
130130
checkLicensesPresent(t, "/usr/share", p)
131131
checkSystemdUnitPermissions(t, p)
132132
ensureNoBuildIDLinks(t, p)
133-
checkRPMDigestTypeSHA256(t, rpmPkg)
134133
}
135134

136135
func checkDeb(t *testing.T, file string, buf *bytes.Buffer) {
@@ -580,16 +579,6 @@ func ensureNoBuildIDLinks(t *testing.T, p *packageFile) {
580579
})
581580
}
582581

583-
// checkRPMDigestTypeSHA256 verifies that the RPM contains sha256 digests.
584-
// https://github.com/elastic/beats/issues/23670
585-
func checkRPMDigestTypeSHA256(t *testing.T, rpmPkg *rpm.PackageFile) {
586-
t.Run("rpm_digest_type_is_sha256", func(t *testing.T) {
587-
if rpmPkg.ChecksumType() != "sha256" {
588-
t.Errorf("expected SHA256 digest type but got %v", rpmPkg.ChecksumType())
589-
}
590-
})
591-
}
592-
593582
// Helpers
594583

595584
type packageFile struct {
@@ -619,8 +608,8 @@ func getFiles(t *testing.T, pattern *regexp.Regexp) []string {
619608
return files
620609
}
621610

622-
func readRPM(rpmFile string) (*packageFile, *rpm.PackageFile, error) {
623-
p, err := rpm.OpenPackageFile(rpmFile)
611+
func readRPM(rpmFile string) (*packageFile, *rpm.Package, error) {
612+
p, err := rpm.Open(rpmFile)
624613
if err != nil {
625614
return nil, nil, err
626615
}

go.mod

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ require (
77
github.com/Microsoft/go-winio v0.6.2
88
github.com/antlr4-go/antlr/v4 v4.13.0
99
github.com/blakesmith/ar v0.0.0-20150311145944-8bd4349a67f2
10-
github.com/cavaliercoder/go-rpm v0.0.0-20190131055624-7a9c54e3d83e
10+
github.com/cavaliergopher/rpm v1.2.0
1111
github.com/cenkalti/backoff/v4 v4.3.0
1212
github.com/docker/docker v26.1.5+incompatible
1313
github.com/docker/go-units v0.5.0
@@ -89,7 +89,6 @@ require (
8989
)
9090

9191
require (
92-
github.com/cavaliercoder/badio v0.0.0-20160213150051-ce5280129e9e // indirect
9392
github.com/distribution/reference v0.6.0 // indirect
9493
github.com/open-telemetry/opentelemetry-collector-contrib/connector/spanmetricsconnector v0.106.1
9594
github.com/open-telemetry/opentelemetry-collector-contrib/exporter/elasticsearchexporter v0.106.1

go.sum

+2-4
Original file line numberDiff line numberDiff line change
@@ -709,10 +709,8 @@ github.com/bmatcuk/doublestar/v4 v4.6.1/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTS
709709
github.com/boombuler/barcode v1.0.0/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8=
710710
github.com/boombuler/barcode v1.0.1/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8=
711711
github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0=
712-
github.com/cavaliercoder/badio v0.0.0-20160213150051-ce5280129e9e h1:YYUjy5BRwO5zPtfk+aa2gw255FIIoi93zMmuy19o0bc=
713-
github.com/cavaliercoder/badio v0.0.0-20160213150051-ce5280129e9e/go.mod h1:V284PjgVwSk4ETmz84rpu9ehpGg7swlIH8npP9k2bGw=
714-
github.com/cavaliercoder/go-rpm v0.0.0-20190131055624-7a9c54e3d83e h1:Gbx+iVCXG/1m5WSnidDGuHgN+vbIwl+6fR092ANU+Y8=
715-
github.com/cavaliercoder/go-rpm v0.0.0-20190131055624-7a9c54e3d83e/go.mod h1:AZIh1CCnMrcVm6afFf96PBvE2MRpWFco91z8ObJtgDY=
712+
github.com/cavaliergopher/rpm v1.2.0 h1:s0h+QeVK252QFTolkhGiMeQ1f+tMeIMhGl8B1HUmGUc=
713+
github.com/cavaliergopher/rpm v1.2.0/go.mod h1:R0q3vTqa7RUvPofAZYrnjJ63hh2vngjFfphuXiExVos=
716714
github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8=
717715
github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE=
718716
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=

0 commit comments

Comments
 (0)