ath12k-check: print compiler version specified in kernel .config file

As the compiler used to compile the kernel can be different from the default
host compiler, print both the host GCC and the compiler specified in .config
file.

Screenshot:

ath12k-check (md5sum a143ac447ffce2545530c2b4ad96a2e8)

python:		3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0]
host gcc:	gcc (Debian 12.2.0-14) 12.2.0
config cc:	x86_64-linux-gcc (GCC) 13.2.0
sparse:		v0.6.4-39-gce1a6720f69e
checkpatch.pl:	Version: 0.32 (md5sum 47ef327d772c156e53a36597723fc781)
gtags:		gtags (Global) 6.6.9

Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
This commit is contained in:
Kalle Valo 2023-10-03 20:56:51 +03:00
parent d0f69db447
commit 8aafad4337

View file

@ -40,6 +40,9 @@ DRIVER_DIR = 'drivers/net/wireless/ath/ath12k/'
FILTER_REGEXP = r'/ath'
# Example: CONFIG_CC_VERSION_TEXT="x86_64-linux-gcc (GCC) 13.2.0"
CONFIG_CC_REGEXP = r'^CONFIG_CC_VERSION_TEXT="(.*)"$'
IGNORE_FILES = []
CHECKPATCH_IGNORE = [
@ -342,7 +345,8 @@ def run_checkpatch(args):
def show_version(args):
gcc_version = 'not found'
host_gcc_version = 'not found'
config_cc_version = 'not found'
sparse_version = 'not found'
checkpatch_version = 'not found'
checkpatch_md5sum = 'N/A'
@ -355,8 +359,17 @@ def show_version(args):
f.close()
try:
gcc_version = run(['gcc', '--version'],
universal_newlines=True).splitlines()[0]
host_gcc_version = run(['gcc', '--version'],
universal_newlines=True).splitlines()[0]
except:
pass
try:
f = open('.config')
m = re.search(CONFIG_CC_REGEXP, f.read(), re.MULTILINE)
if m is not None:
config_cc_version = m.group(1)
f.close()
except:
pass
@ -382,7 +395,8 @@ def show_version(args):
print('ath12k-check (md5sum %s)' % (ath12kcheck_md5sum))
print()
print('python:\t\t%s' % (sys.version))
print('gcc:\t\t%s' % (gcc_version))
print('host gcc:\t%s' % (host_gcc_version))
print('config cc:\t%s' % (config_cc_version))
print('sparse:\t\t%s' % (sparse_version))
print('checkpatch.pl:\t%s (md5sum %s)' % (checkpatch_version, checkpatch_md5sum))
print('gtags:\t\t%s' % (gtags_version))