Include column is_soong_module when loading installed file list
In soong-only build all installed files should be built by soong so this
field is needed when validating if there is any metadata associating
with an installed file.
Bug: 398039178
Test: presubmits
Test: build/soong/tests/sbom_test.sh
Change-Id: I185edf01dd89489d13bf31e82ec5cffcf29e5546
diff --git a/tools/sbom/compliance_metadata.py b/tools/sbom/compliance_metadata.py
index 502c110..2f0b180 100644
--- a/tools/sbom/compliance_metadata.py
+++ b/tools/sbom/compliance_metadata.py
@@ -123,7 +123,7 @@
def get_installed_files(self):
# Get all records from table make_metadata, which contains all installed files and corresponding make modules' metadata
- cursor = self.conn.execute('select installed_file, module_path, is_prebuilt_make_module, product_copy_files, kernel_module_copy_files, is_platform_generated, license_text from make_metadata')
+ cursor = self.conn.execute('select installed_file, module_path, is_soong_module, is_prebuilt_make_module, product_copy_files, kernel_module_copy_files, is_platform_generated, license_text from make_metadata')
rows = cursor.fetchall()
cursor.close()
installed_files_metadata = []
@@ -135,7 +135,7 @@
def get_installed_file_in_dir(self, dir):
dir = dir.removesuffix('/')
cursor = self.conn.execute(
- 'select installed_file, module_path, is_prebuilt_make_module, product_copy_files, '
+ 'select installed_file, module_path, is_soong_module, is_prebuilt_make_module, product_copy_files, '
' kernel_module_copy_files, is_platform_generated, license_text '
'from make_metadata '
'where installed_file like ?', (dir + '/%',))
diff --git a/tools/sbom/gen_sbom.py b/tools/sbom/gen_sbom.py
index 77bccbb..e875ddb 100644
--- a/tools/sbom/gen_sbom.py
+++ b/tools/sbom/gen_sbom.py
@@ -415,11 +415,13 @@
def installed_file_has_metadata(installed_file_metadata, report):
installed_file = installed_file_metadata['installed_file']
module_path = installed_file_metadata['module_path']
+ is_soong_module = installed_file_metadata['is_soong_module']
product_copy_files = installed_file_metadata['product_copy_files']
kernel_module_copy_files = installed_file_metadata['kernel_module_copy_files']
is_platform_generated = installed_file_metadata['is_platform_generated']
if (not module_path and
+ not is_soong_module and
not product_copy_files and
not kernel_module_copy_files and
not is_platform_generated and