diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-12-02 17:48:40 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-12-03 17:45:54 +0000 |
commit | d1e66643ae2e379f5e51ab9370ef8cb7e66dcb35 (patch) | |
tree | 2e129b3f58109ba30d1b8ce757f6adbe979e2601 /bitbake/lib/bb/cooker.py | |
parent | b8f0963592aa6a9ebd679fa363ca6f894b132d75 (diff) | |
download | poky-d1e66643ae2e379f5e51ab9370ef8cb7e66dcb35.tar.gz |
bitbake: cooker/command/hob: Cleanup configuration init/reset functions and commands
initConfigurationData and loadConfigurationData are similar functions, the only
reason for them appears to be to be able to reset the pre/post configuration
files. The current code is confusing and unmaintainable.
Instead this patch creates a new Sync command which allows these to be explicitly
set. The init and load functions can then be merged into one. There is then no
need for a parseConfiguration command, we can simply reset the server to have the
settings take effect.
The reset fuction is not an instant value return and triggers an event so it should
be an Async command, not a sync one.
The number of calls for the set pre/post command is probably higher than it
need be but someone with more familiarity with the hob code base can probably
figure out the right places its needed (maybe just init_cooker?).
(Bitbake rev: bae5210d7e048022f083361964ebec7daf1608f7)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/cooker.py')
-rw-r--r-- | bitbake/lib/bb/cooker.py | 31 |
1 files changed, 12 insertions, 19 deletions
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py index 7b10f80680..fcf8db5c11 100644 --- a/bitbake/lib/bb/cooker.py +++ b/bitbake/lib/bb/cooker.py | |||
@@ -117,7 +117,7 @@ class BBCooker: | |||
117 | 117 | ||
118 | self.configuration = configuration | 118 | self.configuration = configuration |
119 | 119 | ||
120 | self.loadConfigurationData() | 120 | self.initConfigurationData() |
121 | 121 | ||
122 | # Take a lock so only one copy of bitbake can run against a given build | 122 | # Take a lock so only one copy of bitbake can run against a given build |
123 | # directory at a time | 123 | # directory at a time |
@@ -152,9 +152,11 @@ class BBCooker: | |||
152 | def initConfigurationData(self): | 152 | def initConfigurationData(self): |
153 | 153 | ||
154 | self.state = state.initial | 154 | self.state = state.initial |
155 | |||
156 | self.caches_array = [] | 155 | self.caches_array = [] |
157 | 156 | ||
157 | if CookerFeatures.BASEDATASTORE_TRACKING in self.featureset: | ||
158 | self.enableDataTracking() | ||
159 | |||
158 | all_extra_cache_names = [] | 160 | all_extra_cache_names = [] |
159 | # We hardcode all known cache types in a single place, here. | 161 | # We hardcode all known cache types in a single place, here. |
160 | if CookerFeatures.HOB_EXTRA_CACHES in self.featureset: | 162 | if CookerFeatures.HOB_EXTRA_CACHES in self.featureset: |
@@ -176,19 +178,6 @@ class BBCooker: | |||
176 | self.databuilder = bb.cookerdata.CookerDataBuilder(self.configuration, False) | 178 | self.databuilder = bb.cookerdata.CookerDataBuilder(self.configuration, False) |
177 | self.data = self.databuilder.data | 179 | self.data = self.databuilder.data |
178 | 180 | ||
179 | def enableDataTracking(self): | ||
180 | self.configuration.tracking = True | ||
181 | self.data.enableTracking() | ||
182 | |||
183 | def disableDataTracking(self): | ||
184 | self.configuration.tracking = False | ||
185 | self.data.disableTracking() | ||
186 | |||
187 | def loadConfigurationData(self): | ||
188 | if CookerFeatures.BASEDATASTORE_TRACKING in self.featureset: | ||
189 | self.enableDataTracking() | ||
190 | |||
191 | self.initConfigurationData() | ||
192 | self.databuilder.parseBaseConfiguration() | 181 | self.databuilder.parseBaseConfiguration() |
193 | self.data = self.databuilder.data | 182 | self.data = self.databuilder.data |
194 | self.data_hash = self.databuilder.data_hash | 183 | self.data_hash = self.databuilder.data_hash |
@@ -203,6 +192,13 @@ class BBCooker: | |||
203 | if CookerFeatures.BASEDATASTORE_TRACKING in self.featureset: | 192 | if CookerFeatures.BASEDATASTORE_TRACKING in self.featureset: |
204 | self.disableDataTracking() | 193 | self.disableDataTracking() |
205 | 194 | ||
195 | def enableDataTracking(self): | ||
196 | self.configuration.tracking = True | ||
197 | self.data.enableTracking() | ||
198 | |||
199 | def disableDataTracking(self): | ||
200 | self.configuration.tracking = False | ||
201 | self.data.disableTracking() | ||
206 | 202 | ||
207 | def modifyConfigurationVar(self, var, val, default_file, op): | 203 | def modifyConfigurationVar(self, var, val, default_file, op): |
208 | if op == "append": | 204 | if op == "append": |
@@ -1333,11 +1329,8 @@ class BBCooker: | |||
1333 | def finishcommand(self): | 1329 | def finishcommand(self): |
1334 | self.state = state.initial | 1330 | self.state = state.initial |
1335 | 1331 | ||
1336 | def initialize(self): | ||
1337 | self.initConfigurationData() | ||
1338 | |||
1339 | def reset(self): | 1332 | def reset(self): |
1340 | self.loadConfigurationData() | 1333 | self.initConfigurationData() |
1341 | 1334 | ||
1342 | def server_main(cooker, func, *args): | 1335 | def server_main(cooker, func, *args): |
1343 | cooker.pre_serve() | 1336 | cooker.pre_serve() |