mirror of
https://github.com/anchore/syft.git
synced 2026-11-01 06:56:40 +01:00
expand compare testing images
Signed-off-by: Alex Goodman <alex.goodman@anchore.com>
This commit is contained in:
@@ -76,12 +76,6 @@ class InlineScan:
|
||||
if v in ("", "N/A"):
|
||||
entry[k] = None
|
||||
|
||||
extra = {}
|
||||
# extra = dict(entry)
|
||||
# extra.pop('type')
|
||||
# extra.pop('maven-version')
|
||||
# extra.pop("origin") # don't include origin as syft does not compact several fields into 1
|
||||
|
||||
pkg = utils.package.Package(
|
||||
name=name,
|
||||
type=pkg_type,
|
||||
@@ -90,7 +84,7 @@ class InlineScan:
|
||||
|
||||
metadata[pkg.type][pkg] = utils.package.Metadata(
|
||||
version=entry["maven-version"],
|
||||
extra=tuple(sorted(extra.items())),
|
||||
extra=tuple(),
|
||||
)
|
||||
|
||||
return packages, metadata
|
||||
|
||||
@@ -50,29 +50,14 @@ class Syft:
|
||||
version = entry["version"]
|
||||
|
||||
if "java" in pkg_type:
|
||||
# lets match what inline scan expects to output
|
||||
|
||||
# specVersion = dig(entry, "metadata", "manifest", "specificationVersion") or None
|
||||
# implVersion = dig(entry, "metadata", "manifest", "implementationVersion") or None
|
||||
virtualPath = dig(entry, "metadata", "virtualPath")
|
||||
|
||||
# package = dig(entry, "metadata", "pomProperties", "artifactId")
|
||||
# if not package:
|
||||
# package = "%s-%s" % (dig(entry, "name"), dig(entry, "version"))
|
||||
#
|
||||
# extra = {
|
||||
# "implementation-version": implVersion,
|
||||
# "specification-version": specVersion,
|
||||
# "location": virtualPath,
|
||||
# "package": package,
|
||||
# }
|
||||
|
||||
# we need to use the virtual path instead of the name to account for nested dependencies with the same
|
||||
# package name (but potentially different metadata)
|
||||
name = virtualPath
|
||||
name = dig(entry, "metadata", "virtualPath")
|
||||
|
||||
elif pkg_type == "apkg":
|
||||
version = entry["version"].split("-")[0]
|
||||
# inline scan strips off the release from the version, which should be normalized here
|
||||
fields = entry["version"].split("-")
|
||||
version = "-".join(fields[:-1])
|
||||
|
||||
pkg = utils.package.Package(
|
||||
name=name,
|
||||
@@ -81,6 +66,6 @@ class Syft:
|
||||
|
||||
packages.add(pkg)
|
||||
|
||||
metadata[pkg.type][pkg] = utils.package.Metadata(version=version, extra=tuple(sorted(extra.items())))
|
||||
metadata[pkg.type][pkg] = utils.package.Metadata(version=version, extra=tuple())
|
||||
|
||||
return utils.package.Info(packages=frozenset(packages), metadata=metadata)
|
||||
|
||||
Reference in New Issue
Block a user