WHATSNEW: Add release notes for Samba 4.6.13.
[Samba.git] / script / compare_cc_results.py
blob43b46f869a96a56e84addf6c5234768320edc7e9
1 #!/usr/bin/env python
4 # Compare the results of native and cross-compiled configure tests
7 import sys
8 import difflib
10 exceptions = ['BUILD_DIRECTORY', 'CROSS_COMPILE', 'CROSS_ANSWERS',
11 'CROSS_EXECUTE', 'SELFTEST_PREFIX', 'LIBSOCKET_WRAPPER_SO_PATH',
12 'defines' ]
14 base_lines = list()
15 base_fname = ''
17 found_diff = False
19 for fname in sys.argv[1:]:
20 lines = list()
21 f = open(fname, 'r')
22 for line in f:
23 if len(line.split('=', 1)) == 2:
24 key = line.split('=', 1)[0].strip()
25 if key in exceptions:
26 continue
27 lines.append(line)
28 f.close()
29 if base_fname:
30 diff = list(difflib.unified_diff(base_lines,lines,base_fname,fname))
31 if diff:
32 print 'configuration files %s and %s do not match' % (base_fname, fname)
33 for l in diff:
34 sys.stdout.write(l)
35 found_diff = True
36 else:
37 base_fname = fname
38 base_lines = lines
40 if found_diff:
41 sys.exit(1)