Skip to content

Commit c86d9ec

Browse files
authored
Merge pull request kivy#1643 from AndreMiras/feature/ticket1306_retry_on_hiccups
Retry on download hiccups, refs kivy#1306
2 parents dba74d6 + 53e3a31 commit c86d9ec

File tree

3 files changed

+36
-40
lines changed

3 files changed

+36
-40
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ services:
66
- docker
77

88
before_install:
9-
- sudo apt update -qq
10-
- sudo apt install -qq --no-install-recommends python2.7 python3
9+
- travis_retry sudo apt update -qq
10+
- travis_retry sudo apt install -qq --no-install-recommends python2.7 python3
1111
- sudo pip install tox>=2.0
1212
# https://github.com/travis-ci/travis-ci/issues/6069#issuecomment-266546552
1313
- git remote set-branches --add origin master

Dockerfile.py2

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,14 @@ FROM ubuntu:18.04
2020
ENV ANDROID_HOME="/opt/android"
2121

2222
RUN apt -y update -qq \
23-
&& apt -y install -qq --no-install-recommends curl unzip \
24-
&& apt -y autoremove \
25-
&& apt -y clean
23+
&& apt -y install -qq --no-install-recommends curl unzip ca-certificates \
24+
&& apt -y autoremove
2625

26+
# retry helper script, refs:
27+
# https://github.com/kivy/python-for-android/issues/1306
28+
ENV RETRY="retry -t 3 --"
29+
RUN curl https://raw.githubusercontent.com/kadwanev/retry/1.0.1/retry \
30+
--output /usr/local/bin/retry && chmod +x /usr/local/bin/retry
2731

2832
ENV ANDROID_NDK_HOME="${ANDROID_HOME}/android-ndk"
2933
ENV ANDROID_NDK_VERSION="17c"
@@ -34,7 +38,7 @@ ENV ANDROID_NDK_ARCHIVE="android-ndk-r${ANDROID_NDK_VERSION}-linux-x86_64.zip"
3438
ENV ANDROID_NDK_DL_URL="https://dl.google.com/android/repository/${ANDROID_NDK_ARCHIVE}"
3539

3640
# download and install Android NDK
37-
RUN curl --location --progress-bar --insecure \
41+
RUN ${RETRY} curl --location --progress-bar --insecure \
3842
"${ANDROID_NDK_DL_URL}" \
3943
--output "${ANDROID_NDK_ARCHIVE}" \
4044
&& mkdir --parents "${ANDROID_NDK_HOME_V}" \
@@ -52,7 +56,7 @@ ENV ANDROID_SDK_TOOLS_ARCHIVE="sdk-tools-linux-${ANDROID_SDK_TOOLS_VERSION}.zip"
5256
ENV ANDROID_SDK_TOOLS_DL_URL="https://dl.google.com/android/repository/${ANDROID_SDK_TOOLS_ARCHIVE}"
5357

5458
# download and install Android SDK
55-
RUN curl --location --progress-bar --insecure \
59+
RUN ${RETRY} curl --location --progress-bar --insecure \
5660
"${ANDROID_SDK_TOOLS_DL_URL}" \
5761
--output "${ANDROID_SDK_TOOLS_ARCHIVE}" \
5862
&& mkdir --parents "${ANDROID_SDK_HOME}" \
@@ -65,10 +69,8 @@ RUN mkdir --parents "${ANDROID_SDK_HOME}/.android/" \
6569
> "${ANDROID_SDK_HOME}/.android/repositories.cfg"
6670

6771
# accept Android licenses (JDK necessary!)
68-
RUN apt -y update -qq \
69-
&& apt -y install -qq --no-install-recommends openjdk-8-jdk \
70-
&& apt -y autoremove \
71-
&& apt -y clean
72+
RUN ${RETRY} apt -y install -qq --no-install-recommends openjdk-8-jdk \
73+
&& apt -y autoremove
7274
RUN yes | "${ANDROID_SDK_HOME}/tools/bin/sdkmanager" "build-tools;${ANDROID_SDK_BUILD_TOOLS_VERSION}" > /dev/null
7375

7476
# download platforms, API, build tools
@@ -84,27 +86,23 @@ ENV WORK_DIR="${HOME_DIR}" \
8486
PATH="${HOME_DIR}/.local/bin:${PATH}"
8587

8688
# install system dependencies
87-
RUN apt -y update -qq \
88-
&& apt -y install -qq --no-install-recommends \
89+
RUN ${RETRY} apt -y install -qq --no-install-recommends \
8990
python virtualenv python-pip wget lbzip2 patch sudo \
90-
&& apt -y autoremove \
91-
&& apt -y clean
91+
&& apt -y autoremove
9292

9393
# build dependencies
9494
# https://buildozer.readthedocs.io/en/latest/installation.html#android-on-ubuntu-16-04-64bit
9595
RUN dpkg --add-architecture i386 \
96-
&& apt -y update -qq \
97-
&& apt -y install -qq --no-install-recommends \
96+
&& ${RETRY} apt -y update -qq \
97+
&& ${RETRY} apt -y install -qq --no-install-recommends \
9898
build-essential ccache git python2.7 python2.7-dev \
9999
libncurses5:i386 libstdc++6:i386 libgtk2.0-0:i386 \
100100
libpangox-1.0-0:i386 libpangoxft-1.0-0:i386 libidn11:i386 \
101101
zip zlib1g-dev zlib1g:i386 \
102-
&& apt -y autoremove \
103-
&& apt -y clean
102+
&& apt -y autoremove
104103

105104
# specific recipes dependencies (e.g. libffi requires autoreconf binary)
106-
RUN apt -y update -qq \
107-
&& apt -y install -qq --no-install-recommends \
105+
RUN ${RETRY} apt -y install -qq --no-install-recommends \
108106
libffi-dev autoconf automake cmake gettext libltdl-dev libtool pkg-config \
109107
&& apt -y autoremove \
110108
&& apt -y clean

Dockerfile.py3

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,14 @@ FROM ubuntu:18.04
2020
ENV ANDROID_HOME="/opt/android"
2121

2222
RUN apt -y update -qq \
23-
&& apt -y install -qq --no-install-recommends curl unzip \
24-
&& apt -y autoremove \
25-
&& apt -y clean
23+
&& apt -y install -qq --no-install-recommends curl unzip ca-certificates \
24+
&& apt -y autoremove
2625

26+
# retry helper script, refs:
27+
# https://github.com/kivy/python-for-android/issues/1306
28+
ENV RETRY="retry -t 3 --"
29+
RUN curl https://raw.githubusercontent.com/kadwanev/retry/1.0.1/retry \
30+
--output /usr/local/bin/retry && chmod +x /usr/local/bin/retry
2731

2832
ENV ANDROID_NDK_HOME="${ANDROID_HOME}/android-ndk"
2933
ENV ANDROID_NDK_VERSION="17c"
@@ -34,7 +38,7 @@ ENV ANDROID_NDK_ARCHIVE="android-ndk-r${ANDROID_NDK_VERSION}-linux-x86_64.zip"
3438
ENV ANDROID_NDK_DL_URL="https://dl.google.com/android/repository/${ANDROID_NDK_ARCHIVE}"
3539

3640
# download and install Android NDK
37-
RUN curl --location --progress-bar --insecure \
41+
RUN ${RETRY} curl --location --progress-bar --insecure \
3842
"${ANDROID_NDK_DL_URL}" \
3943
--output "${ANDROID_NDK_ARCHIVE}" \
4044
&& mkdir --parents "${ANDROID_NDK_HOME_V}" \
@@ -52,7 +56,7 @@ ENV ANDROID_SDK_TOOLS_ARCHIVE="sdk-tools-linux-${ANDROID_SDK_TOOLS_VERSION}.zip"
5256
ENV ANDROID_SDK_TOOLS_DL_URL="https://dl.google.com/android/repository/${ANDROID_SDK_TOOLS_ARCHIVE}"
5357

5458
# download and install Android SDK
55-
RUN curl --location --progress-bar --insecure \
59+
RUN ${RETRY} curl --location --progress-bar --insecure \
5660
"${ANDROID_SDK_TOOLS_DL_URL}" \
5761
--output "${ANDROID_SDK_TOOLS_ARCHIVE}" \
5862
&& mkdir --parents "${ANDROID_SDK_HOME}" \
@@ -65,10 +69,8 @@ RUN mkdir --parents "${ANDROID_SDK_HOME}/.android/" \
6569
> "${ANDROID_SDK_HOME}/.android/repositories.cfg"
6670

6771
# accept Android licenses (JDK necessary!)
68-
RUN apt -y update -qq \
69-
&& apt -y install -qq --no-install-recommends openjdk-8-jdk \
70-
&& apt -y autoremove \
71-
&& apt -y clean
72+
RUN ${RETRY} apt -y install -qq --no-install-recommends openjdk-8-jdk \
73+
&& apt -y autoremove
7274
RUN yes | "${ANDROID_SDK_HOME}/tools/bin/sdkmanager" "build-tools;${ANDROID_SDK_BUILD_TOOLS_VERSION}" > /dev/null
7375

7476
# download platforms, API, build tools
@@ -84,27 +86,23 @@ ENV WORK_DIR="${HOME_DIR}" \
8486
PATH="${HOME_DIR}/.local/bin:${PATH}"
8587

8688
# install system dependencies
87-
RUN apt -y update -qq \
88-
&& apt -y install -qq --no-install-recommends \
89+
RUN ${RETRY} apt -y install -qq --no-install-recommends \
8990
python3 virtualenv python3-pip wget lbzip2 patch sudo \
90-
&& apt -y autoremove \
91-
&& apt -y clean
91+
&& apt -y autoremove
9292

9393
# build dependencies
9494
# https://buildozer.readthedocs.io/en/latest/installation.html#android-on-ubuntu-16-04-64bit
9595
RUN dpkg --add-architecture i386 \
96-
&& apt -y update -qq \
97-
&& apt -y install -qq --no-install-recommends \
96+
&& ${RETRY} apt -y update -qq \
97+
&& ${RETRY} apt -y install -qq --no-install-recommends \
9898
build-essential ccache git python3 python3-dev \
9999
libncurses5:i386 libstdc++6:i386 libgtk2.0-0:i386 \
100100
libpangox-1.0-0:i386 libpangoxft-1.0-0:i386 libidn11:i386 \
101101
zip zlib1g-dev zlib1g:i386 \
102-
&& apt -y autoremove \
103-
&& apt -y clean
102+
&& apt -y autoremove
104103

105104
# specific recipes dependencies (e.g. libffi requires autoreconf binary)
106-
RUN apt -y update -qq \
107-
&& apt -y install -qq --no-install-recommends \
105+
RUN ${RETRY} apt -y install -qq --no-install-recommends \
108106
libffi-dev autoconf automake cmake gettext libltdl-dev libtool pkg-config \
109107
&& apt -y autoremove \
110108
&& apt -y clean

0 commit comments

Comments
 (0)