Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Alexandre Belloni <alexandre.belloni@bootlin.com>
To: jpuhlman@mvista.com
Cc: openembedded-core@lists.openembedded.org
Subject: Re: [OE-core] [PATCH] create-spdx-2.2: combine spdx can try to write before dir creation
Date: Sat, 16 Dec 2023 23:18:41 +0100	[thread overview]
Message-ID: <20231216221841b5eec19c@mail.local> (raw)
In-Reply-To: <20231215171046.2926492-1-jpuhlman@mvista.com>

Hello,

Most of the builds failed do_rootfs with:

ERROR: core-image-sato-1.0-r0 do_rootfs: Error executing a python function in exec_func_python() autogenerated:
The stack trace of python calls that resulted in this exception/failure was:
File: 'exec_func_python() autogenerated', lineno: 2, function: <module>
     0001:
 *** 0002:image_combine_spdx(d)
     0003:
File: '/home/pokybuild/yocto-worker/qemuarm64-ltp/build/meta/classes/create-spdx-2.2.bbclass', lineno: 964, function: image_combine_spdx
     0960:    imgdeploydir = Path(d.getVar("IMGDEPLOYDIR"))
     0961:    img_spdxid = oe.sbom.get_image_spdxid(image_name)
     0962:    packages = image_list_installed_packages(d)
     0963:
 *** 0964:    combine_spdx(d, image_name, imgdeploydir, img_spdxid, packages, Path(d.getVar("SPDXIMAGEWORK")))
     0965:
     0966:    def make_image_link(target_path, suffix):
     0967:        if image_link_name:
     0968:            link = imgdeploydir / (image_link_name + suffix)
File: '/home/pokybuild/yocto-worker/qemuarm64-ltp/build/meta/classes/create-spdx-2.2.bbclass', lineno: 1078, function: combine_spdx
     1074:            "OTHER",
     1075:            "%s:%s" % (runtime_ref.externalDocumentId, runtime_doc.SPDXID),
     1076:            comment="Runtime dependencies for %s" % name
     1077:        )
 *** 1078:    bb.utils.mkdirhier(spdx_workdir)
     1079:    image_spdx_path = spdx_workdir / (rootfs_name + ".spdx.json")
     1080:
     1081:    with image_spdx_path.open("wb") as f:
     1082:        doc.to_json(f, sort_keys=True, indent=get_json_indent(d))
File: '/home/pokybuild/yocto-worker/qemuarm64-ltp/build/bitbake/lib/bb/utils.py', lineno: 764, function: mkdirhier
     0760:def mkdirhier(directory):
     0761:    """Create a directory like 'mkdir -p', but does not complain if
     0762:    directory already exists like os.makedirs
     0763:    """
 *** 0764:    if directory.find('${') != -1:
     0765:        bb.fatal("Directory name {} contains unexpanded bitbake variable. This may cause build failures and WORKDIR polution.".format(directory))
     0766:    try:
     0767:        os.makedirs(directory)
     0768:    except OSError as e:
Exception: AttributeError: 'PosixPath' object has no attribute 'find'

On 15/12/2023 09:10:46-0800, Jeremy Puhlman via lists.openembedded.org wrote:
> From: "Jeremy A. Puhlman" <jpuhlman@mvista.com>
> 
> On occasion a file is attmpeded to be opened prior to the
> creation of the spdx_workdir. Create the directory before
> the open, just in case.
> 
> File: '/build/layers/poky/meta/classes/create-spdx-2.2.bbclass', lineno: 1081, function: combine_spdx
>      1077:        )
>      1078:
>      1079:    image_spdx_path = spdx_workdir / (rootfs_name + ".spdx.json")
>      1080:
>  *** 1081:    with image_spdx_path.open("wb") as f:
>      1082:        doc.to_json(f, sort_keys=True, indent=get_json_indent(d))
> 
> Signed-off-by: Jeremy A. Puhlman <jpuhlman@mvista.com>
> ---
>  meta/classes/create-spdx-2.2.bbclass | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/meta/classes/create-spdx-2.2.bbclass b/meta/classes/create-spdx-2.2.bbclass
> index b0aef80db1..486efadba9 100644
> --- a/meta/classes/create-spdx-2.2.bbclass
> +++ b/meta/classes/create-spdx-2.2.bbclass
> @@ -1075,7 +1075,7 @@ def combine_spdx(d, rootfs_name, rootfs_deploydir, rootfs_spdxid, packages, spdx
>              "%s:%s" % (runtime_ref.externalDocumentId, runtime_doc.SPDXID),
>              comment="Runtime dependencies for %s" % name
>          )
> -
> +    bb.utils.mkdirhier(spdx_workdir)
>      image_spdx_path = spdx_workdir / (rootfs_name + ".spdx.json")
>  
>      with image_spdx_path.open("wb") as f:
> -- 
> 2.35.2
> 

> 
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#192536): https://lists.openembedded.org/g/openembedded-core/message/192536
> Mute This Topic: https://lists.openembedded.org/mt/103194653/3617179
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [alexandre.belloni@bootlin.com]
> -=-=-=-=-=-=-=-=-=-=-=-
> 


-- 
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


      parent reply	other threads:[~2023-12-16 22:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-15 17:10 [PATCH] create-spdx-2.2: combine spdx can try to write before dir creation jpuhlman
2023-12-15 17:19 ` [OE-core] " Joshua Watt
2023-12-16 22:18 ` Alexandre Belloni [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231216221841b5eec19c@mail.local \
    --to=alexandre.belloni@bootlin.com \
    --cc=jpuhlman@mvista.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox