Merge lp:~pfalcon/linaro-android-build-tools/apt-get-retry into lp:linaro-android-build-tools

Proposed by Paul Sokolovsky
Status: Merged
Approved by: James Tunnicliffe
Approved revision: 423
Merged at revision: 421
Proposed branch: lp:~pfalcon/linaro-android-build-tools/apt-get-retry
Merge into: lp:linaro-android-build-tools
Diff against target: 66 lines (+21/-5)
1 file modified
node/setup-build-android (+21/-5)
To merge this branch: bzr merge lp:~pfalcon/linaro-android-build-tools/apt-get-retry
Reviewer Review Type Date Requested Status
James Tunnicliffe (community) Approve
Linaro Infrastructure Pending
Review via email: mp+95396@code.launchpad.net

Description of the change

Retry apt-get operation in case of failure, protect build lsave setup against non-deterministic EC2 failures.

To post a comment you must log in.
Revision history for this message
James Tunnicliffe (dooferlad) wrote :

Looks good.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'node/setup-build-android'
2--- node/setup-build-android 2012-02-27 16:23:41 +0000
3+++ node/setup-build-android 2012-03-01 16:07:41 +0000
4@@ -1,4 +1,4 @@
5-#!/bin/sh
6+#!/bin/bash
7
8 ###############################################################################
9 # Copyright (c) 2011 Linaro
10@@ -10,6 +10,22 @@
11
12 set -xe
13
14+# Stubborn apt-get, retrying on errors
15+apt-get-retry () {
16+ local delay=1;
17+ while [ $delay -lt 100 ]; do
18+ if apt-get "$@"; then
19+ return
20+ fi
21+ echo "apt-get failed, sleeping ${delay}s before retrying"
22+ sleep $delay
23+ delay=$((delay * 2))
24+ done
25+ echo "apt-get failed after several attempts, aborting"
26+ exit 1
27+}
28+
29+
30 # get latest repo script and install it in PATH
31 #wget http://android.git.kernel.org/repo
32 # Use our mirror of repo
33@@ -20,13 +36,13 @@
34 adduser --system jenkins-build
35
36 sed -i.bk 's,^\(.*://[^.]*.ec2.archive.ubuntu.com\)/,\1.s3.amazonaws.com/,' /etc/apt/sources.list
37-apt-get update
38+apt-get-retry update
39
40 # We do update as part of early node init (to get this script actually)
41 #apt-get update
42
43 # add feature to allow add-apt-repository
44-apt-get install -y python-software-properties unixodbc java-common
45+apt-get-retry install -y python-software-properties unixodbc java-common
46
47 # enable partner repo for sun-java6
48 ##add-apt-repository "deb http://archive.canonical.com/ubuntu maverick partner"
49@@ -45,7 +61,7 @@
50
51 # Install basic development packages
52 # Do not install toolchains and other variable stuff here
53-apt-get install -y \
54+apt-get-retry install -y \
55 zip \
56 curl \
57 texinfo \
58@@ -55,7 +71,7 @@
59 git-core
60
61 # install base stuff for android
62-apt-get install -y \
63+apt-get-retry install -y \
64 gnupg \
65 gperf \
66 zlib1g-dev \

Subscribers

People subscribed via source and target branches