mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-07 21:16:57 +02:00
feat(setup_board): Configure binary package sources on the fly.
Generate list of board binhosts based on the new $COREOS_DOWNLOAD_ROOT variable and optionally use packages only from a specific version
This commit is contained in:
parent
5524a7ce9a
commit
7a43a07fef
@ -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
|
||||
|
@ -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
|
||||
|
16
setup_board
16
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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user