]> code.ossystems Code Review - openembedded-core.git/commitdiff
rm_work.bbclass: allow preserving additional content
authorPatrick Ohly <patrick.ohly@intel.com>
Fri, 13 Jan 2017 14:23:56 +0000 (15:23 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 19 Jan 2017 22:45:54 +0000 (22:45 +0000)
By default, do_rm_work either skips recipes entirely (when listed in
RM_WORK_EXCLUDE) or removes everything except for temp.

In meta-swupd, virtual image recipes collaborate on producing update
data for the base recipe. Tasks running in the base recipe need some
information from the virtual images.

Those files could be passed via a new shared work directory, but that
scatters data in even more places. It's simpler to use the normal
WORKDIR and teach rm_work.bbclass to not remove the special output
with the new RM_WORK_EXCLUDE_ITEMS.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
meta/classes/rm_work.bbclass

index 3516c7edf8ae7b137b1b2ac13c3933374c4b5500..9b7220fc2b8ed37467a10eab1b7a17e5701d0f69 100644 (file)
 #
 # RM_WORK_EXCLUDE += "icu-native icu busybox"
 #
+# Recipes can also configure which entries in their ${WORKDIR}
+# are preserved besides temp, which already gets excluded by default
+# because it contains logs:
+# do_install_append () {
+#     echo "bar" >${WORKDIR}/foo
+# }
+# RM_WORK_EXCLUDE_ITEMS += "foo"
+RM_WORK_EXCLUDE_ITEMS = "temp"
 
 # Use the completion scheduler by default when rm_work is active
 # to try and reduce disk usage
@@ -37,7 +45,7 @@ do_rm_work () {
         # failures of removing pseudo folers on NFS2/3 server.
         if [ $dir = 'pseudo' ]; then
             rm -rf $dir 2> /dev/null || true
-        elif [ $dir != 'temp' ]; then
+        elif ! echo '${RM_WORK_EXCLUDE_ITEMS}' | grep -q -w "$dir"; then
             rm -rf $dir
         fi
     done