diff options
author | Noel Power <noel.power@suse.com> | 2018-12-05 16:37:17 +0000 |
---|---|---|
committer | Noel Power <npower@samba.org> | 2018-12-10 10:38:25 +0100 |
commit | 0e35d741934eb1626f9a7aeacd9eb1a96e27546f (patch) | |
tree | bedea9f6d034145628a4daecc3e10a9bbf831bed /script/compare_cc_results.py | |
parent | 0186f2733aa59f70278747a6fd4ae9e66b8fd4e4 (diff) | |
download | samba-0e35d741934eb1626f9a7aeacd9eb1a96e27546f.tar.gz |
script: Fix failing build_xc job
build_xc job uses compare_cc_results.py to compare cache
files, the cache files are stringified hash maps, the results
in python 3.4 don't compare well due to inconsistent order of
dict key/value pairs when the cache files are created. While
comparing the file contents works fine in python3.6 it fails
with python3.4. This patch detects problematic dict lines and
rewrites the value for comparison
Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'script/compare_cc_results.py')
-rwxr-xr-x | script/compare_cc_results.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/script/compare_cc_results.py b/script/compare_cc_results.py index 570f454ca9c..8ff7bde6564 100755 --- a/script/compare_cc_results.py +++ b/script/compare_cc_results.py @@ -33,8 +33,22 @@ for fname in sys.argv[1:]: continue if len(line.split('=', 1)) == 2: key = line.split('=', 1)[0].strip() + value = line.split('=', 1)[1].strip() if key in exceptions: continue + # using waf with python 3.4 seems to randomly sort dict keys + # we can't modify the waf code but we can fake a dict value + # string representation as if it were sorted. python 3.6.5 + # doesn't seem to suffer from this behaviour + if value.startswith('{'): + import ast + amap = ast.literal_eval(value) + fakeline = "" + for k in sorted(amap.keys()): + if not len(fakeline) == 0: + fakeline = fakeline + ", " + fakeline = fakeline + '\'' + k + '\': \'' + amap[k] + '\'' + line = key + ' = {' + fakeline + '}' lines.append(line) f.close() if base_fname: |