From 58f084291beb3a87d8d9fdb36dfe7eff911fa36b Mon Sep 17 00:00:00 2001 From: Paul Eggleton Date: Fri, 16 Dec 2016 07:09:13 +1300 Subject: runqueue: dry-run real tasks when BB_SETSCENE_ENFORCE is set 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 Signed-off-by: Richard Purdie --- bin/bitbake-worker | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'bin') diff --git a/bin/bitbake-worker b/bin/bitbake-worker index 4dbd68117..5010bada7 100755 --- a/bin/bitbake-worker +++ b/bin/bitbake-worker @@ -136,7 +136,7 @@ def sigterm_handler(signum, frame): os.killpg(0, signal.SIGTERM) sys.exit() -def fork_off_task(cfg, data, databuilder, workerdata, fn, task, taskname, appends, taskdepdata, extraconfigdata, quieterrors=False): +def fork_off_task(cfg, data, databuilder, workerdata, fn, task, taskname, appends, taskdepdata, extraconfigdata, quieterrors=False, dry_run_exec=False): # We need to setup the environment BEFORE the fork, since # a fork() or exec*() activates PSEUDO... @@ -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 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) @@ -263,7 +265,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: @@ -421,10 +423,10 @@ class BitbakeWorker(object): sys.exit(0) def handle_runtask(self, data): - fn, task, taskname, quieterrors, appends, taskdepdata = pickle.loads(data) + fn, task, taskname, quieterrors, appends, taskdepdata, dry_run_exec = pickle.loads(data) workerlog_write("Handling runtask %s %s %s\n" % (task, fn, taskname)) - pid, pipein, pipeout = fork_off_task(self.cookercfg, self.data, self.databuilder, self.workerdata, fn, task, taskname, appends, taskdepdata, self.extraconfigdata, quieterrors) + pid, pipein, pipeout = fork_off_task(self.cookercfg, self.data, self.databuilder, self.workerdata, fn, task, taskname, appends, taskdepdata, self.extraconfigdata, quieterrors, dry_run_exec) self.build_pids[pid] = task self.build_pipes[pid] = runQueueWorkerPipe(pipein, pipeout) -- cgit 1.2.3-korg