19775104 Multiple TPNO's not being correctly displayed on Userland gatelist webpage
authorRich Burridge <rich.burridge@oracle.com>
Tue, 07 Oct 2014 14:20:21 -0700
changeset 2140 ba3091d7e9b6
parent 2139 127c47823841
child 2141 3b99626d1270
19775104 Multiple TPNO's not being correctly displayed on Userland gatelist webpage
make-rules/component-report
tools/gen-components
--- a/make-rules/component-report	Tue Oct 07 12:52:21 2014 -0700
+++ b/make-rules/component-report	Tue Oct 07 14:20:21 2014 -0700
@@ -9,6 +9,11 @@
 REPORT_TRANSFORMS = $(WS_TOP)/transforms/report
 CDIR=$(COMPONENT_DIR:$(WS_TOP)/%=%)
 
+# Add all the TPNO* Makefile macros together for further processing below.
+$(foreach macro, $(filter TPNO%, $(.VARIABLES)), \
+    $(eval ALL_TPNOS += $$($(macro))) \
+)
+
 component-report:	$(BUILD_DIR)/component-report
 
 $(BUILD_DIR)/component-report:	$(BUILD_DIR)/package-info
@@ -25,7 +30,9 @@
 	@echo "<td>" >>$@ ; for license in $(LICENSE) ; do \
 	     echo "$$license<br>" >>$@ ; \
 	 done ; echo "</td>" >>$@
-	@echo "<td>$(TPNO)</td>" >>$@
+	@echo "<td>" >>$@ ; for tpno in $(ALL_TPNOS) ; do \
+	     echo "$${tpno}<br>" >>$@ ; \
+	 done ; echo "</td>" >>$@
 	@echo "<td>" >>$@ ; for bugdb in $(COMPONENT_BUGDB) ; do \
 	     echo "<a href='$(BUGDB_URL)$$bugdb'>$$bugdb</a><br>" >>$@ ; \
 	 done ; echo "</td>" >>$@
@@ -43,7 +50,7 @@
 	@echo "COMPONENT_PROJECT_URL=\"$(COMPONENT_PROJECT_URL)\"" >>$@
 	@echo "COMPONENT_ARCHIVE_URL=\"$(COMPONENT_ARCHIVE_URL)\"" >>$@
 	@echo "COMPONENT_DIR=\"$(CDIR)\"" >>$@
-	@echo "TPNO=\"$(TPNO)\"" >>$@
+	@echo "TPNO=\"$(ALL_TPNOS)\"" >>$@
 	@echo "COMPONENT_BUGDB=\"$(COMPONENT_BUGDB)\"" >>$@
 	@echo "RESPONSIBLE_ENGINEER=\"$(RESPONSIBLE_ENGINEER)\"" >>$@
 	@echo "RESPONSIBLE_MANAGER=\"$(RESPONSIBLE_MANAGER)\"" >>$@
--- a/tools/gen-components	Tue Oct 07 12:52:21 2014 -0700
+++ b/tools/gen-components	Tue Oct 07 14:20:21 2014 -0700
@@ -19,12 +19,12 @@
 #
 # CDDL HEADER END
 #
-# Copyright (c) 2012, 2013, Oracle and/or it's affiliates.  All rights reserved.
+# Copyright (c) 2012, 2014, Oracle and/or it's affiliates.  All rights reserved.
 #
 #
 # gen_components
-# A simple script to generate (on stdout), the component.html web page 
-# found at: http://userland.us.oracle.com/components.html
+# A simple script to generate (on stdout), the component.html web page
+# found at: http://userland.us.oracle.com/component-lists/s12.html
 #
 
 import getopt
@@ -33,12 +33,6 @@
 
 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 = {}
-
 # Hashtable of RE's, RM's and Teams keyed by component path.
 owners = {}
 
@@ -127,55 +121,6 @@
 
     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(".p5m"):
-                pathname = os.path.join(directory, filename)
-                fin = open(pathname, 'r')
-                lines = fin.readlines()
-                fin.close()
-
-                for line in lines:
-                    line = line.replace("\n", "")
-                    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)
-                            if debug:
-                                print >> sys.stderr, "TPNO: %s: %s" % \
-                                    (directory, tpno_str)
-                            comp_TPNOs[directory] = tpno_str
-                        except:
-                            # 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)
-
 # Return a sorted list of the directories containing one or more .p5m files.
 def find_p5m_dirs(workspace):
     p5m_dirs = []
@@ -217,21 +162,15 @@
     if debug:
         print >> sys.stderr, "Processing %s" % component_dir
 
-    try:
-        tpno = comp_TPNOs[component_dir]
-    except:
-        tpno = ""
-
     re, rm, team = get_owner(component_dir)
     makefiles = "-f Makefile -f %s/make-rules/component-report" % workspace
     targets = "clean component-hook"
     template = "cd %s; "
-    template += "TPNO='%s' "
     template += "RESPONSIBLE_ENGINEER='%s' "
     template += "RESPONSIBLE_MANAGER='%s' "
     template += "TEAM='%s' "
     template += "gmake COMPONENT_HOOK='gmake %s component-report' %s"
-    cmd = template % (component_dir, tpno, re, rm, team, makefiles, targets)
+    cmd = template % (component_dir, re, rm, team, makefiles, targets)
 
     if debug:
         print >> sys.stderr, "gen_reports: command: `%s`" % cmd
@@ -299,7 +238,6 @@
  
     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)