19775104 Multiple TPNO's not being correctly displayed on Userland gatelist webpage s11-update
authorJohn Beck <John.Beck@Oracle.COM>
Sun, 18 Jan 2015 17:09:55 -0800
branchs11-update
changeset 3662 d2e09f75ea27
parent 3661 47545fb8aed4
child 3665 e472522a0ae9
19775104 Multiple TPNO's not being correctly displayed on Userland gatelist webpage 19807306 Userland gatelist shouldn't show entry for the "Package History" component
make-rules/component-report
tools/gen-components
--- a/make-rules/component-report	Sat Jan 17 09:17:37 2015 -0800
+++ b/make-rules/component-report	Sun Jan 18 17:09:55 2015 -0800
@@ -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>" >>[email protected] ; for license in $(LICENSE) ; do \
 	     echo "$$license<br>" >>[email protected] ; \
 	 done ; echo "</td>" >>[email protected]
-	@echo "<td>$(TPNO)</td>" >>[email protected]
+	@echo "<td>" >>[email protected] ; for tpno in $(ALL_TPNOS) ; do \
+	     echo "$${tpno}<br>" >>[email protected] ; \
+	 done ; echo "</td>" >>[email protected]
 	@echo "<td>" >>[email protected] ; for bugdb in $(COMPONENT_BUGDB) ; do \
 	     echo "<a href='$(BUGDB_URL)$$bugdb'>$$bugdb</a><br>" >>[email protected] ; \
 	 done ; echo "</td>" >>[email protected]
@@ -43,7 +50,7 @@
 	@echo "COMPONENT_PROJECT_URL=\"$(COMPONENT_PROJECT_URL)\"" >>[email protected]
 	@echo "COMPONENT_ARCHIVE_URL=\"$(COMPONENT_ARCHIVE_URL)\"" >>[email protected]
 	@echo "COMPONENT_DIR=\"$(CDIR)\"" >>[email protected]
-	@echo "TPNO=\"$(TPNO)\"" >>[email protected]
+	@echo "TPNO=\"$(ALL_TPNOS)\"" >>[email protected]
 	@echo "COMPONENT_BUGDB=\"$(COMPONENT_BUGDB)\"" >>[email protected]
 	@echo "RESPONSIBLE_ENGINEER=\"$(RESPONSIBLE_ENGINEER)\"" >>[email protected]
 	@echo "RESPONSIBLE_MANAGER=\"$(RESPONSIBLE_MANAGER)\"" >>[email protected]
--- a/tools/gen-components	Sat Jan 17 09:17:37 2015 -0800
+++ b/tools/gen-components	Sun Jan 18 17:09:55 2015 -0800
@@ -19,12 +19,12 @@
 #
 # CDDL HEADER END
 #
-# Copyright (c) 2012, 2013, Oracle and/or it's affiliates.  All rights reserved.
+# Copyright (c) 2012, 2015, 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/s11-update.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,60 +121,13 @@
 
     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 = []
     for dir, _, files in os.walk(workspace + "/components"):
         for file in files:
+            if dir.endswith("meta-packages/history"):
+                continue;
             if file.endswith(".p5m"):
                 p5m_dirs.append(dir)
 
@@ -217,21 +164,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 +240,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)