diff options
| author | hongxu <hongxu.jia@eng.windriver.com> | 2024-12-24 18:48:26 -0800 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-01-08 12:49:00 +0000 |
| commit | 0fee98b8e8245a829f2c524c987711b896553508 (patch) | |
| tree | 05fcc0d24889eab10c6fbb3e7ae94b52cd222d0e /meta/lib/oe | |
| parent | 446e74ccee9bb868fcb10c4cb7de84b3d453c019 (diff) | |
| download | poky-0fee98b8e8245a829f2c524c987711b896553508.tar.gz | |
meta/lib/oe/sbom30.py: fix alias in simplelicensing_customIdToUri not extracted
After commit [spdx 3.0: Rework how SPDX aliases are linked] applied, it set
license_text_map with SPDX alias other than actual ID
The property of simplelicensing_customIdToUri is ListProp(ObjectProp(DictionaryEntry))),
and class DictionaryEntry has key and value, the property of value is StringProp other
than ObjectProp in which could not support to decode/extract SPDX alias with actual ID
in image jsonld file
-----------
"simplelicensing_customIdToUri": [
{
"type": "DictionaryEntry",
"key": "LicenseRef-PD",
"value": "http://spdxdocs.org/openembedded-alias/by-doc-hash/d53e90e23b12c4ad640809a74a810e86f31c76cdbdf36487712d22a33d53362a/sqlite3-native/UNIHASH/license-text/PD"
}
],
-----------
Add special code in the linking to manually go through all of the
simplelicensing_customIdToUri DictionaryEntry items and resolve
any aliases to actual objects
-----------
"simplelicensing_customIdToUri": [
{
"type": "DictionaryEntry",
"key": "LicenseRef-PD",
"value": "http://spdx.org/spdxdocs/sqlite3-native-e5cc0672-d8dd-57e8-a2df-fe4615831fda/162c62b5b011cd3f82f413b3dae4d6d1542201552c964d5ce69fe170e0720b85/license-text/PD"
}
]
-----------
Suggested-by: Joshua Watt <jpewhacker@gmail.com>
(From OE-Core rev: f16c2eae5a7e1a483e1d537d8711d83fede75691)
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oe')
| -rw-r--r-- | meta/lib/oe/sbom30.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/meta/lib/oe/sbom30.py b/meta/lib/oe/sbom30.py index 08fea2aca3..0004447066 100644 --- a/meta/lib/oe/sbom30.py +++ b/meta/lib/oe/sbom30.py | |||
| @@ -855,6 +855,18 @@ class ObjectSet(oe.spdx30.SHACLObjectSet): | |||
| 855 | self.doc.import_ = sorted(imports.values(), key=lambda e: e.externalSpdxId) | 855 | self.doc.import_ = sorted(imports.values(), key=lambda e: e.externalSpdxId) |
| 856 | bb.debug(1, "Linking...") | 856 | bb.debug(1, "Linking...") |
| 857 | self.link() | 857 | self.link() |
| 858 | |||
| 859 | # Manually go through all of the simplelicensing_customIdToUri DictionaryEntry | ||
| 860 | # items and resolve any aliases to actual objects. | ||
| 861 | for lic in self.foreach_type(oe.spdx30.simplelicensing_LicenseExpression): | ||
| 862 | for d in lic.simplelicensing_customIdToUri: | ||
| 863 | if d.value.startswith(OE_ALIAS_PREFIX): | ||
| 864 | obj = self.find_by_id(d.value) | ||
| 865 | if obj is not None: | ||
| 866 | d.value = obj._id | ||
| 867 | else: | ||
| 868 | self.missing_ids.add(d.value) | ||
| 869 | |||
| 858 | self.missing_ids -= set(imports.keys()) | 870 | self.missing_ids -= set(imports.keys()) |
| 859 | return self.missing_ids | 871 | return self.missing_ids |
| 860 | 872 | ||
