diff options
| author | Joshua Lock <josh@linux.intel.com> | 2011-07-14 15:25:59 -0700 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-07-26 13:50:05 +0100 |
| commit | ba3aef9b06c5fdb2b9cc5bf43915886f3fa313a7 (patch) | |
| tree | 8e66ce9874f22aba0ce099b80a8dcfe66c31382a | |
| parent | 0828e6c481ffdf67e1d893025f2233ac6a4b0b46 (diff) | |
| download | poky-ba3aef9b06c5fdb2b9cc5bf43915886f3fa313a7.tar.gz | |
command|cooker: Add reparseFiles command
Add command reparseFiles to reparse bb files in a running cooker instance.
Fixes [YOCTO #1249]
(Bitbake rev: de035ad99feb7644f99ad54804bf9f98cc776877)
Signed-off-by: Joshua Lock <josh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
| -rw-r--r-- | bitbake/lib/bb/command.py | 8 | ||||
| -rw-r--r-- | bitbake/lib/bb/cooker.py | 51 |
2 files changed, 40 insertions, 19 deletions
diff --git a/bitbake/lib/bb/command.py b/bitbake/lib/bb/command.py index a902da2ce8..893a6d9070 100644 --- a/bitbake/lib/bb/command.py +++ b/bitbake/lib/bb/command.py | |||
| @@ -311,6 +311,14 @@ class CommandsAsync: | |||
| 311 | command.finishAsyncCommand() | 311 | command.finishAsyncCommand() |
| 312 | parseFiles.needcache = True | 312 | parseFiles.needcache = True |
| 313 | 313 | ||
| 314 | def reparseFiles(self, command, params): | ||
| 315 | """ | ||
| 316 | Reparse .bb files | ||
| 317 | """ | ||
| 318 | command.cooker.reparseFiles() | ||
| 319 | command.finishAsyncCommand() | ||
| 320 | reparseFiles.needcache = True | ||
| 321 | |||
| 314 | def compareRevisions(self, command, params): | 322 | def compareRevisions(self, command, params): |
| 315 | """ | 323 | """ |
| 316 | Parse the .bb files | 324 | Parse the .bb files |
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py index f99d78634f..3959abf14d 100644 --- a/bitbake/lib/bb/cooker.py +++ b/bitbake/lib/bb/cooker.py | |||
| @@ -130,21 +130,8 @@ class BBCooker: | |||
| 130 | logger.critical("Unable to import extra RecipeInfo '%s' from '%s': %s" % (cache_name, module_name, exc)) | 130 | logger.critical("Unable to import extra RecipeInfo '%s' from '%s': %s" % (cache_name, module_name, exc)) |
| 131 | sys.exit("FATAL: Failed to import extra cache class '%s'." % cache_name) | 131 | sys.exit("FATAL: Failed to import extra cache class '%s'." % cache_name) |
| 132 | 132 | ||
| 133 | self.configuration.data = bb.data.init() | 133 | self.configuration.data = None |
| 134 | 134 | self.loadConfigurationData() | |
| 135 | if not self.server_registration_cb: | ||
| 136 | bb.data.setVar("BB_WORKERCONTEXT", "1", self.configuration.data) | ||
| 137 | |||
| 138 | bb.data.inheritFromOS(self.configuration.data, self.savedenv) | ||
| 139 | |||
| 140 | try: | ||
| 141 | self.parseConfigurationFiles(self.configuration.prefile, | ||
| 142 | self.configuration.postfile) | ||
| 143 | except SyntaxError: | ||
| 144 | sys.exit(1) | ||
| 145 | except Exception: | ||
| 146 | logger.exception("Error parsing configuration files") | ||
| 147 | sys.exit(1) | ||
| 148 | 135 | ||
| 149 | if not self.configuration.cmd: | 136 | if not self.configuration.cmd: |
| 150 | self.configuration.cmd = bb.data.getVar("BB_DEFAULT_TASK", self.configuration.data, True) or "build" | 137 | self.configuration.cmd = bb.data.getVar("BB_DEFAULT_TASK", self.configuration.data, True) or "build" |
| @@ -174,6 +161,26 @@ class BBCooker: | |||
| 174 | 161 | ||
| 175 | self.parser = None | 162 | self.parser = None |
| 176 | 163 | ||
| 164 | def loadConfigurationData(self): | ||
| 165 | self.configuration.data = bb.data.init() | ||
| 166 | |||
| 167 | if not self.server_registration_cb: | ||
| 168 | bb.data.setVar("BB_WORKERCONTEXT", "1", self.configuration.data) | ||
| 169 | |||
| 170 | bb.data.inheritFromOS(self.configuration.data, self.savedenv) | ||
| 171 | |||
| 172 | try: | ||
| 173 | self.parseConfigurationFiles(self.configuration.prefile, | ||
| 174 | self.configuration.postfile) | ||
| 175 | except SyntaxError: | ||
| 176 | sys.exit(1) | ||
| 177 | except Exception: | ||
| 178 | logger.exception("Error parsing configuration files") | ||
| 179 | sys.exit(1) | ||
| 180 | |||
| 181 | if not self.configuration.cmd: | ||
| 182 | self.configuration.cmd = bb.data.getVar("BB_DEFAULT_TASK", self.configuration.data, True) or "build" | ||
| 183 | |||
| 177 | def parseConfiguration(self): | 184 | def parseConfiguration(self): |
| 178 | 185 | ||
| 179 | 186 | ||
| @@ -566,7 +573,7 @@ class BBCooker: | |||
| 566 | bb.data.expandKeys(localdata) | 573 | bb.data.expandKeys(localdata) |
| 567 | 574 | ||
| 568 | # Handle PREFERRED_PROVIDERS | 575 | # Handle PREFERRED_PROVIDERS |
| 569 | for p in (bb.data.getVar('PREFERRED_PROVIDERS', localdata, 1) or "").split(): | 576 | for p in (bb.data.getVar('PREFERRED_PROVIDERS', localdata, True) or "").split(): |
| 570 | try: | 577 | try: |
| 571 | (providee, provider) = p.split(':') | 578 | (providee, provider) = p.split(':') |
| 572 | except: | 579 | except: |
| @@ -1062,8 +1069,8 @@ class BBCooker: | |||
| 1062 | 1069 | ||
| 1063 | self.server_registration_cb(buildTargetsIdle, rq) | 1070 | self.server_registration_cb(buildTargetsIdle, rq) |
| 1064 | 1071 | ||
| 1065 | def updateCache(self): | 1072 | def updateCache(self, force=False): |
| 1066 | if self.state == state.running: | 1073 | if self.state == state.running and not force: |
| 1067 | return | 1074 | return |
| 1068 | 1075 | ||
| 1069 | if self.state in (state.shutdown, state.stop): | 1076 | if self.state in (state.shutdown, state.stop): |
| @@ -1073,6 +1080,8 @@ class BBCooker: | |||
| 1073 | if self.state != state.parsing: | 1080 | if self.state != state.parsing: |
| 1074 | self.parseConfiguration () | 1081 | self.parseConfiguration () |
| 1075 | 1082 | ||
| 1083 | if self.status: | ||
| 1084 | del self.status | ||
| 1076 | self.status = bb.cache.CacheData(self.caches_array) | 1085 | self.status = bb.cache.CacheData(self.caches_array) |
| 1077 | 1086 | ||
| 1078 | ignore = bb.data.getVar("ASSUME_PROVIDED", self.configuration.data, 1) or "" | 1087 | ignore = bb.data.getVar("ASSUME_PROVIDED", self.configuration.data, 1) or "" |
| @@ -1146,7 +1155,7 @@ class BBCooker: | |||
| 1146 | 1155 | ||
| 1147 | collectlog.debug(1, "collecting .bb files") | 1156 | collectlog.debug(1, "collecting .bb files") |
| 1148 | 1157 | ||
| 1149 | files = (data.getVar( "BBFILES", self.configuration.data, 1 ) or "").split() | 1158 | files = (data.getVar( "BBFILES", self.configuration.data, True) or "").split() |
| 1150 | data.setVar("BBFILES", " ".join(files), self.configuration.data) | 1159 | data.setVar("BBFILES", " ".join(files), self.configuration.data) |
| 1151 | 1160 | ||
| 1152 | # Sort files by priority | 1161 | # Sort files by priority |
| @@ -1244,6 +1253,10 @@ class BBCooker: | |||
| 1244 | def stop(self): | 1253 | def stop(self): |
| 1245 | self.state = state.stop | 1254 | self.state = state.stop |
| 1246 | 1255 | ||
| 1256 | def reparseFiles(self): | ||
| 1257 | self.loadConfigurationData() | ||
| 1258 | self.updateCache(force=True) | ||
| 1259 | |||
| 1247 | def server_main(cooker, func, *args): | 1260 | def server_main(cooker, func, *args): |
| 1248 | cooker.pre_serve() | 1261 | cooker.pre_serve() |
| 1249 | 1262 | ||
