Skip to content

Commit

Permalink
curl to follow redirects and use bsdtar
Browse files Browse the repository at this point in the history
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.
```
  • Loading branch information
AndreMiras committed May 20, 2018
1 parent 20292e5 commit d013a86
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ ENV ANDROID_NDK_DL_URL="https://dl.google.com/android/repository/${ANDROID_NDK_A

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

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

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

# download and install CrystaX NDK
RUN curl --progress-bar "${CRYSTAX_NDK_DL_URL}" --output "${CRYSTAX_NDK_ARCHIVE}" && \
tar -xf "${CRYSTAX_NDK_ARCHIVE}" --directory "${ANDROID_HOME}" && \
# added `gnutls_handshake` flag to workaround random `gnutls_handshake()` issues
RUN curl --location --progress-bar "${CRYSTAX_NDK_DL_URL}" --output "${CRYSTAX_NDK_ARCHIVE}" --insecure && \
bsdtar -xf "${CRYSTAX_NDK_ARCHIVE}" --directory "${ANDROID_HOME}" \
--exclude=crystax-ndk-${CRYSTAX_NDK_VERSION}/docs \
--exclude=crystax-ndk-${CRYSTAX_NDK_VERSION}/samples \
--exclude=crystax-ndk-${CRYSTAX_NDK_VERSION}/tests \
--exclude=crystax-ndk-${CRYSTAX_NDK_VERSION}/toolchains/renderscript \
--exclude=crystax-ndk-${CRYSTAX_NDK_VERSION}/toolchains/x86_64-* \
--exclude=crystax-ndk-${CRYSTAX_NDK_VERSION}/toolchains/llvm-* \
--exclude=crystax-ndk-${CRYSTAX_NDK_VERSION}/toolchains/aarch64-* \
--exclude=crystax-ndk-${CRYSTAX_NDK_VERSION}/toolchains/mips64el-* && \
ln -sfn "${CRYSTAX_NDK_HOME_V}" "${CRYSTAX_NDK_HOME}"

# download and install Android SDK
RUN curl --progress-bar "${ANDROID_SDK_TOOLS_DL_URL}" --output "${ANDROID_SDK_TOOLS_ARCHIVE}" && \
RUN curl --location --progress-bar "${ANDROID_SDK_TOOLS_DL_URL}" --output "${ANDROID_SDK_TOOLS_ARCHIVE}" && \
mkdir --parents "${ANDROID_SDK_HOME}" && \
unzip -q "${ANDROID_SDK_TOOLS_ARCHIVE}" -d "${ANDROID_SDK_HOME}"

Expand Down

0 comments on commit d013a86

Please sign in to comment.