summaryrefslogtreecommitdiff
path: root/meta
diff options
context:
space:
mode:
Diffstat (limited to 'meta')
-rw-r--r--meta/classes/rm_work.bbclass31
1 files changed, 20 insertions, 11 deletions
diff --git a/meta/classes/rm_work.bbclass b/meta/classes/rm_work.bbclass
index 9b7220fc2b..054c93716e 100644
--- a/meta/classes/rm_work.bbclass
+++ b/meta/classes/rm_work.bbclass
@@ -26,9 +26,6 @@ BB_SCHEDULER ?= "completion"
# Run the rm_work task in the idle scheduling class
BB_TASK_IONICE_LEVEL_task-rm_work = "3.0"
-RMWORK_ORIG_TASK := "${BB_DEFAULT_TASK}"
-BB_DEFAULT_TASK = "rm_work_all"
-
do_rm_work () {
# If the recipe name is in the RM_WORK_EXCLUDE, skip the recipe.
for p in ${RM_WORK_EXCLUDE}; do
@@ -105,13 +102,6 @@ do_rm_work () {
rm -f $i
done
}
-addtask rm_work after do_${RMWORK_ORIG_TASK}
-
-do_rm_work_all () {
- :
-}
-do_rm_work_all[recrdeptask] = "do_rm_work"
-addtask rm_work_all after do_rm_work
do_populate_sdk[postfuncs] += "rm_work_populatesdk"
rm_work_populatesdk () {
@@ -125,7 +115,13 @@ rm_work_rootfs () {
}
rm_work_rootfs[cleandirs] = "${WORKDIR}/rootfs"
-python () {
+# We have to add the do_rmwork task already now, because all tasks are
+# meant to be defined before the RecipeTaskPreProcess event triggers.
+# The inject_rm_work event handler then merely changes task dependencies.
+addtask do_rm_work
+addhandler inject_rm_work
+inject_rm_work[eventmask] = "bb.event.RecipeTaskPreProcess"
+python inject_rm_work() {
if bb.data.inherits_class('kernel', d):
d.appendVar("RM_WORK_EXCLUDE", ' ' + d.getVar("PN"))
# If the recipe name is in the RM_WORK_EXCLUDE, skip the recipe.
@@ -134,4 +130,17 @@ python () {
if pn in excludes:
d.delVarFlag('rm_work_rootfs', 'cleandirs')
d.delVarFlag('rm_work_populatesdk', 'cleandirs')
+ else:
+ # Inject do_rm_work into the tasks of the current recipe such that do_build
+ # depends on it and that it runs after all other tasks that block do_build,
+ # i.e. after all work on the current recipe is done. The reason for taking
+ # this approach instead of making do_rm_work depend on do_build is that
+ # do_build inherits additional runtime dependencies on
+ # other recipes and thus will typically run much later than completion of
+ # work in the recipe itself.
+ deps = bb.build.preceedtask('do_build', True, d)
+ if 'do_build' in deps:
+ deps.remove('do_build')
+ # In practice, addtask() here merely updates the dependencies.
+ bb.build.addtask('do_rm_work', 'do_build', ' '.join(deps), d)
}