generic-poky/meta/classes/rm_work.bbclass
Richard Purdie e8e9f56057 rm_work.bbclass: Update to convert stamps to setscene stamps
We need to manipulate the stamps when removing WORKDIR to indicte that
tasks like compile or install can't just rerun. The most effective method
to do this is to convert the layout to match that which would have been the
case had the system been build from sstate packages.

For example, we'd task stamps like:

xxx-1.4.7-r3.do_compile
xxx-1.4.7-r3.do_configure
xxx-1.4.7-r3.do_fetch
xxx-1.4.7-r3.do_generate_toolchain_file
xxx-1.4.7-r3.do_install
xxx-1.4.7-r3.do_package.emenlow
xxx-1.4.7-r3.do_package_write
xxx-1.4.7-r3.do_package_write_ipk
xxx-1.4.7-r3.do_package_write_rpm
xxx-1.4.7-r3.do_patch
xxx-1.4.7-r3.do_populate_sysroot.emenlow
xxx-1.4.7-r3.do_setscene
xxx-1.4.7-r3.do_unpack

and after rm_work, we'd have stamps of:

xxx-1.4.7-r3.do_package_setscene.emenlow
xxx-1.4.7-r3.do_package_write_ipk_setscene
xxx-1.4.7-r3.do_package_write_rpm_setscene
xxx-1.4.7-r3.do_populate_sysroot_setscene.emenlow

We also need to handle stamps in the form xxx-1.4.7-r3.do_package.MACHINE.TASKHASH
as used by some signature generators.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-01-27 11:10:57 +00:00

62 lines
1.4 KiB
Text

#
# Removes source after build
#
# To use it add that line to conf/local.conf:
#
# INHERIT += "rm_work"
#
# Use the completion scheulder 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 () {
cd ${WORKDIR}
for dir in *
do
if [ `basename ${S}` = $dir ]; then
rm -rf $dir
elif [ $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
cd `dirname ${STAMP}`
for i in `basename ${STAMP}`*
do
for j in ${SSTATETASKS}
do
case $i in
*do_setscene*)
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