classes/create-spdx-2.2: allow absolute paths in NO_GENERIC_LICENSE
Quoted 35 lines · Max Krummenacher via lists.openembedded.org
From: Max Krummenacher <[email protected]>
The current implementation expects the license file in
NO_GENERIC_LICENSEspecified as being relative to ${S}.
Assuming that there are two source locations this gets confusing to specify, e.g. ${WORKDIR}/other_tree/file looks more natural than ${S}/../other_tree/file.Check if the filename specified is not absolute and only then assume it is relative to ${S}.
Signed-off-by Max Krummenacher <[email protected]>--- meta/classes/create-spdx-2.2.bbclass | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)meta/classes/create-spdx-2.2.bbclass +2
-2@@ -134,7 +134,8 @@ def convert_license_to_spdx(lic, document, d, existing={}): # If it's not SPDX or PD, then NO_GENERIC_LICENSE must be set filename = d.getVarFlag('NO_GENERIC_LICENSE', name) if filename: - filename = d.expand("${S}/" + filename) + if not Path(filename).is_absolute(): + filename = d.expand("${S}/" + filename) with open(filename, errors="replace") as f: extracted_info.extractedText = f.read() else: --2.35.3
Quoted 8 lines
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#185690): https://lists.openembedded.org/g/openembedded-core/message/185690
Mute This Topic: https://lists.openembedded.org/mt/100639089/3617484
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Gentle ping.