mirror of
https://github.com/anchore/syft.git
synced 2025-11-17 16:33:21 +01:00
* Support RPM distros with newer db formats Recent RPM distros (Fedora 33+, CBL-Mariner 2.0+, amazonlinux 2022+) use an sqlite package database in /var/lib/rpm/rpmdb.sqlite, or "ndb" format (SUSE). Remove anchore's fork in favour of the upstream, https://github.com/knqyf263/go-rpmdb, to gain support for these formats. Signed-off-by: Tom Fay <tomfay@microsoft.com> * add exception for modernc.org repos Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * shorten rpmdb helper function Signed-off-by: Alex Goodman <alex.goodman@anchore.com> Co-authored-by: Alex Goodman <alex.goodman@anchore.com>
26 lines
649 B
Go
26 lines
649 B
Go
package integration
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/anchore/syft/syft/source"
|
|
|
|
"github.com/anchore/syft/syft/pkg"
|
|
)
|
|
|
|
func TestSqliteRpm(t *testing.T) {
|
|
// This is a regression test for issue #469 (https://github.com/anchore/syft/issues/469). Recent RPM
|
|
// based distribution store package data in an sqlite database
|
|
sbom, _ := catalogFixtureImage(t, "image-sqlite-rpmdb", source.SquashedScope)
|
|
|
|
expectedPkgs := 139
|
|
actualPkgs := 0
|
|
for range sbom.Artifacts.PackageCatalog.Enumerate(pkg.RpmPkg) {
|
|
actualPkgs += 1
|
|
}
|
|
|
|
if actualPkgs != expectedPkgs {
|
|
t.Errorf("unexpected number of RPM packages: %d != %d", expectedPkgs, actualPkgs)
|
|
}
|
|
}
|