@@ -137,6 +137,10 @@ def add_package_files(d, doc, spdx_pkg, topdir, get_spdxid, get_types, *, archiv
spdx_files = []
file_counter = 1
+
+ check_compiled_sources = d.getVar("SPDX_INCLUDE_COMPILED_SOURCES") == "1"
+ if check_compiled_sources:
+ compiled_sources = bb.build.exec_func('get_compiled_sources', d)
for subdir, dirs, files in os.walk(topdir):
dirs[:] = [d for d in dirs if d not in ignore_dirs]
if subdir == str(topdir):
@@ -147,6 +151,10 @@ def add_package_files(d, doc, spdx_pkg, topdir, get_spdxid, get_types, *, archiv
filename = str(filepath.relative_to(topdir))
if not filepath.is_symlink() and filepath.is_file():
+ # Check if file is compiled
+ if check_compiled_sources:
+ if not bb.build.exec_func('is_compiled_source', d, file, kernel_sources):
+ break
spdx_file = oe.spdx.SPDXFile()
spdx_file.SPDXID = get_spdxid(file_counter)
for t in get_types(filepath):
@@ -26,6 +26,7 @@ SPDX_TOOL_VERSION ??= "1.0"
SPDXRUNTIMEDEPLOY = "${SPDXDIR}/runtime-deploy"
SPDX_INCLUDE_SOURCES ??= "0"
+SPDX_INCLUDE_COMPILED_SOURCES ??= "0"
SPDX_UUID_NAMESPACE ??= "sbom.openembedded.org"
SPDX_NAMESPACE_PREFIX ??= "http://spdx.org/spdxdocs"
@@ -156,6 +156,10 @@ def add_package_files(
bb.note(f"Skip {topdir}")
return spdx_files
+ check_compiled_sources = d.getVar("SPDX_INCLUDE_COMPILED_SOURCES") == "1"
+ if check_compiled_sources:
+ compiled_sources = bb.build.exec_func('get_compiled_sources', d)
+
for subdir, dirs, files in os.walk(topdir, onerror=walk_error):
dirs[:] = [d for d in dirs if d not in ignore_dirs]
if subdir == str(topdir):
@@ -167,6 +171,10 @@ def add_package_files(
filepath = Path(subdir) / file
if filepath.is_symlink() or not filepath.is_file():
continue
+ # Check if file is compiled
+ if check_compiled_sources:
+ if not bb.build.exec_func('is_compiled_source', d, file, kernel_sources):
+ break
filename = str(filepath.relative_to(topdir))
file_purposes = get_purposes(filepath)