* [PATCH] checkpatch: Fix SPDX license check with --root=<path>
@ 2018-07-31 12:07 Joe Perches
0 siblings, 0 replies; only message in thread
From: Joe Perches @ 2018-07-31 12:07 UTC (permalink / raw)
To: Andrew Morton; +Cc: Andy Whitcroft, Charlemagne Lasse, LKML
checkpatch uses the in-kernel script spdxcheck.py to validate
the specific license in a file or script.
This check can currently fail for a couple reasons:
o spdxcheck.py assumes the existence of git tree that may not
exist for a bare source tree from something like a tarball
o the spdxcheck.py must be run from the top level root directory
So add a git existence test and set the subprocess subdirectory.
Signed-off-by: Joe Perches <joe@perches.com>
Reported-by: Charlemagne Lasse <charlemagnelasse@gmail.com>
Tested-by: Charlemagne Lasse <charlemagnelasse@gmail.com>
---
scripts/checkpatch.pl | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index f25f708cd2a7..ce72cc4784e6 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -852,9 +852,10 @@ sub is_maintained_obsolete {
sub is_SPDX_License_valid {
my ($license) = @_;
- return 1 if (!$tree || which("python") eq "" || !(-e "$root/scripts/spdxcheck.py"));
+ return 1 if (!$tree || which("python") eq "" || !(-e "$root/scripts/spdxcheck.py") || !(-e "$root/.git"));
- my $status = `echo "$license" | python $root/scripts/spdxcheck.py -`;
+ my $root_path = abs_path($root);
+ my $status = `cd "$root_path"; echo "$license" | python scripts/spdxcheck.py -`;
return 0 if ($status ne "");
return 1;
}
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2018-07-31 12:07 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-31 12:07 [PATCH] checkpatch: Fix SPDX license check with --root=<path> Joe Perches
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).