summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorAlexandru DAMIAN <alexandru.damian@intel.com>2013-05-28 12:49:55 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-05-30 10:20:32 +0100
commite6a1b33bc87ea205b5d4ea8cf29159fc6ddd8853 (patch)
treef05d56f8b41b1c36fcea581cc2adcbfd5da0e49b /bitbake
parente09a15927714362866297c3a7a2992506ccf4f75 (diff)
downloadpoky-e6a1b33bc87ea205b5d4ea8cf29159fc6ddd8853.tar.gz
bitbake: bitbake: move extra cache collection out of cooker
The collection of the extra caching data should not be performed by the cooker, but supplied to it. This patch will also streamline the code for launching servers without a UI attached. Based on a patch by Bogdan Marinescu <bogdan.a.marinescu@intel.com> (Bitbake rev: f0b54280a6bce522508e4741e5f507bc284113a8) Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rwxr-xr-xbitbake/bin/bitbake18
-rw-r--r--bitbake/lib/bb/cooker.py24
-rw-r--r--bitbake/lib/bb/cookerdata.py1
3 files changed, 20 insertions, 23 deletions
diff --git a/bitbake/bin/bitbake b/bitbake/bin/bitbake
index 86cf3a8ae8..f44543de2c 100755
--- a/bitbake/bin/bitbake
+++ b/bitbake/bin/bitbake
@@ -75,6 +75,18 @@ def get_ui(config):
75 sys.exit("FATAL: Invalid user interface '%s' specified.\n" 75 sys.exit("FATAL: Invalid user interface '%s' specified.\n"
76 "Valid interfaces: depexp, goggle, ncurses, hob, knotty [default]." % interface) 76 "Valid interfaces: depexp, goggle, ncurses, hob, knotty [default]." % interface)
77 77
78def gather_extra_cache_data():
79 extra = []
80 interfaces = ['depexp', 'goggle', 'ncurses', 'hob', 'knotty']
81 for i in interfaces:
82 try:
83 ui = __import__("bb.ui." + i, fromlist = [i])
84 if hasattr(ui, "extraCaches"):
85 extra = extra + ui.extraCaches
86 del ui
87 except:
88 pass
89 return extra
78 90
79# Display bitbake/OE warnings via the BitBake.Warnings logger, ignoring others""" 91# Display bitbake/OE warnings via the BitBake.Warnings logger, ignoring others"""
80warnlog = logging.getLogger("BitBake.Warnings") 92warnlog = logging.getLogger("BitBake.Warnings")
@@ -237,6 +249,12 @@ def main():
237 249
238 try: 250 try:
239 configuration.setServerRegIdleCallback(server.getServerIdleCB()) 251 configuration.setServerRegIdleCallback(server.getServerIdleCB())
252
253 if configParams.server_only:
254 configuration.extra_caches = gather_extra_cache_data()
255 else:
256 configuration.extra_caches = getattr(ui_module, "extraCaches", [])
257
240 cooker = bb.cooker.BBCooker(configuration) 258 cooker = bb.cooker.BBCooker(configuration)
241 259
242 server.addcooker(cooker) 260 server.addcooker(cooker)
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index 2ae3e9d239..2edfa9faeb 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -94,28 +94,8 @@ class BBCooker:
94 self.configuration = configuration 94 self.configuration = configuration
95 95
96 self.caches_array = [] 96 self.caches_array = []
97 # Currently, only Image Creator hob ui needs extra cache. 97
98 # So, we save Extra Cache class name and container file 98 caches_name_array = ['bb.cache:CoreRecipeInfo'] + configuration.extra_caches
99 # information into a extraCaches field in hob UI.
100 # TODO: In future, bin/bitbake should pass information into cooker,
101 # instead of getting information from configuration.ui. Also, some
102 # UI start up issues need to be addressed at the same time.
103 caches_name_array = ['bb.cache:CoreRecipeInfo']
104 if configuration.ui:
105 try:
106 module = __import__('bb.ui', fromlist=[configuration.ui])
107 name_array = (getattr(module, configuration.ui)).extraCaches
108 for recipeInfoName in name_array:
109 caches_name_array.append(recipeInfoName)
110 except ImportError as exc:
111 # bb.ui.XXX is not defined and imported. It's an error!
112 logger.critical("Unable to import '%s' interface from bb.ui: %s" % (configuration.ui, exc))
113 sys.exit("FATAL: Failed to import '%s' interface." % configuration.ui)
114 except AttributeError:
115 # This is not an error. If the field is not defined in the ui,
116 # this interface might need no extra cache fields, so
117 # just skip this error!
118 logger.debug(2, "UI '%s' does not require extra cache!" % (configuration.ui))
119 99
120 # At least CoreRecipeInfo will be loaded, so caches_array will never be empty! 100 # At least CoreRecipeInfo will be loaded, so caches_array will never be empty!
121 # This is the entry point, no further check needed! 101 # This is the entry point, no further check needed!
diff --git a/bitbake/lib/bb/cookerdata.py b/bitbake/lib/bb/cookerdata.py
index 11063b4af2..cbaa0bed47 100644
--- a/bitbake/lib/bb/cookerdata.py
+++ b/bitbake/lib/bb/cookerdata.py
@@ -119,7 +119,6 @@ class CookerConfiguration(object):
119 self.cmd = None 119 self.cmd = None
120 self.abort = True 120 self.abort = True
121 self.force = False 121 self.force = False
122 self.ui = None
123 self.profile = False 122 self.profile = False
124 self.nosetscene = False 123 self.nosetscene = False
125 self.invalidate_stamp = False 124 self.invalidate_stamp = False