summaryrefslogtreecommitdiffstats
path: root/bitbake/lib
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2013-09-13 17:31:09 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-09-14 08:20:38 +0100
commit2174a51ee8bcfd3a14e0a889e9beccc0b32e406b (patch)
tree521e89b1ded89f21a8f9cff29d143d8fe318fc88 /bitbake/lib
parentfe1258d47855efcfdc7fe7ecd617ba2ae7e378b2 (diff)
downloadpoky-2174a51ee8bcfd3a14e0a889e9beccc0b32e406b.tar.gz
bitbake: cooker: Clean up init/reset configuration code
Currently the cooker event data isn't rebuilt upon reset and the cache configuration cannot be changed after init. These are both bad things and this patch refactors the init/reset code so that it is possible to reconfigure the server. (Bitbake rev: 1193b8d76fcb6cb87e9ec135a2514370d7dd90ac) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib')
-rw-r--r--bitbake/lib/bb/cooker.py49
1 files changed, 24 insertions, 25 deletions
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index daa00a45d0..7034f1d718 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -93,22 +93,6 @@ class BBCooker:
93 93
94 self.configuration = configuration 94 self.configuration = configuration
95 95
96 self.caches_array = []
97
98 caches_name_array = ['bb.cache:CoreRecipeInfo'] + configuration.extra_caches
99
100 # At least CoreRecipeInfo will be loaded, so caches_array will never be empty!
101 # This is the entry point, no further check needed!
102 for var in caches_name_array:
103 try:
104 module_name, cache_name = var.split(':')
105 module = __import__(module_name, fromlist=(cache_name,))
106 self.caches_array.append(getattr(module, cache_name))
107 except ImportError as exc:
108 logger.critical("Unable to import extra RecipeInfo '%s' from '%s': %s" % (cache_name, module_name, exc))
109 sys.exit("FATAL: Failed to import extra cache class '%s'." % cache_name)
110
111 self.data = None
112 self.loadConfigurationData() 96 self.loadConfigurationData()
113 97
114 # Take a lock so only one copy of bitbake can run against a given build 98 # Take a lock so only one copy of bitbake can run against a given build
@@ -118,13 +102,6 @@ class BBCooker:
118 if not self.lock: 102 if not self.lock:
119 bb.fatal("Only one copy of bitbake should be run against a build directory") 103 bb.fatal("Only one copy of bitbake should be run against a build directory")
120 104
121 #
122 # Special updated configuration we use for firing events
123 #
124 self.event_data = bb.data.createCopy(self.data)
125 bb.data.update_data(self.event_data)
126 bb.parse.init_parser(self.event_data)
127
128 # TOSTOP must not be set or our children will hang when they output 105 # TOSTOP must not be set or our children will hang when they output
129 fd = sys.stdout.fileno() 106 fd = sys.stdout.fileno()
130 if os.isatty(fd): 107 if os.isatty(fd):
@@ -141,6 +118,23 @@ class BBCooker:
141 self.parser = None 118 self.parser = None
142 119
143 def initConfigurationData(self): 120 def initConfigurationData(self):
121
122 self.state = state.initial
123
124 self.caches_array = []
125 caches_name_array = ['bb.cache:CoreRecipeInfo'] + self.configuration.extra_caches
126
127 # At least CoreRecipeInfo will be loaded, so caches_array will never be empty!
128 # This is the entry point, no further check needed!
129 for var in caches_name_array:
130 try:
131 module_name, cache_name = var.split(':')
132 module = __import__(module_name, fromlist=(cache_name,))
133 self.caches_array.append(getattr(module, cache_name))
134 except ImportError as exc:
135 logger.critical("Unable to import extra RecipeInfo '%s' from '%s': %s" % (cache_name, module_name, exc))
136 sys.exit("FATAL: Failed to import extra cache class '%s'." % cache_name)
137
144 self.databuilder = bb.cookerdata.CookerDataBuilder(self.configuration, False) 138 self.databuilder = bb.cookerdata.CookerDataBuilder(self.configuration, False)
145 self.data = self.databuilder.data 139 self.data = self.databuilder.data
146 140
@@ -158,6 +152,13 @@ class BBCooker:
158 self.data = self.databuilder.data 152 self.data = self.databuilder.data
159 self.data_hash = self.databuilder.data_hash 153 self.data_hash = self.databuilder.data_hash
160 154
155 #
156 # Special updated configuration we use for firing events
157 #
158 self.event_data = bb.data.createCopy(self.data)
159 bb.data.update_data(self.event_data)
160 bb.parse.init_parser(self.event_data)
161
161 def modifyConfigurationVar(self, var, val, default_file, op): 162 def modifyConfigurationVar(self, var, val, default_file, op):
162 if op == "append": 163 if op == "append":
163 self.appendConfigurationVar(var, val, default_file) 164 self.appendConfigurationVar(var, val, default_file)
@@ -1246,11 +1247,9 @@ class BBCooker:
1246 self.state = state.stop 1247 self.state = state.stop
1247 1248
1248 def initialize(self): 1249 def initialize(self):
1249 self.state = state.initial
1250 self.initConfigurationData() 1250 self.initConfigurationData()
1251 1251
1252 def reset(self): 1252 def reset(self):
1253 self.state = state.initial
1254 self.loadConfigurationData() 1253 self.loadConfigurationData()
1255 1254
1256def server_main(cooker, func, *args): 1255def server_main(cooker, func, *args):