runqueue: Ensure pseudo executes from the correct place (use the right datastore with multiconfig)
PATCH 1/7 runqueue: Ensure pseudo executes from the correct place (use the right datastore with multiconfig)
The location of the fakeroot command and the various environmental values need to be taken from the right multiconfig datastore, not the shared one. This patch ensures the right one is used for cases like a split TMPDIR.
[YOCTO #10344]
--- lib/bb/runqueue.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
lib/bb/runqueue.py +3 -2
@@ -1004,8 +1004,9 @@ class RunQueue: magic = "decafbadbad" if fakeroot: magic = magic + "beef" - fakerootcmd = self.cfgData.getVar("FAKEROOTCMD") - fakerootenv = (self.cfgData.getVar("FAKEROOTBASEENV") or "").split() + mcdata = self.cooker.databuilder.mcdata[mc] + fakerootcmd = mcdata.getVar("FAKEROOTCMD") + fakerootenv = (mcdata.getVar("FAKEROOTBASEENV") or "").split() env = os.environ.copy() for key, value in (var.split('=') for var in fakerootenv): env[key] = value
Signature · 1 line
2.7.4
PATCH 2/7 build/uihelper: Show better information about multiconfig tasks on UI
Currently the UI shows X is building, possibly multiple times but doesn't say which of the multilibs that might be. This adds a prefix to the task name so the mulitconfig being built can be identified.
--- lib/bb/build.py | 1 + lib/bb/ui/uihelper.py | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-)
lib/bb/build.py +1 -0
@@ -92,6 +92,7 @@ class TaskBase(event.Event): def __init__(self, t, logfile, d): self._task = t self._package = d.getVar("PF") + self._mc = d.getVar("BB_CURRENT_MC") self.taskfile = d.getVar("FILE") self.taskname = self._task self.logfile = logfile
lib/bb/ui/uihelper.py +4 -1
@@ -32,7 +32,10 @@ class BBUIHelper: def eventHandler(self, event): if isinstance(event, bb.build.TaskStarted): - self.running_tasks[event.pid] = { 'title' : "%s %s" % (event._package, event._task), 'starttime' : time.time() } + if event._mc != "default": + self.running_tasks[event.pid] = { 'title' : "mc:%s:%s %s" % (event._mc, event._package, event._task), 'starttime' : time.time() } + else: + self.running_tasks[event.pid] = { 'title' : "%s %s" % (event._package, event._task), 'starttime' : time.time() } self.running_pids.append(event.pid) self.needUpdate = True elif isinstance(event, bb.build.TaskSucceeded):
Signature · 1 line
2.7.4
PATCH 3/7 siggen: Fix clean_basepath to work with multiconfig
In reply to Richard PurdieTasknames can now start with "multiconfig:" which broke the virtual: comparison code and lead to unpredictable checksums with nativesdk recipes. This adds in handling for the new additional prefix which unbreaks nativesdk builds when using multiconfig.
--- lib/bb/siggen.py | 5 +++++ 1 file changed, 5 insertions(+)
lib/bb/siggen.py +5 -0
@@ -352,9 +352,14 @@ def dump_this_task(outfile, d): bb.parse.siggen.dump_sigtask(fn, task, outfile, "customfile:" + referencestamp) def clean_basepath(a): + mc = None + if a.startswith("multiconfig:"): + _, mc, a = a.split(":", 2) b = a.rsplit("/", 2)[1] + a.rsplit("/", 2)[2] if a.startswith("virtual:"): b = b + ":" + a.rsplit(":", 1)[0] + if mc: + b = b + ":multiconfig:" + mc return b def clean_basepaths(a):
Signature · 1 line
2.7.4
PATCH 4/7 runqueue: Fix setscene issues with multiconfig
In reply to Richard Purdiesetscene was being entirelu skipped for multiconfig variants as the tasks were simply not being spotted. If the default config was also being built it masked the problem. When this was fixed by using taskfn instead of fn in lookups against dataCache, several other instances of this problem were highlighted.
This goes through and corrects the setscene code to correclty use taskfn instead of fn in the appropriate places meaning setscene tasks for multiconfig now work correctly.
--- lib/bb/runqueue.py | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-)
lib/bb/runqueue.py +20 -20
@@ -290,8 +290,8 @@ class RunQueueData: return tid + task_name_suffix def get_short_user_idstring(self, task, task_name_suffix = ""): - (mc, fn, taskname, _) = split_tid_mcfn(task) - pn = self.dataCaches[mc].pkg_fn[fn] + (mc, fn, taskname, taskfn) = split_tid_mcfn(task) + pn = self.dataCaches[mc].pkg_fn[taskfn] taskname = taskname_from_tid(task) + task_name_suffix return "%s:%s" % (pn, taskname)
@@ -885,14 +885,14 @@ class RunQueueData: if not self.cooker.configuration.nosetscene: for tid in self.runtaskentries: (mc, fn, taskname, _) = split_tid_mcfn(tid) - setscenetid = fn + ":" + taskname + "_setscene" + setscenetid = tid + "_setscene" if setscenetid not in taskData[mc].taskentries: continue self.runq_setscene_tids.append(tid) def invalidate_task(tid, error_nostamp): - (mc, fn, taskname, _) = split_tid_mcfn(tid) - taskdep = self.dataCaches[mc].task_deps[fn] + (mc, fn, taskname, taskfn) = split_tid_mcfn(tid) + taskdep = self.dataCaches[mc].task_deps[taskfn] if fn + ":" + taskname not in taskData[mc].taskentries: logger.warning("Task %s does not exist, invalidating this task will have no effect" % taskname) if 'nostamp' in taskdep and taskname in taskdep['nostamp']:
@@ -1339,7 +1339,7 @@ class RunQueue: continue sq_fn.append(fn) - sq_hashfn.append(self.rqdata.dataCaches[mc].hashfn[fn]) + sq_hashfn.append(self.rqdata.dataCaches[mc].hashfn[taskfn]) sq_hash.append(self.rqdata.runtaskentries[tid].hash) sq_taskname.append(taskname) sq_task.append(tid)
@@ -1419,8 +1419,8 @@ class RunQueue: for tid in invalidtasks: - (mc, fn, taskname, _) = split_tid_mcfn(tid) - pn = self.rqdata.dataCaches[mc].pkg_fn[fn] + (mc, fn, taskname, taskfn) = split_tid_mcfn(tid) + pn = self.rqdata.dataCaches[mc].pkg_fn[taskfn] h = self.rqdata.runtaskentries[tid].hash matches = bb.siggen.find_siginfo(pn, taskname, [], self.cfgData) match = None
@@ -1523,8 +1523,8 @@ class RunQueueExecute: taskdata = {} taskdeps.add(task) for dep in taskdeps: - (mc, fn, taskname, _) = split_tid_mcfn(dep) - pn = self.rqdata.dataCaches[mc].pkg_fn[fn] + (mc, fn, taskname, taskfn) = split_tid_mcfn(dep) + pn = self.rqdata.dataCaches[mc].pkg_fn[taskfn] taskdata[dep] = [pn, taskname, fn] call = self.rq.depvalidate + "(task, taskdata, notneeded, d)" locs = { "task" : task, "taskdata" : taskdata, "notneeded" : self.scenequeue_notneeded, "d" : self.cooker.data }
@@ -1724,7 +1724,7 @@ class RunQueueExecuteTasks(RunQueueExecute): # Check tasks that are going to run against the whitelist def check_norun_task(tid, showerror=False): - (mc, fn, taskname, _) = split_tid_mcfn(tid) + (mc, fn, taskname, taskfn) = split_tid_mcfn(tid) # Ignore covered tasks if tid in self.rq.scenequeue_covered: return False
@@ -1732,11 +1732,11 @@ class RunQueueExecuteTasks(RunQueueExecute): if self.rq.check_stamp_task(tid, taskname, cache=self.stampcache): return False # Ignore noexec tasks - taskdep = self.rqdata.dataCaches[mc].task_deps[fn] + taskdep = self.rqdata.dataCaches[mc].task_deps[taskfn] if 'noexec' in taskdep and taskname in taskdep['noexec']: return False - pn = self.rqdata.dataCaches[mc].pkg_fn[fn] + pn = self.rqdata.dataCaches[mc].pkg_fn[taskfn] if not check_setscene_enforce_whitelist(pn, taskname, self.rqdata.setscenewhitelist): if showerror: if tid in self.rqdata.runq_setscene_tids:
@@ -1996,8 +1996,8 @@ class RunQueueExecuteScenequeue(RunQueueExecute): # e.g. do_sometask_setscene[depends] = "targetname:do_someothertask_setscene" # Note that anything explicitly depended upon will have its reverse dependencies removed to avoid circular dependencies for tid in self.rqdata.runq_setscene_tids: - (mc, fn, taskname, _) = split_tid_mcfn(tid) - realtid = fn + ":" + taskname + "_setscene" + (mc, fn, taskname, taskfn) = split_tid_mcfn(tid) + realtid = tid + "_setscene" idepends = self.rqdata.taskData[mc].taskentries[realtid].idepends for (depname, idependtask) in idepends:
@@ -2062,7 +2062,7 @@ class RunQueueExecuteScenequeue(RunQueueExecute): for tid in self.sq_revdeps: (mc, fn, taskname, taskfn) = split_tid_mcfn(tid) - taskdep = self.rqdata.dataCaches[mc].task_deps[fn] + taskdep = self.rqdata.dataCaches[mc].task_deps[taskfn] if 'noexec' in taskdep and taskname in taskdep['noexec']: noexec.append(tid)
@@ -2083,7 +2083,7 @@ class RunQueueExecuteScenequeue(RunQueueExecute): continue sq_fn.append(fn) - sq_hashfn.append(self.rqdata.dataCaches[mc].hashfn[fn]) + sq_hashfn.append(self.rqdata.dataCaches[mc].hashfn[taskfn]) sq_hash.append(self.rqdata.runtaskentries[tid].hash) sq_taskname.append(taskname) sq_task.append(tid)
@@ -2131,8 +2131,8 @@ class RunQueueExecuteScenequeue(RunQueueExecute): def check_taskfail(self, task): if self.rqdata.setscenewhitelist: realtask = task.split('_setscene')[0] - (mc, fn, taskname, _) = split_tid_mcfn(realtask) - pn = self.rqdata.dataCaches[mc].pkg_fn[fn] + (mc, fn, taskname, taskfn) = split_tid_mcfn(realtask) + pn = self.rqdata.dataCaches[mc].pkg_fn[taskfn] if not check_setscene_enforce_whitelist(pn, taskname, self.rqdata.setscenewhitelist): logger.error('Task %s.%s failed' % (pn, taskname + "_setscene")) self.rq.state = runQueueCleanUp
@@ -2262,7 +2262,7 @@ class RunQueueExecuteScenequeue(RunQueueExecute): def getsetscenedeps(tid): deps = set() (mc, fn, taskname, _) = split_tid_mcfn(tid) - realtid = fn + ":" + taskname + "_setscene" + realtid = tid + "_setscene" idepends = self.rqdata.taskData[mc].taskentries[realtid].idepends for (depname, idependtask) in idepends: if depname not in self.rqdata.taskData[mc].build_targets:
Signature · 1 line
2.7.4
PATCH 5/7 runqueue: Ensure setscene tasks with overlapping stamps don't parallel execute
In reply to Richard PurdieIn multiconfig, mutliple tasks can execute which share the same stamp file. These must not execute in parallel, the idea is the first should execute, the subsequent ones should see a valid stamp and get skipped.
The normal task execution code has stamps code to handle this, this adds similar code to the setscene execute() function to handle the issue there too.
--- lib/bb/runqueue.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
lib/bb/runqueue.py +5 -1
@@ -1886,6 +1886,7 @@ class RunQueueExecuteScenequeue(RunQueueExecute): sq_revdeps_new = {} sq_revdeps_squash = {} self.sq_harddeps = {} + self.stamps = {} # We need to construct a dependency graph for the setscene functions. Intermediate # dependencies between the setscene tasks only complicate the code. This code
@@ -1999,6 +2000,7 @@ class RunQueueExecuteScenequeue(RunQueueExecute): (mc, fn, taskname, taskfn) = split_tid_mcfn(tid) realtid = tid + "_setscene" idepends = self.rqdata.taskData[mc].taskentries[realtid].idepends + self.stamps[tid] = bb.build.stampfile(taskname + "_setscene", self.rqdata.dataCaches[mc], taskfn, noextra=True) for (depname, idependtask) in idepends: if depname not in self.rqdata.taskData[mc].build_targets:
@@ -2175,7 +2177,7 @@ class RunQueueExecuteScenequeue(RunQueueExecute): if self.stats.active < self.number_tasks: # Find the next setscene to run for nexttask in self.rqdata.runq_setscene_tids: - if nexttask in self.runq_buildable and nexttask not in self.runq_running: + if nexttask in self.runq_buildable and nexttask not in self.runq_running and self.stamps[nexttask] not in self.build_stamps.values(): if nexttask in self.unskippable: logger.debug(2, "Setscene task %s is unskippable" % nexttask) if nexttask not in self.unskippable and len(self.sq_revdeps[nexttask]) > 0 and self.sq_revdeps[nexttask].issubset(self.scenequeue_covered) and self.check_dependencies(nexttask, self.sq_revdeps[nexttask], True):
@@ -2227,6 +2229,8 @@ class RunQueueExecuteScenequeue(RunQueueExecute): self.rq.worker[mc].process.stdin.write(b"<runtask>" + pickle.dumps((taskfn, task, taskname, True, self.cooker.collection.get_file_appends(taskfn), taskdepdata, False)) + b"</runtask>") self.rq.worker[mc].process.stdin.flush() + self.build_stamps[task] = bb.build.stampfile(taskname, self.rqdata.dataCaches[mc], taskfn, noextra=True) + self.build_stamps2.append(self.build_stamps[task]) self.runq_running.add(task) self.stats.taskActive() if self.stats.active < self.number_tasks:
Signature · 1 line
2.7.4
PATCH 6/7 runqueue: Only start fakeroot workers when needed
In reply to Richard PurdieFakeroot workers usually have dependencies that need to be ready before they can be started. Starting them as a block therefore doesn't work as the dependencies may or may not have been built. Therefore start the multiconfig fakeworkers individually upon demand.
[YOCTO #10344]
--- lib/bb/runqueue.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)
lib/bb/runqueue.py +7 -8
@@ -1068,10 +1068,9 @@ class RunQueue: for mc in self.rqdata.dataCaches: self.worker[mc] = self._start_worker(mc) - def start_fakeworker(self, rqexec): - if not self.fakeworker: - for mc in self.rqdata.dataCaches: - self.fakeworker[mc] = self._start_worker(mc, True, rqexec) + def start_fakeworker(self, rqexec, mc): + if not mc in self.fakeworker: + self.fakeworker[mc] = self._start_worker(mc, True, rqexec) def teardown_workers(self): self.teardown = True
@@ -1804,9 +1803,9 @@ class RunQueueExecuteTasks(RunQueueExecute): taskdep = self.rqdata.dataCaches[mc].task_deps[taskfn] 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: + if not mc in self.rq.fakeworker: try: - self.rq.start_fakeworker(self) + self.rq.start_fakeworker(self, mc) except OSError as exc: logger.critical("Failed to spawn fakeroot worker to run %s: %s" % (task, str(exc))) self.rq.state = runQueueFailed
@@ -2221,8 +2220,8 @@ class RunQueueExecuteScenequeue(RunQueueExecute): 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 not self.rq.fakeworker: - self.rq.start_fakeworker(self) + if not mc in self.rq.fakeworker: + self.rq.start_fakeworker(self, mc) self.rq.fakeworker[mc].process.stdin.write(b"<runtask>" + pickle.dumps((taskfn, task, taskname, True, self.cooker.collection.get_file_appends(taskfn), taskdepdata, False)) + b"</runtask>") self.rq.fakeworker[mc].process.stdin.flush() else:
Signature · 1 line
2.7.4
PATCH 7/7 cookerdata: Convert multiconfig to use BB_CURRENT_MC
In reply to Richard PurdiePeople are struggling with multiconfig as the point the conf file is injected into the data store is not what people expect. We can't really use a post config since that is too late and we can't really use a pre config file since that is too early. In OE terms, we need something right around the local.conf point so it behaves in a similar way.
A way to handle this is to set the new variable BB_CURRENT_MC to be the currently selected multiconfig, then the metadata itself can choose when to inject the approriate configuration.
--- lib/bb/cookerdata.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
lib/bb/cookerdata.py +3 -2
@@ -289,7 +289,7 @@ class CookerDataBuilder(object): multiconfig = (self.data.getVar("BBMULTICONFIG") or "").split() for config in multiconfig: - mcdata = self.parseConfigurationFiles(['conf/multiconfig/%s.conf' % config] + self.prefiles, self.postfiles) + mcdata = self.parseConfigurationFiles(self.prefiles, self.postfiles, config) bb.event.fire(bb.event.ConfigParsed(), mcdata) self.mcdata[config] = mcdata
@@ -305,8 +305,9 @@ class CookerDataBuilder(object): def _findLayerConf(self, data): return findConfigFile("bblayers.conf", data) - def parseConfigurationFiles(self, prefiles, postfiles): + def parseConfigurationFiles(self, prefiles, postfiles, mc = "default"): data = bb.data.createCopy(self.basedata) + data.setVar("BB_CURRENT_MC", mc) # Parse files for loading *before* bitbake.conf and any includes for f in prefiles:
Signature · 1 line
2.7.4