Files
poky/meta/classes/rm_work.bbclass
Chen Qi 83409910dd rm_work.bbclass: inhibit rm_work per recipe
Use RM_WORK_WHITELIST to inhibit rm_work per recipe. In this way,
one can use rm_work for the most of the recipes but still keep the
work area for the recipe(s) one is working on.

As an example, the following settings in local.conf will inhibit
rm_work for icu-native, icu and busybox.
    INHERIT += "rm_work"
    RM_WORK_WHITELIST += "icu-native icu busybox"

If we comment out the RM_WORK_WHITELIST line and do a rebuild, the
working area of these recipes will be cleaned up.

[YOCTO #3675]

(From OE-Core rev: 6c930c3c06f2e698540626c87bd7f7f571df35ef)

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-03-18 13:18:21 +00:00

97 lines
2.6 KiB
Plaintext

#
# Removes source after build
#
# To use it add that line to conf/local.conf:
#
# INHERIT += "rm_work"
#
# To inhibit rm_work for some recipes, specify them in RM_WORK_WHITELIST.
# For example, in conf/local.conf:
#
# RM_WORK_WHITELIST += "icu-native icu busybox"
#
# Use the completion scheduler by default when rm_work is active
# to try and reduce disk usage
BB_SCHEDULER ?= "completion"
RMWORK_ORIG_TASK := "${BB_DEFAULT_TASK}"
BB_DEFAULT_TASK = "rm_work_all"
do_rm_work () {
# If the recipe name is in the RM_WORK_WHITELIST, skip the recipe.
for p in ${RM_WORK_WHITELIST}; do
if [ "$p" = "${PN}" ]; then
bbnote "rm_work: Skipping ${PN} since it is in RM_WORK_WHITELIST"
exit 0
fi
done
cd ${WORKDIR}
for dir in *
do
# Retain only logs and other files in temp.
if [ $dir != 'temp' ]; then
rm -rf $dir
fi
done
# Need to add pseudo back or subsqeuent work in this workdir
# might fail since setscene may not rerun to recreate it
mkdir ${WORKDIR}/pseudo/
# Change normal stamps into setscene stamps as they better reflect the
# fact WORKDIR is now empty
# Also leave noexec stamps since setscene stamps don't cover them
cd `dirname ${STAMP}`
for i in `basename ${STAMP}`*
do
for j in ${SSTATETASKS}
do
case $i in
*do_setscene*)
break
;;
*sigdata*)
i=dummy
break
;;
*do_package_write*)
i=dummy
break
;;
*do_build*)
i=dummy
break
;;
# We remove do_package entirely, including any
# sstate version since otherwise we'd need to leave 'plaindirs' around
# such as 'packages' and 'packages-split' and these can be large. No end
# of chain tasks depend directly on do_package anymore.
*do_package|*do_package.*|*do_package_setscene.*)
rm -f $i;
i=dummy
break
;;
*_setscene*)
i=dummy
break
;;
*$j|*$j.*)
mv $i `echo $i | sed -e "s#${j}#${j}_setscene#"`
i=dummy
break
;;
esac
done
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