@@ -0,0 +1,2447 @@
+#!/usr/bin/env python%0A##%0A# Parse out a string array to be compiled into an executable for revision%0A# history%0A#%0A# @author Stuart W. Baker%0A# @data 28 April 2018%0A%0Afrom optparse import OptionParser%0Aimport os%0A%0Ausage = %22usage: %25prog %5Boptions%5D%5Cn%5Cn%22 + %5C%0A        %22  %25prog -i $(APP_PATH) -o revisions.cxxout%5Cn%22%0A%0Aparser = OptionParser(usage=usage)%0Aparser.add_option(%22-o%22, %22--output%22, dest=%22output%22, metavar=%22FILE%22,%0A                  default=%22revisions.cxxout%22,%0A                  help=%22generated output file%22)%0Aparser.add_option(%22-i%22, %22--input%22, dest=%22input%22, metavar=%22FILE%22,%0A                  default=None,%0A                  help=%22space seperated list of repository root paths%22)%0Aparser.add_option(%22-d%22, %22--dirty%22, dest=%22dirty%22, action=%22store_true%22,%0A                  default=False,%0A                  help=%22add the %5C%22dirty%5C%22 suffix: -d%22)%0Aparser.add_option(%22-u%22, %22--untracked%22, dest=%22untracked%22, action=%22store_true%22,%0A                  default=False,%0A                  help=%22add the %5C%22untracked files%5C%22 suffix: -u%22)%0A%0Aparser.add_option(%22-g%22, %22--gcc%22, dest=%22gcc%22, metavar=%22%60gcc -dumpversion%60%22,%0A                  default=None,%0A                  help=%22add the GNU GCC version%22)%0A%0A(options, args) = parser.parse_args()%0A%0Aif (options.input == None) :%0A    parser.error('missing parameter -i')%0A%0Ainputs = options.input.split(%22 %22)%0A%0Aorig_dir = os.path.abspath('./')%0Aoutput = '#include %3Ccstddef%3E%5Cn%5Cn'%0Aoutput += 'const char *REVISIONS%5B%5D = %5Cn%7B%5Cn'%0A%0Aif options.gcc != None :%0A    output += '    %7Bgcc-' + options.gcc + '%7D,%5Cn'%0A%0Afor x in inputs :%0A    # go into the root of the repo%0A    os.chdir(orig_dir)%0A    os.chdir(x)%0A%0A    # get the short hash%0A    os.system('git rev-parse --short HEAD %3E /tmp/git_hash')%0A%0A    # get the dirty flag%0A    dirty = os.system('git diff --quiet')%0A%0A    # get the untracked flag%0A    os.system('git status -u -s %3E /tmp/git_untracked')%0A%0A    # format the output%0A    git_hash_file = open('/tmp/git_hash', 'r')%0A    output += '    %22'%0A    output += git_hash_file.read(7)%0A    output += ':' + os.path.split(os.path.abspath(x))%5B1%5D%0A%0A    if dirty or os.stat('/tmp/git_untracked').st_size != 0 :%0A        output += ':'%0A    if dirty :%0A        output += '-d'%0A    if os.stat('/tmp/git_untracked').st_size != 0 :%0A        output += '-u'%0A    output += '%22,%5Cn'%0A%0Aos.chdir(orig_dir)%0Aoutput += '    NULL%5Cn'%0Aoutput += '%7D;%5Cn'%0Aoutput_file = open(options.output, 'w')%0Aoutput_file.write(output)%0Aoutput_file.close()%0A%0Aos.system('rm -f /tmp/git_hash')%0Aos.system('rm -f /tmp/git_untracked')%0A%0A

Add script for printing revision info to a string array.