gen-components revision 1273
456238178f89e5a3de2988ee6c8af924297d52d9Christian Maeder# CDDL HEADER START
456238178f89e5a3de2988ee6c8af924297d52d9Christian Maeder# The contents of this file are subject to the terms of the
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder# Common Development and Distribution License (the "License").
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder# You may not use this file except in compliance with the License.
43b4c41fbb07705c9df321221ab9cb9832460407Christian Maeder# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder# or http://www.opensolaris.org/os/licensing.
f4a2a20e49f41b2afa657e5e64d9e349c7faa091Christian Maeder# See the License for the specific language governing permissions
f2f9df2e17e70674f0bf426ed1763c973ee4cde0Christian Maeder# and limitations under the License.
c9a7e6af169a2adfb92f42331cd578065ed83a2bChristian Maeder# When distributing Covered Code, include this CDDL HEADER in each
e7757995211bd395dc79d26fe017d99375f7d2a6Christian Maeder# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
e7757995211bd395dc79d26fe017d99375f7d2a6Christian Maeder# If applicable, add the following below this CDDL HEADER, with the
63f0e65a37b95621334db9ee4ba0cd9d826f5c0fChristian Maeder# fields enclosed by brackets "[]" replaced with your own identifying
63f0e65a37b95621334db9ee4ba0cd9d826f5c0fChristian Maeder# information: Portions Copyright [yyyy] [name of copyright owner]
c0c2380bced8159ff0297ece14eba948bd236471Christian Maeder# CDDL HEADER END
b1f59a4ea7c96f4c03a4d7cfcb9c5e66871cfbbbChristian Maeder# Copyright (c) 2012, Oracle and/or it's affiliates. All rights reserved.
4cb215739e9ab13447fa21162482ebe485b47455Christian Maeder# gen_components
8ef75f1cc0437656bf622cec5ac9e8ea221da8f2Christian Maeder# A simple script to generate (on stdout), the component.html web page
404166b9366552e9ec5abb87a37c76ec8a815fb7Klaus Luettich# found at: http://userland.us.oracle.com/components.html
e593b89bfd4952698dc37feced21cefe869d87a2Christian Maeder# Hashtable of components with TPNOs keyed by component name.
7cc09dd93962a2155c34d209d1d4cd7d7b838264Christian Maeder# Hashtable of RE's, RM's and Teams keyed by component path.
51d769d55d88dfa88bdf54bee78d8fa85a2deba8Christian Maeder# Initial HTML for the generated web page.
1aee4aaddde105264c1faf394d88e302c05094ffChristian Maeder <style type='text/css' media='screen'>
f4a2a20e49f41b2afa657e5e64d9e349c7faa091Christian Maeder tr.even:hover, tr.even:hover td.sorting_1 ,
dcbd32289a7bdf1e6edd06c6ab0698c6a9dbf37aChristian Maeder tr.odd:hover, tr.odd:hover td.sorting_1 {
05a62e84edac8c64de04f8349dee418598d216b9Christian Maeder background-color: gold;
8b767d09a78927b111f5596fdff9ca7d2c1a439fChristian Maeder <script type='text/javascript' src='js/jquery.js'></script>
8b767d09a78927b111f5596fdff9ca7d2c1a439fChristian Maeder <script type='text/javascript' src='js/jquery.dataTables.js'></script>
8b767d09a78927b111f5596fdff9ca7d2c1a439fChristian Maeder <script type='text/javascript' src='js/ColReorder.js'></script>
8b767d09a78927b111f5596fdff9ca7d2c1a439fChristian Maeder <script type='text/javascript' src='js/ColVis.js'></script>
8cacad2a09782249243b80985f28e9387019fe40Christian Maeder bPaginate: true,
363939beade943a02b31004cea09dec34fa8a6d9Christian Maeder bFilter: true,
363939beade943a02b31004cea09dec34fa8a6d9Christian Maeder iDisplayLength: -1,
014dc30f64ec25e4790cca987d4d1e6635430510Christian Maeder aLengthMenu: [ [ 10, 50, -1], [ 10, 50, 'All'] ]
f1541d4a151dbd08002dbd14e7eb1d5dde253689Christian Maeder<h1>Userland Components</h1>
6dc9bc98d0854fe2e3dd3bfc4275096a0c28ee1cChristian Maeder<table align='center' id='components'>
61fa0ac06ede811c7aad54ec4c4202346727368eChristian Maeder <th>Component</th>
c0c2380bced8159ff0297ece14eba948bd236471Christian Maeder <th>Version</th>
63f0e65a37b95621334db9ee4ba0cd9d826f5c0fChristian Maeder <th>Gate Path</th>
63f0e65a37b95621334db9ee4ba0cd9d826f5c0fChristian Maeder <th>Package(s)</th>
63f0e65a37b95621334db9ee4ba0cd9d826f5c0fChristian Maeder <th>ARC Case(s)</th>
63f0e65a37b95621334db9ee4ba0cd9d826f5c0fChristian Maeder <th>License(s)</th>
63f0e65a37b95621334db9ee4ba0cd9d826f5c0fChristian Maeder <th>TPNO</th>
9e748851c150e1022fb952bab3315e869aaf0214Christian Maeder <th>BugDB</th>
6a79849bed67264c396dddb3e9c184bdfc1a1bc9Christian Maeder <th>Team</th>
bc8cbf12aa172bf5673b92a9e7a0151d4aa4c315Christian Maeder# Final HTML for the generated web page.
1cd4f6541984962658add5cfaa9f28a93879881bChristian Maeder# Return a hashtable of RE's, RM's and Teams keyed by component path.
6ff7a91875597d6e4dfaa68c79187d01473e8341Christian Maeder print >> sys.stderr, "Reading %s" % owners_file
6a79849bed67264c396dddb3e9c184bdfc1a1bc9Christian Maeder print >> sys.stderr, "Unable to read owners file: %s" % owners_file
ca074a78b8dcccbb8c419586787882f98d0c6163Christian Maeder# Return a hashtable of components with TPNOs keyed by component name.
b568982efd0997d877286faa592d81b03c8c67b8Christian Maeder for directory, _, files in os.walk(workspace + "/components"):
0be0db405c49906bd7057255069bf6df53395ac9Klaus Luettich if filename.endswith(".license") or filename.endswith(".copyright"):
ca074a78b8dcccbb8c419586787882f98d0c6163Christian Maeder pathname = os.path.join(directory, filename)
d946c1bfdd7d58aa7c023efe864d5999eb44a61bChristian Maeder if line.startswith("Oracle Internal Tracking Number"):
63f0e65a37b95621334db9ee4ba0cd9d826f5c0fChristian Maeder # Check that the TPNO is a valid number.
63f0e65a37b95621334db9ee4ba0cd9d826f5c0fChristian Maeder print >> sys.stderr, "Unable to read TPNO: %s" % \
f1541d4a151dbd08002dbd14e7eb1d5dde253689Christian Maeder# Return a sorted list of the directories containing one or more .p5m files.
e6d5dbbc3308f05197868806e0b860f4f53875f1Christian Maeder for dir, _, files in os.walk(workspace + "/components"):
456238178f89e5a3de2988ee6c8af924297d52d9Christian Maeder# Write out the initial HTML for the components.html web page.
6cd33d6101fb1b93baa6d86fac158af18a115108Christian Maeder# Return the RE, RM and Team for this component.
6cd33d6101fb1b93baa6d86fac158af18a115108Christian Maeder result = [ "Unknown", "Unknown", "Unknown" ]
c9a7e6af169a2adfb92f42331cd578065ed83a2bChristian Maeder print >> sys.stderr, "Component path: ", component_path,
456238178f89e5a3de2988ee6c8af924297d52d9Christian Maeder print >> sys.stderr, "RE, RM, Team: ", result
93f5b72fdb9ee734caa750b43dd79bbb590dcd73Christian Maeder# Generate an HTML table entry for all the information for the component
93f5b72fdb9ee734caa750b43dd79bbb590dcd73Christian Maeder# in the given directory. This generates a file called 'component-report'
93f5b72fdb9ee734caa750b43dd79bbb590dcd73Christian Maeder# under the components build directory.
06dd4e7c29f33f6122a910719e3bd9062256e397Andy Gimblett print >> sys.stderr, "Processing %s" % component_dir
63f0e65a37b95621334db9ee4ba0cd9d826f5c0fChristian Maeder makefiles = "-f Makefile -f %s/make-rules/component-report" % workspace
9e748851c150e1022fb952bab3315e869aaf0214Christian Maeder template += "gmake COMPONENT_HOOK='gmake %s component-report' %s"
63f0e65a37b95621334db9ee4ba0cd9d826f5c0fChristian Maeder cmd = template % (component_dir, tpno, re, rm, team, makefiles, targets)
383aa66e5142365fe9b1f88b18c1da5b27cc8c04Christian Maeder print >> sys.stderr, "gen_reports: command: `%s`" % cmd
383aa66e5142365fe9b1f88b18c1da5b27cc8c04Christian Maeder# Collect all the .../build/component-report files and write them to stdout.
aded505f9b42cc38975559c2a5d175ae95de436bChristian Maeder report = "%s/build/component-report" % p5m_dir
aded505f9b42cc38975559c2a5d175ae95de436bChristian Maeder print >> sys.stderr, "Unable to read: %s" % report
54ea981a0503c396c2923a1c06421c6235baf27fChristian Maeder# Write out the final HTML for the components.html web page.
aded505f9b42cc38975559c2a5d175ae95de436bChristian Maeder# Write out a usage message showing valid options to this script.
d23b0cc79c0d204e6ec758dff8d0ba71c9f693f7Christian Maeder Turn on debugging
d23b0cc79c0d204e6ec758dff8d0ba71c9f693f7Christian Maeder Location of a file containing a list of RE's /RM's per component
d23b0cc79c0d204e6ec758dff8d0ba71c9f693f7Christian Maeder-w --workspace
d23b0cc79c0d204e6ec758dff8d0ba71c9f693f7Christian Maeder Location of the Userland workspace
4fc9de0da898448f1d3597ebbd8c04a066464c21Christian Maeder owners_file = "/net/userland.us.oracle.com/gates/private/RM-RE-list.txt"