diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2017-07-19 11:56:00 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-07-21 08:41:11 +0100 |
commit | 192b2e15369fd052e5e4d5f70c5f5d83d50c2b5b (patch) | |
tree | da880a5de29cb5c67d460a04c48859e09377ec4f /bitbake | |
parent | 579b811233d6183089e9687fc96fafae1932bc5c (diff) | |
download | poky-192b2e15369fd052e5e4d5f70c5f5d83d50c2b5b.tar.gz |
bitbake: tinfoil: add internal mode to build_file() function
In OE's devtool we want to repeatedly run build_file() without showing
unnecessary messages and triggering buildhistory for each call.
build_file() is just a wrapper around the buildFile command. Change
the final "hidewarning" parameter of the buildFile command to "internal"
and have this call a new buildFileInternal() function without triggering
any of the normal build events, silencing the normal info messages from
the runqueue ("Executing RunQueue Tasks", "Tasks Summary" etc.) and
avoiding calling parseConfiguration() which we've already done at this
point.
(Bitbake rev: ba53e067a2d448dd63b4ca252557ce98aa8e6321)
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r-- | bitbake/lib/bb/command.py | 9 | ||||
-rw-r--r-- | bitbake/lib/bb/cooker.py | 34 | ||||
-rw-r--r-- | bitbake/lib/bb/tinfoil.py | 9 |
3 files changed, 37 insertions, 15 deletions
diff --git a/bitbake/lib/bb/command.py b/bitbake/lib/bb/command.py index eb7c86f4fe..c06ab072ad 100644 --- a/bitbake/lib/bb/command.py +++ b/bitbake/lib/bb/command.py | |||
@@ -548,11 +548,14 @@ class CommandsAsync: | |||
548 | bfile = params[0] | 548 | bfile = params[0] |
549 | task = params[1] | 549 | task = params[1] |
550 | if len(params) > 2: | 550 | if len(params) > 2: |
551 | hidewarning = params[2] | 551 | internal = params[2] |
552 | else: | 552 | else: |
553 | hidewarning = False | 553 | internal = False |
554 | 554 | ||
555 | command.cooker.buildFile(bfile, task, hidewarning) | 555 | if internal: |
556 | command.cooker.buildFileInternal(bfile, task, fireevents=False, quietlog=True) | ||
557 | else: | ||
558 | command.cooker.buildFile(bfile, task) | ||
556 | buildFile.needcache = False | 559 | buildFile.needcache = False |
557 | 560 | ||
558 | def buildTargets(self, command, params): | 561 | def buildTargets(self, command, params): |
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py index daffe67540..1625d3c158 100644 --- a/bitbake/lib/bb/cooker.py +++ b/bitbake/lib/bb/cooker.py | |||
@@ -1219,21 +1219,27 @@ class BBCooker: | |||
1219 | raise NoSpecificMatch | 1219 | raise NoSpecificMatch |
1220 | return matches[0] | 1220 | return matches[0] |
1221 | 1221 | ||
1222 | def buildFile(self, buildfile, task, hidewarning=False): | 1222 | def buildFile(self, buildfile, task): |
1223 | """ | 1223 | """ |
1224 | Build the file matching regexp buildfile | 1224 | Build the file matching regexp buildfile |
1225 | """ | 1225 | """ |
1226 | bb.event.fire(bb.event.BuildInit(), self.data) | 1226 | bb.event.fire(bb.event.BuildInit(), self.data) |
1227 | 1227 | ||
1228 | if not hidewarning: | 1228 | # Too many people use -b because they think it's how you normally |
1229 | # Too many people use -b because they think it's how you normally | 1229 | # specify a target to be built, so show a warning |
1230 | # specify a target to be built, so show a warning | 1230 | bb.warn("Buildfile specified, dependencies will not be handled. If this is not what you want, do not use -b / --buildfile.") |
1231 | bb.warn("Buildfile specified, dependencies will not be handled. If this is not what you want, do not use -b / --buildfile.") | ||
1232 | 1231 | ||
1233 | # Parse the configuration here. We need to do it explicitly here since | 1232 | # Parse the configuration here. We need to do it explicitly here since |
1234 | # buildFile() doesn't use the cache | 1233 | # buildFile() doesn't use the cache |
1235 | self.parseConfiguration() | 1234 | self.parseConfiguration() |
1236 | 1235 | ||
1236 | self.buildFileInternal(buildfile, task) | ||
1237 | |||
1238 | def buildFileInternal(self, buildfile, task, fireevents=True, quietlog=False): | ||
1239 | """ | ||
1240 | Build the file matching regexp buildfile | ||
1241 | """ | ||
1242 | |||
1237 | # If we are told to do the None task then query the default task | 1243 | # If we are told to do the None task then query the default task |
1238 | if (task == None): | 1244 | if (task == None): |
1239 | task = self.configuration.cmd | 1245 | task = self.configuration.cmd |
@@ -1270,8 +1276,8 @@ class BBCooker: | |||
1270 | # Remove external dependencies | 1276 | # Remove external dependencies |
1271 | self.recipecaches[mc].task_deps[fn]['depends'] = {} | 1277 | self.recipecaches[mc].task_deps[fn]['depends'] = {} |
1272 | self.recipecaches[mc].deps[fn] = [] | 1278 | self.recipecaches[mc].deps[fn] = [] |
1273 | self.recipecaches[mc].rundeps[fn] = [] | 1279 | self.recipecaches[mc].rundeps[fn] = defaultdict(list) |
1274 | self.recipecaches[mc].runrecs[fn] = [] | 1280 | self.recipecaches[mc].runrecs[fn] = defaultdict(list) |
1275 | 1281 | ||
1276 | # Invalidate task for target if force mode active | 1282 | # Invalidate task for target if force mode active |
1277 | if self.configuration.force: | 1283 | if self.configuration.force: |
@@ -1283,8 +1289,13 @@ class BBCooker: | |||
1283 | taskdata[mc] = bb.taskdata.TaskData(self.configuration.abort) | 1289 | taskdata[mc] = bb.taskdata.TaskData(self.configuration.abort) |
1284 | taskdata[mc].add_provider(self.databuilder.mcdata[mc], self.recipecaches[mc], item) | 1290 | taskdata[mc].add_provider(self.databuilder.mcdata[mc], self.recipecaches[mc], item) |
1285 | 1291 | ||
1292 | if quietlog: | ||
1293 | rqloglevel = bb.runqueue.logger.getEffectiveLevel() | ||
1294 | bb.runqueue.logger.setLevel(logging.WARNING) | ||
1295 | |||
1286 | buildname = self.databuilder.mcdata[mc].getVar("BUILDNAME") | 1296 | buildname = self.databuilder.mcdata[mc].getVar("BUILDNAME") |
1287 | bb.event.fire(bb.event.BuildStarted(buildname, [item]), self.databuilder.mcdata[mc]) | 1297 | if fireevents: |
1298 | bb.event.fire(bb.event.BuildStarted(buildname, [item]), self.databuilder.mcdata[mc]) | ||
1288 | 1299 | ||
1289 | # Execute the runqueue | 1300 | # Execute the runqueue |
1290 | runlist = [[mc, item, task, fn]] | 1301 | runlist = [[mc, item, task, fn]] |
@@ -1311,11 +1322,16 @@ class BBCooker: | |||
1311 | retval = False | 1322 | retval = False |
1312 | except SystemExit as exc: | 1323 | except SystemExit as exc: |
1313 | self.command.finishAsyncCommand(str(exc)) | 1324 | self.command.finishAsyncCommand(str(exc)) |
1325 | if quietlog: | ||
1326 | bb.runqueue.logger.setLevel(rqloglevel) | ||
1314 | return False | 1327 | return False |
1315 | 1328 | ||
1316 | if not retval: | 1329 | if not retval: |
1317 | bb.event.fire(bb.event.BuildCompleted(len(rq.rqdata.runtaskentries), buildname, item, failures, interrupted), self.databuilder.mcdata[mc]) | 1330 | if fireevents: |
1331 | bb.event.fire(bb.event.BuildCompleted(len(rq.rqdata.runtaskentries), buildname, item, failures, interrupted), self.databuilder.mcdata[mc]) | ||
1318 | self.command.finishAsyncCommand(msg) | 1332 | self.command.finishAsyncCommand(msg) |
1333 | if quietlog: | ||
1334 | bb.runqueue.logger.setLevel(rqloglevel) | ||
1319 | return False | 1335 | return False |
1320 | if retval is True: | 1336 | if retval is True: |
1321 | return True | 1337 | return True |
diff --git a/bitbake/lib/bb/tinfoil.py b/bitbake/lib/bb/tinfoil.py index 303ce02b00..65ebdc2b78 100644 --- a/bitbake/lib/bb/tinfoil.py +++ b/bitbake/lib/bb/tinfoil.py | |||
@@ -415,12 +415,15 @@ class Tinfoil: | |||
415 | else: | 415 | else: |
416 | return None | 416 | return None |
417 | 417 | ||
418 | def build_file(self, buildfile, task): | 418 | def build_file(self, buildfile, task, internal=True): |
419 | """ | 419 | """ |
420 | Runs the specified task for just a single recipe (i.e. no dependencies). | 420 | Runs the specified task for just a single recipe (i.e. no dependencies). |
421 | This is equivalent to bitbake -b, except no warning will be printed. | 421 | This is equivalent to bitbake -b, except with the default internal=True |
422 | no warning about dependencies will be produced, normal info messages | ||
423 | from the runqueue will be silenced and BuildInit, BuildStarted and | ||
424 | BuildCompleted events will not be fired. | ||
422 | """ | 425 | """ |
423 | return self.run_command('buildFile', buildfile, task, True) | 426 | return self.run_command('buildFile', buildfile, task, internal) |
424 | 427 | ||
425 | def shutdown(self): | 428 | def shutdown(self): |
426 | if self.server_connection: | 429 | if self.server_connection: |