diff --git a/syft/distro/identify_test.go b/syft/distro/identify_test.go index 6343f561e..e5abd349c 100644 --- a/syft/distro/identify_test.go +++ b/syft/distro/identify_test.go @@ -6,10 +6,9 @@ import ( "os" "testing" - hashiVer "github.com/hashicorp/go-version" - "github.com/anchore/syft/internal" "github.com/anchore/syft/syft/source" + hashiVer "github.com/hashicorp/go-version" "github.com/stretchr/testify/assert" ) @@ -128,6 +127,11 @@ func TestIdentifyDistro(t *testing.T) { Type: RockyLinux, Version: "8.4.0", }, + { + fixture: "test-fixtures/os/almalinux", + Type: AlmaLinux, + Version: "8.4.0", + }, } observedDistros := internal.NewStringSet() diff --git a/syft/distro/test-fixtures/os/almalinux/etc/os-release b/syft/distro/test-fixtures/os/almalinux/etc/os-release new file mode 100644 index 000000000..61deb8e91 --- /dev/null +++ b/syft/distro/test-fixtures/os/almalinux/etc/os-release @@ -0,0 +1,15 @@ +NAME="AlmaLinux" +VERSION="8.4 (Electric Cheetah)" +ID="almalinux" +ID_LIKE="rhel centos fedora" +VERSION_ID="8.4" +PLATFORM_ID="platform:el8" +PRETTY_NAME="AlmaLinux 8.4 (Electric Cheetah)" +ANSI_COLOR="0;34" +CPE_NAME="cpe:/o:almalinux:almalinux:8.4:GA" +HOME_URL="https://almalinux.org/" +DOCUMENTATION_URL="https://wiki.almalinux.org/" +BUG_REPORT_URL="https://bugs.almalinux.org/" + +ALMALINUX_MANTISBT_PROJECT="AlmaLinux-8" +ALMALINUX_MANTISBT_PROJECT_VERSION="8.4" \ No newline at end of file diff --git a/syft/distro/type.go b/syft/distro/type.go index aa1fd8bb0..245c506fd 100644 --- a/syft/distro/type.go +++ b/syft/distro/type.go @@ -22,6 +22,7 @@ const ( Windows Type = "windows" Mariner Type = "mariner" RockyLinux Type = "rockylinux" + AlmaLinux Type = "almalinux" ) // All contains all Linux distribution options @@ -42,6 +43,7 @@ var All = []Type{ Windows, Mariner, RockyLinux, + AlmaLinux, } // IDMapping connects a distro ID like "ubuntu" to a Distro type @@ -62,6 +64,7 @@ var IDMapping = map[string]Type{ "windows": Windows, "mariner": Mariner, "rocky": RockyLinux, + "almalinux": AlmaLinux, } // String returns the string representation of the given Linux distribution.