diff options
Diffstat (limited to 'bitbake')
-rwxr-xr-x | bitbake/bin/bitbake-runtask | 119 |
1 files changed, 0 insertions, 119 deletions
diff --git a/bitbake/bin/bitbake-runtask b/bitbake/bin/bitbake-runtask deleted file mode 100755 index 6a0ecdc555..0000000000 --- a/bitbake/bin/bitbake-runtask +++ /dev/null | |||
@@ -1,119 +0,0 @@ | |||
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 | from bb import fetch2 | ||
8 | import logging | ||
9 | |||
10 | logger = logging.getLogger("BitBake") | ||
11 | |||
12 | try: | ||
13 | import cPickle as pickle | ||
14 | except ImportError: | ||
15 | import pickle | ||
16 | bb.msg.note(1, bb.msg.domain.Cache, "Importing cPickle failed. Falling back to a very slow implementation.") | ||
17 | |||
18 | class BBConfiguration(object): | ||
19 | """ | ||
20 | Manages build options and configurations for one run | ||
21 | """ | ||
22 | |||
23 | def __init__(self, **options): | ||
24 | self.data = {} | ||
25 | self.file = [] | ||
26 | self.cmd = None | ||
27 | self.dump_signatures = True | ||
28 | self.prefile = [] | ||
29 | self.postfile = [] | ||
30 | self.parse_only = True | ||
31 | |||
32 | def __getattr__(self, attribute): | ||
33 | try: | ||
34 | return super(BBConfiguration, self).__getattribute__(attribute) | ||
35 | except AttributeError: | ||
36 | return None | ||
37 | |||
38 | _warnings_showwarning = warnings.showwarning | ||
39 | def _showwarning(message, category, filename, lineno, file=None, line=None): | ||
40 | """Display python warning messages using bb.msg""" | ||
41 | if file is not None: | ||
42 | if _warnings_showwarning is not None: | ||
43 | _warnings_showwarning(message, category, filename, lineno, file, line) | ||
44 | else: | ||
45 | s = warnings.formatwarning(message, category, filename, lineno) | ||
46 | s = s.split("\n")[0] | ||
47 | bb.msg.warn(None, s) | ||
48 | |||
49 | warnings.showwarning = _showwarning | ||
50 | warnings.simplefilter("ignore", DeprecationWarning) | ||
51 | |||
52 | import bb.event | ||
53 | import bb.cooker | ||
54 | |||
55 | buildfile = sys.argv[1] | ||
56 | taskname = sys.argv[2] | ||
57 | if len(sys.argv) >= 4: | ||
58 | dryrun = sys.argv[3] | ||
59 | else: | ||
60 | dryrun = False | ||
61 | if len(sys.argv) >= 5: | ||
62 | hashfile = sys.argv[4] | ||
63 | p = pickle.Unpickler(file(hashfile, "rb")) | ||
64 | hashdata = p.load() | ||
65 | else: | ||
66 | hashdata = None | ||
67 | |||
68 | handler = bb.event.LogHandler() | ||
69 | logger.addHandler(handler) | ||
70 | |||
71 | #An example to make debug log messages show up | ||
72 | #bb.msg.init_msgconfig(True, 3, []) | ||
73 | |||
74 | console = logging.StreamHandler(sys.stdout) | ||
75 | format = bb.msg.BBLogFormatter("%(levelname)s: %(message)s") | ||
76 | bb.msg.addDefaultlogFilter(console) | ||
77 | console.setFormatter(format) | ||
78 | |||
79 | def worker_fire(event, d): | ||
80 | if isinstance(event, logging.LogRecord): | ||
81 | console.handle(event) | ||
82 | bb.event.worker_fire = worker_fire | ||
83 | bb.event.worker_pid = os.getpid() | ||
84 | |||
85 | initialenv = os.environ.copy() | ||
86 | config = BBConfiguration() | ||
87 | |||
88 | def register_idle_function(self, function, data): | ||
89 | pass | ||
90 | |||
91 | cooker = bb.cooker.BBCooker(config, register_idle_function, initialenv) | ||
92 | config_data = cooker.configuration.data | ||
93 | cooker.status = config_data | ||
94 | cooker.handleCollections(config_data.getVar("BBFILE_COLLECTIONS", 1)) | ||
95 | |||
96 | fn, cls = bb.cache.Cache.virtualfn2realfn(buildfile) | ||
97 | buildfile = cooker.matchFile(fn) | ||
98 | fn = bb.cache.Cache.realfn2virtual(buildfile, cls) | ||
99 | |||
100 | cooker.buildSetVars() | ||
101 | |||
102 | # Load data into the cache for fn and parse the loaded cache data | ||
103 | the_data = bb.cache.Cache.loadDataFull(fn, cooker.get_file_appends(fn), cooker.configuration.data) | ||
104 | |||
105 | if taskname.endswith("_setscene"): | ||
106 | the_data.setVarFlag(taskname, "quieterrors", "1") | ||
107 | |||
108 | if hashdata: | ||
109 | bb.parse.siggen.set_taskdata(hashdata["hashes"], hashdata["deps"]) | ||
110 | for h in hashdata["hashes"]: | ||
111 | the_data.setVar("BBHASH_%s" % h, hashdata["hashes"][h]) | ||
112 | for h in hashdata["deps"]: | ||
113 | the_data.setVar("BBHASHDEPS_%s" % h, hashdata["deps"][h]) | ||
114 | |||
115 | ret = 0 | ||
116 | if dryrun != "True": | ||
117 | ret = bb.build.exec_task(fn, taskname, the_data) | ||
118 | sys.exit(ret) | ||
119 | |||