diff options
author | Patrick Williams <patrick@stwcx.xyz> | 2016-08-17 14:31:25 -0500 |
---|---|---|
committer | Patrick Williams <patrick@stwcx.xyz> | 2016-08-22 16:43:26 +0000 |
commit | 60f9d69e016b11c468c98ea75ba0a60c44afbbc4 (patch) | |
tree | ecb49581a9e41a37943c22cd9ef3f63451b20ee7 /import-layers/yocto-poky/meta/classes/rm_work.bbclass | |
parent | e18c61205e0234b03697129c20cc69c9b3940efc (diff) | |
download | blackbird-openbmc-60f9d69e016b11c468c98ea75ba0a60c44afbbc4.tar.gz blackbird-openbmc-60f9d69e016b11c468c98ea75ba0a60c44afbbc4.zip |
yocto-poky: Move to import-layers subdir
We are going to import additional layers, so create a subdir to
hold all of the layers that we import with git-subtree.
Change-Id: I6f732153a22be8ca663035c518837e3cc5ec0799
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Diffstat (limited to 'import-layers/yocto-poky/meta/classes/rm_work.bbclass')
-rw-r--r-- | import-layers/yocto-poky/meta/classes/rm_work.bbclass | 128 |
1 files changed, 128 insertions, 0 deletions
diff --git a/import-layers/yocto-poky/meta/classes/rm_work.bbclass b/import-layers/yocto-poky/meta/classes/rm_work.bbclass new file mode 100644 index 000000000..c647d88d2 --- /dev/null +++ b/import-layers/yocto-poky/meta/classes/rm_work.bbclass @@ -0,0 +1,128 @@ +# +# 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_EXCLUDE. +# For example, in conf/local.conf: +# +# RM_WORK_EXCLUDE += "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_EXCLUDE, skip the recipe. + for p in ${RM_WORK_EXCLUDE}; do + if [ "$p" = "${PN}" ]; then + bbnote "rm_work: Skipping ${PN} since it is in RM_WORK_EXCLUDE" + exit 0 + fi + done + + cd ${WORKDIR} + for dir in * + do + # Retain only logs and other files in temp, safely ignore + # failures of removing pseudo folers on NFS2/3 server. + if [ $dir = 'pseudo' ]; then + rm -rf $dir 2> /dev/null || true + 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 -p ${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_shared_workdir + do + case $i in + *do_setscene*) + break + ;; + *sigdata*) + i=dummy + break + ;; + *do_package_write*) + i=dummy + break + ;; + *do_rootfs*) + i=dummy + break + ;; + *do_image*) + 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 + +do_populate_sdk[postfuncs] += "rm_work_populatesdk" +rm_work_populatesdk () { + : +} +rm_work_populatesdk[cleandirs] = "${WORKDIR}/sdk" + +do_image_complete[postfuncs] += "rm_work_rootfs" +rm_work_rootfs () { + : +} +rm_work_rootfs[cleandirs] = "${WORKDIR}/rootfs" + +python () { + # If the recipe name is in the RM_WORK_EXCLUDE, skip the recipe. + excludes = (d.getVar("RM_WORK_EXCLUDE", True) or "").split() + pn = d.getVar("PN", True) + if pn in excludes: + d.delVarFlag('rm_work_rootfs', 'cleandirs') + d.delVarFlag('rm_work_populatesdk', 'cleandirs') +} |