Marcel Telka
2024-04-02 327b05574f0dc1b1046c72401256ce5afd3e3247
tools/gen-components
@@ -19,7 +19,7 @@
#
# 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
@@ -32,6 +32,9 @@
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 = {}
@@ -86,7 +89,6 @@
    <th>ARC Case(s)</th>
    <th>License(s)</th>
    <th>TPNO</th>
    <th>BugDB</th>
    <th>RE</th>
    <th>RM</th>
    <th>Team</th>
@@ -129,7 +131,7 @@
    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()
@@ -137,8 +139,9 @@
                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)
@@ -147,8 +150,28 @@
                                    (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)
@@ -237,7 +260,7 @@
    print  >> sys.stderr, \
"""
Usage: 
      update_man_pages.py [OPTION...]
      gen-components [OPTION...]
-d, --debug
      Turn on debugging
@@ -254,7 +277,7 @@
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:",