1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00
samba-mirror/script/compare_cc_results.py
Thomas Nagy 247d12c4fa build:wafsamba: Ignore cfg_file absolute paths differences
Due to build variants, cfg_file paths are written as absolute paths.

Signed-off-by: Thomas Nagy <tnagy@waf.io>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2018-09-05 06:37:22 +02:00

52 lines
1.3 KiB
Python
Executable File

#!/usr/bin/env python
#
# Compare the results of native and cross-compiled configure tests
#
from __future__ import print_function
import sys
import difflib
exceptions = [
'BUILD_DIRECTORY', 'SELFTEST_PREFIX', 'defines',
'CROSS_COMPILE', 'CROSS_ANSWERS', 'CROSS_EXECUTE',
'LIBSOCKET_WRAPPER_SO_PATH',
'LIBNSS_WRAPPER_SO_PATH',
'LIBPAM_WRAPPER_SO_PATH',
'LIBUID_WRAPPER_SO_PATH',
'LIBRESOLV_WRAPPER_SO_PATH',
]
base_lines = list()
base_fname = ''
found_diff = False
for fname in sys.argv[1:]:
lines = list()
f = open(fname, 'r')
for line in f:
if line.startswith("cfg_files ="):
# waf writes configuration files as absolute paths
continue
if len(line.split('=', 1)) == 2:
key = line.split('=', 1)[0].strip()
if key in exceptions:
continue
lines.append(line)
f.close()
if base_fname:
diff = list(difflib.unified_diff(base_lines, lines, base_fname, fname))
if diff:
print('configuration files %s and %s do not match' % (base_fname, fname))
for l in diff:
sys.stdout.write(l)
found_diff = True
else:
base_fname = fname
base_lines = lines
if found_diff:
sys.exit(1)