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 2B734C28B30 for ; Thu, 20 Mar 2025 11:24:18 +0000 (UTC) Subject: Problem creating spdx #poky #bitbake #spdx To: poky@lists.yoctoproject.org From: "Thomas Kilian" X-Originating-Location: =?UTF-8?B?QmFkZW4tQmFkZW4sIEJhZGVuLVfDvHJ0dGVtYmVyZywgREU=?= (85.115.27.58) X-Originating-Platform: Windows Chrome 134 User-Agent: GROUPS.IO Web Poster MIME-Version: 1.0 Date: Thu, 20 Mar 2025 04:24:15 -0700 Message-ID: <8OKr.1742469855469420609.ChUh@lists.yoctoproject.org> Content-Type: multipart/alternative; boundary="qsQ0ZLHokFzOa5ogZNGg" 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 ; Thu, 20 Mar 2025 11:24:18 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/poky/message/13572 --qsQ0ZLHokFzOa5ogZNGg Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Hi, On Poky master when I have a root filesystem containing symlinks i get the = following spdx creation error: >=20 > ERROR: image-debug-1.0-r0 do_create_rootfs_spdx: 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:do_create_rootfs_spdx(d) > 0003: > File: > '/workspaces/build/../sources/poky/meta/classes-recipe/create-spdx-image-= 3.0.bbclass', > lineno: 31, function: do_create_rootfs_spdx > 0027:ROOTFS_POSTUNINSTALL_COMMAND =3D+ "spdx_collect_rootfs_packages" > 0028: > 0029:python do_create_rootfs_spdx() { > 0030: =C2=A0 =C2=A0import oe.spdx30_tasks > *** 0031: =C2=A0 =C2=A0oe.spdx30_tasks.create_rootfs_spdx(d) > 0032:} > 0033:addtask do_create_rootfs_spdx after do_rootfs before do_image > 0034:SSTATETASKS +=3D "do_create_rootfs_spdx" > 0035:do_create_rootfs_spdx[sstate-inputdirs] =3D "${SPDXROOTFSDEPLOY}" > File: '/workspaces/build/../sources/poky/meta/lib/oe/spdx30_tasks.py', > lineno: 1071, function: create_rootfs_spdx > 1067: =C2=A0 =C2=A0 =C2=A0 =C2=A0dirnames.sort() > 1068: =C2=A0 =C2=A0 =C2=A0 =C2=A0filenames.sort() > 1069: =C2=A0 =C2=A0 =C2=A0 =C2=A0for fn in filenames: > 1070: =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0fpath =3D Path(dirpath) / = fn > *** 1071: =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if not fpath.is_file()= or fpath.is_symlink(): > 1072: =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0continue > 1073: > 1074: =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0relpath =3D str(fpath.rela= tive_to(image_rootfs)) > 1075: =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0h =3D bb.utils.sha256_file= (fpath) > File: '/usr/lib/python3.12/pathlib.py', lineno: 894, function: is_file > 0890: =C2=A0 =C2=A0 =C2=A0 =C2=A0Whether this path is a regular file (als= o True for symlinks > pointing > 0891: =C2=A0 =C2=A0 =C2=A0 =C2=A0to regular files). > 0892: =C2=A0 =C2=A0 =C2=A0 =C2=A0""" > 0893: =C2=A0 =C2=A0 =C2=A0 =C2=A0try: > *** 0894: =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return S_ISREG(self.st= at().st_mode) > 0895: =C2=A0 =C2=A0 =C2=A0 =C2=A0except OSError as e: > 0896: =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if not _ignore_error(e): > 0897: =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0raise > 0898: =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0# Path doesn't exist or is= a broken symlink > File: '/usr/lib/python3.12/pathlib.py', lineno: 842, function: stat > 0838: =C2=A0 =C2=A0 =C2=A0 =C2=A0""" > 0839: =C2=A0 =C2=A0 =C2=A0 =C2=A0Return the result of the stat() system c= all on this path, > like > 0840: =C2=A0 =C2=A0 =C2=A0 =C2=A0os.stat() does. > 0841: =C2=A0 =C2=A0 =C2=A0 =C2=A0""" > *** 0842: =C2=A0 =C2=A0 =C2=A0 =C2=A0return os.stat(self, follow_symlinks= =3Dfollow_symlinks) > 0843: > 0844: =C2=A0 =C2=A0def lstat(self): > 0845: =C2=A0 =C2=A0 =C2=A0 =C2=A0""" > 0846: =C2=A0 =C2=A0 =C2=A0 =C2=A0Like stat(), except if the path points t= o a symlink, the > symlink's > Exception: PermissionError: [Errno 13] Permission denied: > '/workspaces/build/tmp/work/poky-linux/image-debug/1.0/rootfs/root/.vs-de= bugger/vs2019' >=20 >=20 >=20 This could be fixed if the check order in spdx30_tasks.py is switched to >=20 > 1071: =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if not fpath.is_symlink() = or fpath.is_file(): >=20 >=20 If I use "create-spdx-2.2.bbclass" I get the following error: >=20 > ERROR: m4-native-1.4.19-r0 do_create_spdx: 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:do_create_spdx(d) > 0003: > File: > '/workspaces/build/../sources/poky/meta/classes/create-spdx-2.2.bbclass', > lineno: 509, function: do_create_spdx > 0505: > 0506: =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if archive is not None: > 0507: =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0recipe.packa= geFileName =3D str(recipe_archive.name) > 0508: > *** 0509: =C2=A0 =C2=A0dep_recipes =3D collect_dep_recipes(d, doc, recipe= ) > 0510: > 0511: =C2=A0 =C2=A0doc_sha1 =3D oe.sbom.write_doc(d, doc, pkg_arch, "reci= pes", > indent=3Dget_json_indent(d)) > 0512: =C2=A0 =C2=A0dep_recipes.append(oe.sbom.DepRecipe(doc, doc_sha1, re= cipe)) > 0513: > File: > '/workspaces/build/../sources/poky/meta/classes/create-spdx-2.2.bbclass', > lineno: 282, function: collect_dep_recipes > 0278: =C2=A0 =C2=A0dep_recipes =3D [] > 0279: > 0280: =C2=A0 =C2=A0deps =3D oe.spdx_common.get_spdx_deps(d) > 0281: > *** 0282: =C2=A0 =C2=A0for dep_pn, dep_hashfn, in_taskhash in deps: > 0283: =C2=A0 =C2=A0 =C2=A0 =C2=A0# If this dependency is not calculated i= n the taskhash skip > it. > 0284: =C2=A0 =C2=A0 =C2=A0 =C2=A0# Otherwise, it can result in broken lin= ks since this task > won't > 0285: =C2=A0 =C2=A0 =C2=A0 =C2=A0# rebuild and see the new SPDX ID if the= dependency changes > 0286: =C2=A0 =C2=A0 =C2=A0 =C2=A0if not in_taskhash: > Exception: TypeError: cannot unpack non-iterable Dep object > ERROR: Logfile of failure stored in: > /workspaces/build/tmp/work/x86_64-linux/m4-native/1.4.19/temp/log.do_crea= te_spdx.213270 >=20 > ERROR: Task > (/workspaces/build/../sources/poky/meta/recipes-devtools/m4/m4-native_1.4= .19.bb:do_create_spdx) > failed with exit code '1' >=20 What can I do to get the spdx creation working again? Greetings, Thomas Kilian --qsQ0ZLHokFzOa5ogZNGg Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable
Hi,
 
On Poky master when I have a root filesystem containing symlinks i get= the following spdx creation error:
 
ERROR: image-debug-1.0-r0 do_create_rootfs_spdx: Error executing a pyt= hon function in exec_func_python() autogenerated:
The stack trace of python calls that resulted in this exception/failur= e was:
File: 'exec_func_python() autogenerated', lineno: 2, function: = <module>
     0001:
 *** 0002:do_create= _rootfs_spdx(d)
     0003:
File: '/workspaces/buil= d/../sources/poky/meta/classes-recipe/create-spdx-image-3.0.bbclass', linen= o: 31, function: do_create_rootfs_spdx
     0027:ROOTFS= _POSTUNINSTALL_COMMAND =3D+ "spdx_collect_rootfs_packages"
  &nbs= p;  0028:
     0029:python do_create_rootfs_spdx()= {
     0030:    import oe.spdx30_tasks
=  *** 0031:    oe.spdx30_tasks.create_rootfs_spdx(d)
&nb= sp;    0032:}
     0033:addtask do_create_roo= tfs_spdx after do_rootfs before do_image
     0034:SSTA= TETASKS +=3D "do_create_rootfs_spdx"
     0035:do_creat= e_rootfs_spdx[sstate-inputdirs] =3D "${SPDXROOTFSDEPLOY}"
File: '/work= spaces/build/../sources/poky/meta/lib/oe/spdx30_tasks.py', lineno: 1071, fu= nction: create_rootfs_spdx
     1067:     &nb= sp;  dirnames.sort()
     1068:     &nbs= p;  filenames.sort()
     1069:     &nbs= p;  for fn in filenames:
     1070:     =        fpath =3D Path(dirpath) / fn
 *** 1071= :            if not fpath.is_file() or fpath.= is_symlink():
     1072:         &n= bsp;      continue
     1073:
 = ;    1074:            relpath =3D s= tr(fpath.relative_to(image_rootfs))
     1075:   &= nbsp;        h =3D bb.utils.sha256_file(fpath)
Fil= e: '/usr/lib/python3.12/pathlib.py', lineno: 894, function: is_file
&n= bsp;    0890:        Whether this path is a r= egular file (also True for symlinks pointing
     0891:=        to regular files).
     089= 2:        """
     0893:   &nb= sp;    try:
 *** 0894:         &nbs= p;  return S_ISREG(self.stat().st_mode)
     0895:=        except OSError as e:
     0= 896:            if not _ignore_error(e):
     0897:              =  raise
     0898:         &nb= sp;  # Path doesn't exist or is a broken symlink
File: '/usr/lib/= python3.12/pathlib.py', lineno: 842, function: stat
    &nbs= p;0838:        """
     0839:  = ;      Return the result of the stat() system call on this p= ath, like
     0840:        os.stat= () does.
     0841:        """
 *** 0842:        return os.stat(self, follow_sym= links=3Dfollow_symlinks)
     0843:
    =  0844:    def lstat(self):
     0845: &n= bsp;      """
     0846:     &= nbsp;  Like stat(), except if the path points to a symlink, the symlin= k's
Exception: PermissionError: [Errno 13] Permission denied: '/worksp= aces/build/tmp/work/poky-linux/image-debug/1.0/rootfs/root/.vs-debugger/vs2= 019'
 
This could be fixed if the check order in spdx30_tasks.py is switched = to
1071:            if not fpath.is_symlink= () or fpath.is_file():
 
If I use "create-spdx-2.2.bbclass" I get the following error:
 
ERROR: m4-native-1.4.19-r0 do_create_spdx: Error executing a python fu= nction in exec_func_python() autogenerated:
The stack trace of python calls that resulted in this exception/failur= e was:
File: 'exec_func_python() autogenerated', lineno: 2, function: = <module>
     0001:
 *** 0002:do_create= _spdx(d)
     0003:
File: '/workspaces/build/../so= urces/poky/meta/classes/create-spdx-2.2.bbclass', lineno: 509, function: do= _create_spdx
     0505:
     0506: =            if archive is not None:
 = ;    0507:                = ;recipe.packageFileName =3D str(recipe_archive.name)
    &nb= sp;0508:
 *** 0509:    dep_recipes =3D collect_dep_reci= pes(d, doc, recipe)
     0510:
     = ;0511:    doc_sha1 =3D oe.sbom.write_doc(d, doc, pkg_arch, "recip= es", indent=3Dget_json_indent(d))
     0512:   &nb= sp;dep_recipes.append(oe.sbom.DepRecipe(doc, doc_sha1, recipe))
 =    0513:
File: '/workspaces/build/../sources/poky/meta/clas= ses/create-spdx-2.2.bbclass', lineno: 282, function: collect_dep_recipes     0278:    dep_recipes =3D []
  &n= bsp;  0279:
     0280:    deps =3D oe.sp= dx_common.get_spdx_deps(d)
     0281:
 *** 02= 82:    for dep_pn, dep_hashfn, in_taskhash in deps:
  &= nbsp;  0283:        # If this dependency is not ca= lculated in the taskhash skip it.
     0284:   &nb= sp;    # Otherwise, it can result in broken links since this task= won't
     0285:        # rebuild = and see the new SPDX ID if the dependency changes
     = 0286:        if not in_taskhash:
Exception: TypeEr= ror: cannot unpack non-iterable Dep object
ERROR: Logfile of failure stored in: /workspaces/build/tmp/work/x86_64= -linux/m4-native/1.4.19/temp/log.do_create_spdx.213270
ERROR: Task (/w= orkspaces/build/../sources/poky/meta/recipes-devtools/m4/m4-native_1.4.19.b= b:do_create_spdx) failed with exit code '1'
What can I do to get the spdx creation working again?
 
 
Greetings,
Thomas Kilian
--qsQ0ZLHokFzOa5ogZNGg--