From 75972cd9917684f74f7a12bbdfa62f88833a7dde Mon Sep 17 00:00:00 2001 From: Michael Marineau Date: Sat, 23 Nov 2013 20:32:55 -0800 Subject: [PATCH] fix(catalyst): Always use the current SDK tarball as seed. Right now there is some funky logic to either use a previous build as a seed or the current SDK tarball if it happens to have been downloaded. This is a bit confusing and doesn't work reliably since it is reasonable for there to be neither a previous build or the current SDK available if the SDK chroot was created some time ago. Fix this by using the new SDK library and always use the latest SDK, downloading it if needed. --- bootstrap_sdk | 2 -- build_container | 3 --- build_library/build_image_util.sh | 2 ++ build_library/catalyst.sh | 43 +++++-------------------------- build_toolchains | 3 --- 5 files changed, 8 insertions(+), 45 deletions(-) diff --git a/bootstrap_sdk b/bootstrap_sdk index 197ad47105..d9e36d6ac4 100755 --- a/bootstrap_sdk +++ b/bootstrap_sdk @@ -34,8 +34,6 @@ SCRIPT_ROOT=$(dirname $(readlink -f "$0")) . "${SCRIPT_ROOT}/common.sh" || exit 1 TYPE="coreos-sdk" -ARCH=$(portageq envvar ARCH) -DEFAULT_PROFILE="coreos:default/linux/${ARCH}/10.0" . "${BUILD_LIBRARY_DIR}/catalyst.sh" || exit 1 diff --git a/build_container b/build_container index 9f76ae86af..afb5a23c56 100755 --- a/build_container +++ b/build_container @@ -8,9 +8,6 @@ SCRIPT_ROOT=$(dirname $(readlink -f "$0")) . "${SCRIPT_ROOT}/common.sh" || exit 1 TYPE="coreos-buildbot" -ARCH=$(portageq envvar ARCH) -DEFAULT_SEED="builds/coreos-sdk/stage4-${ARCH}-latest.tar.bz2" -DEFAULT_PROFILE="coreos:default/linux/${ARCH}/10.0" FORCE_STAGES="stage4" . "${BUILD_LIBRARY_DIR}/catalyst.sh" || exit 1 diff --git a/build_library/build_image_util.sh b/build_library/build_image_util.sh index 9885a08e01..eb84a2e05d 100755 --- a/build_library/build_image_util.sh +++ b/build_library/build_image_util.sh @@ -131,6 +131,8 @@ generate_au_zip () { local largs="-o ${BUILD_DIR}" test ! -d "${BUILD_DIR}" && mkdir -p "${BUILD_DIR}" info "Running ${lgenerateauzip} ${largs} for generating AU updater zip file" + # Make sure some vars this script needs are exported + export REPO_MANIFESTS_DIR SCRIPTS_DIR $lgenerateauzip $largs } diff --git a/build_library/catalyst.sh b/build_library/catalyst.sh index 600a9eff26..2a6ab7fb1c 100644 --- a/build_library/catalyst.sh +++ b/build_library/catalyst.sh @@ -5,20 +5,17 @@ # common.sh should be sourced first [[ -n "${DEFAULT_BUILD_ROOT}" ]] || exit 1 +. "${SCRIPTS_DIR}/sdk_lib/sdk_util.sh" # Default option values, may be provided before including this file : ${TYPE:="coreos-sdk"} : ${ARCH:=$(portageq envvar ARCH)} : ${DEFAULT_CATALYST_ROOT:="${DEFAULT_BUILD_ROOT}/catalyst"} -: ${DEFAULT_SEED:="builds/${TYPE}/stage4-${ARCH}-latest.tar.bz2"} +: ${DEFAULT_SEED:=${COREOS_SDK_TARBALL_PATH}} : ${DEFAULT_PROFILE:="coreos:default/linux/${ARCH}/10.0"} # Set to something like "stage4" to restrict what to build # FORCE_STAGES= -if [[ "${DEFAULT_SEED}" != /* ]]; then - DEFAULT_SEED="${DEFAULT_CATALYST_ROOT}/${DEFAULT_SEED}" -fi - # Values set in catalyst_init, don't use till after calling it CATALYST_ROOT= DEBUG= @@ -28,11 +25,6 @@ DISTDIR= TEMPDIR= STAGES= -# For searching for alternatives when DEFAULT_SEED doesn't exist -# unset SDK_SEARCH=1 to disable this fallback -SDK_TARBALL="coreos-sdk-${ARCH}-${COREOS_SDK_VERSION}.tar.bz2" -SDK_SEARCH=1 - DEFINE_string catalyst_root "${DEFAULT_CATALYST_ROOT}" \ "Path to directory for all catalyst images and other files." DEFINE_string portage_stable "${SRC_ROOT}/third_party/portage-stable" \ @@ -182,8 +174,10 @@ catalyst_init() { TEMPDIR="$CATALYST_ROOT/tmp/$TYPE" DISTDIR="$CATALYST_ROOT/distfiles" - # possibly search for existing seeds - search_for_sdk_seed + # automatically download the current SDK if it is the seed tarball. + if [[ "$FLAGS_seed_tarball" == "${COREOS_SDK_TARBALL_PATH}" ]]; then + sdk_download_tarball + fi # confirm seed exists if [[ ! -f "$FLAGS_seed_tarball" ]]; then @@ -211,31 +205,6 @@ catalyst_init() { fi } -# search_for_sdk_seed -# As a fallback search around for an existing SDK tarball we -# can use as a seed when the default doesn't exist. -search_for_sdk_seed() { - # Search disabled - [[ "${SDK_SEARCH}" != 1 ]] && return - # Seed already exists - [[ -f "${FLAGS_seed_tarball}" ]] && return - # User set the option so we shouldn't change it - [[ "${FLAGS_seed_tarball}" != "${DEFAULT_SEED}" ]] && return - - local check_path - for check_path in \ - "${CATALYST_ROOT}/builds/coreos-sdk/${SDK_TARBALL}" \ - "${CATALYST_ROOT}/builds/seeds/${SDK_TARBALL}" \ - "${REPO_CACHE_DIR}/sdks/${SDK_TARBALL}" \ - do - if [[ -f "${check_path}" ]]; then - info "Using SDK for seed: ${check_path}" - FLAGS_seed_tarball="${check_path}" - return - fi - done -} - write_configs() { # No catalyst config option, so defined via environment export CCACHE_DIR="$TEMPDIR/ccache" diff --git a/build_toolchains b/build_toolchains index 0b283b1b06..70bcda0b28 100755 --- a/build_toolchains +++ b/build_toolchains @@ -8,9 +8,6 @@ SCRIPT_ROOT=$(dirname $(readlink -f "$0")) . "${SCRIPT_ROOT}/common.sh" || exit 1 TYPE="coreos-toolchains" -ARCH=$(portageq envvar ARCH) -DEFAULT_SEED="builds/coreos-sdk/stage4-${ARCH}-latest.tar.bz2" -DEFAULT_PROFILE="coreos:default/linux/${ARCH}/10.0" FORCE_STAGES="stage4" . "${BUILD_LIBRARY_DIR}/catalyst.sh" || exit 1