@@ -0,0 +1,3349 @@
+#!/usr/bin/env python%0A# coding: utf-8%0A%0A# ==================================================%0A# open%0A# --------------------------------------------------%0A%0Afrom __future__ import print_function%0Afrom __future__ import absolute_import%0A%0Aimport os%0Aimport shutil%0Aimport sys%0Aimport tct%0A%0Afrom os.path import join as ospj%0Afrom tct import deepget, writejson%0A%0Aparams = tct.readjson(sys.argv%5B1%5D)%0Afacts = tct.readjson(params%5B'factsfile'%5D)%0Amilestones = tct.readjson(params%5B'milestonesfile'%5D)%0Aresultfile = params%5B'resultfile'%5D%0Aresult = tct.readjson(resultfile)%0Atoolname = params%5B'toolname'%5D%0Atoolname_pure = params%5B'toolname_pure'%5D%0Atoolchain_name = facts%5B'toolchain_name'%5D%0Aworkdir = params%5B'workdir'%5D%0Aloglist = result%5B'loglist'%5D = result.get('loglist', %5B%5D)%0Aexitcode = CONTINUE = 0%0A%0A%0A# ==================================================%0A# Make a copy of milestones for later inspection?%0A# --------------------------------------------------%0A%0Aif 0 or milestones.get('debug_always_make_milestones_snapshot'):%0A    tct.make_snapshot_of_milestones(params%5B'milestonesfile'%5D, sys.argv%5B1%5D)%0A%0A%0A# ==================================================%0A# Helper functions%0A# --------------------------------------------------%0A%0Adef lookup(D, *keys, **kwdargs):%0A    result = deepget(D, *keys, **kwdargs)%0A    loglist.append((keys, result))%0A    return result%0A%0A%0A# ==================================================%0A# define%0A# --------------------------------------------------%0A%0Areveal_exitcodes_file = None%0Areveal_milestones_file = None%0A%0A%0A# ==================================================%0A# Check params%0A# --------------------------------------------------%0A%0Aif exitcode == CONTINUE:%0A    loglist.append('CHECK PARAMS')%0A%0A    TheProjectWebroot = lookup(milestones, 'TheProjectWebroot')%0A    if not TheProjectWebroot:%0A        CONTINUE = -2%0A%0Aif exitcode == CONTINUE:%0A    loglist.append('PARAMS are ok')%0Aelse:%0A    loglist.append('Bad PARAMS or nothing to do')%0A%0A%0A# ==================================================%0A# work%0A# --------------------------------------------------%0A%0Aif exitcode == CONTINUE:%0A%0A    reveal_exitcodes = lookup(milestones, 'reveal_exitcodes')%0A    if reveal_exitcodes and milestones.get('tool_exitcodes_2'):%0A        reveal_exitcodes_file = ospj(TheProjectWebroot, 'exitcodes.json')%0A        writejson(milestones.get('tool_exitcodes_2'), reveal_exitcodes_file)%0A%0A    reveal_milestones = lookup(milestones, 'reveal_milestones')%0A    if reveal_milestones:%0A        reveal_milestones_file = ospj(TheProjectWebroot, 'milestones.json')%0A        shutil.copy2(params%5B'milestonesfile'%5D, reveal_milestones_file)%0A%0A%0A# ==================================================%0A# Set MILESTONE%0A# --------------------------------------------------%0A%0Aif reveal_exitcodes_file:%0A    result%5B'MILESTONES'%5D.append(%7B'reveal_exitcodes_file':%0A                                 reveal_exitcodes_file%7D)%0A%0Aif reveal_milestones_file:%0A    result%5B'MILESTONES'%5D.append(%7B'reveal_milestones_file':%0A                                 reveal_milestones_file%7D)%0A%0A%0A# ==================================================%0A# save result%0A# --------------------------------------------------%0A%0Atct.save_the_result(result, resultfile, params, facts, milestones, exitcode, CONTINUE)%0A%0A# ==================================================%0A# Return with proper exitcode%0A# --------------------------------------------------%0A%0Asys.exit(exitcode)%0A

Add run_14-Reveal-exitcodes-and-milestones.py