diff --git a/build_library/toolchain_util.sh b/build_library/toolchain_util.sh index e841f33057..74f40d7c3e 100644 --- a/build_library/toolchain_util.sh +++ b/build_library/toolchain_util.sh @@ -105,6 +105,30 @@ get_board_profile() { done } +# Usage: get_board_binhost [-t] board [version...] +# -t: toolchain only, full rebuilds re-using toolchain pkgs +# If no versions are specified the current and SDK versions are used. +get_board_binhost() { + local toolchain_only=0 board ver + if [[ "$1" == "-t" ]]; then + toolchain_only=1 + shift + fi + board="$1" + shift + + if [[ $# -eq 0 ]]; then + set -- "${COREOS_VERSION_ID}" "${COREOS_SDK_VERSION}" + fi + + for ver in "$@"; do + if [[ $toolchain_only -eq 0 ]]; then + echo "${COREOS_DOWNLOAD_ROOT}/${board}/${ver}/pkgs/" + fi + echo "${COREOS_DOWNLOAD_ROOT}/${board}/${ver}/toolchain/" + done +} + # Usage: get_cross_pkgs chost [chost2...] get_cross_pkgs() { local cross_chost native_pkg diff --git a/build_packages b/build_packages index ed9e383a54..0f408aedb8 100755 --- a/build_packages +++ b/build_packages @@ -47,6 +47,10 @@ show_help_if_requested "$@" # The following options are advanced options, only available to those willing # to read the source code. They are not shown in help output, since they are # not needed for the typical developer workflow. +DEFINE_string getbinpkgver "" \ + "Use binary packages from a specific version." +DEFINE_boolean toolchainpkgonly $FLAGS_FALSE \ + "Use binary packages only for the board toolchain." DEFINE_string accept_licenses "" \ "Licenses to append to the accept list." DEFINE_boolean fast "${DEFAULT_FAST}" \ @@ -91,7 +95,7 @@ check_gsutil_opts CHROMITE_BIN="${GCLIENT_ROOT}/chromite/bin" # Before we can run any tools, we need to update chroot or setup_board. -UPDATE_ARGS=() +UPDATE_ARGS=( --regen_configs ) if [[ -n ${FLAGS_accept_licenses} ]]; then UPDATE_ARGS+=( --accept_licenses "${FLAGS_accept_licenses}" ) fi @@ -107,6 +111,14 @@ if [ "${FLAGS_usepkg}" -eq "${FLAGS_TRUE}" ]; then else UPDATE_ARGS+=( --nogetbinpkg ) fi + if [[ "${FLAGS_toolchainpkgonly}" -eq "${FLAGS_TRUE}" ]]; then + UPDATE_ARGS+=( --toolchainpkgonly ) + else + UPDATE_ARGS+=( --notoolchainpkgonly ) + fi + if [[ -n "${FLAGS_getbinpkgver}" ]]; then + UPDATE_ARGS+=( --getbinpkgver="${FLAGS_getbinpkgver}" ) + fi else UPDATE_ARGS+=( --nousepkg ) fi diff --git a/setup_board b/setup_board index ff278bc58a..dcde4975a3 100755 --- a/setup_board +++ b/setup_board @@ -33,6 +33,10 @@ show_help_if_requested "$@" # The following options are advanced options, only available to those willing # to read the source code. They are not shown in help output, since they are # not needed for the typical developer workflow. +DEFINE_string getbinpkgver "" \ + "Use binary packages from a specific version." +DEFINE_boolean toolchainpkgonly $FLAGS_FALSE \ + "Use binary packages only for the board toolchain." DEFINE_string accept_licenses "" \ "Licenses to append to the accept list." DEFINE_boolean fast "${DEFAULT_FAST}" \ @@ -124,6 +128,16 @@ EOF sudo_multi "${cmds[@]}" } +generate_binhost_list() { + local t + [[ "${FLAGS_toolchainpkgonly}" -eq "${FLAGS_TRUE}" ]] && t="-t" + FLAGS_getbinpkgver="${FLAGS_getbinpkgver/current/${COREOS_VERSION_ID}}" + FLAGS_getbinpkgver="${FLAGS_getbinpkgver/latest/${COREOS_VERSION_ID}}" + FLAGS_getbinpkgver="${FLAGS_getbinpkgver/sdk/${COREOS_SDK_VERSION}}" + + get_board_binhost $t "${BOARD}" ${FLAGS_getbinpkgver} +} + # Parse command line flags FLAGS "$@" || exit 1 eval set -- "${FLAGS_ARGV}" @@ -180,6 +194,7 @@ BOARD_PROFILE="${BOARD_ETC}/portage/profile" BOARD_ARCH=$(get_board_arch "$BOARD") BOARD_CHOST=$(get_board_chost ${BOARD}) PORTAGE_PROFILE=$(get_board_profile "$BOARD") +BOARD_BINHOST=$(generate_binhost_list) if [ -d "${BOARD_ROOT}" ]; then if [[ ${FLAGS_force} -eq ${FLAGS_TRUE} ]]; then @@ -237,6 +252,7 @@ ROOT="${BOARD_ROOT}/" MAKEOPTS="--jobs=${NUM_JOBS} --load-average=${NUM_JOBS}" PKG_CONFIG="pkg-config-${BOARD_VARIANT}" BOARD_USE="${BOARD_VARIANT}" +PORTAGE_BINHOST="${BOARD_BINHOST}" ${ACCEPT_LICENSE} EOF