mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-08 05:26:58 +02:00
fix(toolchain_util.sh): Fix variable name conflicts.
Although it didn't seem to be causing any bugs the global variables in toolchain_util conflicted with some names used elsewhere. Clean that up by adding an S to the array names that didn't already have one.
This commit is contained in:
parent
0badc0a576
commit
d91e8d21c4
@ -17,16 +17,26 @@ TOOLCHAIN_BINONLY=( "${TOOLCHAIN_PKGS[@]/#/--useoldpkg-atoms=}"
|
|||||||
# Portage profile to use for building out the cross compiler's SYSROOT.
|
# Portage profile to use for building out the cross compiler's SYSROOT.
|
||||||
# This is only used as an intermediate step to be able to use the cross
|
# This is only used as an intermediate step to be able to use the cross
|
||||||
# compiler to build a full native toolchain. Packages are not uploaded.
|
# compiler to build a full native toolchain. Packages are not uploaded.
|
||||||
CROSS_PROFILE["x86_64-cros-linux-gnu"]="coreos:coreos/amd64/generic"
|
declare -A CROSS_PROFILES
|
||||||
|
CROSS_PROFILES["x86_64-cros-linux-gnu"]="coreos:coreos/amd64/generic"
|
||||||
|
|
||||||
# Map board names to CHOSTs and portage profiles. This is the
|
# Map board names to CHOSTs and portage profiles. This is the
|
||||||
# definitive list, there is assorted code new and old that either
|
# definitive list, there is assorted code new and old that either
|
||||||
# guesses or hard-code these. All that should migrate to this list.
|
# guesses or hard-code these. All that should migrate to this list.
|
||||||
declare -A BOARD_CHOST BOARD_PROFILE
|
declare -A BOARD_CHOSTS BOARD_PROFILES
|
||||||
BOARD_CHOST["amd64-generic"]="x86_64-cros-linux-gnu"
|
BOARD_CHOSTS["amd64-generic"]="x86_64-cros-linux-gnu"
|
||||||
BOARD_PROFILE["amd64-generic"]="coreos:coreos/amd64/generic"
|
BOARD_PROFILES["amd64-generic"]="coreos:coreos/amd64/generic"
|
||||||
BOARD_NAMES=( "${!BOARD_CHOST[@]}" )
|
BOARD_NAMES=( "${!BOARD_CHOST[@]}" )
|
||||||
|
|
||||||
|
# Declare the above globals as read-only to avoid accidental conflicts.
|
||||||
|
declare -r \
|
||||||
|
TOOLCHAIN_PKGS \
|
||||||
|
TOOLCHAIN_BINONLY \
|
||||||
|
CROSS_PROFILES \
|
||||||
|
BOARD_CHOSTS \
|
||||||
|
BOARD_NAMES \
|
||||||
|
BOARD_PROFILES
|
||||||
|
|
||||||
### Generic metadata fetching functions ###
|
### Generic metadata fetching functions ###
|
||||||
|
|
||||||
# map CHOST to portage ARCH, list came from crossdev
|
# map CHOST to portage ARCH, list came from crossdev
|
||||||
@ -58,12 +68,12 @@ get_board_list() {
|
|||||||
|
|
||||||
get_chost_list() {
|
get_chost_list() {
|
||||||
local IFS=$'\n\t '
|
local IFS=$'\n\t '
|
||||||
sort -u <<<"${BOARD_CHOST[*]}"
|
sort -u <<<"${BOARD_CHOSTS[*]}"
|
||||||
}
|
}
|
||||||
|
|
||||||
get_profile_list() {
|
get_profile_list() {
|
||||||
local IFS=$'\n\t '
|
local IFS=$'\n\t '
|
||||||
sort -u <<<"${BOARD_PROFILE[*]}"
|
sort -u <<<"${BOARD_PROFILES[*]}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Usage: get_board_arch board [board...]
|
# Usage: get_board_arch board [board...]
|
||||||
@ -78,8 +88,8 @@ get_board_arch() {
|
|||||||
get_board_chost() {
|
get_board_chost() {
|
||||||
local board
|
local board
|
||||||
for board in "$@"; do
|
for board in "$@"; do
|
||||||
if [[ ${#BOARD_CHOST["$board"]} -ne 0 ]]; then
|
if [[ ${#BOARD_CHOSTS["$board"]} -ne 0 ]]; then
|
||||||
echo "${BOARD_CHOST["$board"]}"
|
echo "${BOARD_CHOSTS["$board"]}"
|
||||||
else
|
else
|
||||||
die "Unknown board '$board'"
|
die "Unknown board '$board'"
|
||||||
fi
|
fi
|
||||||
@ -90,8 +100,8 @@ get_board_chost() {
|
|||||||
get_board_profile() {
|
get_board_profile() {
|
||||||
local board
|
local board
|
||||||
for board in "$@"; do
|
for board in "$@"; do
|
||||||
if [[ ${#BOARD_PROFILE["$board"]} -ne 0 ]]; then
|
if [[ ${#BOARD_PROFILES["$board"]} -ne 0 ]]; then
|
||||||
echo "${BOARD_PROFILE["$board"]}"
|
echo "${BOARD_PROFILES["$board"]}"
|
||||||
else
|
else
|
||||||
die "Unknown board '$board'"
|
die "Unknown board '$board'"
|
||||||
fi
|
fi
|
||||||
@ -214,7 +224,7 @@ install_cross_libs() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
CHOST="${cross_chost}" ROOT="$ROOT" SYSROOT="$ROOT" \
|
CHOST="${cross_chost}" ROOT="$ROOT" SYSROOT="$ROOT" \
|
||||||
_configure_sysroot "${CROSS_PROFILE[${cross_chost}]}"
|
_configure_sysroot "${CROSS_PROFILES[${cross_chost}]}"
|
||||||
|
|
||||||
# In order to get a dependency list we must calculate it before
|
# In order to get a dependency list we must calculate it before
|
||||||
# updating package.provided. Otherwise portage will no-op.
|
# updating package.provided. Otherwise portage will no-op.
|
||||||
|
Loading…
Reference in New Issue
Block a user