diff options
Diffstat (limited to 'bitbake/bin')
-rwxr-xr-x | bitbake/bin/bitbake-runtask | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/bitbake/bin/bitbake-runtask b/bitbake/bin/bitbake-runtask new file mode 100755 index 0000000000..417f3949cd --- /dev/null +++ b/bitbake/bin/bitbake-runtask | |||
@@ -0,0 +1,77 @@ | |||
1 | #!/usr/bin/env python | ||
2 | |||
3 | import os | ||
4 | import sys | ||
5 | import warnings | ||
6 | sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(sys.argv[0])), 'lib')) | ||
7 | |||
8 | class BBConfiguration(object): | ||
9 | """ | ||
10 | Manages build options and configurations for one run | ||
11 | """ | ||
12 | |||
13 | def __init__(self): | ||
14 | setattr(self, "data", {}) | ||
15 | setattr(self, "file", []) | ||
16 | setattr(self, "cmd", None) | ||
17 | |||
18 | _warnings_showwarning = warnings.showwarning | ||
19 | def _showwarning(message, category, filename, lineno, file=None, line=None): | ||
20 | """Display python warning messages using bb.msg""" | ||
21 | if file is not None: | ||
22 | if _warnings_showwarning is not None: | ||
23 | _warnings_showwarning(message, category, filename, lineno, file, line) | ||
24 | else: | ||
25 | s = warnings.formatwarning(message, category, filename, lineno) | ||
26 | s = s.split("\n")[0] | ||
27 | bb.msg.warn(None, s) | ||
28 | |||
29 | warnings.showwarning = _showwarning | ||
30 | warnings.simplefilter("ignore", DeprecationWarning) | ||
31 | |||
32 | import bb.event | ||
33 | |||
34 | # Need to map our I/O correctly. Currently stdout is a pipe to | ||
35 | # the server expecting events. We save this and map stdout to stderr. | ||
36 | |||
37 | eventfd = os.dup(sys.stdout.fileno()) | ||
38 | bb.event.worker_pipe = os.fdopen(eventfd, 'w', 0) | ||
39 | # Replace those fds with our own | ||
40 | os.dup2(sys.stderr.fileno(), sys.stdout.fileno()) | ||
41 | |||
42 | # Save out the PID so that the event can include it the | ||
43 | # events | ||
44 | bb.event.worker_pid = os.getpid() | ||
45 | bb.event.usestdout = False | ||
46 | |||
47 | |||
48 | import bb.cooker | ||
49 | |||
50 | cooker = bb.cooker.BBCooker(BBConfiguration(), None) | ||
51 | buildfile = sys.argv[1] | ||
52 | taskname = sys.argv[2] | ||
53 | |||
54 | cooker.parseConfiguration() | ||
55 | |||
56 | cooker.bb_cache = bb.cache.init(cooker) | ||
57 | cooker.status = bb.cache.CacheData() | ||
58 | |||
59 | (fn, cls) = cooker.bb_cache.virtualfn2realfn(buildfile) | ||
60 | buildfile = cooker.matchFile(fn) | ||
61 | fn = cooker.bb_cache.realfn2virtual(buildfile, cls) | ||
62 | |||
63 | cooker.buildSetVars() | ||
64 | |||
65 | # Load data into the cache for fn and parse the loaded cache data | ||
66 | the_data = cooker.bb_cache.loadDataFull(fn, cooker.get_file_appends(fn), cooker.configuration.data) | ||
67 | cooker.bb_cache.setData(fn, buildfile, the_data) | ||
68 | cooker.bb_cache.handle_data(fn, cooker.status) | ||
69 | |||
70 | if taskname.endswith("_setscene"): | ||
71 | the_data.setVarFlag(taskname, "quieterrors", "1") | ||
72 | |||
73 | ret = 0 | ||
74 | if sys.argv[3] != "True": | ||
75 | ret = bb.build.exec_task(taskname, the_data) | ||
76 | sys.exit(ret) | ||
77 | |||