On Mon, Jul 27, 2026 at 2:34 AM Benjamin Robin <[email protected]>
wrote:

> This change will affect the SPDX output: the source file path will no
> longer be prefixed by `sources/`.
>

This is fine (and probably better)


>
> The rest of the changes are safe because:
> - `S` should reference `UNPACKDIR` and not directly reference `WORKDIR`.
>

Correct. This is a nice improvement that UNPACKDIR allows us tomake


> - 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 <[email protected]>
>

LGTM Thanks.

Reviewed-by: Joshua Watt <[email protected]>


> ---
>  meta/lib/oe/spdx30_tasks.py |  1 -
>  meta/lib/oe/spdx_common.py  | 18 +++++-------------
>  2 files changed, 5 insertions(+), 14 deletions(-)
>
> diff --git a/meta/lib/oe/spdx30_tasks.py b/meta/lib/oe/spdx30_tasks.py
> index ef12e638ae85..4da9e8bb7e24 100644
> --- a/meta/lib/oe/spdx30_tasks.py
> +++ b/meta/lib/oe/spdx30_tasks.py
> @@ -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
> diff --git a/meta/lib/oe/spdx_common.py b/meta/lib/oe/spdx_common.py
> index 9d1e22629b21..013f23ae7c65 100644
> --- a/meta/lib/oe/spdx_common.py
> +++ b/meta/lib/oe/spdx_common.py
> @@ -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)
>
> --
> 2.55.0
>
>
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#242949): 
https://lists.openembedded.org/g/openembedded-core/message/242949
Mute This Topic: https://lists.openembedded.org/mt/120463986/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to