diff options
author | Joe Perches <joe@perches.com> | 2018-08-22 00:58:04 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-08-22 13:52:49 -0400 |
commit | 56294112791ac11c6fcdc6544f1381f9272202db (patch) | |
tree | 8ce70b62ed30406ba7d32700d7cf30800f54ec5c /scripts | |
parent | 490b292c834c5e72057f4315ef915692cbd6defd (diff) |
checkpatch: fix SPDX license check with --root=<path>
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.
Link: http://lkml.kernel.org/r/2b32864324ae9c92948b002ec4c0c22409ed98f1.camel@perches.com
Signed-off-by: Joe Perches <joe@perches.com>
Reported-by: Charlemagne Lasse <charlemagnelasse@gmail.com>
Tested-by: Charlemagne Lasse <charlemagnelasse@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/checkpatch.pl | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 25adf9811a2c..eced9b303995 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl | |||
@@ -852,9 +852,10 @@ sub is_maintained_obsolete { | |||
852 | sub is_SPDX_License_valid { | 852 | sub is_SPDX_License_valid { |
853 | my ($license) = @_; | 853 | my ($license) = @_; |
854 | 854 | ||
855 | return 1 if (!$tree || which("python") eq "" || !(-e "$root/scripts/spdxcheck.py")); | 855 | return 1 if (!$tree || which("python") eq "" || !(-e "$root/scripts/spdxcheck.py") || !(-e "$root/.git")); |
856 | 856 | ||
857 | my $status = `echo "$license" | python $root/scripts/spdxcheck.py -`; | 857 | my $root_path = abs_path($root); |
858 | my $status = `cd "$root_path"; echo "$license" | python scripts/spdxcheck.py -`; | ||
858 | return 0 if ($status ne ""); | 859 | return 0 if ($status ne ""); |
859 | return 1; | 860 | return 1; |
860 | } | 861 | } |