In order to inherit SPDX class conditionally, using variable ${SPDX_CLASS}
to inherit SPDX class other than original 'INHERIT:remove = "create-spdx"'
and INHERIT += "create-spdx-2.2"

Signed-off-by: Hongxu Jia <hongxu....@windriver.com>
---
 meta/classes/create-spdx.bbclass     | 3 ++-
 meta/lib/oeqa/selftest/cases/spdx.py | 8 ++------
 2 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/meta/classes/create-spdx.bbclass b/meta/classes/create-spdx.bbclass
index b604973ae0..35cd63f31e 100644
--- a/meta/classes/create-spdx.bbclass
+++ b/meta/classes/create-spdx.bbclass
@@ -5,4 +5,5 @@
 #
 # Include this class when you don't care what version of SPDX you get; it will
 # be updated to the latest stable version that is supported
-inherit create-spdx-3.0
+SPDX_CLASS ??= "create-spdx-3.0"
+inherit ${SPDX_CLASS}
diff --git a/meta/lib/oeqa/selftest/cases/spdx.py 
b/meta/lib/oeqa/selftest/cases/spdx.py
index f3b955ed2b..4789041a6a 100644
--- a/meta/lib/oeqa/selftest/cases/spdx.py
+++ b/meta/lib/oeqa/selftest/cases/spdx.py
@@ -24,8 +24,7 @@ class SPDX22Check(OESelftestTestCase):
     def check_recipe_spdx(self, high_level_dir, spdx_file, target_name):
         config = textwrap.dedent(
             """\
-            INHERIT:remove = "create-spdx"
-            INHERIT += "create-spdx-2.2"
+            SPDX_CLASS = "create-spdx-2.2"
             """
         )
         self.write_config(config)
@@ -89,8 +88,7 @@ class SPDX3CheckBase(object):
         config = (
             textwrap.dedent(
                 f"""\
-                INHERIT:remove = "create-spdx"
-                INHERIT += "{self.SPDX_CLASS}"
+                SPDX_CLASS = "create-spdx-3.0"
                 """
             )
             + textwrap.dedent(extraconf)
@@ -138,8 +136,6 @@ class SPDX3CheckBase(object):
 
 
 class SPDX30Check(SPDX3CheckBase, OESelftestTestCase):
-    SPDX_CLASS = "create-spdx-3.0"
-
     def test_base_files(self):
         self.check_recipe_spdx(
             "base-files",
-- 
2.25.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#209093): 
https://lists.openembedded.org/g/openembedded-core/message/209093
Mute This Topic: https://lists.openembedded.org/mt/110301813/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to