devops: fix "ensure-depot-tools" script (#13303)
The script should is supposed to be sourced and thus should not change any env variables of parent script besides `$PATH`.
This commit is contained in:
parent
6ef8b63e5d
commit
786b4a55fc
|
|
@ -11,18 +11,22 @@ if [[ $sourced == 0 ]]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Install depot_tools if they are not in system, and modify $PATH
|
function ensure_depot_tools() {
|
||||||
# to include depot_tools
|
# Install depot_tools if they are not in system, and modify $PATH
|
||||||
if ! command -v autoninja >/dev/null; then
|
# to include depot_tools
|
||||||
if [[ $(uname) == "MINGW"* ]]; then
|
if ! command -v autoninja >/dev/null; then
|
||||||
# NOTE: as of Feb 8, 2021, windows requires manual and separate
|
if [[ $(uname) == "MINGW"* ]]; then
|
||||||
# installation of depot_tools.
|
# NOTE: as of Feb 8, 2021, windows requires manual and separate
|
||||||
echo "ERROR: cannot automatically install depot_tools on windows. Please, install manually"
|
# installation of depot_tools.
|
||||||
exit 1
|
echo "ERROR: cannot automatically install depot_tools on windows. Please, install manually"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
local SCRIPT_PATH=$(cd "$(dirname "$BASH_SOURCE")"; pwd -P)
|
||||||
|
if [[ ! -d "${SCRIPT_PATH}/depot_tools" ]]; then
|
||||||
|
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git "${SCRIPT_PATH}/depot_tools"
|
||||||
|
fi
|
||||||
|
export PATH="${SCRIPT_PATH}/depot_tools:$PATH"
|
||||||
fi
|
fi
|
||||||
SCRIPT_PATH=$(cd "$(dirname "$BASH_SOURCE")"; pwd -P)
|
}
|
||||||
if [[ ! -d "${SCRIPT_PATH}/depot_tools" ]]; then
|
|
||||||
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git "${SCRIPT_PATH}/depot_tools"
|
ensure_depot_tools
|
||||||
fi
|
|
||||||
export PATH="${SCRIPT_PATH}/depot_tools:$PATH"
|
|
||||||
fi
|
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@ fi
|
||||||
function prepare_chromium_checkout {
|
function prepare_chromium_checkout {
|
||||||
cd "${SCRIPT_PATH}"
|
cd "${SCRIPT_PATH}"
|
||||||
|
|
||||||
|
source "${SCRIPT_PATH}/chromium/UPSTREAM_CONFIG.sh"
|
||||||
source "${SCRIPT_PATH}/chromium/ensure_depot_tools.sh"
|
source "${SCRIPT_PATH}/chromium/ensure_depot_tools.sh"
|
||||||
|
|
||||||
if [[ -z "${CR_CHECKOUT_PATH}" ]]; then
|
if [[ -z "${CR_CHECKOUT_PATH}" ]]; then
|
||||||
|
|
@ -55,7 +56,6 @@ function prepare_chromium_checkout {
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
source "${SCRIPT_PATH}/chromium/UPSTREAM_CONFIG.sh"
|
|
||||||
cd "${CR_CHECKOUT_PATH}/src"
|
cd "${CR_CHECKOUT_PATH}/src"
|
||||||
gclient sync --with_branch_heads
|
gclient sync --with_branch_heads
|
||||||
git fetch origin
|
git fetch origin
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue