mirror of
https://git.yoctoproject.org/poky
synced 2026-06-02 01:19:52 +00:00
classes/create-spdx: Add NOASSERTION for unknown debug sources
If a debug source cannot be found, mark it as NOASSERTION so that other tools at least know we were unable to locate it. (From OE-Core rev: 0e6bdd3f208c50153087c2baca67e9fd64a458d0) Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
0b871c57b8
commit
bdda626481
@@ -190,6 +190,7 @@ def add_package_sources_from_debug(d, package_doc, spdx_package, package, packag
|
||||
continue
|
||||
|
||||
for debugsrc in file_data["debugsrc"]:
|
||||
ref_id = "NOASSERTION"
|
||||
for search in debug_search_paths:
|
||||
debugsrc_path = search / debugsrc.lstrip("/")
|
||||
if not debugsrc_path.exists():
|
||||
@@ -205,31 +206,26 @@ def add_package_sources_from_debug(d, package_doc, spdx_package, package, packag
|
||||
|
||||
file_sha256 = sha.hexdigest()
|
||||
|
||||
if not file_sha256 in sources:
|
||||
if file_sha256 in sources:
|
||||
source_file = sources[file_sha256]
|
||||
|
||||
doc_ref = package_doc.find_external_document_ref(source_file.doc.documentNamespace)
|
||||
if doc_ref is None:
|
||||
doc_ref = oe.spdx.SPDXExternalDocumentRef()
|
||||
doc_ref.externalDocumentId = "DocumentRef-dependency-" + source_file.doc.name
|
||||
doc_ref.spdxDocument = source_file.doc.documentNamespace
|
||||
doc_ref.checksum.algorithm = "SHA1"
|
||||
doc_ref.checksum.checksumValue = source_file.doc_sha1
|
||||
package_doc.externalDocumentRefs.append(doc_ref)
|
||||
|
||||
ref_id = "%s:%s" % (doc_ref.externalDocumentId, source_file.file.SPDXID),
|
||||
else:
|
||||
bb.debug(1, "Debug source %s with SHA256 %s not found in any dependency" % (str(debugsrc_path), file_sha256))
|
||||
continue
|
||||
|
||||
source_file = sources[file_sha256]
|
||||
|
||||
doc_ref = package_doc.find_external_document_ref(source_file.doc.documentNamespace)
|
||||
if doc_ref is None:
|
||||
doc_ref = oe.spdx.SPDXExternalDocumentRef()
|
||||
doc_ref.externalDocumentId = "DocumentRef-dependency-" + source_file.doc.name
|
||||
doc_ref.spdxDocument = source_file.doc.documentNamespace
|
||||
doc_ref.checksum.algorithm = "SHA1"
|
||||
doc_ref.checksum.checksumValue = source_file.doc_sha1
|
||||
package_doc.externalDocumentRefs.append(doc_ref)
|
||||
|
||||
package_doc.add_relationship(
|
||||
pkg_file,
|
||||
"GENERATED_FROM",
|
||||
"%s:%s" % (doc_ref.externalDocumentId, source_file.file.SPDXID),
|
||||
comment=debugsrc
|
||||
)
|
||||
break
|
||||
else:
|
||||
bb.debug(1, "Debug source %s not found" % debugsrc)
|
||||
|
||||
package_doc.add_relationship(pkg_file, "GENERATED_FROM", ref_id, comment=debugsrc)
|
||||
|
||||
def collect_dep_recipes(d, doc, spdx_recipe):
|
||||
from pathlib import Path
|
||||
|
||||
Reference in New Issue
Block a user