From 04d9ee0211e7cf2d5f637941ff6579b4f5462da6 Mon Sep 17 00:00:00 2001 From: Lyndon Brown Date: Thu, 12 Mar 2020 01:21:39 +0000 Subject: stagefiles: simplify & robustify - avoid all need to pass ".build/" path in stage file names into the functions - add a helper to remove a stage file (required to complete the above properly) - avoid duplicating filenames within scripts which makes them prone to mistakes (some instances of which I've actually encountered and had to fix) Gbp-Dch: Short --- scripts/build/chroot_cache | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'scripts/build/chroot_cache') diff --git a/scripts/build/chroot_cache b/scripts/build/chroot_cache index d58ffea1f..3c9134472 100755 --- a/scripts/build/chroot_cache +++ b/scripts/build/chroot_cache @@ -26,12 +26,15 @@ then exit 0 fi +STAGE_FILE="chroot_cache" + case "${1}" in restore) Echo_message "Restoring chroot stage from cache..." # Checking stage file - Check_stagefile .build/chroot_cache.restore + STAGE_FILE="${STAGE_FILE}.restore" + Check_stagefile "${STAGE_FILE}" if [ -d cache/chroot ] then @@ -45,7 +48,7 @@ case "${1}" in cp -a cache/chroot chroot # Creating stage file - Create_stagefile .build/chroot_cache.restore + Create_stagefile "${STAGE_FILE}" exit 0 fi @@ -55,7 +58,8 @@ case "${1}" in Echo_message "Saving chroot stage to cache..." # Checking stage file - Check_stagefile .build/chroot_cache.save + STAGE_FILE="${STAGE_FILE}.save" + Check_stagefile "${STAGE_FILE}" # Acquire lock file Acquire_lockfile @@ -67,6 +71,6 @@ case "${1}" in cp -a chroot cache/chroot # Creating stage file - Create_stagefile .build/chroot_cache.save + Create_stagefile "${STAGE_FILE}" ;; esac -- cgit v1.2.3