Skip to content

Commit d013a86

Browse files
committed
curl to follow redirects and use bsdtar
On Travis CrystaX download is redirected from https://eu.crystax.net/download/crystax-ndk-10.3.2-linux-x86.tar.xz to https://us.crystax.net/download/crystax-ndk-10.3.2-linux-x86.tar.xz Adding `--location` flag makes it possible to automatically follow that redirect. Also replaced tar by bsdtar, since tar was failing with the following: ``` tar: crystax-ndk-10.3.2/sources/cpufeatures: Directory renamed before its status could be extracted ``` Plus excluded some folders from the extract command to save time and space. Reduces decompressed size from 7.6G to 6.3G. Also added `gnutls_handshake` flag to `curl` to workaround random `gnutls_handshake()` issues on CrystaX download only. The error was: ``` curl: (35) gnutls_handshake() failed: Error in the pull function. ```
1 parent 20292e5 commit d013a86

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

Dockerfile

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ ENV ANDROID_NDK_DL_URL="https://dl.google.com/android/repository/${ANDROID_NDK_A
3636

3737
# install system dependencies
3838
RUN apt update -qq && apt install -qq --yes --no-install-recommends \
39-
python virtualenv python-pip wget curl lbzip2 patch
39+
python virtualenv python-pip wget curl lbzip2 patch bsdtar
4040

4141
# build dependencies
4242
# https://buildozer.readthedocs.io/en/latest/installation.html#android-on-ubuntu-16-04-64bit
@@ -47,18 +47,27 @@ RUN dpkg --add-architecture i386 && apt update -qq && apt install -qq --yes --n
4747
RUN pip install --quiet --upgrade cython==0.21
4848

4949
# download and install Android NDK
50-
RUN curl --progress-bar "${ANDROID_NDK_DL_URL}" --output "${ANDROID_NDK_ARCHIVE}" && \
50+
RUN curl --location --progress-bar "${ANDROID_NDK_DL_URL}" --output "${ANDROID_NDK_ARCHIVE}" && \
5151
mkdir --parents "${ANDROID_NDK_HOME_V}" && \
5252
unzip -q "${ANDROID_NDK_ARCHIVE}" -d "${ANDROID_HOME}" && \
5353
ln -sfn "${ANDROID_NDK_HOME_V}" "${ANDROID_NDK_HOME}"
5454

5555
# download and install CrystaX NDK
56-
RUN curl --progress-bar "${CRYSTAX_NDK_DL_URL}" --output "${CRYSTAX_NDK_ARCHIVE}" && \
57-
tar -xf "${CRYSTAX_NDK_ARCHIVE}" --directory "${ANDROID_HOME}" && \
56+
# added `gnutls_handshake` flag to workaround random `gnutls_handshake()` issues
57+
RUN curl --location --progress-bar "${CRYSTAX_NDK_DL_URL}" --output "${CRYSTAX_NDK_ARCHIVE}" --insecure && \
58+
bsdtar -xf "${CRYSTAX_NDK_ARCHIVE}" --directory "${ANDROID_HOME}" \
59+
--exclude=crystax-ndk-${CRYSTAX_NDK_VERSION}/docs \
60+
--exclude=crystax-ndk-${CRYSTAX_NDK_VERSION}/samples \
61+
--exclude=crystax-ndk-${CRYSTAX_NDK_VERSION}/tests \
62+
--exclude=crystax-ndk-${CRYSTAX_NDK_VERSION}/toolchains/renderscript \
63+
--exclude=crystax-ndk-${CRYSTAX_NDK_VERSION}/toolchains/x86_64-* \
64+
--exclude=crystax-ndk-${CRYSTAX_NDK_VERSION}/toolchains/llvm-* \
65+
--exclude=crystax-ndk-${CRYSTAX_NDK_VERSION}/toolchains/aarch64-* \
66+
--exclude=crystax-ndk-${CRYSTAX_NDK_VERSION}/toolchains/mips64el-* && \
5867
ln -sfn "${CRYSTAX_NDK_HOME_V}" "${CRYSTAX_NDK_HOME}"
5968

6069
# download and install Android SDK
61-
RUN curl --progress-bar "${ANDROID_SDK_TOOLS_DL_URL}" --output "${ANDROID_SDK_TOOLS_ARCHIVE}" && \
70+
RUN curl --location --progress-bar "${ANDROID_SDK_TOOLS_DL_URL}" --output "${ANDROID_SDK_TOOLS_ARCHIVE}" && \
6271
mkdir --parents "${ANDROID_SDK_HOME}" && \
6372
unzip -q "${ANDROID_SDK_TOOLS_ARCHIVE}" -d "${ANDROID_SDK_HOME}"
6473

0 commit comments

Comments
 (0)