Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/devbot
diff options
context:
space:
mode:
Diffstat (limited to 'devbot')
-rw-r--r--devbot/build.py5
-rw-r--r--devbot/command.py24
2 files changed, 22 insertions, 7 deletions
diff --git a/devbot/build.py b/devbot/build.py
index 097ab08..b04989f 100644
--- a/devbot/build.py
+++ b/devbot/build.py
@@ -70,11 +70,12 @@ def pull_source(module):
os.chdir(module_dir)
command.run(["git", "remote", "set-url", "origin", module["repo"]])
- command.run(["git", "remote", "update", "origin"])
+ command.run(["git", "remote", "updat", "origin"], retry=10)
else:
os.chdir(config.source_dir)
command.run(["git", "clone", "--progress",
- module["repo"], module["name"]])
+ module["repo"], module["name"]],
+ retry=10)
os.chdir(module_dir)
branch = module.get("branch", "master")
diff --git a/devbot/command.py b/devbot/command.py
index 9a39a06..9a8b5e2 100644
--- a/devbot/command.py
+++ b/devbot/command.py
@@ -1,12 +1,26 @@
import subprocess
+import time
-def run(args, test=False):
+def run(args, test=False, retry=0):
print " ".join(args)
- if not test:
- subprocess.check_call(args)
+ if test:
+ return
-def run_with_sudo(args, test=False):
+ tries = 0
+ while tries < retry + 1:
+ try:
+ tries = tries + 1
+ subprocess.check_call(args)
+ return
+ except subprocess.CalledProcessError, e:
+ if tries < retry + 1:
+ print "Retrying (attempt %d) in 1 minute" % tries
+ time.sleep(60)
+ else:
+ raise e
+
+def run_with_sudo(args, test=False, retry=0):
args_with_sudo = ["sudo"]
args_with_sudo.extend(args)
- run(args_with_sudo, test=test)
+ run(args_with_sudo, test=test, retry=retry)