Add support for build epoch counter. This allows us to bump the number

anytime we want to force downstream builders to perform a full rebuild
and invalidate any local incremental cache.
This commit is contained in:
Kris Moore
2021-01-29 13:04:14 -05:00
parent c519959e23
commit d7361fa134
3 changed files with 18 additions and 2 deletions

1
.gitignore vendored
View File

@@ -2,3 +2,4 @@
/logs/
/sources/
/tmp/
/.buildEpoch

View File

@@ -94,6 +94,7 @@
"libgdk-pixbuf2.0-0",
"x11-common"
],
"build-epoch":1,
"additional-packages": [
{
"package": "xtail",

View File

@@ -821,14 +821,28 @@ build_update_image() {
echo "`date`: Success! Update image created at: ${RELEASE_DIR}/TrueNAS-SCALE.update"
}
check_epoch() {
local epoch=$(jq -r '."build-epoch"' $MANIFEST)
if [ -e ".buildEpoch" ] ; then
if [ "$(cat .buildEpoch)" != "$epoch" ] ; then
echo "Build epoch changed! Removing temporary files and forcing clean build."
cleanup
echo "$epoch" > .buildEpoch
fi
else
echo "$epoch" > .buildEpoch
fi
}
# Check that host has all the prereq tools installed
preflight_check
case $1 in
checkout) checkout_sources ;;
checkout) check_epoch ; checkout_sources ;;
clean) cleanup ;;
iso) build_iso ;;
packages) build_deb_packages ;;
packages) check_epoch ; build_deb_packages ;;
update) build_update_image ;;
*) exit_err "Invalid build option!" ;;
esac