tools/gen-components
author Rich Burridge <rich.burridge@oracle.com>
Tue, 27 Nov 2012 08:25:14 -0800
changeset 1061 757624619bb3
parent 1058 34d7aaa03423
child 1063 ce6e2ed3767e
permissions -rwxr-xr-x
15922912 Auto-generation of Userland gate list - Phase 4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1048
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
     1
#!/usr/bin/python
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
     2
#
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
     3
# CDDL HEADER START
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
     4
#
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
     5
# The contents of this file are subject to the terms of the
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
     6
# Common Development and Distribution License (the "License").
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
     7
# You may not use this file except in compliance with the License.
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
     8
#
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
     9
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    10
# or http://www.opensolaris.org/os/licensing.
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    11
# See the License for the specific language governing permissions
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    12
# and limitations under the License.
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    13
#
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    14
# When distributing Covered Code, include this CDDL HEADER in each
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    15
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    16
# If applicable, add the following below this CDDL HEADER, with the
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    17
# fields enclosed by brackets "[]" replaced with your own identifying
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    18
# information: Portions Copyright [yyyy] [name of copyright owner]
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    19
#
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    20
# CDDL HEADER END
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    21
#
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    22
# Copyright (c) 2012, Oracle and/or it's affiliates.  All rights reserved.
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    23
#
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    24
#
1061
757624619bb3 15922912 Auto-generation of Userland gate list - Phase 4
Rich Burridge <rich.burridge@oracle.com>
parents: 1058
diff changeset
    25
# gen_components
757624619bb3 15922912 Auto-generation of Userland gate list - Phase 4
Rich Burridge <rich.burridge@oracle.com>
parents: 1058
diff changeset
    26
# A simple script to generate (on stdout), the component.html web page 
1048
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    27
# found at: http://userland.us.oracle.com/components.html
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    28
#
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    29
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    30
import getopt
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    31
import os
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    32
import sys
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    33
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    34
debug = False
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    35
1061
757624619bb3 15922912 Auto-generation of Userland gate list - Phase 4
Rich Burridge <rich.burridge@oracle.com>
parents: 1058
diff changeset
    36
# Hashtable of components with TPNOs keyed by component name.
757624619bb3 15922912 Auto-generation of Userland gate list - Phase 4
Rich Burridge <rich.burridge@oracle.com>
parents: 1058
diff changeset
    37
comp_TPNOs = {}
757624619bb3 15922912 Auto-generation of Userland gate list - Phase 4
Rich Burridge <rich.burridge@oracle.com>
parents: 1058
diff changeset
    38
1053
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
    39
# Hashtable of RE's / RM's keyed by component path.
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
    40
owners = {}
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
    41
1048
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    42
# Initial HTML for the generated web page.
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    43
preamble = """
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    44
<html>
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    45
<head>
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    46
    <style type='text/css' media='screen'>
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    47
        @import '/css/demo_table.css';
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    48
        @import '/css/ColVis.css';
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    49
        @import '/css/ColReorder.css';
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    50
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    51
            tr.even:hover,  tr.even:hover td.sorting_1 ,
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    52
            tr.odd:hover,  tr.odd:hover td.sorting_1 {
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    53
                            background-color: gold;
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    54
            }
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    55
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    56
    </style>
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    57
    <script type='text/javascript' src='js/jquery.js'></script>
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    58
    <script type='text/javascript' src='js/jquery.dataTables.js'></script>
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    59
    <script type='text/javascript' src='js/ColReorder.js'></script>
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    60
    <script type='text/javascript' src='js/ColVis.js'></script>
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    61
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    62
    <script>
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    63
        $(document).ready(function() {
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    64
            $('#components').dataTable({
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    65
                "sDom": 'C<"clear">Rlfrtip',
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    66
                bPaginate: true,
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    67
                bFilter: true,
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    68
                bSort: true,
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    69
                iDisplayLength: -1,
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    70
                aLengthMenu: [ [ 10, 50, -1], [ 10, 50, 'All'] ]
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    71
            });
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    72
        });
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    73
    </script>
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    74
</head>
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    75
<body>
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    76
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    77
<h1>Userland Components</h1>
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    78
<p>
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    79
<table align='center' id='components'>
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    80
<thead>
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    81
<tr>
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    82
    <th>Component</th>
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    83
    <th>Version</th>
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    84
    <th>Gate Path</th>
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    85
    <th>Package(s)</th>
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    86
    <th>ARC Case(s)</th>
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    87
    <th>License(s)</th>
1061
757624619bb3 15922912 Auto-generation of Userland gate list - Phase 4
Rich Burridge <rich.burridge@oracle.com>
parents: 1058
diff changeset
    88
    <th>TPNO</th>
1058
34d7aaa03423 15886624 Auto-generation of Userland gate list - Phase 3
Rich Burridge <rich.burridge@oracle.com>
parents: 1053
diff changeset
    89
    <th>BugDB</th>
1053
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
    90
    <th>RE</th>
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
    91
    <th>RM</th>
1048
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    92
</tr>
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    93
</thead>
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    94
<tbody>
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    95
"""
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    96
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    97
# Final HTML for the generated web page.
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    98
postamble = """
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    99
</tr>
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   100
</tbody>
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   101
</table>
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   102
</body>
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   103
</html>
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   104
"""
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   105
1053
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   106
# Return a hashtable of RE's / RM's keyed by component path.
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   107
def read_owners(owners_file):
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   108
    if debug:
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   109
        print >> sys.stderr, "Reading %s" % owners_file
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   110
    try:
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   111
        fin = open(owners_file, 'r')
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   112
        lines = fin.readlines()
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   113
        fin.close()
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   114
    except:
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   115
        if debug:
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   116
            print >> sys.stderr, "Unable to read owners file: %s" % owners_file
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   117
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   118
    owners = {}
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   119
    for line in lines:
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   120
        line = line[:-1]
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   121
        component, re, rm = line.split("|")
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   122
        owners[component] = [ re, rm ]
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   123
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   124
    return owners
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   125
1061
757624619bb3 15922912 Auto-generation of Userland gate list - Phase 4
Rich Burridge <rich.burridge@oracle.com>
parents: 1058
diff changeset
   126
# Return a hashtable of components with TPNOs keyed by component name.
757624619bb3 15922912 Auto-generation of Userland gate list - Phase 4
Rich Burridge <rich.burridge@oracle.com>
parents: 1058
diff changeset
   127
def find_TPNOs(workspace):
757624619bb3 15922912 Auto-generation of Userland gate list - Phase 4
Rich Burridge <rich.burridge@oracle.com>
parents: 1058
diff changeset
   128
    comp_TPNOs = {}
757624619bb3 15922912 Auto-generation of Userland gate list - Phase 4
Rich Burridge <rich.burridge@oracle.com>
parents: 1058
diff changeset
   129
    for directory, _, files in os.walk(workspace + "/components"):
757624619bb3 15922912 Auto-generation of Userland gate list - Phase 4
Rich Burridge <rich.burridge@oracle.com>
parents: 1058
diff changeset
   130
        for filename in files:
757624619bb3 15922912 Auto-generation of Userland gate list - Phase 4
Rich Burridge <rich.burridge@oracle.com>
parents: 1058
diff changeset
   131
            if filename.endswith(".license") or filename.endswith(".copyright"):
757624619bb3 15922912 Auto-generation of Userland gate list - Phase 4
Rich Burridge <rich.burridge@oracle.com>
parents: 1058
diff changeset
   132
                pathname = os.path.join(directory, filename)
757624619bb3 15922912 Auto-generation of Userland gate list - Phase 4
Rich Burridge <rich.burridge@oracle.com>
parents: 1058
diff changeset
   133
                fin = open(pathname, 'r')
757624619bb3 15922912 Auto-generation of Userland gate list - Phase 4
Rich Burridge <rich.burridge@oracle.com>
parents: 1058
diff changeset
   134
                lines = fin.readlines()
757624619bb3 15922912 Auto-generation of Userland gate list - Phase 4
Rich Burridge <rich.burridge@oracle.com>
parents: 1058
diff changeset
   135
                fin.close()
757624619bb3 15922912 Auto-generation of Userland gate list - Phase 4
Rich Burridge <rich.burridge@oracle.com>
parents: 1058
diff changeset
   136
757624619bb3 15922912 Auto-generation of Userland gate list - Phase 4
Rich Burridge <rich.burridge@oracle.com>
parents: 1058
diff changeset
   137
                for line in lines:
757624619bb3 15922912 Auto-generation of Userland gate list - Phase 4
Rich Burridge <rich.burridge@oracle.com>
parents: 1058
diff changeset
   138
                    line = line.replace("\n", "")
757624619bb3 15922912 Auto-generation of Userland gate list - Phase 4
Rich Burridge <rich.burridge@oracle.com>
parents: 1058
diff changeset
   139
                    if line.startswith("Oracle Internal Tracking Number"):
757624619bb3 15922912 Auto-generation of Userland gate list - Phase 4
Rich Burridge <rich.burridge@oracle.com>
parents: 1058
diff changeset
   140
                        tpno_str = line.split()[-1]
757624619bb3 15922912 Auto-generation of Userland gate list - Phase 4
Rich Burridge <rich.burridge@oracle.com>
parents: 1058
diff changeset
   141
                        try:
757624619bb3 15922912 Auto-generation of Userland gate list - Phase 4
Rich Burridge <rich.burridge@oracle.com>
parents: 1058
diff changeset
   142
                            # Check that the TPNO is a valid number.
757624619bb3 15922912 Auto-generation of Userland gate list - Phase 4
Rich Burridge <rich.burridge@oracle.com>
parents: 1058
diff changeset
   143
                            tpno = int(tpno_str)
757624619bb3 15922912 Auto-generation of Userland gate list - Phase 4
Rich Burridge <rich.burridge@oracle.com>
parents: 1058
diff changeset
   144
                            if debug:
757624619bb3 15922912 Auto-generation of Userland gate list - Phase 4
Rich Burridge <rich.burridge@oracle.com>
parents: 1058
diff changeset
   145
                                print >> sys.stderr, "TPNO: %s: %s" % \
757624619bb3 15922912 Auto-generation of Userland gate list - Phase 4
Rich Burridge <rich.burridge@oracle.com>
parents: 1058
diff changeset
   146
                                    (directory, tpno_str)
757624619bb3 15922912 Auto-generation of Userland gate list - Phase 4
Rich Burridge <rich.burridge@oracle.com>
parents: 1058
diff changeset
   147
                            comp_TPNOs[directory] = tpno_str
757624619bb3 15922912 Auto-generation of Userland gate list - Phase 4
Rich Burridge <rich.burridge@oracle.com>
parents: 1058
diff changeset
   148
                        except:
757624619bb3 15922912 Auto-generation of Userland gate list - Phase 4
Rich Burridge <rich.burridge@oracle.com>
parents: 1058
diff changeset
   149
                            print >> sys.stderr, "Unable to read TPNO: %s" % \
757624619bb3 15922912 Auto-generation of Userland gate list - Phase 4
Rich Burridge <rich.burridge@oracle.com>
parents: 1058
diff changeset
   150
                                pathname
757624619bb3 15922912 Auto-generation of Userland gate list - Phase 4
Rich Burridge <rich.burridge@oracle.com>
parents: 1058
diff changeset
   151
757624619bb3 15922912 Auto-generation of Userland gate list - Phase 4
Rich Burridge <rich.burridge@oracle.com>
parents: 1058
diff changeset
   152
    return(comp_TPNOs)
757624619bb3 15922912 Auto-generation of Userland gate list - Phase 4
Rich Burridge <rich.burridge@oracle.com>
parents: 1058
diff changeset
   153
1048
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   154
# Return a sorted list of the directories containing one or more .p5m files.
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   155
def find_p5m_dirs(workspace):
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   156
    p5m_dirs = []
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   157
    for dir, _, files in os.walk(workspace + "/components"):
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   158
        for file in files:
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   159
            if file.endswith(".p5m"):
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   160
                p5m_dirs.append(dir)
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   161
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   162
    return sorted(list(set(p5m_dirs)))
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   163
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   164
# Write out the initial HTML for the components.html web page.
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   165
def write_preamble():
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   166
    print preamble
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   167
1053
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   168
# Return the RE / RM for this component.
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   169
def get_re_and_rm(p5m_dir):
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   170
    re_and_rm = [ "Unknown", "Unknown" ]
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   171
    component_path = ""
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   172
    started = False
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   173
    tokens = p5m_dir.split("/")
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   174
    for token in tokens:
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   175
        if started:
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   176
            component_path += token + "/"
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   177
        if token == "components":
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   178
            started = True
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   179
    component_path = component_path[:-1]
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   180
    if component_path in owners:
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   181
        re_and_rm = owners[component_path]
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   182
    if debug:
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   183
        print >> sys.stderr, "Component path: ", component_path,
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   184
        print >> sys.stderr, "RE / RM: ", re_and_rm
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   185
    
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   186
    return re_and_rm
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   187
1048
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   188
# Generate an HTML table entry for all the information for the component
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   189
# in the given directory. This generates a file called 'component-report'
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   190
# under the components build directory.
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   191
def gen_reports(workspace, component_dir):
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   192
    if debug:
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   193
        print >> sys.stderr, "Processing %s" % component_dir
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   194
1061
757624619bb3 15922912 Auto-generation of Userland gate list - Phase 4
Rich Burridge <rich.burridge@oracle.com>
parents: 1058
diff changeset
   195
    try:
757624619bb3 15922912 Auto-generation of Userland gate list - Phase 4
Rich Burridge <rich.burridge@oracle.com>
parents: 1058
diff changeset
   196
        tpno = comp_TPNOs[component_dir]
757624619bb3 15922912 Auto-generation of Userland gate list - Phase 4
Rich Burridge <rich.burridge@oracle.com>
parents: 1058
diff changeset
   197
    except:
757624619bb3 15922912 Auto-generation of Userland gate list - Phase 4
Rich Burridge <rich.burridge@oracle.com>
parents: 1058
diff changeset
   198
        tpno = ""
757624619bb3 15922912 Auto-generation of Userland gate list - Phase 4
Rich Burridge <rich.burridge@oracle.com>
parents: 1058
diff changeset
   199
1053
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   200
    re, rm = get_re_and_rm(component_dir)
1048
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   201
    makefiles = "-f Makefile -f %s/make-rules/component-report" % workspace
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   202
    targets = "clean component-hook"
1061
757624619bb3 15922912 Auto-generation of Userland gate list - Phase 4
Rich Burridge <rich.burridge@oracle.com>
parents: 1058
diff changeset
   203
    cmd = "cd %s; TPNO='%s' RESPONSIBLE_ENGINEER='%s' RESPONSIBLE_MANAGER='%s' gmake COMPONENT_HOOK='gmake %s component-report' %s" % \
757624619bb3 15922912 Auto-generation of Userland gate list - Phase 4
Rich Burridge <rich.burridge@oracle.com>
parents: 1058
diff changeset
   204
        (component_dir, tpno, re, rm, makefiles, targets)
1048
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   205
1053
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   206
    if debug:
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   207
        print >> sys.stderr, "gen_reports: command: `%s`" % cmd
1048
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   208
    lines = os.popen(cmd).readlines()
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   209
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   210
# Collect all the .../build/component-report files and write them to stdout.
1053
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   211
def write_reports(p5m_dirs, owners_file):
1048
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   212
    for p5m_dir in p5m_dirs:
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   213
        report = "%s/build/component-report" % p5m_dir
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   214
        if debug:
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   215
            print >> sys.stderr, "Reading %s" % report
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   216
        try:
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   217
            fin = open(report, 'r')
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   218
            lines = fin.readlines()
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   219
            fin.close()
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   220
            sys.stdout.writelines(lines)
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   221
        except:
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   222
            if debug:
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   223
                print >> sys.stderr, "Unable to read: %s" % report
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   224
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   225
# Write out the final HTML for the components.html web page.
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   226
def write_postamble():
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   227
    print postamble
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   228
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   229
# Write out a usage message showing valid options to this script.
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   230
def usage():
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   231
    print  >> sys.stderr, \
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   232
"""
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   233
Usage: 
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   234
      update_man_pages.py [OPTION...]
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   235
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   236
-d, --debug
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   237
      Turn on debugging
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   238
1053
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   239
-o, --owners
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   240
      Location of a file containing a list of RE's /RM's per component
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   241
1048
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   242
-w --workspace
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   243
      Location of the Userland workspace
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   244
"""
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   245
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   246
    sys.exit(1)
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   247
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   248
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   249
if __name__ == "__main__":
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   250
    workspace = os.getenv('WS_TOP')
1053
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   251
    owners_file = "/net/userland.us.oracle.com/gates/private/RM-RE-list.txt"
1048
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   252
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   253
    try:
1053
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   254
        opts, args = getopt.getopt(sys.argv[1:], "do:w:",
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   255
            [ "debug", "owners=", "workspace=" ])
1048
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   256
    except getopt.GetoptError, err:
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   257
        print str(err)
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   258
        usage()
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   259
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   260
    for opt, arg in opts:
1053
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   261
        if opt in [ "-d", "--debug" ]:
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   262
            debug = True
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   263
        elif opt in [ "-o", "--owners" ]:
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   264
            owners_file = arg
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   265
        elif opt in [ "-w", "--workspace" ]:
1048
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   266
            workspace = arg
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   267
        else:
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   268
            assert False, "unknown option"
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   269
 
1053
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   270
    owners = read_owners(owners_file)
1048
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   271
    write_preamble()
1061
757624619bb3 15922912 Auto-generation of Userland gate list - Phase 4
Rich Burridge <rich.burridge@oracle.com>
parents: 1058
diff changeset
   272
    comp_TPNOs = find_TPNOs(workspace)
1048
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   273
    p5m_dirs = find_p5m_dirs(workspace)
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   274
    for p5m_dir in p5m_dirs:
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   275
        gen_reports(workspace, p5m_dir)
1053
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   276
    write_reports(p5m_dirs, owners_file)
1048
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   277
    write_postamble()
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   278
    sys.exit(0)