@@ -1674,7 +1674,17 @@ def get_check_cmds() -> Tuple[List[str], List[str]]:
if topdir:
checkpatch = os.path.join(topdir, 'scripts', 'checkpatch.pl')
if os.access(checkpatch, os.X_OK):
- ppcmds = [f'{checkpatch} -q --terse --no-summary --mailback --showfile']
+ ecode, help_out, err = b4._run_command([checkpatch, "-h"], stdin=None, rundir=topdir)
+ help_out = help_out.decode(errors='replace').strip() if help_out else ""
+ if ecode == 0:
+ ppcmds = f'{checkpatch}'
+ for arg in ["q", "-terse", "-no-summary", "-mailback", "-showfile"]:
+ if ("-" + arg + " ") in help_out:
+ ppcmds += " " + "-" + arg
+ ppcmds += " -"
+ ppcmds = [ppcmds]
+ else:
+ ppcmds = [f'{checkpatch} -q --terse --no-summary --mailback --showfile -']
# TODO: support for a whole-series check command, (pytest, etc)
return ppcmds, scmds
For projects which use a scripts/checkpatch.pl workflow like the kernel but do not sync its source [ever/frequently], like QEMU, some arguments might not be available. This leads to checkpatch not working if it is automagically detected without the user's knowledge leading to hard to diagnose errors. Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org> --- src/b4/ez.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)