[bitbake-devel] [PATCH 1/1] runqueue: dry-run real tasks when BB_SETSCENE_ENFORCE is set
Paul Eggleton
paul.eggleton at linux.intel.com
Fri Dec 9 02:26:33 UTC 2016
For the purposes BB_SETSCENE_ENFORCE is designed for (in OE, it is used
by the installation process for the extensible SDK), we don't actually
need the whitelisted real tasks to execute - we just need to have them
in the dependency tree so that we get all of the setscene tasks they
depend on to run. Therefore we can actually dry-run those real tasks
i.e. they won't be run (and thus we won't waste a significant amount of
time doing so) and won't be stamped as having run either. We do already
have a dry-run mode in BitBake (activated by the -n or --dry-run command
line option), but it dry-runs the setscene tasks as well which we don't
want here.
Note that this has no effect on the checking we are doing with
BB_SETSCENE_ENFORCE to ensure that only whitelisted real tasks are
scheduled to run - that's handled separately.
Fixes [YOCTO #10369].
Signed-off-by: Paul Eggleton <paul.eggleton at linux.intel.com>
---
bin/bitbake-worker | 6 ++++--
lib/bb/runqueue.py | 6 ++++--
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/bin/bitbake-worker b/bin/bitbake-worker
index 97b32c3..9d8f004 100755
--- a/bin/bitbake-worker
+++ b/bin/bitbake-worker
@@ -152,8 +152,10 @@ def fork_off_task(cfg, data, databuilder, workerdata, fn, task, taskname, append
except TypeError:
umask = taskdep['umask'][taskname]
+ dry_run = cfg.dry_run or workerdata['dry_run_exec']
+
# We can't use the fakeroot environment in a dry run as it possibly hasn't been built
- if 'fakeroot' in taskdep and taskname in taskdep['fakeroot'] and not cfg.dry_run:
+ if 'fakeroot' in taskdep and taskname in taskdep['fakeroot'] and not dry_run:
envvars = (workerdata["fakerootenv"][fn] or "").split()
for key, value in (var.split('=') for var in envvars):
envbackup[key] = os.environ.get(key)
@@ -260,7 +262,7 @@ def fork_off_task(cfg, data, databuilder, workerdata, fn, task, taskname, append
logger.critical(traceback.format_exc())
os._exit(1)
try:
- if cfg.dry_run:
+ if dry_run:
return 0
return bb.build.exec_task(fn, taskname, the_data, cfg.profile)
except:
diff --git a/lib/bb/runqueue.py b/lib/bb/runqueue.py
index 389df4f..6d786f8 100644
--- a/lib/bb/runqueue.py
+++ b/lib/bb/runqueue.py
@@ -266,6 +266,7 @@ class RunQueueData:
self.multi_provider_whitelist = (cfgData.getVar("MULTI_PROVIDER_WHITELIST") or "").split()
self.setscenewhitelist = get_setscene_enforce_whitelist(cfgData)
self.setscenewhitelist_checked = False
+ self.setscene_enforce = cfgData.getVar('BB_SETSCENE_ENFORCE') or False
self.init_progress_reporter = bb.progress.DummyMultiStageProcessProgressReporter()
self.reset()
@@ -1033,6 +1034,7 @@ class RunQueue:
"buildname" : self.cfgData.getVar("BUILDNAME"),
"date" : self.cfgData.getVar("DATE"),
"time" : self.cfgData.getVar("TIME"),
+ "dry_run_exec" : bool(self.rqdata.setscene_enforce),
}
worker.stdin.write(b"<cookerconfig>" + pickle.dumps(self.cooker.configuration) + b"</cookerconfig>")
@@ -1789,7 +1791,7 @@ class RunQueueExecuteTasks(RunQueueExecute):
bb.event.fire(startevent, self.cfgData)
self.runq_running.add(task)
self.stats.taskActive()
- if not self.cooker.configuration.dry_run:
+ if not (self.cooker.configuration.dry_run or self.rqdata.setscene_enforce):
bb.build.make_stamp(taskname, self.rqdata.dataCaches[mc], taskfn)
self.task_complete(task)
return True
@@ -1800,7 +1802,7 @@ class RunQueueExecuteTasks(RunQueueExecute):
taskdepdata = self.build_taskdepdata(task)
taskdep = self.rqdata.dataCaches[mc].task_deps[taskfn]
- if 'fakeroot' in taskdep and taskname in taskdep['fakeroot'] and not self.cooker.configuration.dry_run:
+ if 'fakeroot' in taskdep and taskname in taskdep['fakeroot'] and not (self.cooker.configuration.dry_run or self.rqdata.setscene_enforce):
if not self.rq.fakeworker:
try:
self.rq.start_fakeworker(self)
--
2.5.5
More information about the bitbake-devel
mailing list