From patchwork Tue Aug 2 09:29:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jose Quaresma X-Patchwork-Id: 10857 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 6E007C00140 for ; Tue, 2 Aug 2022 09:29:41 +0000 (UTC) Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) by mx.groups.io with SMTP id smtpd.web11.4133.1659432578599253067 for ; Tue, 02 Aug 2022 02:29:39 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=U55UMfo8; spf=pass (domain: gmail.com, ip: 209.85.128.45, mailfrom: quaresma.jose@gmail.com) Received: by mail-wm1-f45.google.com with SMTP id u14-20020a05600c00ce00b003a323062569so6686153wmm.4 for ; Tue, 02 Aug 2022 02:29:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc; bh=WA6OpPJfMFBhBbSoQ7iqV4hBKRLku1ZwZS88cRq2EOc=; b=U55UMfo8dNEmP09s5MRNriGUOfELJTkgmFBGKJYnKp11VHHV7tqhvy22wvVNuOq6oe cPxoAMtd6oPRF7NI0S/7o68DMY1tE/ALYPfTOBt3hL5w/EZdaQiTxskzAmt8yC3kXA8K gWTuQw2SdwweA9Vsu0tKoHNpqaY4MUUgkr9OvnPytkno5dodvExouC2/PQNL5hYjmqK/ IcBrGKgVMB0K1CPBgRCyc1LT9hgc6nkWK6S3Htf0XEaFGMlubRzttnHO8J2whA5FBeoY 0n2qwFAKJQSD2Wy6y1wTtNaDuSawMzqb4HTSHzjsh9YJTKm93tzqDUxfTA4jA3B6yVt2 Lu7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc; bh=WA6OpPJfMFBhBbSoQ7iqV4hBKRLku1ZwZS88cRq2EOc=; b=b+tSYX25VgJX9WTzOUj77XT0klCz0C1qgDyk1PLDY+Kce21tAUBDhZsGk9bMycjXfo buNn8OTYXhHStPBTIMoXlKIUm7HFfG+r4doPbIWyyFV0CsuH6scHurUzmKVLmy95NjVr nomVhAKzRwfjEatZT5cHOK5YoWjzUefmVevRSPCXd/MKY/4LqMIbhGZfbT3z+/lLHNYC jCEw+0/AzbmRNPrCjgp6dViaXtTAzDnnSSyB0/GMZPJ6qHa5XiQqQQCdbm9q0CtX7I72 TKPJssCUW1p5iMNK1e7inxQbbxIgyKJidej6i9HRaOZamt5cGz9oFmhr8JiAH+q6QxTB X6JQ== X-Gm-Message-State: AJIora8LRyQf8pE16xvHDJCHlZN9Ipou9BGizir9lm4tDVP7GbIsXGPf RyjXxXH0QmFDgAsS55bcl8wCG5ZeMKaHJA== X-Google-Smtp-Source: AGRyM1sYNpMQUuszOEkH/WWAK5FV6gf5f2lBykjpGP3EZ8BwROy5DRE6P4GFAPuNvUsKVL1wsIpXBA== X-Received: by 2002:a1c:2783:0:b0:3a2:fd82:bf46 with SMTP id n125-20020a1c2783000000b003a2fd82bf46mr13731884wmn.29.1659432576643; Tue, 02 Aug 2022 02:29:36 -0700 (PDT) Received: from fio.lan (176.57.115.89.rev.vodafone.pt. [89.115.57.176]) by smtp.gmail.com with ESMTPSA id i2-20020a1c5402000000b003a2cf1535aasm18065865wmb.17.2022.08.02.02.29.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Aug 2022 02:29:35 -0700 (PDT) From: Jose Quaresma X-Google-Original-From: Jose Quaresma To: openembedded-core@lists.openembedded.org Cc: ricardo@foundries.io, daiane.angolini@foundries.io, Jose Quaresma Subject: [OE-core][PATCH] create-spdx: ignore packing control files from ipk and deb Date: Tue, 2 Aug 2022 10:29:24 +0100 Message-Id: <20220802092924.82664-1-jose.quaresma@foundries.io> X-Mailer: git-send-email 2.37.1 MIME-Version: 1.0 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 ; Tue, 02 Aug 2022 09:29:41 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/168773 Otherwise spdx can have references for data that is not packed in the package delivered because this contol data is temporarly and only exist while the package is been write. During do_package_write_ipk task in do_package_ipk the control files is cleaned up at the end. This can create a race condiction when the do_create_spdx task runs the add_package_files function and these files is been deleted at same time in the task do_package_write_ipk. ERROR: alsa-topology-conf-1.2.5.1-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: '/srv/oe/build/conf/../../layers/openembedded-core/meta/classes/create-spdx.bbclass', lineno: 567, function: do_create_spdx 0563: package_doc.add_relationship(package_doc, "DESCRIBES", spdx_package) 0564: 0565: package_archive = deploy_dir_spdx / "packages" / (package_doc.name + ".tar.zst") 0566: with optional_tarfile(package_archive, archive_packaged) as archive: *** 0567: package_files = add_package_files( 0568: d, 0569: package_doc, 0570: spdx_package, 0571: pkgdest / package, File: '/srv/oe/build/conf/../../layers/openembedded-core/meta/classes/create-spdx.bbclass', lineno: 234, function: add_package_files 0230: info.mtime = source_date_epoch 0231: 0232: archive.addfile(info, f) 0233: *** 0234: sha1 = bb.utils.sha1_file(filepath) 0235: sha1s.append(sha1) 0236: spdx_file.checksums.append(oe.spdx.SPDXChecksum( 0237: algorithm="SHA1", 0238: checksumValue=sha1, File: '/srv/oe/bitbake/lib/bb/utils.py', lineno: 559, function: sha1_file 0555: """ 0556: Return the hex string representation of the SHA1 checksum of the filename 0557: """ 0558: import hashlib *** 0559: return _hasher(hashlib.sha1(), filename) 0560: 0561:def sha384_file(filename): 0562: """ 0563: Return the hex string representation of the SHA384 checksum of the filename File: '/srv/oe/bitbake/lib/bb/utils.py', lineno: 528, function: _hasher 0524: 0525:def _hasher(method, filename): 0526: import mmap 0527: *** 0528: with open(filename, "rb") as f: 0529: try: 0530: with mmap.mmap(f.fileno(), 0, access=mmap.ACCESS_READ) as mm: 0531: for chunk in iter(lambda: mm.read(8192), b''): 0532: method.update(chunk) Exception: FileNotFoundError: [Errno 2] No such file or directory: '/srv/oe/build/tmp-lmp/work/all-lmp-linux/alsa-topology-conf/1.2.5.1-r0/packages-split/alsa-topology-conf/CONTROL/control' ERROR: Logfile of failure stored in: /srv/oe/build/tmp-lmp/work/all-lmp-linux/alsa-topology-conf/1.2.5.1-r0/temp/log.do_create_spdx.998864 INFO: recipe alsa-topology-conf-1.2.5.1-r0: task do_create_spdx: Failed Signed-off-by: Jose Quaresma --- meta/classes/create-spdx.bbclass | 1 + 1 file changed, 1 insertion(+) diff --git a/meta/classes/create-spdx.bbclass b/meta/classes/create-spdx.bbclass index 37b6b569a1..08ef7fd409 100644 --- a/meta/classes/create-spdx.bbclass +++ b/meta/classes/create-spdx.bbclass @@ -571,6 +571,7 @@ python do_create_spdx() { pkgdest / package, lambda file_counter: oe.sbom.get_packaged_file_spdxid(pkg_name, file_counter), lambda filepath: ["BINARY"], + ignore_top_level_dirs=['CONTROL', 'DEBIAN'], archive=archive, )