Skip to content

Commit c26be09

Browse files
committed
feat(os/rpm): allow building on macOS
1 parent f91afc5 commit c26be09

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

extractor/filesystem/os/rpm/rpm_linux.go renamed to extractor/filesystem/os/rpm/rpm.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
//go:build linux
15+
//go:build !windows
1616

1717
// Package rpm extracts packages from rpm database.
1818
package rpm
@@ -113,7 +113,9 @@ func (e Extractor) Name() string { return Name }
113113
func (e Extractor) Version() int { return 0 }
114114

115115
// Requirements of the extractor.
116-
func (e Extractor) Requirements() *plugin.Capabilities { return &plugin.Capabilities{} }
116+
func (e Extractor) Requirements() *plugin.Capabilities {
117+
return &plugin.Capabilities{}
118+
}
117119

118120
// FileRequired returns true if the specified file matches rpm status file pattern.
119121
func (e Extractor) FileRequired(api filesystem.FileAPI) bool {

extractor/filesystem/os/rpm/rpm_dummy.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
//go:build !linux
15+
//go:build windows
1616

1717
// Package rpm extracts packages from rpm database.
1818
package rpm

extractor/filesystem/os/rpm/rpm_test.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import (
2121
"path"
2222
"path/filepath"
2323
"runtime"
24-
"slices"
2524
"sort"
2625
"strings"
2726
"testing"
@@ -44,7 +43,7 @@ import (
4443

4544
func TestFileRequired(t *testing.T) {
4645
// supported OSes
47-
if !slices.Contains([]string{"linux"}, runtime.GOOS) {
46+
if runtime.GOOS == "windows" {
4847
t.Skipf("Test skipped, OS unsupported: %v", runtime.GOOS)
4948
}
5049

@@ -172,7 +171,7 @@ VARIANT="Container Image"`
172171

173172
func TestExtract(t *testing.T) {
174173
// supported OSes
175-
if !slices.Contains([]string{"linux"}, runtime.GOOS) {
174+
if runtime.GOOS == "windows" {
176175
t.Skipf("Test skipped, OS unsupported: %v", runtime.GOOS)
177176
}
178177

@@ -566,7 +565,7 @@ func TestExtract(t *testing.T) {
566565

567566
func TestExtract_VirtualFilesystem(t *testing.T) {
568567
// supported OSes
569-
if !slices.Contains([]string{"linux"}, runtime.GOOS) {
568+
if runtime.GOOS == "windows" {
570569
t.Skipf("Test skipped, OS unsupported: %v", runtime.GOOS)
571570
}
572571

0 commit comments

Comments
 (0)