tools/gen-components
author Shawn Walker-Salas <shawn.walker@oracle.com>
Wed, 30 Mar 2016 13:33:31 -0700
changeset 5682 94c0ca64c022
parent 5406 5ac656f02914
permissions -rwxr-xr-x
15558602 TCL_LD_SEARCH_FLAGS is wrongly defined in tclConfig.sh 22228656 remove redundant declarations and additions from makefiles 22252545 simplify build rules for components from common upstream 22378457 tclConfig.sh compiler settings are too specific 22727315 httping curses gui missing 22750630 procmail ignores userland cflags and may use private strstr function 22758725 wdiff uses diff from PATH instead of /usr/gnu/bin/diff 22926847 cloog Makefile typo when setting ASLR_MODE 22935090 tk config script has wrong linker flags
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3770
ca450a806cc1 20440888 Userland python tools should migrate to 2.7
John Beck <John.Beck@Oracle.COM>
parents: 2150
diff changeset
     1
#!/usr/bin/python2.7
1048
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
#
5682
94c0ca64c022 15558602 TCL_LD_SEARCH_FLAGS is wrongly defined in tclConfig.sh
Shawn Walker-Salas <shawn.walker@oracle.com>
parents: 5406
diff changeset
    22
94c0ca64c022 15558602 TCL_LD_SEARCH_FLAGS is wrongly defined in tclConfig.sh
Shawn Walker-Salas <shawn.walker@oracle.com>
parents: 5406
diff changeset
    23
#
5406
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
    24
# Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
1048
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    25
#
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    26
#
1061
757624619bb3 15922912 Auto-generation of Userland gate list - Phase 4
Rich Burridge <rich.burridge@oracle.com>
parents: 1058
diff changeset
    27
# gen_components
2140
ba3091d7e9b6 19775104 Multiple TPNO's not being correctly displayed on Userland gatelist webpage
Rich Burridge <rich.burridge@oracle.com>
parents: 1205
diff changeset
    28
# A simple script to generate (on stdout), the component.html web page
ba3091d7e9b6 19775104 Multiple TPNO's not being correctly displayed on Userland gatelist webpage
Rich Burridge <rich.burridge@oracle.com>
parents: 1205
diff changeset
    29
# found at: http://userland.us.oracle.com/component-lists/s12.html
1048
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    30
#
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    31
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    32
import getopt
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    33
import os
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    34
import sys
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    35
5406
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
    36
from subprocess import Popen, PIPE
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
    37
1048
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    38
debug = False
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    39
1063
ce6e2ed3767e 15924689 Auto-generation of Userland gate list - Phase 5
Rich Burridge <rich.burridge@oracle.com>
parents: 1061
diff changeset
    40
# Hashtable of RE's, RM's and Teams keyed by component path.
1053
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
    41
owners = {}
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
    42
1048
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    43
# 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
    44
preamble = """
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    45
<html>
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    46
<head>
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    47
    <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
    48
        @import '/css/demo_table.css';
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    49
        @import '/css/ColVis.css';
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    50
        @import '/css/ColReorder.css';
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    51
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    52
            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
    53
            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
    54
                            background-color: gold;
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
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    57
    </style>
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.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/jquery.dataTables.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/ColReorder.js'></script>
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    61
    <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
    62
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    63
    <script>
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    64
        $(document).ready(function() {
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    65
            $('#components').dataTable({
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    66
                "sDom": 'C<"clear">Rlfrtip',
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    67
                bPaginate: true,
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    68
                bFilter: true,
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    69
                bSort: true,
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    70
                iDisplayLength: -1,
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    71
                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
    72
            });
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    73
        });
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    74
    </script>
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    75
</head>
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    76
<body>
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    77
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    78
<h1>Userland Components</h1>
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    79
<p>
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    80
<table align='center' id='components'>
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    81
<thead>
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    82
<tr>
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    83
    <th>Component</th>
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    84
    <th>Version</th>
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    85
    <th>Gate Path</th>
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    86
    <th>Package(s)</th>
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    87
    <th>ARC Case(s)</th>
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    88
    <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
    89
    <th>TPNO</th>
1058
34d7aaa03423 15886624 Auto-generation of Userland gate list - Phase 3
Rich Burridge <rich.burridge@oracle.com>
parents: 1053
diff changeset
    90
    <th>BugDB</th>
1053
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
    91
    <th>RE</th>
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
    92
    <th>RM</th>
1063
ce6e2ed3767e 15924689 Auto-generation of Userland gate list - Phase 5
Rich Burridge <rich.burridge@oracle.com>
parents: 1061
diff changeset
    93
    <th>Team</th>
1048
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    94
</tr>
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    95
</thead>
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    96
<tbody>
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    97
"""
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    98
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    99
# 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
   100
postamble = """
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   101
</tr>
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   102
</tbody>
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   103
</table>
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   104
</body>
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   105
</html>
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   106
"""
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   107
5406
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
   108
# Get a complete list of package names for the repo associated with this
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
   109
# Userland workspace.
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
   110
def get_package_list(repo, build_version):
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
   111
    names = []
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
   112
    cmd = "pkgrepo list -H -s %s" % repo
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
   113
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
   114
    if debug:
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
   115
        print >> sys.stderr, "get_package_list: command: `%s`" % cmd
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
   116
    lines = os.popen(cmd).readlines()
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
   117
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
   118
    for line in lines:
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
   119
        tokens = line.split()
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
   120
        if tokens[2] != 'o' and tokens[2] != 'r':
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
   121
            n = tokens[2].find(build_version)
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
   122
            name = tokens[1] + "@" + tokens[2][:n]
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
   123
            if debug:
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
   124
                print >> sys.stderr, "get_package_list: name: ", name
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
   125
            names.append(name)
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
   126
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
   127
    if debug:
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
   128
        print >> sys.stderr, "get_package_list: names: ", names
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
   129
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
   130
    return names
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
   131
1063
ce6e2ed3767e 15924689 Auto-generation of Userland gate list - Phase 5
Rich Burridge <rich.burridge@oracle.com>
parents: 1061
diff changeset
   132
# Return a hashtable of RE's, RM's and Teams keyed by component path.
1053
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   133
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
   134
    if debug:
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   135
        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
   136
    try:
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   137
        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
   138
        lines = fin.readlines()
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   139
        fin.close()
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   140
    except:
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   141
        if debug:
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   142
            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
   143
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   144
    owners = {}
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   145
    for line in lines:
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   146
        line = line[:-1]
1063
ce6e2ed3767e 15924689 Auto-generation of Userland gate list - Phase 5
Rich Burridge <rich.burridge@oracle.com>
parents: 1061
diff changeset
   147
        component, re, rm, team = line.split("|")
ce6e2ed3767e 15924689 Auto-generation of Userland gate list - Phase 5
Rich Burridge <rich.burridge@oracle.com>
parents: 1061
diff changeset
   148
        owners[component] = [ re, rm, team ]
1053
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   149
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   150
    return owners
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   151
1048
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   152
# 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
   153
def find_p5m_dirs(workspace):
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   154
    p5m_dirs = []
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   155
    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
   156
        for file in files:
5406
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
   157
            if dir.endswith("meta-packages/developer-opensolaris-userland"):
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
   158
                continue;
2150
1acc968ac0d9 19807306 Userland gatelist shouldn't show entry for the "Package History" component
Rich Burridge <rich.burridge@oracle.com>
parents: 2140
diff changeset
   159
            if dir.endswith("meta-packages/history"):
1acc968ac0d9 19807306 Userland gatelist shouldn't show entry for the "Package History" component
Rich Burridge <rich.burridge@oracle.com>
parents: 2140
diff changeset
   160
                continue;
1048
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   161
            if file.endswith(".p5m"):
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   162
                p5m_dirs.append(dir)
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
    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
   165
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   166
# 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
   167
def write_preamble():
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   168
    print preamble
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   169
1063
ce6e2ed3767e 15924689 Auto-generation of Userland gate list - Phase 5
Rich Burridge <rich.burridge@oracle.com>
parents: 1061
diff changeset
   170
# Return the RE,  RM and Team for this component.
ce6e2ed3767e 15924689 Auto-generation of Userland gate list - Phase 5
Rich Burridge <rich.burridge@oracle.com>
parents: 1061
diff changeset
   171
def get_owner(p5m_dir):
ce6e2ed3767e 15924689 Auto-generation of Userland gate list - Phase 5
Rich Burridge <rich.burridge@oracle.com>
parents: 1061
diff changeset
   172
    result = [ "Unknown", "Unknown", "Unknown" ]
1053
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   173
    component_path = ""
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   174
    started = False
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   175
    tokens = p5m_dir.split("/")
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   176
    for token in tokens:
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   177
        if started:
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   178
            component_path += token + "/"
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   179
        if token == "components":
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   180
            started = True
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   181
    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
   182
    if component_path in owners:
1063
ce6e2ed3767e 15924689 Auto-generation of Userland gate list - Phase 5
Rich Burridge <rich.burridge@oracle.com>
parents: 1061
diff changeset
   183
        result = owners[component_path]
1053
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   184
    if debug:
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   185
        print >> sys.stderr, "Component path: ", component_path,
1063
ce6e2ed3767e 15924689 Auto-generation of Userland gate list - Phase 5
Rich Burridge <rich.burridge@oracle.com>
parents: 1061
diff changeset
   186
        print >> sys.stderr, "RE, RM, Team: ", result
5406
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
   187
1063
ce6e2ed3767e 15924689 Auto-generation of Userland gate list - Phase 5
Rich Burridge <rich.burridge@oracle.com>
parents: 1061
diff changeset
   188
    return result
1053
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   189
1048
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   190
# 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
   191
# 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
   192
# under the components build directory.
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   193
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
   194
    if debug:
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   195
        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
   196
1063
ce6e2ed3767e 15924689 Auto-generation of Userland gate list - Phase 5
Rich Burridge <rich.burridge@oracle.com>
parents: 1061
diff changeset
   197
    re, rm, team = get_owner(component_dir)
1048
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   198
    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
   199
    targets = "clean component-hook"
1063
ce6e2ed3767e 15924689 Auto-generation of Userland gate list - Phase 5
Rich Burridge <rich.burridge@oracle.com>
parents: 1061
diff changeset
   200
    template = "cd %s; "
ce6e2ed3767e 15924689 Auto-generation of Userland gate list - Phase 5
Rich Burridge <rich.burridge@oracle.com>
parents: 1061
diff changeset
   201
    template += "RESPONSIBLE_ENGINEER='%s' "
ce6e2ed3767e 15924689 Auto-generation of Userland gate list - Phase 5
Rich Burridge <rich.burridge@oracle.com>
parents: 1061
diff changeset
   202
    template += "RESPONSIBLE_MANAGER='%s' "
ce6e2ed3767e 15924689 Auto-generation of Userland gate list - Phase 5
Rich Burridge <rich.burridge@oracle.com>
parents: 1061
diff changeset
   203
    template += "TEAM='%s' "
ce6e2ed3767e 15924689 Auto-generation of Userland gate list - Phase 5
Rich Burridge <rich.burridge@oracle.com>
parents: 1061
diff changeset
   204
    template += "gmake COMPONENT_HOOK='gmake %s component-report' %s"
2140
ba3091d7e9b6 19775104 Multiple TPNO's not being correctly displayed on Userland gatelist webpage
Rich Burridge <rich.burridge@oracle.com>
parents: 1205
diff changeset
   205
    cmd = template % (component_dir, re, rm, team, makefiles, targets)
1048
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   206
1053
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   207
    if debug:
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   208
        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
   209
    lines = os.popen(cmd).readlines()
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   210
5406
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
   211
# The package name(s) in the component-report files will be incorrectly
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
   212
# generated if there was a <whatever>VER.p5m file in the component
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
   213
# directory. For those components we've got to use the package names
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
   214
# from the repo associated with this Userland workspace.
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
   215
def fix_reports(p5m_dirs, package_names):
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
   216
    for p5m_dir in p5m_dirs:
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
   217
        cmd = "ls %s/*VER.p5m" % p5m_dir
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
   218
        p = Popen(cmd, shell=True, stdin=PIPE, stdout=PIPE, stderr=PIPE,
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
   219
                  close_fds=True)
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
   220
        output = p.stdout.read()
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
   221
        if output.find(".p5m") == -1:
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
   222
            continue
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
   223
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
   224
        report = "%s/build/component-report" % p5m_dir
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
   225
        with open(report, 'r') as fin:
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
   226
            lines = fin.readlines()
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
   227
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
   228
        fixed = False
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
   229
        td_count = 0
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
   230
        report = "%s/build/component-report" % p5m_dir
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
   231
        fout = open(report, 'w')
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
   232
        for line in lines:
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
   233
            if not fixed and td_count == 4 and line.startswith("</td>"):
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
   234
                fixed = True
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
   235
            elif not fixed and td_count == 4:
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
   236
                n = line.rfind("-@")
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
   237
                if n != -1:
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
   238
                    if debug:
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
   239
                        print >> sys.stderr, "FIX: %s" % line
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
   240
                    broken_pkg_name = line[:n]
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
   241
                    for package_name in package_names:
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
   242
                        if package_name.startswith(broken_pkg_name):
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
   243
                            line = "%s<br>\n" % package_name
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
   244
                            fout.write(line)
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
   245
                else:
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
   246
                    fout.write(line)
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
   247
                continue
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
   248
            elif line.startswith("<td>"):
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
   249
                td_count += 1
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
   250
            fout.write(line)
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
   251
        fout.close()
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
   252
1048
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   253
# 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
   254
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
   255
    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
   256
        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
   257
        if debug:
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   258
            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
   259
        try:
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   260
            fin = open(report, 'r')
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   261
            lines = fin.readlines()
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   262
            fin.close()
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   263
            sys.stdout.writelines(lines)
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   264
        except:
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   265
            if debug:
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   266
                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
   267
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   268
# 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
   269
def write_postamble():
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   270
    print postamble
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   271
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   272
# 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
   273
def usage():
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   274
    print  >> sys.stderr, \
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   275
"""
5406
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
   276
Usage:
1139
2fe2a52488cb 16245054 Auto-generation of Userland gate list - Phase 6
Rich Burridge <rich.burridge@oracle.com>
parents: 1063
diff changeset
   277
      gen-components [OPTION...]
1048
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   278
5406
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
   279
-b, --build-version
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
   280
      Build version script to look for (and strip off) from package FMRIs.
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
   281
1048
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   282
-d, --debug
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   283
      Turn on debugging
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   284
1053
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   285
-o, --owners
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   286
      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
   287
5406
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
   288
-r, --repo
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
   289
      Repo containing the packages associated with this Userland workspace
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
   290
1048
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   291
-w --workspace
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   292
      Location of the Userland workspace
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   293
"""
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   294
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   295
    sys.exit(1)
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   296
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   297
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   298
if __name__ == "__main__":
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   299
    workspace = os.getenv('WS_TOP')
1139
2fe2a52488cb 16245054 Auto-generation of Userland gate list - Phase 6
Rich Burridge <rich.burridge@oracle.com>
parents: 1063
diff changeset
   300
    owners_file = "/net/userland.us.oracle.com/gates/private/RE-RM-list.txt"
5406
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
   301
    repo = "http://userland.us.oracle.com:10004/"
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
   302
    build_version = "-5.12.0.0.0"
1048
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   303
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   304
    try:
5406
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
   305
        opts, args = getopt.getopt(sys.argv[1:], "b:do:r:w:",
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
   306
            [ "build-version=", "debug", "owners=", "repo=", "workspace=" ])
1048
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   307
    except getopt.GetoptError, err:
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   308
        print str(err)
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   309
        usage()
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   310
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   311
    for opt, arg in opts:
5406
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
   312
        if opt in [ "-b", "--build-version" ]:
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
   313
            build_version = arg
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
   314
        elif opt in [ "-d", "--debug" ]:
1053
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   315
            debug = True
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   316
        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
   317
            owners_file = arg
5406
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
   318
        elif opt in [ "-r", "--repo" ]:
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
   319
            repo = arg
1053
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   320
        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
   321
            workspace = arg
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   322
        else:
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   323
            assert False, "unknown option"
5406
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
   324
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
   325
    package_names = get_package_list(repo, build_version)
1053
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   326
    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
   327
    write_preamble()
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   328
    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
   329
    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
   330
        gen_reports(workspace, p5m_dir)
5406
5ac656f02914 22666618 Userland gate list package names are wrong if component has a whateverVER.p5m
Rich Burridge <rich.burridge@oracle.com>
parents: 3770
diff changeset
   331
    fix_reports(p5m_dirs, package_names)
1053
accc15fa8762 15878378 Auto-generation of Userland gate list - Phase 2
Rich Burridge <rich.burridge@oracle.com>
parents: 1048
diff changeset
   332
    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
   333
    write_postamble()
e82fa02a4d16 15863968 Auto-generation of Userland gate list - Phase 1.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   334
    sys.exit(0)