From patchwork Mon May 16 19:45:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Kiernan X-Patchwork-Id: 8095 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 0A99CC433EF for ; Mon, 16 May 2022 19:45:52 +0000 (UTC) Received: from mail-ed1-f48.google.com (mail-ed1-f48.google.com [209.85.208.48]) by mx.groups.io with SMTP id smtpd.web12.878.1652730345584104502 for ; Mon, 16 May 2022 12:45:45 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=FDHwhrJs; spf=pass (domain: gmail.com, ip: 209.85.208.48, mailfrom: alex.kiernan@gmail.com) Received: by mail-ed1-f48.google.com with SMTP id i40so4713769eda.7 for ; Mon, 16 May 2022 12:45:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=tDkUgTn3fholICnWbPDltwakUwpk0zb5fGUpmAyhx9s=; b=FDHwhrJsxn0Ey287FZh33CgxooG/qCXPhP20L4qFLGZOsHbwxvgEAZ44UCYyIvXC4H dWf2k/5A/LtWuEoetHTY1rQzAaK94gq1UmqDgcSik+FHSu5SWM8DjjwHQ0kOP2DaTK/p ng4blrS42TArgWJOX1sGzANzKS6aJ10PGXHbMjj2z4/9R3Q9arg4Y56QrFMF8pa7tB7F ODD9mHbpeU8GH1hZkVbqVlJte9KSYEc6HnGaZupm/YJGHkUfKIBCW/oZCL9vjFrLNvqm pMGuPqseAmqWwkg683eo0ySMlnPp5HB9poxX4kQiFITmq2VETpr0ecQmjT40jImyMOCg 9eqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=tDkUgTn3fholICnWbPDltwakUwpk0zb5fGUpmAyhx9s=; b=CLN3WNdfUEl1+UsED/btBKSEeZpphKJuqhddmGhFjO+jq+3wJoPB7t3S9L1ZNbb/BS ARsrHEdsiRjhn2r0Z0ycQKX/hDTi8nsk8NdaMy3glDMB61o3VigjiuFk+V6Qx95qInVu PAI9bStvPLqwc0WvdkZkcqC5gw0NNRuoScIyVSO5UBMVZ/9AkKxDyP/9u/g6yiyTItPC 8pXp6S5VwhwaQshZ1J75JIblCq1DkOuL3WoE5RngX5UIM2yw1KdPWyiRVBqFIMtF6uYV B1Jp2tjWVWWpYVeKEt9Qiuh+CoLXuRlsnYjQsKIh50hU3LXA+Y8P84wSiPp3ESKXKvY3 LpKw== X-Gm-Message-State: AOAM531RlgQvBwkKgLmIkE5UWs5veAGjY3vaKM/vGOZONBFUolX4SVYn y3oGUlyeOwKmoaotPKmB7DKGXrtyTMY= X-Google-Smtp-Source: ABdhPJzz0dK8vgN6irWLVrXmADNHhw7f7bk1+mDxPdywtopSLGhStT/5mxji0s4fK8qum6vo191IsA== X-Received: by 2002:aa7:cb1a:0:b0:41c:dd9c:2eaa with SMTP id s26-20020aa7cb1a000000b0041cdd9c2eaamr14737685edt.119.1652730343693; Mon, 16 May 2022 12:45:43 -0700 (PDT) Received: from localhost.localdomain (cust246-dsl91-135-6.idnet.net. [91.135.6.246]) by smtp.gmail.com with ESMTPSA id da12-20020a056402176c00b0042aaa626ac0sm3004743edb.38.2022.05.16.12.45.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 May 2022 12:45:42 -0700 (PDT) From: Alex Kiernan To: openembedded-core@lists.openembedded.org Cc: Alex Kiernan , Alex Kiernan Subject: [OE-Core][PATCH] cve-check: Fix rootfs CVE generation Date: Mon, 16 May 2022 20:45:03 +0100 Message-Id: <20220516194502.29026-1-alex.kiernan@gmail.com> X-Mailer: git-send-email 2.35.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 ; Mon, 16 May 2022 19:45:52 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/165694 Building an image with INHERIT += "cve-check" fails with undefined variables and fails to pass d into pure python functions: ERROR: core-image-minimal-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:cve_check_write_rootfs_manifest(d) 0003: File: '/home/alexk/poky/meta/classes/cve-check.bbclass', lineno: 213, function: cve_check_write_rootfs_manifest 0209: 0210: link_path = os.path.join(deploy_dir, "%s.json" % link_name) 0211: manifest_path = d.getVar("CVE_CHECK_MANIFEST_JSON") 0212: bb.note("Generating JSON CVE manifest") *** 0213: generate_json_report(json_summary_name, json_summary_link_name) 0214: bb.plain("Image CVE JSON report stored in: %s" % link_path) 0215:} 0216: 0217:ROOTFS_POSTPROCESS_COMMAND:prepend = "${@'cve_check_write_rootfs_manifest; ' if d.getVar('CVE_CHECK_CREATE_MANIFEST') == '1' else ''}" Exception: NameError: name 'json_summary_name' is not defined Fixes: f2987891d315 ("cve-check: add JSON format to summary output") Signed-off-by: Alex Kiernan Signed-off-by: Alex Kiernan --- meta/classes/cve-check.bbclass | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/meta/classes/cve-check.bbclass b/meta/classes/cve-check.bbclass index 24ddb865eaf5..d1ad875d9508 100644 --- a/meta/classes/cve-check.bbclass +++ b/meta/classes/cve-check.bbclass @@ -79,7 +79,7 @@ CVE_CHECK_LAYER_INCLUDELIST ??= "" # set to "alphabetical" for version using single alphabetical character as increment release CVE_VERSION_SUFFIX ??= "" -def generate_json_report(out_path, link_path): +def generate_json_report(d, out_path, link_path): if os.path.exists(d.getVar("CVE_CHECK_SUMMARY_INDEX_PATH")): import json from oe.cve_check import cve_check_merge_jsons @@ -129,7 +129,7 @@ python cve_save_summary_handler () { json_summary_link_name = os.path.join(cvelogpath, d.getVar("CVE_CHECK_SUMMARY_FILE_NAME_JSON")) json_summary_name = os.path.join(cvelogpath, "%s-%s.json" % (cve_summary_name, timestamp)) - generate_json_report(json_summary_name, json_summary_link_name) + generate_json_report(d, json_summary_name, json_summary_link_name) bb.plain("CVE report summary created at: %s" % json_summary_link_name) } @@ -210,7 +210,7 @@ python cve_check_write_rootfs_manifest () { link_path = os.path.join(deploy_dir, "%s.json" % link_name) manifest_path = d.getVar("CVE_CHECK_MANIFEST_JSON") bb.note("Generating JSON CVE manifest") - generate_json_report(json_summary_name, json_summary_link_name) + generate_json_report(d, manifest_path, link_path) bb.plain("Image CVE JSON report stored in: %s" % link_path) }