summaryrefslogtreecommitdiffstats
path: root/meta/classes/create-spdx.bbclass
diff options
context:
space:
mode:
authorSaul Wold <Saul.Wold@windriver.com>2021-11-17 18:08:13 (GMT)
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-11-21 11:05:02 (GMT)
commite1e8531c64b2663767546adf0f46bc6c96c12360 (patch)
tree730cb55f5f94e0808e1e8487076b8109edb68c40 /meta/classes/create-spdx.bbclass
parentdbf4c65541cde5d308a7597ebeab5344bddb3a0c (diff)
downloadpoky-e1e8531c64b2663767546adf0f46bc6c96c12360.tar.gz
create_spdx: ensure is_work_shared() is unique
There is a function with the same name is_work_shared() in the archiver class this causes a conflict when both classes are included. Use work-shared as the check in WORKDIR to allow for other packages beyond the kernel and gcc that use a common shared-work source directory. (From OE-Core rev: 18eab77ee65c73b17225e69c7ba446ab1c69fa92) Signed-off-by: Saul Wold <saul.wold@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/create-spdx.bbclass')
-rw-r--r--meta/classes/create-spdx.bbclass12
1 files changed, 5 insertions, 7 deletions
diff --git a/meta/classes/create-spdx.bbclass b/meta/classes/create-spdx.bbclass
index eb1d446..1d5c8b3 100644
--- a/meta/classes/create-spdx.bbclass
+++ b/meta/classes/create-spdx.bbclass
@@ -53,10 +53,8 @@ def recipe_spdx_is_native(d, recipe):
53 a.annotator == "Tool: %s - %s" % (d.getVar("SPDX_TOOL_NAME"), d.getVar("SPDX_TOOL_VERSION")) and 53 a.annotator == "Tool: %s - %s" % (d.getVar("SPDX_TOOL_NAME"), d.getVar("SPDX_TOOL_VERSION")) and
54 a.comment == "isNative" for a in recipe.annotations) 54 a.comment == "isNative" for a in recipe.annotations)
55 55
56def is_work_shared(d): 56def is_work_shared_spdx(d):
57 pn = d.getVar('PN') 57 return bb.data.inherits_class('kernel', d) or ('work-shared' in d.getVar('WORKDIR'))
58 return bb.data.inherits_class('kernel', d) or pn.startswith('gcc-source')
59
60 58
61python() { 59python() {
62 import json 60 import json
@@ -747,7 +745,7 @@ def spdx_get_src(d):
747 745
748 try: 746 try:
749 # The kernel class functions require it to be on work-shared, so we dont change WORKDIR 747 # The kernel class functions require it to be on work-shared, so we dont change WORKDIR
750 if not is_work_shared(d): 748 if not is_work_shared_spdx(d):
751 # Change the WORKDIR to make do_unpack do_patch run in another dir. 749 # Change the WORKDIR to make do_unpack do_patch run in another dir.
752 d.setVar('WORKDIR', spdx_workdir) 750 d.setVar('WORKDIR', spdx_workdir)
753 # Restore the original path to recipe's native sysroot (it's relative to WORKDIR). 751 # Restore the original path to recipe's native sysroot (it's relative to WORKDIR).
@@ -760,7 +758,7 @@ def spdx_get_src(d):
760 758
761 bb.build.exec_func('do_unpack', d) 759 bb.build.exec_func('do_unpack', d)
762 # Copy source of kernel to spdx_workdir 760 # Copy source of kernel to spdx_workdir
763 if is_work_shared(d): 761 if is_work_shared_spdx(d):
764 d.setVar('WORKDIR', spdx_workdir) 762 d.setVar('WORKDIR', spdx_workdir)
765 d.setVar('STAGING_DIR_NATIVE', spdx_sysroot_native) 763 d.setVar('STAGING_DIR_NATIVE', spdx_sysroot_native)
766 src_dir = spdx_workdir + "/" + d.getVar('PN')+ "-" + d.getVar('PV') + "-" + d.getVar('PR') 764 src_dir = spdx_workdir + "/" + d.getVar('PN')+ "-" + d.getVar('PV') + "-" + d.getVar('PR')
@@ -776,7 +774,7 @@ def spdx_get_src(d):
776 shutils.rmtree(git_path) 774 shutils.rmtree(git_path)
777 775
778 # Make sure gcc and kernel sources are patched only once 776 # Make sure gcc and kernel sources are patched only once
779 if not (d.getVar('SRC_URI') == "" or is_work_shared(d)): 777 if not (d.getVar('SRC_URI') == "" or is_work_shared_spdx(d)):
780 bb.build.exec_func('do_patch', d) 778 bb.build.exec_func('do_patch', d)
781 779
782 # Some userland has no source. 780 # Some userland has no source.