fix(toolchain_util.sh): Move native->cross pkg translation to function

Will be useful in other places and seems better to hide the bash magic.
This commit is contained in:
Michael Marineau 2013-10-23 13:56:35 -07:00
parent 0ba3d9ea04
commit 986548722d
2 changed files with 10 additions and 1 deletions

View File

@ -47,7 +47,7 @@ EOF
build_cross_toolchain() {
local cross_chost="$1"
local cross_pkgs=( "${TOOLCHAIN_PKGS[@]/*\//cross-${cross_chost}/}" )
local cross_pkgs=( $(get_cross_pkgs $cross_chost) )
local PORTDIR="$(portageq envvar PORTDIR)"
local PKGDIR="${PORTDIR}/packages/crossdev"

View File

@ -62,3 +62,12 @@ get_board_profile() {
fi
done
}
get_cross_pkgs() {
local cross_chost native_pkg
for cross_chost in "$@"; do
for native_pkg in "${TOOLCHAIN_PKGS[@]}"; do
echo "${native_pkg/*\//cross-${cross_chost}/}"
done
done
}