aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorRichard Weickelt <richard@weickelt.de>2020-05-06 14:11:25 +0200
committerRichard Weickelt <richard@weickelt.de>2020-05-11 08:04:19 +0000
commita3c97374d0e06e0e2a23b22c10450ede48bcb478 (patch)
tree88dfaafcf462b13370e7f6e1003d3ff1bac949a5 /scripts
parent62215625dde98f6a6457159b4e3ef975d7014259 (diff)
Do not reinstall Qt if already installed
The server download.qt.io is frequently overloaded. Instead of re-installing Qt every time, try to check if the desired packages are already installed. Utilize Travis' caching meachanism for Qt installations. Change-Id: I4ff1c05b93fd1f0224a7ea4e4869998a21478bfc Reviewed-by: Richard Weickelt <richard@weickelt.de> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/install-qt.sh30
1 files changed, 29 insertions, 1 deletions
diff --git a/scripts/install-qt.sh b/scripts/install-qt.sh
index 3024c7417..e52fefce4 100755
--- a/scripts/install-qt.sh
+++ b/scripts/install-qt.sh
@@ -59,11 +59,14 @@ Positional arguments
target and toolchain.
Options
- --directory <directory>
+ -d, --directory <directory>
Root directory where to install the components.
Maps to C:/Qt on Windows, /opt/Qt on Linux, /usr/local/Qt on Mac
by default.
+ -f, --force
+ Force download and do not attempt to re-use an existing installation.
+
--host <host-os>
The host operating system. Can be one of linux_x64, mac_x64,
windows_x86. Auto-detected by default.
@@ -106,6 +109,7 @@ EOF
TARGET_PLATFORM=desktop
COMPONENTS=
VERSION=
+FORCE_DOWNLOAD=false
case "$OSTYPE" in
*linux*)
@@ -135,6 +139,9 @@ while [ $# -gt 0 ]; do
INSTALL_DIR="$2"
shift
;;
+ --force|-f)
+ FORCE_DOWNLOAD=true
+ ;;
--host)
HOST_OS="$2"
shift
@@ -195,6 +202,25 @@ case "$TARGET_PLATFORM" in
;;
esac
+
+HASH=$(echo "${OSTYPE} ${TARGET_PLATFORM} ${TOOLCHAIN} ${VERSION} ${INSTALL_DIR}" | md5sum | head -c 16)
+HASH_FILEPATH="${INSTALL_DIR}/${HASH}.manifest"
+INSTALLATION_IS_VALID=false
+if ! ${FORCE_DOWNLOAD} && [ -f "${HASH_FILEPATH}" ]; then
+ INSTALLATION_IS_VALID=true
+ while read filepath; do
+ if [ ! -e "${filepath}" ]; then
+ INSTALLATION_IS_VALID=false
+ break
+ fi
+ done <"${HASH_FILEPATH}"
+fi
+
+if ${INSTALLATION_IS_VALID}; then
+ echo "Already installed. Skipping download."
+ exit 0
+fi
+
DOWNLOAD_DIR=`mktemp -d 2>/dev/null || mktemp -d -t 'install-qt'`
#
@@ -242,6 +268,7 @@ function compute_url(){
}
mkdir -p ${INSTALL_DIR}
+rm -f "${HASH_FILEPATH}"
for COMPONENT in ${COMPONENTS}; do
@@ -249,6 +276,7 @@ for COMPONENT in ${COMPONENTS}; do
echo "Downloading ${COMPONENT}..." >&2
curl --progress-bar -L -o ${DOWNLOAD_DIR}/package.7z ${URL} >&2
7z x -y -o${INSTALL_DIR} ${DOWNLOAD_DIR}/package.7z >/dev/null 2>&1
+ 7z l -ba -slt -y ${DOWNLOAD_DIR}/package.7z | tr '\\' '/' | sed -n -e "s|^Path\ =\ |${INSTALL_DIR}/|p" >> "${HASH_FILEPATH}" 2>/dev/null
rm -f ${DOWNLOAD_DIR}/package.7z
#