From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6E12EC41535 for ; Sat, 16 Dec 2023 22:18:53 +0000 (UTC) Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [217.70.183.195]) by mx.groups.io with SMTP id smtpd.web11.5380.1702765129513902174 for ; Sat, 16 Dec 2023 14:18:50 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=eEwYqwIf; spf=pass (domain: bootlin.com, ip: 217.70.183.195, mailfrom: alexandre.belloni@bootlin.com) Received: by mail.gandi.net (Postfix) with ESMTPSA id 5F12860002; Sat, 16 Dec 2023 22:18:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1702765127; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=MvKvskxUGnoLclUp6AS6SHoYVPidhSzsLZe5MpVJNuQ=; b=eEwYqwIf1gt8KXOcRvTx3CG9IXRZ1IePQWQd6iDEMyq32u7s66xLxWPKBuG0422TyPqnHz S9hQFBgJbgvZ4qNf6BgkT2OcIY2mgLQWc45rIr/FBxTkMpfblocsAM0oP0f2/o5cAuc/qH 5INWor4KVZxh2Jos+Mg0Y7l/LD3K5TOW6sRoePX74hn+hs//nG7n85hJTGuz0+nq+88yXV nv2sRqHe206c2Pja+gLj9440aPOkUyOTw2MQXcpSLmLsM2Wvx4t6pRSFqti//ngaI23vDX nOQg2IBd0WuXt7LXclpLQeqtKvOBY6rI1/BSYkJfCd9PdZfzeu2Z2tbj9k0iPQ== Date: Sat, 16 Dec 2023 23:18:41 +0100 From: Alexandre Belloni 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 Message-ID: <20231216221841b5eec19c@mail.local> References: <20231215171046.2926492-1-jpuhlman@mvista.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231215171046.2926492-1-jpuhlman@mvista.com> X-GND-Sasl: alexandre.belloni@bootlin.com List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Sat, 16 Dec 2023 22:18:53 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/192572 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: 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" > > 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 > --- > 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