prep: add --check option to run necessary patch check
PATCH 1/2 prep: add --check option to run necessary patch check
This just run script/tools/checkpatch.pl
--- b4/command.py | 1 + b4/ez.py | 15 +++++++++++++++ 2 files changed, 16 insertions(+)
b4/command.py +1 -0
@@ -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',
b4/ez.py +15 -0
@@ -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()
Signature · 1 line
2.34.1
PATCH 2/2 prep: --check run dt_binding_check when patch include yaml file
When patch include device binding yaml file, run dt_binding_check
--- b4/ez.py | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-)
b4/ez.py +24 -2
@@ -2190,8 +2190,30 @@ def prep_check_patch() -> None: cmdargs.append(getcheckpatch) cmdargs.append('-g') cmdargs.append(stc + '..' + endc) - ret = subprocess.run(cmdargs) - if ret.returncode > 0: + dtret = ret = subprocess.run(cmdargs) + + gitargs = ['diff', '--stat', '--name-only', f'{stc}..{endc}'] + ecode, diffstat = b4.git_run_command(None, gitargs) + + for file in diffstat.split("\n"): + if file.startswith('Documentation/devicetree/bindings/'): + directory, filename = os.path.split(file) + if filename.endswith('.yaml'): + touchargs = list() + touchargs.append('touch') + touchargs.append(file) + subprocess.run(touchargs) + + logger.info('Run dt_binding_check: ' + filename) + cmdargs = list() + cmdargs.append('make') + cmdargs.append('dt_binding_check') + cmdargs.append('DT_SCHEMA_FILES=' + filename); + dtret = subprocess.run(cmdargs) + if dtret.returncode > 0: + break + + if ret.returncode > 0 or dtret.returncode > 0: logger.critical('CRITICAL: Check patch failure') def cmd_prep(cmdargs: argparse.Namespace) -> None:
Signature · 1 line
2.34.1
Quoted 1 line · Frank Li
This just run
script/tools/checkpatch.pl
Hello:
Thank you for your contribution. I didn't end up taking it, because I wanted to make it more generic and less tied to the kernel. However, there is now very similar functionality in the current master that can be invoked with "b4 prep --check".
It's not yet a complete feature, but any feedback is welcome.
-K
Quoted 9 lines · Konstantin Ryabitsev
Quoted 1 line · Frank Li
This just run
script/tools/checkpatch.plHello:
Thank you for your contribution. I didn't end up taking it, because I wanted to make it more generic and less tied to the kernel. However, there is now very similar functionality in the current master that can be invoked with "b4 prep --check".
Can you point me the functionality name?
Frank
Quoted 4 lines
It's not yet a complete feature, but any feedback is welcome.
-K
Quoted 4 lines · Frank Li
Quoted 3 lines · Konstantin Ryabitsev
Quoted 1 line · Frank Li
This just run
script/tools/checkpatch.pl
Quoted 8 lines
Quoted 6 lines
Hello:
Thank you for your contribution. I didn't end up taking it, because I wanted to make it more generic and less tied to the kernel. However, there is now very similar functionality in the current master that can be invoked with "b4 prep --check".
Can you point me the functionality name?
I'm not quite sure what you mean. You should be able to just run "b4 prep --check" to use it (with the latest master). E.g.:
$ b4 prep --check Checking patches using: /home/user/work/git/linux/scripts/checkpatch.pl -q --terse --no-summary --mailback --showfile --- ● 0e77d0387477: serial: exar: adding missing CTI and Exar PCI ids ● d60ea7cc5b31: serial: exar: add support for reading from Exar EEPROM ● c78b0d54faac: serial: exar: add support for config/set single MPIO ● 32bd8299e6d3: serial: exar: add optional board_setup function ● 656acc105c50: serial: exar: add some CTI helper functions ● checkpatch.pl: drivers/tty/serial/8250/8250_exar.c:606: WARNING: 'transciever' may be misspelled - perhaps 'transceiver'? ● checkpatch.pl: drivers/tty/serial/8250/8250_exar.c:612: WARNING: 'transciever' may be misspelled - perhaps 'transceiver'? ● checkpatch.pl: drivers/tty/serial/8250/8250_exar.c:652: WARNING: 'interupts' may be misspelled - perhaps 'interrupts'? ● dfda64f51bcc: serial: exar: add CTI board and port setup functions ● checkpatch.pl: drivers/tty/serial/8250/8250_exar.c:1147: WARNING: 'interupts' may be misspelled - perhaps 'interrupts'? ● 32ea19edf0da: serial: exar: fix: fix crash during shutdown if setup fails --- Success: 5, Warning: 4, Error: 0
Hope this helps.
-K