summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoshua Watt <JPEWhacker@gmail.com>2025-03-11 08:03:02 -0600
committerRichard Purdie <richard.purdie@linuxfoundation.org>2025-03-11 21:29:50 +0000
commit143103a1c457ebfd4fe088cc5d8233b934d3e2a9 (patch)
treeed2bb69df243eef6db9c563d3b41a90d3bb03d82
parent0606ae583e157160692bc80edf03b582a06ef30d (diff)
downloadpoky-143103a1c457ebfd4fe088cc5d8233b934d3e2a9.tar.gz
lib: Fix dependencies on SPDX code
The SPDX library code was being ignored from taskhash calculations due to accidentally being omitted from BBIMPORTS. This meant that changes in the code or dependent variables would not cause the task to rebuild correctly. In order to add spdx_common, convert the `Dep` object from a named tuple to a frozen dataclass. These function more or less equivalently, but the bitbake code parser cannot handle named tuples. Finally, the vardepsexclude that used to be present on the recipe tasks needs to be moved to the python code in order for the variables to be correctly ignored. Several unused exclusions were removed (From OE-Core rev: eb597bf61cbcb0a4d43149404c93eec0894fb4c7) Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/classes/create-spdx-3.0.bbclass3
-rw-r--r--meta/lib/oe/__init__.py2
-rw-r--r--meta/lib/oe/spdx_common.py8
3 files changed, 8 insertions, 5 deletions
diff --git a/meta/classes/create-spdx-3.0.bbclass b/meta/classes/create-spdx-3.0.bbclass
index 25f3aa5f43..b4a5156e70 100644
--- a/meta/classes/create-spdx-3.0.bbclass
+++ b/meta/classes/create-spdx-3.0.bbclass
@@ -134,7 +134,6 @@ python do_create_spdx() {
134 import oe.spdx30_tasks 134 import oe.spdx30_tasks
135 oe.spdx30_tasks.create_spdx(d) 135 oe.spdx30_tasks.create_spdx(d)
136} 136}
137do_create_spdx[vardepsexclude] += "BB_NUMBER_THREADS SPDX_BUILD_HOST"
138do_create_spdx[vardeps] += "\ 137do_create_spdx[vardeps] += "\
139 SPDX_INCLUDE_BITBAKE_PARENT_BUILD \ 138 SPDX_INCLUDE_BITBAKE_PARENT_BUILD \
140 SPDX_PACKAGE_ADDITIONAL_PURPOSE \ 139 SPDX_PACKAGE_ADDITIONAL_PURPOSE \
@@ -170,7 +169,7 @@ python do_create_package_spdx() {
170 import oe.spdx30_tasks 169 import oe.spdx30_tasks
171 oe.spdx30_tasks.create_package_spdx(d) 170 oe.spdx30_tasks.create_package_spdx(d)
172} 171}
173do_create_package_spdx[vardepsexclude] += "OVERRIDES SPDX_MULTILIB_SSTATE_ARCHS" 172oe.spdx30_tasks.create_package_spdx[vardepsexclude] = "OVERRIDES"
174 173
175addtask do_create_package_spdx after do_create_spdx before do_build do_rm_work 174addtask do_create_package_spdx after do_create_spdx before do_build do_rm_work
176SSTATETASKS += "do_create_package_spdx" 175SSTATETASKS += "do_create_package_spdx"
diff --git a/meta/lib/oe/__init__.py b/meta/lib/oe/__init__.py
index d760481283..3179a3f3d2 100644
--- a/meta/lib/oe/__init__.py
+++ b/meta/lib/oe/__init__.py
@@ -11,4 +11,4 @@ __path__ = extend_path(__path__, __name__)
11# processed correctly (e.g. qa) 11# processed correctly (e.g. qa)
12BBIMPORTS = ["qa", "data", "path", "utils", "types", "package", "packagedata", \ 12BBIMPORTS = ["qa", "data", "path", "utils", "types", "package", "packagedata", \
13 "packagegroup", "sstatesig", "lsb", "cachedpath", "license", \ 13 "packagegroup", "sstatesig", "lsb", "cachedpath", "license", \
14 "reproducible", "rust", "buildcfg", "go"] 14 "reproducible", "rust", "buildcfg", "go", "spdx30_tasks", "spdx_common"]
diff --git a/meta/lib/oe/spdx_common.py b/meta/lib/oe/spdx_common.py
index 23a17271d6..e1b26edaaf 100644
--- a/meta/lib/oe/spdx_common.py
+++ b/meta/lib/oe/spdx_common.py
@@ -12,7 +12,7 @@ import re
12import shutil 12import shutil
13 13
14from pathlib import Path 14from pathlib import Path
15 15from dataclasses import dataclass
16 16
17LIC_REGEX = re.compile( 17LIC_REGEX = re.compile(
18 rb"^\W*SPDX-License-Identifier:\s*([ \w\d.()+-]+?)(?:\s+\W*)?$", 18 rb"^\W*SPDX-License-Identifier:\s*([ \w\d.()+-]+?)(?:\s+\W*)?$",
@@ -77,7 +77,11 @@ def process_sources(d):
77 return True 77 return True
78 78
79 79
80Dep = collections.namedtuple("Dep", ["pn", "hashfn", "in_taskhash"]) 80@dataclass(frozen=True)
81class Dep(object):
82 pn: str
83 hashfn: str
84 in_taskhash: bool
81 85
82 86
83def collect_direct_deps(d, dep_task): 87def collect_direct_deps(d, dep_task):