@@ -843,7 +843,6 @@ def create_spdx(d):
lambda filepath: [oe.spdx30.software_SoftwarePurpose.source],
license_data,
ignore_dirs=[".git"],
- ignore_top_level_dirs=["temp"],
archive=None,
)
build_inputs |= files
@@ -169,28 +169,20 @@ def collect_package_providers(d, direct_deps):
def get_patched_src(d):
"""
- Save patched source of the recipe in SPDX_WORKDIR.
+ Save patched source of the recipe in SPDXWORK.
"""
spdx_workdir = d.getVar("SPDXWORK")
- # The kernel class functions require it to be on work-shared, so we don't change WORKDIR
+ # Do not unpack the sources again for the recipe using work-shared
if not is_work_shared_spdx(d):
- spdx_sysroot_native = d.getVar("STAGING_DIR_NATIVE")
localdata = d.createCopy()
- # Change the WORKDIR to make do_unpack do_patch run in another dir.
- localdata.setVar("WORKDIR", spdx_workdir)
- # Restore the original path to recipe's native sysroot (it's relative to WORKDIR).
- localdata.setVar("STAGING_DIR_NATIVE", spdx_sysroot_native)
-
- # The changed 'WORKDIR' also caused 'B' changed, create dir 'B' for the
- # possibly requiring of the following tasks (such as some recipe's
- # do_patch required 'B' existed).
- bb.utils.mkdirhier(localdata.getVar("B"))
+ # Change the UNPACKDIR to make do_unpack do_patch run in another dir.
+ localdata.setVar("UNPACKDIR", spdx_workdir)
bb.build.exec_func("do_unpack", localdata)
- if localdata.getVar("SRC_URI") != "":
+ if localdata.getVar("SRC_URI"):
if bb.data.inherits_class("dos2unix", localdata):
bb.build.exec_func("do_convert_crlf_to_lf", localdata)
bb.build.exec_func("do_patch", localdata)
This change will affect the SPDX output: the source file path will no longer be prefixed by `sources/`. The rest of the changes are safe because: - `S` should reference `UNPACKDIR` and not directly reference `WORKDIR`. - After analyzing all public layers, no `do_unpack()` or `do_patch()` was found to reference the `${B}` variable. The comment mentioning the `${B}` variable traces back to [1] (though no further explanation was provided). Additionally, this ensures proper capture of sources if the recipe modifies `UNPACKDIR` outside of `WORKDIR` (though such cases should be rare). With these changes, SPDXWORK is no longer a working directory which is "temporary" replacing WORKDIR, it is now a "temporary" directory containing unpacked source files. The run.do_patch.XXXX and associated files are now stored in ${WORKDIR}/temp. [1] https://github.com/doubleopen-io/meta-doubleopen/blob/ e84f0c32663da9c743e4f1802042b733df0e36d7/classes/doubleopen.bbclass#L285 Signed-off-by: Benjamin Robin <benjamin.robin@bootlin.com> --- meta/lib/oe/spdx30_tasks.py | 1 - meta/lib/oe/spdx_common.py | 18 +++++------------- 2 files changed, 5 insertions(+), 14 deletions(-)