From 15b637aa78aeac4c8e439e0ccc7eb5e7a2918579 Mon Sep 17 00:00:00 2001 From: Michael Marineau Date: Wed, 10 Jul 2013 17:31:22 -0400 Subject: [PATCH 1/2] fix(catalyst): Take advantage of binary packages for cross toolchains. The previous logic here only skipped the bootstrap if the toolchain packages were already installed (which won't happen on the build host) but we can also skip the bootstrap if binary packages are available (which will happen on the build host). This will help avoid needless gcc rebuilds :) --- lib/catalyst_sdk_stage4.sh | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/lib/catalyst_sdk_stage4.sh b/lib/catalyst_sdk_stage4.sh index 4d264498b4..44ad54587f 100644 --- a/lib/catalyst_sdk_stage4.sh +++ b/lib/catalyst_sdk_stage4.sh @@ -3,32 +3,28 @@ source /tmp/chroot-functions.sh # Build cross toolchains -# crossdev only does full bootstraps so if all of the packages are already -# installed (i.e. we are updating an existing stage4) then use emerge for cross_chost in x86_64-cros-linux-gnu; do echo "Installing toolchain for ${cross_chost}" cross_pkgs=( cross-${cross_chost}/{binutils,gcc,gdb,glibc,linux-headers} ) - cross_bootstrap=0 - for pkg in "${cross_pkgs[@]}"; do - if ! portageq match / "$pkg" | grep .; then - cross_bootstrap=1 - break - fi - done + crossdev --ov-output "/usr/local/portage/crossdev" \ + --env 'FEATURES=splitdebug' \ + --stable --ex-gdb --init-target \ + --target "${cross_chost}" || exit 1 - if [[ "${cross_bootstrap}" -eq 1 ]]; then + # If PKGCACHE is enabled check to see if binary packages are available + # or (due to --noreplace) the packages are already installed. If so then + # we don't need to perform a full bootstrap and just call emerge instead. + if [[ -n "${clst_PKGCACHE}" ]] && \ + emerge ${clst_myemergeopts} --usepkgonly --binpkg-respect-use=y \ + --noreplace "${cross_pkgs[@]}" &>/dev/null + then + run_merge -u "${cross_pkgs[@]}" + else crossdev --ov-output "/usr/local/portage/crossdev" \ --portage "${clst_myemergeopts}" \ --env 'FEATURES=splitdebug' \ --stable --ex-gdb --stage4 \ --target "${cross_chost}" || exit 1 - else - # Still run --init-target to ensure config is correct - crossdev --ov-output "/usr/local/portage/crossdev" \ - --env 'FEATURES=splitdebug' \ - --stable --ex-gdb --init-target \ - --target "${cross_chost}" || exit 1 - run_merge -u "${cross_pkgs[@]}" fi done From ddb92a0887ef8783d76f00b673f166bdcddf6c81 Mon Sep 17 00:00:00 2001 From: Michael Marineau Date: Wed, 10 Jul 2013 19:44:40 -0400 Subject: [PATCH 2/2] feat(build_library): Add --upload_path option to override default This will be used to upload the latest images built from master, we don't need every build so we just want to upload to a 'master' directory, not one named for the current version. --- build_library/release_util.sh | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/build_library/release_util.sh b/build_library/release_util.sh index c36ad0101d..cbd75476fb 100644 --- a/build_library/release_util.sh +++ b/build_library/release_util.sh @@ -4,6 +4,7 @@ GSUTIL_OPTS= UPLOAD_ROOT="gs://storage.core-os.net/coreos" +UPLOAD_PATH= UPLOAD_DEFAULT=${FLAGS_FALSE} if [[ ${COREOS_OFFICIAL:-0} -eq 1 ]]; then UPLOAD_DEFAULT=${FLAGS_TRUE} @@ -16,6 +17,8 @@ DEFINE_boolean parallel ${FLAGS_TRUE} \ "Enable parallelism in gsutil." DEFINE_boolean upload ${UPLOAD_DEFAULT} \ "Upload all packages/images via gsutil." +DEFINE_string upload_path "" \ + "Upload files to an alternative location. Must be a full gs:// URL." check_gsutil_opts() { [[ ${FLAGS_upload} -eq ${FLAGS_TRUE} ]] || return 0 @@ -24,6 +27,11 @@ check_gsutil_opts() { GSUTIL_OPTS="-m" fi + if [[ -n "${FLAGS_upload_path}" ]]; then + # Make sure the path doesn't end with a slash + UPLOAD_PATH="${FLAGS_upload_path%%/}" + fi + if [[ ! -f "$HOME/.boto" ]]; then die_notrace "Please run gsutil config to create ~/.boto" fi @@ -34,9 +42,10 @@ upload_packages() { [[ -n "${BOARD}" ]] || die "board_options.sh must be sourced first" local BOARD_PACKAGES="${1:-"${BOARD_ROOT}/packages"}" - local UPLOAD_PATH="${UPLOAD_ROOT}/${BOARD}/${COREOS_VERSION_STRING}/pkgs/" + : ${UPLOAD_PATH:="${UPLOAD_ROOT}/${BOARD}/${COREOS_VERSION_STRING}"} + info "Uploading packages" - gsutil ${GSUTIL_OPTS} cp -R "${BOARD_PACKAGES}"/* "${UPLOAD_PATH}" + gsutil ${GSUTIL_OPTS} cp -R "${BOARD_PACKAGES}"/* "${UPLOAD_PATH}/pkgs/" } make_digests() { @@ -57,7 +66,7 @@ upload_image() { [[ -n "${BOARD}" ]] || die "board_options.sh must be sourced first" local BUILT_IMAGE="$1" - local UPLOAD_PATH="${UPLOAD_ROOT}/${BOARD}/${COREOS_VERSION_STRING}/" + : ${UPLOAD_PATH:="${UPLOAD_ROOT}/${BOARD}/${COREOS_VERSION_STRING}"} if [[ ! -f "${BUILT_IMAGE}" ]]; then die "Image '${BUILT_IMAGE}' does not exist!" @@ -76,5 +85,5 @@ upload_image() { info "Uploading ${BUILT_IMAGE##*/}" gsutil ${GSUTIL_OPTS} cp "${BUILT_IMAGE}" \ - "${BUILT_IMAGE}.DIGESTS" "${UPLOAD_PATH}" + "${BUILT_IMAGE}.DIGESTS" "${UPLOAD_PATH}/" }