91 </table> |
96 </table> |
92 </body> |
97 </body> |
93 </html> |
98 </html> |
94 """ |
99 """ |
95 |
100 |
|
101 # Return a hashtable of RE's / RM's keyed by component path. |
|
102 def read_owners(owners_file): |
|
103 if debug: |
|
104 print >> sys.stderr, "Reading %s" % owners_file |
|
105 try: |
|
106 fin = open(owners_file, 'r') |
|
107 lines = fin.readlines() |
|
108 fin.close() |
|
109 except: |
|
110 if debug: |
|
111 print >> sys.stderr, "Unable to read owners file: %s" % owners_file |
|
112 |
|
113 owners = {} |
|
114 for line in lines: |
|
115 line = line[:-1] |
|
116 component, re, rm = line.split("|") |
|
117 owners[component] = [ re, rm ] |
|
118 |
|
119 return owners |
|
120 |
96 # Return a sorted list of the directories containing one or more .p5m files. |
121 # Return a sorted list of the directories containing one or more .p5m files. |
97 def find_p5m_dirs(workspace): |
122 def find_p5m_dirs(workspace): |
98 p5m_dirs = [] |
123 p5m_dirs = [] |
99 for dir, _, files in os.walk(workspace + "/components"): |
124 for dir, _, files in os.walk(workspace + "/components"): |
100 for file in files: |
125 for file in files: |
105 |
130 |
106 # Write out the initial HTML for the components.html web page. |
131 # Write out the initial HTML for the components.html web page. |
107 def write_preamble(): |
132 def write_preamble(): |
108 print preamble |
133 print preamble |
109 |
134 |
|
135 # Return the RE / RM for this component. |
|
136 def get_re_and_rm(p5m_dir): |
|
137 re_and_rm = [ "Unknown", "Unknown" ] |
|
138 component_path = "" |
|
139 started = False |
|
140 tokens = p5m_dir.split("/") |
|
141 for token in tokens: |
|
142 if started: |
|
143 component_path += token + "/" |
|
144 if token == "components": |
|
145 started = True |
|
146 component_path = component_path[:-1] |
|
147 if component_path in owners: |
|
148 re_and_rm = owners[component_path] |
|
149 if debug: |
|
150 print >> sys.stderr, "Component path: ", component_path, |
|
151 print >> sys.stderr, "RE / RM: ", re_and_rm |
|
152 |
|
153 return re_and_rm |
|
154 |
110 # Generate an HTML table entry for all the information for the component |
155 # Generate an HTML table entry for all the information for the component |
111 # in the given directory. This generates a file called 'component-report' |
156 # in the given directory. This generates a file called 'component-report' |
112 # under the components build directory. |
157 # under the components build directory. |
113 def gen_reports(workspace, component_dir): |
158 def gen_reports(workspace, component_dir): |
114 if debug: |
159 if debug: |
115 print >> sys.stderr, "Processing %s" % component_dir |
160 print >> sys.stderr, "Processing %s" % component_dir |
116 |
161 |
|
162 re, rm = get_re_and_rm(component_dir) |
117 makefiles = "-f Makefile -f %s/make-rules/component-report" % workspace |
163 makefiles = "-f Makefile -f %s/make-rules/component-report" % workspace |
118 targets = "clean component-hook" |
164 targets = "clean component-hook" |
119 cmd = "cd %s; gmake COMPONENT_HOOK='gmake %s component-report' %s" % \ |
165 cmd = "cd %s; RESPONSIBLE_ENGINEER='%s' RESPONSIBLE_MANAGER='%s' gmake COMPONENT_HOOK='gmake %s component-report' %s" % \ |
120 (component_dir, makefiles, targets) |
166 (component_dir, re, rm, makefiles, targets) |
121 |
167 |
|
168 if debug: |
|
169 print >> sys.stderr, "gen_reports: command: `%s`" % cmd |
122 lines = os.popen(cmd).readlines() |
170 lines = os.popen(cmd).readlines() |
123 |
171 |
124 # Collect all the .../build/component-report files and write them to stdout. |
172 # Collect all the .../build/component-report files and write them to stdout. |
125 def write_reports(p5m_dirs): |
173 def write_reports(p5m_dirs, owners_file): |
126 for p5m_dir in p5m_dirs: |
174 for p5m_dir in p5m_dirs: |
127 report = "%s/build/component-report" % p5m_dir |
175 report = "%s/build/component-report" % p5m_dir |
128 if debug: |
176 if debug: |
129 print >> sys.stderr, "Reading %s" % report |
177 print >> sys.stderr, "Reading %s" % report |
130 try: |
178 try: |
148 update_man_pages.py [OPTION...] |
196 update_man_pages.py [OPTION...] |
149 |
197 |
150 -d, --debug |
198 -d, --debug |
151 Turn on debugging |
199 Turn on debugging |
152 |
200 |
|
201 -o, --owners |
|
202 Location of a file containing a list of RE's /RM's per component |
|
203 |
153 -w --workspace |
204 -w --workspace |
154 Location of the Userland workspace |
205 Location of the Userland workspace |
155 """ |
206 """ |
156 |
207 |
157 sys.exit(1) |
208 sys.exit(1) |
158 |
209 |
159 |
210 |
160 if __name__ == "__main__": |
211 if __name__ == "__main__": |
161 workspace = os.getenv('WS_TOP') |
212 workspace = os.getenv('WS_TOP') |
|
213 owners_file = "/net/userland.us.oracle.com/gates/private/RM-RE-list.txt" |
162 |
214 |
163 try: |
215 try: |
164 opts, args = getopt.getopt(sys.argv[1:], "dw:", |
216 opts, args = getopt.getopt(sys.argv[1:], "do:w:", |
165 [ "debug", "workspace=" ]) |
217 [ "debug", "owners=", "workspace=" ]) |
166 except getopt.GetoptError, err: |
218 except getopt.GetoptError, err: |
167 print str(err) |
219 print str(err) |
168 usage() |
220 usage() |
169 |
221 |
170 for opt, arg in opts: |
222 for opt, arg in opts: |
171 if opt in [ "-w", "--workspace" ]: |
223 if opt in [ "-d", "--debug" ]: |
|
224 debug = True |
|
225 elif opt in [ "-o", "--owners" ]: |
|
226 owners_file = arg |
|
227 elif opt in [ "-w", "--workspace" ]: |
172 workspace = arg |
228 workspace = arg |
173 elif opt in [ "-d", "--debug" ]: |
|
174 debug = True |
|
175 else: |
229 else: |
176 assert False, "unknown option" |
230 assert False, "unknown option" |
177 |
231 |
|
232 owners = read_owners(owners_file) |
178 write_preamble() |
233 write_preamble() |
179 p5m_dirs = find_p5m_dirs(workspace) |
234 p5m_dirs = find_p5m_dirs(workspace) |
180 for p5m_dir in p5m_dirs: |
235 for p5m_dir in p5m_dirs: |
181 gen_reports(workspace, p5m_dir) |
236 gen_reports(workspace, p5m_dir) |
182 write_reports(p5m_dirs) |
237 write_reports(p5m_dirs, owners_file) |
183 write_postamble() |
238 write_postamble() |
184 sys.exit(0) |
239 sys.exit(0) |