All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Martin Jansa" <Martin.Jansa@gmail.com>
To: openembedded-devel@lists.openembedded.org
Cc: Martin Jansa <Martin.Jansa@gmail.com>
Subject: [meta-python2][PATCH] bandit.bbclass: drop
Date: Sun, 21 Mar 2021 09:40:24 +0100	[thread overview]
Message-ID: <20210321084024.5281-1-Martin.Jansa@gmail.com> (raw)

* the identical bbclass is in meta-openembedded/meta-python layer, it depends
  on python3-bandit-native and isn't inherited by default, anyone who wants to
  use it can add meta-python layer

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
---
 classes/bandit.bbclass | 63 ------------------------------------------
 1 file changed, 63 deletions(-)
 delete mode 100644 classes/bandit.bbclass

diff --git a/classes/bandit.bbclass b/classes/bandit.bbclass
deleted file mode 100644
index dc1041e..0000000
--- a/classes/bandit.bbclass
+++ /dev/null
@@ -1,63 +0,0 @@
-# Class to scan Python code for security issues, using Bandit.
-#
-# $ bitbake python-foo -c bandit
-#
-# Writes the report to $DEPLOY_DIR/bandit/python-foo.html.
-# No output if no issues found, a warning if issues found.
-#
-# https://github.com/PyCQA/bandit
-
-# Default location of sources, based on standard distutils
-BANDIT_SOURCE ?= "${S}/build"
-
-# The report format to use.
-# https://bandit.readthedocs.io/en/latest/formatters/index.html
-BANDIT_FORMAT ?= "html"
-
-# Whether a scan should be done every time the recipe is built.
-#
-# By default the scanning needs to be done explicitly, but by setting BANDIT_AUTO
-# to 1 the scan will be done whenever the recipe it built.  Note that you
-# shouldn't set BANDIT_AUTO to 1 globally as it will then try to scan every
-# recipe, including non-Python recipes, causing circular loops.
-BANDIT_AUTO ?= "0"
-
-# Whether Bandit finding issues results in a warning (0) or an error (1).
-BANDIT_FATAL ?= "0"
-
-do_bandit[depends] = "python3-bandit-native:do_populate_sysroot"
-python do_bandit() {
-    import os, subprocess
-    try:
-        report = d.expand("${DEPLOY_DIR}/bandit/${PN}-${PV}.${BANDIT_FORMAT}")
-        os.makedirs(os.path.dirname(report), exist_ok=True)
-
-        args = ("bandit",
-                "--format", d.getVar("BANDIT_FORMAT"),
-                "--output", report,
-                "-ll",
-                "--recursive", d.getVar("BANDIT_SOURCE"))
-        subprocess.check_output(args, stderr=subprocess.STDOUT)
-        bb.note("Bandit found no issues (report written to %s)" % report)
-    except subprocess.CalledProcessError as e:
-        if e.returncode == 1:
-            if oe.types.boolean(d.getVar("BANDIT_FATAL")):
-                bb.error("Bandit found issues (report written to %s)" % report)
-            else:
-                bb.warn("Bandit found issues (report written to %s)" % report)
-        else:
-            bb.error("Bandit failed:\n" + e.output.decode("utf-8"))
-}
-
-python() {
-    before = "do_build"
-    after = "do_compile"
-
-    if oe.types.boolean(d.getVar("BANDIT_AUTO")):
-        bb.build.addtask("do_bandit", before, after, d)
-    else:
-        bb.build.addtask("do_bandit", None, after, d)
-}
-
-# TODO: store report in sstate
-# TODO: a way to pass extra args or .bandit file, basically control -ll
-- 
2.30.2


                 reply	other threads:[~2021-03-21  8:40 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20210321084024.5281-1-Martin.Jansa@gmail.com \
    --to=martin.jansa@gmail.com \
    --cc=openembedded-devel@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.