tools.linux.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Frank Li <Frank.Li@nxp.com>
To: konstantin@linuxfoundation.org, tools@kernel.org
Cc: robh@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org
Subject: [PATCH 1/2] prep: add --check option to run necessary patch check
Date: Tue, 19 Mar 2024 00:53:31 -0400	[thread overview]
Message-ID: <20240319045332.2304950-1-Frank.Li@nxp.com> (raw)

This just run script/tools/checkpatch.pl

Signed-off-by: Frank Li <Frank.Li@nxp.com>
---
 b4/command.py |  1 +
 b4/ez.py      | 15 +++++++++++++++
 2 files changed, 16 insertions(+)

diff --git a/b4/command.py b/b4/command.py
index f4516b2..5d3bbc7 100644
--- a/b4/command.py
+++ b/b4/command.py
@@ -291,6 +291,7 @@ def setup_parser() -> argparse.ArgumentParser:
                          help='Force revision to be this number instead')
     sp_prep.add_argument('--set-prefixes', metavar='PREFIX', nargs='+',
                          help='Extra prefixes to add to [PATCH] (e.g.: RFC mydrv)')
+    sp_prep.add_argument('--check', action='store_true', default=False, help='Run necessary check before send patches')
 
     spp_g = sp_prep.add_mutually_exclusive_group()
     spp_g.add_argument('-p', '--format-patch', metavar='OUTPUT_DIR',
diff --git a/b4/ez.py b/b4/ez.py
index 9207282..bcf6363 100644
--- a/b4/ez.py
+++ b/b4/ez.py
@@ -2181,6 +2181,18 @@ def set_prefixes(prefixes: list) -> None:
     else:
         logger.info('No changes to extra prefixes.')
 
+def prep_check_patch() -> None:
+    logger.info('Run check patch.')
+    base_commit, stc, endc, oneline, shortlog, diffstat = get_series_details()
+    topdir = b4.git_get_toplevel()
+    getcheckpatch = os.path.join(topdir, 'scripts', 'checkpatch.pl')
+    cmdargs = list();
+    cmdargs.append(getcheckpatch)
+    cmdargs.append('-g')
+    cmdargs.append(stc + '..' + endc)
+    ret = subprocess.run(cmdargs)
+    if ret.returncode > 0:
+        logger.critical('CRITICAL: Check patch failure')
 
 def cmd_prep(cmdargs: argparse.Namespace) -> None:
     check_can_gfr()
@@ -2245,6 +2257,9 @@ def cmd_prep(cmdargs: argparse.Namespace) -> None:
     if cmdargs.auto_to_cc:
         auto_to_cc()
 
+    if cmdargs.check:
+        prep_check_patch()
+
     if cmdargs.edit_cover:
         return edit_cover()
 
-- 
2.34.1


             reply	other threads:[~2024-03-19  4:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-19  4:53 Frank Li [this message]
2024-03-19  4:53 ` [PATCH 2/2] prep: --check run dt_binding_check when patch include yaml file Frank Li
2024-04-12 21:09 ` [PATCH 1/2] prep: add --check option to run necessary patch check Konstantin Ryabitsev
2024-04-15 21:33   ` Frank Li
2024-04-16 20:09     ` Konstantin Ryabitsev

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=20240319045332.2304950-1-Frank.Li@nxp.com \
    --to=frank.li@nxp.com \
    --cc=conor+dt@kernel.org \
    --cc=konstantin@linuxfoundation.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=robh@kernel.org \
    --cc=tools@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).