mirror of
https://github.com/qca/qca-swiss-army-knife.git
synced 2025-12-10 07:44:42 +01:00
ath12k-check: verify checkpatch.pl md5sum
Print a warning if checkpatch.pl md5sum doesn't match. This way it's easier to make sure that correct version of checkpatch is used. Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
This commit is contained in:
parent
27d9574ce6
commit
c880314adb
1 changed files with 15 additions and 5 deletions
|
|
@ -32,6 +32,7 @@ import hashlib
|
||||||
import distutils.spawn
|
import distutils.spawn
|
||||||
|
|
||||||
CHECKPATCH_COMMIT = '362173572a4018e9c8e39c616823189c41d39d41'
|
CHECKPATCH_COMMIT = '362173572a4018e9c8e39c616823189c41d39d41'
|
||||||
|
CHECKPATCH_MD5SUM = '47ef327d772c156e53a36597723fc781'
|
||||||
|
|
||||||
GIT_URL = 'https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/plain/scripts/checkpatch.pl?id=%s'
|
GIT_URL = 'https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/plain/scripts/checkpatch.pl?id=%s'
|
||||||
|
|
||||||
|
|
@ -222,6 +223,14 @@ def is_filtered(cpwarning):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
def get_checkpatch_md5sum():
|
||||||
|
path = distutils.spawn.find_executable('checkpatch.pl', os.environ['PATH'])
|
||||||
|
f = open(path, 'rb')
|
||||||
|
md5sum = hashlib.md5(f.read()).hexdigest()
|
||||||
|
f.close()
|
||||||
|
|
||||||
|
return md5sum
|
||||||
|
|
||||||
def get_checkpatch_cmdline():
|
def get_checkpatch_cmdline():
|
||||||
return ['checkpatch.pl'] + CHECKPATCH_OPTS + \
|
return ['checkpatch.pl'] + CHECKPATCH_OPTS + \
|
||||||
['--ignore', ",".join(CHECKPATCH_IGNORE)]
|
['--ignore', ",".join(CHECKPATCH_IGNORE)]
|
||||||
|
|
@ -261,6 +270,11 @@ def run_checkpatch_cmd(args, q, tag_map):
|
||||||
|
|
||||||
|
|
||||||
def run_checkpatch(args):
|
def run_checkpatch(args):
|
||||||
|
md5sum = get_checkpatch_md5sum()
|
||||||
|
if md5sum != CHECKPATCH_MD5SUM:
|
||||||
|
print('WARNING: checkpatch.pl md5sum %s does not match with %s' %
|
||||||
|
(md5sum, CHECKPATCH_MD5SUM))
|
||||||
|
|
||||||
# get all files which need to be checked
|
# get all files which need to be checked
|
||||||
cmd = 'git ls-tree HEAD %s | cut -f 2' % (DRIVER_DIR)
|
cmd = 'git ls-tree HEAD %s | cut -f 2' % (DRIVER_DIR)
|
||||||
output = subprocess.check_output(cmd, shell=True, universal_newlines=True)
|
output = subprocess.check_output(cmd, shell=True, universal_newlines=True)
|
||||||
|
|
@ -355,11 +369,7 @@ def show_version(args):
|
||||||
try:
|
try:
|
||||||
checkpatch_version = run(['checkpatch.pl', '--version'],
|
checkpatch_version = run(['checkpatch.pl', '--version'],
|
||||||
universal_newlines=True).splitlines()[1]
|
universal_newlines=True).splitlines()[1]
|
||||||
path = distutils.spawn.find_executable(
|
checkpatch_md5sum = get_checkpatch_md5sum()
|
||||||
'checkpatch.pl', os.environ['PATH'])
|
|
||||||
f = open(path, 'rb')
|
|
||||||
checkpatch_md5sum = hashlib.md5(f.read()).hexdigest()
|
|
||||||
f.close()
|
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue