@@ -204,6 +204,15 @@ def isar_export_ccache(d):
else:
os.environ['CCACHE_DISABLE'] = '1'
+isar_check_current_task() {
+ if [ "do_${BB_CURRENTTASK}" = "$1" ]; then
+ return 0
+ else
+ echo "skipping because current task is not $1"
+ return 1
+ fi
+}
+
do_fetch[dirs] = "${DL_DIR}"
do_fetch[file-checksums] = "${@bb.fetch.get_checksum_file_list(d)}"
do_fetch[vardeps] += "SRCREV"
@@ -184,6 +184,7 @@ SSTATECREATEFUNCS += "dpkg_build_sstate_prepare"
SSTATEPOSTINSTFUNCS += "dpkg_build_sstate_finalize"
dpkg_build_sstate_prepare() {
+ (isar_check_current_task "do_dpkg_build" || return) || true
# this runs in SSTATE_BUILDDIR, which will be deleted automatically
if [ -n "$(find ${WORKDIR} -maxdepth 1 -name '*.deb' -print -quit)" ]; then
cp -f ${WORKDIR}/*.deb -t .
@@ -191,6 +192,7 @@ dpkg_build_sstate_prepare() {
}
dpkg_build_sstate_finalize() {
+ (isar_check_current_task "do_dpkg_build_setscene" || return) || true
# this runs in SSTATE_INSTDIR
if [ -n "$(find . -maxdepth 1 -name '*.deb' -print -quit)" ]; then
mv -f ./*.deb -t ${WORKDIR}/
@@ -437,6 +437,7 @@ SSTATE_TAR_ATTR_FLAGS ?= "--xattrs --xattrs-include='*'"
# the rootfs is owned by root, so we need some sudoing to pack and unpack
rootfs_install_sstate_prepare() {
+ (isar_check_current_task "do_rootfs_install" || return) || true
# this runs in SSTATE_BUILDDIR, which will be deleted automatically
# tar --one-file-system will cross bind-mounts to the same filesystem,
# so we use some mount magic to prevent that
@@ -450,6 +451,7 @@ rootfs_install_sstate_prepare() {
do_rootfs_install_sstate_prepare[lockfiles] = "${REPO_ISAR_DIR}/isar.lock"
rootfs_install_sstate_finalize() {
+ (isar_check_current_task "do_rootfs_install_setscene" || return) || true
# this runs in SSTATE_INSTDIR
# - after building the rootfs, the tar won't be there, but we also don't need to unpack
# - after restoring from cache, there will be a tar which we unpack and then delete
@@ -219,12 +219,14 @@ SSTATECREATEFUNCS += "bootstrap_sstate_prepare"
SSTATEPOSTINSTFUNCS += "bootstrap_sstate_finalize"
bootstrap_sstate_prepare() {
+ (isar_check_current_task "do_bootstrap" || return) || true
# this runs in SSTATE_BUILDDIR, which will be deleted automatically
sudo cp -a "${WORKDIR}/rootfs.tar.zst" ./bootstrap.tar.zst
sudo chown $(id -u):$(id -g) bootstrap.tar.zst
}
bootstrap_sstate_finalize() {
+ (isar_check_current_task "do_bootstrap_setscene" || return) || true
# this runs in SSTATE_INSTDIR
# we should restore symlinks after using tar
if [ -f bootstrap.tar.zst ]; then
@@ -222,12 +222,14 @@ SSTATECREATEFUNCS += "bootstrap_sstate_prepare"
SSTATEPOSTINSTFUNCS += "bootstrap_sstate_finalize"
bootstrap_sstate_prepare() {
+ (isar_check_current_task "do_bootstrap" || return) || true
# this runs in SSTATE_BUILDDIR, which will be deleted automatically
sudo cp -a "${WORKDIR}/rootfs.tar.zst" ./bootstrap.tar.zst
sudo chown $(id -u):$(id -g) bootstrap.tar.zst
}
bootstrap_sstate_finalize() {
+ (isar_check_current_task "do_bootstrap_setscene" || return) || true
# this runs in SSTATE_INSTDIR
# we should restore symlinks after using tar
if [ -f bootstrap.tar.zst ]; then
We use SSTATECREATEFUNCS and SSTATEPOSTINSTFUNCS to insert code for preparation/postprocessing of sstate artifacts. As it turns out, those are not per-job, but global, so if a recipe has multiple sstate-cacheable tasks, all of those functions are executed, and we need to make sure to bail out of all unintended calls. Because all invocations are visible in the logs, we add a message in case a function was skipped, to make logs more readable. Signed-off-by: Adriaan Schmidt <adriaan.schmidt@siemens.com> --- meta/classes/base.bbclass | 9 +++++++++ meta/classes/dpkg-base.bbclass | 2 ++ meta/classes/rootfs.bbclass | 2 ++ meta/recipes-core/isar-bootstrap/isar-bootstrap.inc | 2 ++ meta/recipes-core/isar-mmdebstrap/isar-mmdebstrap.inc | 2 ++ 5 files changed, 17 insertions(+)