# HG changeset patch # User Rich Burridge # Date 1354033514 28800 # Node ID 757624619bb367ff88e820bec1329d13fc3ebe61 # Parent 57ffa0ff918c0cf887324636ebe8bdeee9a5ed3f 15922912 Auto-generation of Userland gate list - Phase 4 diff -r 57ffa0ff918c -r 757624619bb3 make-rules/component-report --- a/make-rules/component-report Mon Nov 26 23:00:58 2012 -0800 +++ b/make-rules/component-report Tue Nov 27 08:25:14 2012 -0800 @@ -24,6 +24,7 @@ @echo "" >>$@ ; for license in $(LICENSE) ; do \ echo "$$license
" >>$@ ; \ done ; echo "" >>$@ + @echo "$(TPNO)" >>$@ @echo "" >>$@ ; for bugdb in $(COMPONENT_BUGDB) ; do \ echo "$$bugdb
" >>$@ ; \ done ; echo "" >>$@ @@ -40,6 +41,7 @@ @echo "COMPONENT_PROJECT_URL=\"$(COMPONENT_PROJECT_URL)\"" >>$@ @echo "COMPONENT_ARCHIVE_URL=\"$(COMPONENT_ARCHIVE_URL)\"" >>$@ @echo "COMPONENT_DIR=\"$(CDIR)\"" >>$@ + @echo "TPNO=\"$(TPNO)\"" >>$@ @echo "COMPONENT_BUGDB=\"$(COMPONENT_BUGDB)\"" >>$@ @echo "RESPONSIBLE_ENGINEER=\"$(RESPONSIBLE_ENGINEER)\"" >>$@ @echo "RESPONSIBLE_MANAGER=\"$(RESPONSIBLE_MANAGER)\"" >>$@ diff -r 57ffa0ff918c -r 757624619bb3 tools/gen-components --- a/tools/gen-components Mon Nov 26 23:00:58 2012 -0800 +++ b/tools/gen-components Tue Nov 27 08:25:14 2012 -0800 @@ -22,8 +22,8 @@ # Copyright (c) 2012, Oracle and/or it's affiliates. All rights reserved. # # -# gen_components.py -# A simple program to generate (on stdout) the component.html web page +# gen_components +# A simple script to generate (on stdout), the component.html web page # found at: http://userland.us.oracle.com/components.html # @@ -33,6 +33,9 @@ debug = False +# Hashtable of components with TPNOs keyed by component name. +comp_TPNOs = {} + # Hashtable of RE's / RM's keyed by component path. owners = {} @@ -82,6 +85,7 @@ Package(s) ARC Case(s) License(s) + TPNO BugDB RE RM @@ -119,6 +123,34 @@ return owners +# Return a hashtable of components with TPNOs keyed by component name. +def find_TPNOs(workspace): + comp_TPNOs = {} + for directory, _, files in os.walk(workspace + "/components"): + for filename in files: + if filename.endswith(".license") or filename.endswith(".copyright"): + pathname = os.path.join(directory, filename) + fin = open(pathname, 'r') + lines = fin.readlines() + fin.close() + + for line in lines: + line = line.replace("\n", "") + if line.startswith("Oracle Internal Tracking Number"): + tpno_str = line.split()[-1] + try: + # Check that the TPNO is a valid number. + tpno = int(tpno_str) + if debug: + print >> sys.stderr, "TPNO: %s: %s" % \ + (directory, tpno_str) + comp_TPNOs[directory] = tpno_str + except: + print >> sys.stderr, "Unable to read TPNO: %s" % \ + pathname + + return(comp_TPNOs) + # Return a sorted list of the directories containing one or more .p5m files. def find_p5m_dirs(workspace): p5m_dirs = [] @@ -160,11 +192,16 @@ if debug: print >> sys.stderr, "Processing %s" % component_dir + try: + tpno = comp_TPNOs[component_dir] + except: + tpno = "" + re, rm = get_re_and_rm(component_dir) makefiles = "-f Makefile -f %s/make-rules/component-report" % workspace targets = "clean component-hook" - cmd = "cd %s; RESPONSIBLE_ENGINEER='%s' RESPONSIBLE_MANAGER='%s' gmake COMPONENT_HOOK='gmake %s component-report' %s" % \ - (component_dir, re, rm, makefiles, targets) + cmd = "cd %s; TPNO='%s' RESPONSIBLE_ENGINEER='%s' RESPONSIBLE_MANAGER='%s' gmake COMPONENT_HOOK='gmake %s component-report' %s" % \ + (component_dir, tpno, re, rm, makefiles, targets) if debug: print >> sys.stderr, "gen_reports: command: `%s`" % cmd @@ -232,6 +269,7 @@ owners = read_owners(owners_file) write_preamble() + comp_TPNOs = find_TPNOs(workspace) p5m_dirs = find_p5m_dirs(workspace) for p5m_dir in p5m_dirs: gen_reports(workspace, p5m_dir)