chore: split out Chromium mirroring to a separate script (#10399)

#10398
This commit is contained in:
Andrey Lushnikov 2021-11-17 16:57:04 -08:00 committed by GitHub
parent 0781d0303b
commit 51f714f235
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 70 additions and 72 deletions

View File

@ -165,33 +165,6 @@ elif [[ "$BUILD_FLAVOR" == "chromium-with-symbols-linux-arm64" ]]; then
BUILD_BLOB_NAME="chromium-with-symbols-linux-arm64.zip"
BUILDS_LIST="EXPECTED_BUILDS_WITH_SYMBOLS"
# ===========================
# CHROMIUM MIRRORING
# ===========================
elif [[ "$BUILD_FLAVOR" == "chromium-linux-mirror-to-cdn" ]]; then
BROWSER_NAME="chromium"
EXTRA_BUILD_ARGS="--mirror-linux"
EXTRA_ARCHIVE_ARGS="--mirror-linux"
EXPECTED_HOST_OS="Ubuntu"
EXPECTED_HOST_OS_VERSION="18.04"
BUILD_BLOB_NAME="chromium-linux.zip"
elif [[ "$BUILD_FLAVOR" == "chromium-mac-mirror-to-cdn" ]]; then
BROWSER_NAME="chromium"
EXTRA_BUILD_ARGS="--mirror-mac"
EXTRA_ARCHIVE_ARGS="--mirror-mac"
EXPECTED_HOST_OS="Ubuntu"
EXPECTED_HOST_OS_VERSION="18.04"
BUILD_BLOB_NAME="chromium-mac.zip"
elif [[ "$BUILD_FLAVOR" == "chromium-win64-mirror-to-cdn" ]]; then
BROWSER_NAME="chromium"
EXTRA_BUILD_ARGS="--mirror-win64"
EXTRA_ARCHIVE_ARGS="--mirror-win64"
EXPECTED_HOST_OS="Ubuntu"
EXPECTED_HOST_OS_VERSION="18.04"
BUILD_BLOB_NAME="chromium-win64.zip"
# ===========================
# FIREFOX COMPILATION
# ===========================

View File

@ -6,9 +6,9 @@ trap "cd $(pwd -P)" EXIT
cd "$(dirname "$0")"
USAGE=$(cat<<EOF
usage: $(basename "$0") [--mirror|--mirror-linux|--mirror-win64|--mirror-mac|--compile-mac-arm64|--compile-linux|--compile-linux-arm64|--compile-win64|--compile-mac] [--symbols] [--full]
usage: $(basename "$0") [--compile-mac-arm64|--compile-linux|--compile-linux-arm64|--compile-win64|--compile-mac] [--symbols] [--full]
Either compiles chromium or mirrors it from Chromium Continuous Builds CDN.
Compiles chromium.
EOF
)
@ -19,8 +19,6 @@ main() {
if [[ $1 == "--help" || $1 == "-h" ]]; then
echo "$USAGE"
exit 0
elif [[ $1 == "--mirror"* ]]; then
mirror_chromium "$1"
elif [[ $1 == "--compile"* ]]; then
compile_chromium "$1" "$2" "$3"
else
@ -115,45 +113,4 @@ compile_chromium() {
fi
}
mirror_chromium() {
cd "$SCRIPT_FOLDER"
rm -rf output
mkdir -p output
cd output
CHROMIUM_URL=""
PLATFORM="$1"
if [[ "${PLATFORM}" == "--mirror" ]]; then
CURRENT_HOST_OS="$(uname)"
if [[ "${CURRENT_HOST_OS}" == "Darwin" ]]; then
PLATFORM="--mirror-mac"
elif [[ "${CURRENT_HOST_OS}" == "Linux" ]]; then
PLATFORM="--mirror-linux"
elif [[ "${CURRENT_HOST_OS}" == MINGW* ]]; then
PLATFORM="--mirror-win64"
else
echo "ERROR: unsupported host platform - ${CURRENT_HOST_OS}"
exit 1
fi
fi
CRREV=$(head -1 "${SCRIPT_FOLDER}/BUILD_NUMBER")
if [[ "${PLATFORM}" == "--mirror-win64" ]]; then
CHROMIUM_URL="https://storage.googleapis.com/chromium-browser-snapshots/Win_x64/${CRREV}/chrome-win.zip"
elif [[ "${PLATFORM}" == "--mirror-mac" ]]; then
CHROMIUM_URL="https://storage.googleapis.com/chromium-browser-snapshots/Mac/${CRREV}/chrome-mac.zip"
elif [[ "${PLATFORM}" == "--mirror-linux" ]]; then
CHROMIUM_URL="https://storage.googleapis.com/chromium-browser-snapshots/Linux_x64/${CRREV}/chrome-linux.zip"
else
echo "ERROR: unknown platform to build: $1"
exit 1
fi
echo "--> Pulling Chromium ${CRREV} for ${PLATFORM#--}"
curl --output chromium-upstream.zip "${CHROMIUM_URL}"
unzip chromium-upstream.zip
}
main "$1" "$2" "$3"

View File

@ -0,0 +1,68 @@
#!/bin/bash
set -e
set +x
trap "cd $(pwd -P)" EXIT
cd "$(dirname "$0")"
USAGE=$(cat<<EOF
usage: $(basename "$0") [--linux|--win64|--mac]
Mirrors Chromium from Chromium Continuous Builds CDN.
EOF
)
SCRIPT_FOLDER=$(pwd -P)
source "${SCRIPT_FOLDER}/../utils.sh"
main() {
if [[ $1 == "--help" || $1 == "-h" ]]; then
echo "$USAGE"
exit 0
else
mirror_chromium "$1"
fi
}
mirror_chromium() {
cd "$SCRIPT_FOLDER"
rm -rf output
mkdir -p output
cd output
CHROMIUM_URL=""
PLATFORM="$1"
if [[ -n "${PLATFORM}" ]]; then
CURRENT_HOST_OS="$(uname)"
if [[ "${CURRENT_HOST_OS}" == "Darwin" ]]; then
PLATFORM="--mac"
elif [[ "${CURRENT_HOST_OS}" == "Linux" ]]; then
PLATFORM="--linux"
elif [[ "${CURRENT_HOST_OS}" == MINGW* ]]; then
PLATFORM="--win64"
else
echo "ERROR: unsupported host platform - ${CURRENT_HOST_OS}"
exit 1
fi
fi
CRREV=$(head -1 "${SCRIPT_FOLDER}/BUILD_NUMBER")
if [[ "${PLATFORM}" == "--win64" ]]; then
CHROMIUM_URL="https://storage.googleapis.com/chromium-browser-snapshots/Win_x64/${CRREV}/chrome-win.zip"
elif [[ "${PLATFORM}" == "--mac" ]]; then
CHROMIUM_URL="https://storage.googleapis.com/chromium-browser-snapshots/Mac/${CRREV}/chrome-mac.zip"
elif [[ "${PLATFORM}" == "--linux" ]]; then
CHROMIUM_URL="https://storage.googleapis.com/chromium-browser-snapshots/Linux_x64/${CRREV}/chrome-linux.zip"
else
echo "ERROR: unknown platform to build: $1"
exit 1
fi
echo "--> Pulling Chromium ${CRREV} for ${PLATFORM#--}"
curl --output chromium-upstream.zip "${CHROMIUM_URL}"
unzip chromium-upstream.zip
}
main "$1" "$2" "$3"