From 719689992cd464cfbea608a7a058b6cb5685cecf Mon Sep 17 00:00:00 2001 From: Thilo Fromm Date: Wed, 12 Jan 2022 15:44:30 +0100 Subject: [PATCH] SDK container: enable binpkg cache for nightly builds Signed-off-by: Thilo Fromm --- build_library/toolchain_util.sh | 9 +++++++-- sdk_lib/sdk_entry.sh | 15 +++++++++++---- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/build_library/toolchain_util.sh b/build_library/toolchain_util.sh index e88981a479..4c77e67991 100644 --- a/build_library/toolchain_util.sh +++ b/build_library/toolchain_util.sh @@ -147,7 +147,7 @@ get_board_binhost() { if [[ "${FLATCAR_BUILD_ID}" =~ ^nightly-.*$ ]] ; then # containerised nightly build; this uses [VERSION]-[BUILD_ID] for binpkg url # and toolchain packages are at the same location as OS image ones - set -- "${FLATCAR_VERSION_ID}-${FLATCAR_BUILD_ID}" + set -- "${FLATCAR_VERSION_ID}+${FLATCAR_BUILD_ID}" pkgs_include_toolchain=1 else set -- "${FLATCAR_VERSION_ID}" @@ -189,7 +189,12 @@ get_sdk_binhost() { set -- "${FLATCAR_SDK_VERSION}" fi - FLATCAR_DEV_BUILDS_SDK="${FLATCAR_DEV_BUILDS_SDK-$FLATCAR_DEV_BUILDS/sdk}" + if [ "${FLATCAR_DEV_BUILDS}" != "${SETTING_BINPKG_SERVER_DEV_CONTAINERISED}" ] ; then + FLATCAR_DEV_BUILDS_SDK="${FLATCAR_DEV_BUILDS_SDK-${FLATCAR_DEV_BUILDS}/sdk}" + else + # ALWAYS use a released SDK version, never a nightly, for SDK binpkgs + FLATCAR_DEV_BUILDS_SDK="${FLATCAR_DEV_BUILDS_SDK-${SETTING_BINPKG_SERVER_PROD}/sdk}" + fi for ver in "$@"; do # Usually only crossdev needs to be fetched from /toolchain/ in the setup_board step. # The entry for /pkgs/ is there if something needs to be reinstalled in the SDK diff --git a/sdk_lib/sdk_entry.sh b/sdk_lib/sdk_entry.sh index b0fae73e6a..e8a4ad4c23 100755 --- a/sdk_lib/sdk_entry.sh +++ b/sdk_lib/sdk_entry.sh @@ -15,24 +15,31 @@ chown -R sdk:sdk /home/sdk ( source /etc/lsb-release # SDK version in DISTRIB_RELEASE source /mnt/host/source/.repo/manifests/version.txt # OS image version in FLATCAR_VERSION_ID + version="${FLATCAR_VERSION_ID}" - if [ "${FLATCAR_VERSION_ID}" != "${DISTRIB_RELEASE}" ] ; then + # If this is a nightly build tag we can use pre-built binaries directly from the + # build cache. + if [[ "${FLATCAR_BUILD_ID}" =~ ^nightly-.*$ ]] ; then + version="${FLATCAR_VERSION_ID}+${FLATCAR_BUILD_ID}" + fi + + if [ "${version}" != "${DISTRIB_RELEASE}" ] ; then for target in amd64-usr arm64-usr; do if [ ! -d "/build/$target" ] ; then continue fi if [ -f "/build/$target/etc/target-version.txt" ] ; then source "/build/$target/etc/target-version.txt" - if [ "${TARGET_FLATCAR_VERSION_ID}" = "${FLATCAR_VERSION_ID}" ] ; then + if [ "${TARGET_FLATCAR_VERSION}" = "${version}" ] ; then continue # already updated fi fi echo - echo "Updating board support in '/build/${target}' to use package cache for version '${FLATCAR_VERSION_ID}'" + echo "Updating board support in '/build/${target}' to use package cache for version '${version}'" echo "---" sudo su sdk -l -c "/home/sdk/trunk/src/scripts/setup_board --board='$target' --regen_configs_only" - echo "TARGET_FLATCAR_VERSION_ID='${FLATCAR_VERSION_ID}'" | sudo tee "/build/$target/etc/target-version.txt" >/dev/null + echo "TARGET_FLATCAR_VERSION='${version}'" | sudo tee "/build/$target/etc/target-version.txt" >/dev/null done fi )