author | Daniel Jacobs <daniel.jacobs@nokia.com> |
Tue, 30 Mar 2010 15:34:13 +0100 | |
branch | wip |
changeset 445 | 28f0ff4c401c |
parent 202 | 5ec640568a23 |
child 451 | 153129bf777e |
permissions | -rwxr-xr-x |
5 | 1 |
#!/usr/bin/python |
2 |
||
3 |
# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
4 |
# All rights reserved. |
|
5 |
# This component and the accompanying materials are made available |
|
6 |
# under the terms of the License "Symbian Foundation License v1.0" |
|
7 |
# which accompanies this distribution, and is available |
|
8 |
# at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". |
|
9 |
# |
|
10 |
# Initial Contributors: |
|
11 |
# Nokia Corporation - initial contribution. |
|
12 |
# |
|
13 |
# Contributors: |
|
14 |
# |
|
15 |
# Description: |
|
16 |
# |
|
17 |
||
18 |
import os |
|
19 |
import sys |
|
20 |
import traceback |
|
21 |
||
22 |
# intercept the -h option |
|
23 |
if "-h" in sys.argv or "--help" in sys.argv: |
|
24 |
print "usage:", sys.argv[0], "[sbs options]" |
|
25 |
print " The log data is read from stdin." |
|
26 |
print " Type 'sbs -h' for a list of sbs options." |
|
27 |
sys.exit(0) |
|
28 |
||
29 |
# get the absolute path to this script |
|
30 |
script = os.path.abspath(sys.argv[0]) |
|
31 |
||
32 |
# add the Raptor python directory to the PYTHONPATH |
|
33 |
sys.path.append(os.path.join(os.path.dirname(script), "..", "python")) |
|
34 |
||
35 |
# now we should be able to find the raptor modules |
|
36 |
import raptor |
|
37 |
import pluginbox |
|
38 |
||
39 |
# make sure that HOSTPLATFORM is set |
|
40 |
if not "HOSTPLATFORM" in os.environ: |
|
41 |
sys.stderr.write("HOSTPLATFORM is not set ... try running gethost.sh\n") |
|
42 |
sys.exit(1) |
|
43 |
||
44 |
if not "HOSTPLATFORM_DIR" in os.environ: |
|
45 |
sys.stderr.write("HOSTPLATFORM_DIR is not set ... try running gethost.sh\n") |
|
46 |
sys.exit(1) |
|
47 |
||
48 |
# construct a Raptor object from our command-line (less the name of this script) |
|
49 |
the_raptor = raptor.Raptor.CreateCommandlineBuild(sys.argv[1:]) |
|
50 |
||
51 |
# from Raptor.OpenLog() |
|
52 |
try: |
|
53 |
# Find all the raptor plugins and put them into a pluginbox. |
|
54 |
if not the_raptor.systemPlugins.isAbsolute(): |
|
55 |
the_raptor.systemPlugins = the_raptor.home.Append(the_raptor.systemPlugins) |
|
56 |
||
57 |
pbox = pluginbox.PluginBox(str(the_raptor.systemPlugins)) |
|
58 |
raptor_params = raptor.BuildStats(the_raptor) |
|
59 |
||
60 |
# Open the requested plugins using the pluginbox |
|
61 |
the_raptor.out.open(raptor_params, the_raptor.filterList.split(','), pbox) |
|
62 |
||
63 |
except Exception, e: |
|
124
e898967975af
sbs_filter: Fix so that return code is 0 on success (was always 1)
timothy.murphy@nokia.com
parents:
115
diff
changeset
|
64 |
sys.stderr.write("error: problem while creating filters %s\n" % str(e)) |
115
5869e06bf2ac
Cause whatcomp output to use the incoming epocroot value. i.e. if epocroot is relative then so is the what output.
timothy.murphy@nokia.com
parents:
5
diff
changeset
|
65 |
traceback.print_exc() |
5 | 66 |
sys.exit(1) |
67 |
||
68 |
# read stdin a line at a time and pass it to the Raptor object |
|
124
e898967975af
sbs_filter: Fix so that return code is 0 on success (was always 1)
timothy.murphy@nokia.com
parents:
115
diff
changeset
|
69 |
try: |
e898967975af
sbs_filter: Fix so that return code is 0 on success (was always 1)
timothy.murphy@nokia.com
parents:
115
diff
changeset
|
70 |
line = " " |
e898967975af
sbs_filter: Fix so that return code is 0 on success (was always 1)
timothy.murphy@nokia.com
parents:
115
diff
changeset
|
71 |
while line: |
e898967975af
sbs_filter: Fix so that return code is 0 on success (was always 1)
timothy.murphy@nokia.com
parents:
115
diff
changeset
|
72 |
line = sys.stdin.readline() |
e898967975af
sbs_filter: Fix so that return code is 0 on success (was always 1)
timothy.murphy@nokia.com
parents:
115
diff
changeset
|
73 |
the_raptor.out.write(line) |
202
5ec640568a23
FilterCheckComp - checking file existence by component
timothy.murphy@nokia.com
parents:
132
diff
changeset
|
74 |
except Exception,e: |
124
e898967975af
sbs_filter: Fix so that return code is 0 on success (was always 1)
timothy.murphy@nokia.com
parents:
115
diff
changeset
|
75 |
sys.stderr.write("error: problem while filtering: %s\n" % str(e)) |
e898967975af
sbs_filter: Fix so that return code is 0 on success (was always 1)
timothy.murphy@nokia.com
parents:
115
diff
changeset
|
76 |
traceback.print_exc() |
e898967975af
sbs_filter: Fix so that return code is 0 on success (was always 1)
timothy.murphy@nokia.com
parents:
115
diff
changeset
|
77 |
sys.exit(1) |
5 | 78 |
|
124
e898967975af
sbs_filter: Fix so that return code is 0 on success (was always 1)
timothy.murphy@nokia.com
parents:
115
diff
changeset
|
79 |
|
e898967975af
sbs_filter: Fix so that return code is 0 on success (was always 1)
timothy.murphy@nokia.com
parents:
115
diff
changeset
|
80 |
# Print the summary (this can't return errors) |
e898967975af
sbs_filter: Fix so that return code is 0 on success (was always 1)
timothy.murphy@nokia.com
parents:
115
diff
changeset
|
81 |
the_raptor.out.summary() |
5 | 82 |
|
83 |
if not the_raptor.out.close(): |
|
124
e898967975af
sbs_filter: Fix so that return code is 0 on success (was always 1)
timothy.murphy@nokia.com
parents:
115
diff
changeset
|
84 |
the_raptor.errorCode = 2 |
5 | 85 |
|
86 |
# return the error code |
|
87 |
sys.exit(the_raptor.errorCode) |
|
88 |