summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
diff options
context:
space:
mode:
authorTudor Florea <tudor.florea@enea.com>2014-10-16 03:05:19 +0200
committerTudor Florea <tudor.florea@enea.com>2014-10-16 03:05:19 +0200
commitc527fd1f14c27855a37f2e8ac5346ce8d940ced2 (patch)
treebb002c1fdf011c41dbd2f0927bed23ecb5f83c97 /bitbake/lib/bb/ui/crumbs/hobeventhandler.py
downloadpoky-daisy-140929.tar.gz
initial commit for Enea Linux 4.0-140929daisy-140929
Migrated from the internal git server on the daisy-enea-point-release branch Signed-off-by: Tudor Florea <tudor.florea@enea.com>
Diffstat (limited to 'bitbake/lib/bb/ui/crumbs/hobeventhandler.py')
-rw-r--r--bitbake/lib/bb/ui/crumbs/hobeventhandler.py639
1 files changed, 639 insertions, 0 deletions
diff --git a/bitbake/lib/bb/ui/crumbs/hobeventhandler.py b/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
new file mode 100644
index 0000000000..43edb70b08
--- /dev/null
+++ b/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
@@ -0,0 +1,639 @@
1#
2# BitBake Graphical GTK User Interface
3#
4# Copyright (C) 2011 Intel Corporation
5#
6# Authored by Joshua Lock <josh@linux.intel.com>
7# Authored by Dongxiao Xu <dongxiao.xu@intel.com>
8#
9# This program is free software; you can redistribute it and/or modify
10# it under the terms of the GNU General Public License version 2 as
11# published by the Free Software Foundation.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU General Public License for more details.
17#
18# You should have received a copy of the GNU General Public License along
19# with this program; if not, write to the Free Software Foundation, Inc.,
20# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21
22import gobject
23import logging
24import ast
25from bb.ui.crumbs.runningbuild import RunningBuild
26
27class HobHandler(gobject.GObject):
28
29 """
30 This object does BitBake event handling for the hob gui.
31 """
32 __gsignals__ = {
33 "package-formats-updated" : (gobject.SIGNAL_RUN_LAST,
34 gobject.TYPE_NONE,
35 (gobject.TYPE_PYOBJECT,)),
36 "config-updated" : (gobject.SIGNAL_RUN_LAST,
37 gobject.TYPE_NONE,
38 (gobject.TYPE_STRING, gobject.TYPE_PYOBJECT,)),
39 "command-succeeded" : (gobject.SIGNAL_RUN_LAST,
40 gobject.TYPE_NONE,
41 (gobject.TYPE_INT,)),
42 "command-failed" : (gobject.SIGNAL_RUN_LAST,
43 gobject.TYPE_NONE,
44 (gobject.TYPE_STRING,)),
45 "parsing-warning" : (gobject.SIGNAL_RUN_LAST,
46 gobject.TYPE_NONE,
47 (gobject.TYPE_STRING,)),
48 "sanity-failed" : (gobject.SIGNAL_RUN_LAST,
49 gobject.TYPE_NONE,
50 (gobject.TYPE_STRING, gobject.TYPE_INT)),
51 "generating-data" : (gobject.SIGNAL_RUN_LAST,
52 gobject.TYPE_NONE,
53 ()),
54 "data-generated" : (gobject.SIGNAL_RUN_LAST,
55 gobject.TYPE_NONE,
56 ()),
57 "parsing-started" : (gobject.SIGNAL_RUN_LAST,
58 gobject.TYPE_NONE,
59 (gobject.TYPE_PYOBJECT,)),
60 "parsing" : (gobject.SIGNAL_RUN_LAST,
61 gobject.TYPE_NONE,
62 (gobject.TYPE_PYOBJECT,)),
63 "parsing-completed" : (gobject.SIGNAL_RUN_LAST,
64 gobject.TYPE_NONE,
65 (gobject.TYPE_PYOBJECT,)),
66 "recipe-populated" : (gobject.SIGNAL_RUN_LAST,
67 gobject.TYPE_NONE,
68 ()),
69 "package-populated" : (gobject.SIGNAL_RUN_LAST,
70 gobject.TYPE_NONE,
71 ()),
72 "network-passed" : (gobject.SIGNAL_RUN_LAST,
73 gobject.TYPE_NONE,
74 ()),
75 "network-failed" : (gobject.SIGNAL_RUN_LAST,
76 gobject.TYPE_NONE,
77 ()),
78 }
79
80 (GENERATE_CONFIGURATION, GENERATE_RECIPES, GENERATE_PACKAGES, GENERATE_IMAGE, POPULATE_PACKAGEINFO, SANITY_CHECK, NETWORK_TEST) = range(7)
81 (SUB_PATH_LAYERS, SUB_FILES_DISTRO, SUB_FILES_MACH, SUB_FILES_SDKMACH, SUB_MATCH_CLASS, SUB_PARSE_CONFIG, SUB_SANITY_CHECK,
82 SUB_GNERATE_TGTS, SUB_GENERATE_PKGINFO, SUB_BUILD_RECIPES, SUB_BUILD_IMAGE, SUB_NETWORK_TEST) = range(12)
83
84 def __init__(self, server, recipe_model, package_model):
85 super(HobHandler, self).__init__()
86
87 self.build = RunningBuild(sequential=True)
88
89 self.recipe_model = recipe_model
90 self.package_model = package_model
91
92 self.commands_async = []
93 self.generating = False
94 self.current_phase = None
95 self.building = False
96 self.recipe_queue = []
97 self.package_queue = []
98
99 self.server = server
100 self.error_msg = ""
101 self.initcmd = None
102 self.parsing = False
103
104 def set_busy(self):
105 if not self.generating:
106 self.emit("generating-data")
107 self.generating = True
108
109 def clear_busy(self):
110 if self.generating:
111 self.emit("data-generated")
112 self.generating = False
113
114 def runCommand(self, commandline):
115 try:
116 result, error = self.server.runCommand(commandline)
117 if error:
118 raise Exception("Error running command '%s': %s" % (commandline, error))
119 return result
120 except Exception as e:
121 self.commands_async = []
122 self.clear_busy()
123 self.emit("command-failed", "Hob Exception - %s" % (str(e)))
124 return None
125
126 def run_next_command(self, initcmd=None):
127 if initcmd != None:
128 self.initcmd = initcmd
129
130 if self.commands_async:
131 self.set_busy()
132 next_command = self.commands_async.pop(0)
133 else:
134 self.clear_busy()
135 if self.initcmd != None:
136 self.emit("command-succeeded", self.initcmd)
137 return
138
139 if next_command == self.SUB_PATH_LAYERS:
140 self.runCommand(["findConfigFilePath", "bblayers.conf"])
141 elif next_command == self.SUB_FILES_DISTRO:
142 self.runCommand(["findConfigFiles", "DISTRO"])
143 elif next_command == self.SUB_FILES_MACH:
144 self.runCommand(["findConfigFiles", "MACHINE"])
145 elif next_command == self.SUB_FILES_SDKMACH:
146 self.runCommand(["findConfigFiles", "MACHINE-SDK"])
147 elif next_command == self.SUB_MATCH_CLASS:
148 self.runCommand(["findFilesMatchingInDir", "rootfs_", "classes"])
149 elif next_command == self.SUB_PARSE_CONFIG:
150 self.runCommand(["resetCooker"])
151 elif next_command == self.SUB_GNERATE_TGTS:
152 self.runCommand(["generateTargetsTree", "classes/image.bbclass", []])
153 elif next_command == self.SUB_GENERATE_PKGINFO:
154 self.runCommand(["triggerEvent", "bb.event.RequestPackageInfo()"])
155 elif next_command == self.SUB_SANITY_CHECK:
156 self.runCommand(["triggerEvent", "bb.event.SanityCheck()"])
157 elif next_command == self.SUB_NETWORK_TEST:
158 self.runCommand(["triggerEvent", "bb.event.NetworkTest()"])
159 elif next_command == self.SUB_BUILD_RECIPES:
160 self.clear_busy()
161 self.building = True
162 self.runCommand(["buildTargets", self.recipe_queue, self.default_task])
163 self.recipe_queue = []
164 elif next_command == self.SUB_BUILD_IMAGE:
165 self.clear_busy()
166 self.building = True
167 target = self.image
168
169 if self.base_image:
170 # Request the build of a custom image
171 self.generate_hob_base_image(target)
172 self.set_var_in_file("LINGUAS_INSTALL", "", "local.conf")
173 hobImage = self.runCommand(["matchFile", target + ".bb"])
174 if self.base_image != self.recipe_model.__custom_image__:
175 baseImage = self.runCommand(["matchFile", self.base_image + ".bb"])
176 version = self.runCommand(["generateNewImage", hobImage, baseImage, self.package_queue, True, ""])
177 target += version
178 self.recipe_model.set_custom_image_version(version)
179
180 targets = [target]
181 if self.toolchain_packages:
182 self.set_var_in_file("TOOLCHAIN_TARGET_TASK", " ".join(self.toolchain_packages), "local.conf")
183 targets.append(target + ":do_populate_sdk")
184
185 self.runCommand(["buildTargets", targets, self.default_task])
186
187 def display_error(self):
188 self.clear_busy()
189 self.emit("command-failed", self.error_msg)
190 self.error_msg = ""
191 if self.building:
192 self.building = False
193
194 def handle_event(self, event):
195 if not event:
196 return
197 if self.building:
198 self.current_phase = "building"
199 self.build.handle_event(event)
200
201 if isinstance(event, bb.event.PackageInfo):
202 self.package_model.populate(event._pkginfolist)
203 self.emit("package-populated")
204 self.run_next_command()
205
206 elif isinstance(event, bb.event.SanityCheckPassed):
207 reparse = self.runCommand(["getVariable", "BB_INVALIDCONF"]) or None
208 if reparse is True:
209 self.set_var_in_file("BB_INVALIDCONF", False, "local.conf")
210 self.runCommand(["setPrePostConfFiles", "conf/.hob.conf", ""])
211 self.commands_async.prepend(self.SUB_PARSE_CONFIG)
212 self.run_next_command()
213
214 elif isinstance(event, bb.event.SanityCheckFailed):
215 self.emit("sanity-failed", event._msg, event._network_error)
216
217 elif isinstance(event, logging.LogRecord):
218 if not self.building:
219 if event.levelno >= logging.ERROR:
220 formatter = bb.msg.BBLogFormatter()
221 msg = formatter.format(event)
222 self.error_msg += msg + '\n'
223 elif event.levelno >= logging.WARNING and self.parsing == True:
224 formatter = bb.msg.BBLogFormatter()
225 msg = formatter.format(event)
226 warn_msg = msg + '\n'
227 self.emit("parsing-warning", warn_msg)
228
229 elif isinstance(event, bb.event.TargetsTreeGenerated):
230 self.current_phase = "data generation"
231 if event._model:
232 self.recipe_model.populate(event._model)
233 self.emit("recipe-populated")
234 elif isinstance(event, bb.event.ConfigFilesFound):
235 self.current_phase = "configuration lookup"
236 var = event._variable
237 values = event._values
238 values.sort()
239 self.emit("config-updated", var, values)
240 elif isinstance(event, bb.event.ConfigFilePathFound):
241 self.current_phase = "configuration lookup"
242 elif isinstance(event, bb.event.FilesMatchingFound):
243 self.current_phase = "configuration lookup"
244 # FIXME: hard coding, should at least be a variable shared between
245 # here and the caller
246 if event._pattern == "rootfs_":
247 formats = []
248 for match in event._matches:
249 classname, sep, cls = match.rpartition(".")
250 fs, sep, format = classname.rpartition("_")
251 formats.append(format)
252 formats.sort()
253 self.emit("package-formats-updated", formats)
254 elif isinstance(event, bb.command.CommandCompleted):
255 self.current_phase = None
256 self.run_next_command()
257 elif isinstance(event, bb.command.CommandFailed):
258 if event.error not in ("Forced shutdown", "Stopped build"):
259 self.error_msg += event.error
260 self.commands_async = []
261 self.display_error()
262 elif isinstance(event, (bb.event.ParseStarted,
263 bb.event.CacheLoadStarted,
264 bb.event.TreeDataPreparationStarted,
265 )):
266 message = {}
267 message["eventname"] = bb.event.getName(event)
268 message["current"] = 0
269 message["total"] = None
270 message["title"] = "Parsing recipes"
271 self.emit("parsing-started", message)
272 if isinstance(event, bb.event.ParseStarted):
273 self.parsing = True
274 elif isinstance(event, (bb.event.ParseProgress,
275 bb.event.CacheLoadProgress,
276 bb.event.TreeDataPreparationProgress)):
277 message = {}
278 message["eventname"] = bb.event.getName(event)
279 message["current"] = event.current
280 message["total"] = event.total
281 message["title"] = "Parsing recipes"
282 self.emit("parsing", message)
283 elif isinstance(event, (bb.event.ParseCompleted,
284 bb.event.CacheLoadCompleted,
285 bb.event.TreeDataPreparationCompleted)):
286 message = {}
287 message["eventname"] = bb.event.getName(event)
288 message["current"] = event.total
289 message["total"] = event.total
290 message["title"] = "Parsing recipes"
291 self.emit("parsing-completed", message)
292 if isinstance(event, bb.event.ParseCompleted):
293 self.parsing = False
294 elif isinstance(event, bb.event.NetworkTestFailed):
295 self.emit("network-failed")
296 self.run_next_command()
297 elif isinstance(event, bb.event.NetworkTestPassed):
298 self.emit("network-passed")
299 self.run_next_command()
300
301 if self.error_msg and not self.commands_async:
302 self.display_error()
303
304 return
305
306 def init_cooker(self):
307 self.runCommand(["createConfigFile", ".hob.conf"])
308
309 def set_extra_inherit(self, bbclass):
310 self.append_var_in_file("INHERIT", bbclass, ".hob.conf")
311
312 def set_bblayers(self, bblayers):
313 self.set_var_in_file("BBLAYERS", " ".join(bblayers), "bblayers.conf")
314
315 def set_machine(self, machine):
316 if machine:
317 self.early_assign_var_in_file("MACHINE", machine, "local.conf")
318
319 def set_sdk_machine(self, sdk_machine):
320 self.set_var_in_file("SDKMACHINE", sdk_machine, "local.conf")
321
322 def set_image_fstypes(self, image_fstypes):
323 self.set_var_in_file("IMAGE_FSTYPES", image_fstypes, "local.conf")
324
325 def set_distro(self, distro):
326 self.set_var_in_file("DISTRO", distro, "local.conf")
327
328 def set_package_format(self, format):
329 package_classes = ""
330 for pkgfmt in format.split():
331 package_classes += ("package_%s" % pkgfmt + " ")
332 self.set_var_in_file("PACKAGE_CLASSES", package_classes, "local.conf")
333
334 def set_bbthreads(self, threads):
335 self.set_var_in_file("BB_NUMBER_THREADS", threads, "local.conf")
336
337 def set_pmake(self, threads):
338 pmake = "-j %s" % threads
339 self.set_var_in_file("PARALLEL_MAKE", pmake, "local.conf")
340
341 def set_dl_dir(self, directory):
342 self.set_var_in_file("DL_DIR", directory, "local.conf")
343
344 def set_sstate_dir(self, directory):
345 self.set_var_in_file("SSTATE_DIR", directory, "local.conf")
346
347 def set_sstate_mirrors(self, url):
348 self.set_var_in_file("SSTATE_MIRRORS", url, "local.conf")
349
350 def set_extra_size(self, image_extra_size):
351 self.set_var_in_file("IMAGE_ROOTFS_EXTRA_SPACE", str(image_extra_size), "local.conf")
352
353 def set_rootfs_size(self, image_rootfs_size):
354 self.set_var_in_file("IMAGE_ROOTFS_SIZE", str(image_rootfs_size), "local.conf")
355
356 def set_incompatible_license(self, incompat_license):
357 self.set_var_in_file("INCOMPATIBLE_LICENSE", incompat_license, "local.conf")
358
359 def set_extra_setting(self, extra_setting):
360 self.set_var_in_file("EXTRA_SETTING", extra_setting, "local.conf")
361
362 def set_extra_config(self, extra_setting):
363 old_extra_setting = self.runCommand(["getVariable", "EXTRA_SETTING"]) or {}
364 old_extra_setting = str(old_extra_setting)
365
366 old_extra_setting = ast.literal_eval(old_extra_setting)
367 if not type(old_extra_setting) == dict:
368 old_extra_setting = {}
369
370 # settings not changed
371 if old_extra_setting == extra_setting:
372 return
373
374 # remove the old EXTRA SETTING variable
375 self.remove_var_from_file("EXTRA_SETTING")
376
377 # remove old settings from conf
378 for key in old_extra_setting.keys():
379 if key not in extra_setting:
380 self.remove_var_from_file(key)
381
382 # add new settings
383 for key, value in extra_setting.iteritems():
384 self.set_var_in_file(key, value, "local.conf")
385
386 if extra_setting:
387 self.set_var_in_file("EXTRA_SETTING", extra_setting, "local.conf")
388
389 def set_http_proxy(self, http_proxy):
390 self.set_var_in_file("http_proxy", http_proxy, "local.conf")
391
392 def set_https_proxy(self, https_proxy):
393 self.set_var_in_file("https_proxy", https_proxy, "local.conf")
394
395 def set_ftp_proxy(self, ftp_proxy):
396 self.set_var_in_file("ftp_proxy", ftp_proxy, "local.conf")
397
398 def set_socks_proxy(self, socks_proxy):
399 self.set_var_in_file("all_proxy", socks_proxy, "local.conf")
400
401 def set_cvs_proxy(self, host, port):
402 self.set_var_in_file("CVS_PROXY_HOST", host, "local.conf")
403 self.set_var_in_file("CVS_PROXY_PORT", port, "local.conf")
404
405 def request_package_info(self):
406 self.commands_async.append(self.SUB_GENERATE_PKGINFO)
407 self.run_next_command(self.POPULATE_PACKAGEINFO)
408
409 def trigger_sanity_check(self):
410 self.commands_async.append(self.SUB_SANITY_CHECK)
411 self.run_next_command(self.SANITY_CHECK)
412
413 def trigger_network_test(self):
414 self.commands_async.append(self.SUB_NETWORK_TEST)
415 self.run_next_command(self.NETWORK_TEST)
416
417 def generate_configuration(self):
418 self.runCommand(["setPrePostConfFiles", "conf/.hob.conf", ""])
419 self.commands_async.append(self.SUB_PARSE_CONFIG)
420 self.commands_async.append(self.SUB_PATH_LAYERS)
421 self.commands_async.append(self.SUB_FILES_DISTRO)
422 self.commands_async.append(self.SUB_FILES_MACH)
423 self.commands_async.append(self.SUB_FILES_SDKMACH)
424 self.commands_async.append(self.SUB_MATCH_CLASS)
425 self.run_next_command(self.GENERATE_CONFIGURATION)
426
427 def generate_recipes(self):
428 self.runCommand(["setPrePostConfFiles", "conf/.hob.conf", ""])
429 self.commands_async.append(self.SUB_PARSE_CONFIG)
430 self.commands_async.append(self.SUB_GNERATE_TGTS)
431 self.run_next_command(self.GENERATE_RECIPES)
432
433 def generate_packages(self, tgts, default_task="build"):
434 targets = []
435 targets.extend(tgts)
436 self.recipe_queue = targets
437 self.default_task = default_task
438 self.runCommand(["setPrePostConfFiles", "conf/.hob.conf", ""])
439 self.commands_async.append(self.SUB_PARSE_CONFIG)
440 self.commands_async.append(self.SUB_BUILD_RECIPES)
441 self.run_next_command(self.GENERATE_PACKAGES)
442
443 def generate_image(self, image, base_image, image_packages=[], toolchain_packages=[], default_task="build"):
444 self.image = image
445 self.base_image = base_image
446 self.package_queue = image_packages
447 self.toolchain_packages = toolchain_packages
448 self.default_task = default_task
449 self.runCommand(["setPrePostConfFiles", "conf/.hob.conf", ""])
450 self.commands_async.append(self.SUB_PARSE_CONFIG)
451 self.commands_async.append(self.SUB_BUILD_IMAGE)
452 self.run_next_command(self.GENERATE_IMAGE)
453
454 def generate_new_image(self, image, base_image, package_queue, description):
455 if base_image:
456 base_image = self.runCommand(["matchFile", self.base_image + ".bb"])
457 self.runCommand(["generateNewImage", image, base_image, package_queue, False, description])
458
459 def generate_hob_base_image(self, hob_image):
460 image_dir = self.get_topdir() + "/recipes/images/"
461 recipe_name = hob_image + ".bb"
462 self.ensure_dir(image_dir)
463 self.generate_new_image(image_dir + recipe_name, None, [], "")
464
465 def ensure_dir(self, directory):
466 self.runCommand(["ensureDir", directory])
467
468 def build_succeeded_async(self):
469 self.building = False
470
471 def build_failed_async(self):
472 self.initcmd = None
473 self.commands_async = []
474 self.building = False
475
476 def cancel_parse(self):
477 self.runCommand(["stateForceShutdown"])
478
479 def cancel_build(self, force=False):
480 if force:
481 # Force the cooker to stop as quickly as possible
482 self.runCommand(["stateForceShutdown"])
483 else:
484 # Wait for tasks to complete before shutting down, this helps
485 # leave the workdir in a usable state
486 self.runCommand(["stateShutdown"])
487
488 def reset_build(self):
489 self.build.reset()
490
491 def get_logfile(self):
492 return self.server.runCommand(["getVariable", "BB_CONSOLELOG"])[0]
493
494 def get_topdir(self):
495 return self.runCommand(["getVariable", "TOPDIR"]) or ""
496
497 def _remove_redundant(self, string):
498 ret = []
499 for i in string.split():
500 if i not in ret:
501 ret.append(i)
502 return " ".join(ret)
503
504 def set_var_in_file(self, var, val, default_file=None):
505 self.runCommand(["enableDataTracking"])
506 self.server.runCommand(["setVarFile", var, val, default_file, "set"])
507 self.runCommand(["disableDataTracking"])
508
509 def early_assign_var_in_file(self, var, val, default_file=None):
510 self.runCommand(["enableDataTracking"])
511 self.server.runCommand(["setVarFile", var, val, default_file, "earlyAssign"])
512 self.runCommand(["disableDataTracking"])
513
514 def remove_var_from_file(self, var):
515 self.server.runCommand(["removeVarFile", var])
516
517 def append_var_in_file(self, var, val, default_file=None):
518 self.server.runCommand(["setVarFile", var, val, default_file, "append"])
519
520 def append_to_bbfiles(self, val):
521 bbfiles = self.runCommand(["getVariable", "BBFILES", "False"]) or ""
522 bbfiles = bbfiles.split()
523 if val not in bbfiles:
524 self.append_var_in_file("BBFILES", val, "bblayers.conf")
525
526 def get_parameters(self):
527 # retrieve the parameters from bitbake
528 params = {}
529 params["core_base"] = self.runCommand(["getVariable", "COREBASE"]) or ""
530 params["layer"] = self.runCommand(["getVariable", "BBLAYERS"]) or ""
531 params["layers_non_removable"] = self.runCommand(["getVariable", "BBLAYERS_NON_REMOVABLE"]) or ""
532 params["dldir"] = self.runCommand(["getVariable", "DL_DIR"]) or ""
533 params["machine"] = self.runCommand(["getVariable", "MACHINE"]) or ""
534 params["distro"] = self.runCommand(["getVariable", "DISTRO"]) or "defaultsetup"
535 params["pclass"] = self.runCommand(["getVariable", "PACKAGE_CLASSES"]) or ""
536 params["sstatedir"] = self.runCommand(["getVariable", "SSTATE_DIR"]) or ""
537 params["sstatemirror"] = self.runCommand(["getVariable", "SSTATE_MIRRORS"]) or ""
538
539 num_threads = self.runCommand(["getCpuCount"])
540 if not num_threads:
541 num_threads = 1
542 max_threads = 65536
543 else:
544 try:
545 num_threads = int(num_threads)
546 max_threads = 16 * num_threads
547 except:
548 num_threads = 1
549 max_threads = 65536
550 params["max_threads"] = max_threads
551
552 bbthread = self.runCommand(["getVariable", "BB_NUMBER_THREADS"])
553 if not bbthread:
554 bbthread = num_threads
555 else:
556 try:
557 bbthread = int(bbthread)
558 except:
559 bbthread = num_threads
560 params["bbthread"] = bbthread
561
562 pmake = self.runCommand(["getVariable", "PARALLEL_MAKE"])
563 if not pmake:
564 pmake = num_threads
565 elif isinstance(pmake, int):
566 pass
567 else:
568 try:
569 pmake = int(pmake.lstrip("-j "))
570 except:
571 pmake = num_threads
572 params["pmake"] = "-j %s" % pmake
573
574 params["image_addr"] = self.runCommand(["getVariable", "DEPLOY_DIR_IMAGE"]) or ""
575
576 image_extra_size = self.runCommand(["getVariable", "IMAGE_ROOTFS_EXTRA_SPACE"])
577 if not image_extra_size:
578 image_extra_size = 0
579 else:
580 try:
581 image_extra_size = int(image_extra_size)
582 except:
583 image_extra_size = 0
584 params["image_extra_size"] = image_extra_size
585
586 image_rootfs_size = self.runCommand(["getVariable", "IMAGE_ROOTFS_SIZE"])
587 if not image_rootfs_size:
588 image_rootfs_size = 0
589 else:
590 try:
591 image_rootfs_size = int(image_rootfs_size)
592 except:
593 image_rootfs_size = 0
594 params["image_rootfs_size"] = image_rootfs_size
595
596 image_overhead_factor = self.runCommand(["getVariable", "IMAGE_OVERHEAD_FACTOR"])
597 if not image_overhead_factor:
598 image_overhead_factor = 1
599 else:
600 try:
601 image_overhead_factor = float(image_overhead_factor)
602 except:
603 image_overhead_factor = 1
604 params['image_overhead_factor'] = image_overhead_factor
605
606 params["incompat_license"] = self._remove_redundant(self.runCommand(["getVariable", "INCOMPATIBLE_LICENSE"]) or "")
607 params["sdk_machine"] = self.runCommand(["getVariable", "SDKMACHINE"]) or self.runCommand(["getVariable", "SDK_ARCH"]) or ""
608
609 params["image_fstypes"] = self._remove_redundant(self.runCommand(["getVariable", "IMAGE_FSTYPES"]) or "")
610
611 params["image_types"] = self._remove_redundant(self.runCommand(["getVariable", "IMAGE_TYPES"]) or "")
612
613 params["conf_version"] = self.runCommand(["getVariable", "CONF_VERSION"]) or ""
614 params["lconf_version"] = self.runCommand(["getVariable", "LCONF_VERSION"]) or ""
615
616 params["runnable_image_types"] = self._remove_redundant(self.runCommand(["getVariable", "RUNNABLE_IMAGE_TYPES"]) or "")
617 params["runnable_machine_patterns"] = self._remove_redundant(self.runCommand(["getVariable", "RUNNABLE_MACHINE_PATTERNS"]) or "")
618 params["deployable_image_types"] = self._remove_redundant(self.runCommand(["getVariable", "DEPLOYABLE_IMAGE_TYPES"]) or "")
619 params["kernel_image_type"] = self.runCommand(["getVariable", "KERNEL_IMAGETYPE"]) or ""
620 params["tmpdir"] = self.runCommand(["getVariable", "TMPDIR"]) or ""
621 params["distro_version"] = self.runCommand(["getVariable", "DISTRO_VERSION"]) or ""
622 params["target_os"] = self.runCommand(["getVariable", "TARGET_OS"]) or ""
623 params["target_arch"] = self.runCommand(["getVariable", "TARGET_ARCH"]) or ""
624 params["tune_pkgarch"] = self.runCommand(["getVariable", "TUNE_PKGARCH"]) or ""
625 params["bb_version"] = self.runCommand(["getVariable", "BB_MIN_VERSION"]) or ""
626
627 params["default_task"] = self.runCommand(["getVariable", "BB_DEFAULT_TASK"]) or "build"
628
629 params["socks_proxy"] = self.runCommand(["getVariable", "all_proxy"]) or ""
630 params["http_proxy"] = self.runCommand(["getVariable", "http_proxy"]) or ""
631 params["ftp_proxy"] = self.runCommand(["getVariable", "ftp_proxy"]) or ""
632 params["https_proxy"] = self.runCommand(["getVariable", "https_proxy"]) or ""
633
634 params["cvs_proxy_host"] = self.runCommand(["getVariable", "CVS_PROXY_HOST"]) or ""
635 params["cvs_proxy_port"] = self.runCommand(["getVariable", "CVS_PROXY_PORT"]) or ""
636
637 params["image_white_pattern"] = self.runCommand(["getVariable", "BBUI_IMAGE_WHITE_PATTERN"]) or ""
638 params["image_black_pattern"] = self.runCommand(["getVariable", "BBUI_IMAGE_BLACK_PATTERN"]) or ""
639 return params