| | |
| | | # |
| | | # CDDL HEADER END |
| | | # |
| | | # Copyright (c) 2012, Oracle and/or it's affiliates. All rights reserved. |
| | | # Copyright (c) 2012, 2013, Oracle and/or it's affiliates. All rights reserved. |
| | | # |
| | | # |
| | | # gen_components |
| | |
| | | import sys |
| | | |
| | | debug = False |
| | | |
| | | # TPNO string to search for in each .p5m file. |
| | | TPNO_str = "com.oracle.info.tpno" |
| | | |
| | | # Hashtable of components with TPNOs keyed by component name. |
| | | comp_TPNOs = {} |
| | |
| | | <th>ARC Case(s)</th> |
| | | <th>License(s)</th> |
| | | <th>TPNO</th> |
| | | <th>BugDB</th> |
| | | <th>RE</th> |
| | | <th>RM</th> |
| | | <th>Team</th> |
| | |
| | | comp_TPNOs = {} |
| | | for directory, _, files in os.walk(workspace + "/components"): |
| | | for filename in files: |
| | | if filename.endswith(".license") or filename.endswith(".copyright"): |
| | | if filename.endswith(".p5m"): |
| | | pathname = os.path.join(directory, filename) |
| | | fin = open(pathname, 'r') |
| | | lines = fin.readlines() |
| | |
| | | |
| | | for line in lines: |
| | | line = line.replace("\n", "") |
| | | if line.startswith("Oracle Internal Tracking Number"): |
| | | tpno_str = line.split()[-1] |
| | | n = line.find(TPNO_str) |
| | | if n != -1: |
| | | tpno_str = line[n:].split("=")[1] |
| | | try: |
| | | # Check that the TPNO is a valid number. |
| | | tpno = int(tpno_str) |
| | |
| | | (directory, tpno_str) |
| | | comp_TPNOs[directory] = tpno_str |
| | | except: |
| | | print >> sys.stderr, "Unable to read TPNO: %s" % \ |
| | | pathname |
| | | # Check to see if line end in a "\" character in |
| | | # which case, it's an attribute rather than an |
| | | # set name action, so extract it a different way. |
| | | try: |
| | | n += len(TPNO_str)+1 |
| | | tpno_str = line[n:].split()[0] |
| | | # Check that the TPNO is a valid number. |
| | | tpno = int(tpno_str) |
| | | if debug: |
| | | print >> sys.stderr, "TPNO: %s: %s" % \ |
| | | (directory, tpno_str) |
| | | |
| | | # If it's an attribute, there might be more |
| | | # than one TPNO for this component. |
| | | if directory in comp_TPNOs: |
| | | entry = comp_TPNOs[directory] |
| | | tpno_str = "%s,%s" % (entry, tpno_str) |
| | | |
| | | comp_TPNOs[directory] = tpno_str |
| | | except: |
| | | print >> sys.stderr, \ |
| | | "Unable to read TPNO: %s" % pathname |
| | | |
| | | return(comp_TPNOs) |
| | | |
| | |
| | | print >> sys.stderr, \ |
| | | """ |
| | | Usage: |
| | | update_man_pages.py [OPTION...] |
| | | gen-components [OPTION...] |
| | | |
| | | -d, --debug |
| | | Turn on debugging |
| | |
| | | |
| | | if __name__ == "__main__": |
| | | workspace = os.getenv('WS_TOP') |
| | | owners_file = "/net/userland.us.oracle.com/gates/private/RM-RE-list.txt" |
| | | owners_file = "/net/userland.us.oracle.com/gates/private/RE-RM-list.txt" |
| | | |
| | | try: |
| | | opts, args = getopt.getopt(sys.argv[1:], "do:w:", |