Specify location of 'repo' tool during 'repo init'
This is to prevent 'repo' from failing when kernel.org is down.
BUG=chromium-os:15128
TEST=Ran trybot on empty buildroot and with an existing buildroot that
requires re-initialization.
Integration of changes http://gerrit.chromium.org/gerrit/#change,7111
and http://gerrit.chromium.org/gerrit/#change,7120 from TOT.
Change-Id: Iae203575d9cf377cc72a87aa5998a5f707b52f26
Reviewed-on: http://gerrit.chromium.org/gerrit/7213
Reviewed-by: Chris Sosa <sosa@chromium.org>
Tested-by: Ryan Cui <rcui@chromium.org>
diff --git a/buildbot/cbuildbot_commands.py b/buildbot/cbuildbot_commands.py
index bb4439e..127baa6 100644
--- a/buildbot/cbuildbot_commands.py
+++ b/buildbot/cbuildbot_commands.py
@@ -184,8 +184,9 @@
cros_lib.OldRunCommand(['sudo', 'rm', '-rf', buildroot])
os.makedirs(buildroot)
branch = tracking_branch.split('/');
- cros_lib.OldRunCommand(['repo', 'init', '-q', '-u', url, '-b',
- '%s' % branch[-1]], cwd=buildroot, input='\n\ny\n')
+ cros_lib.OldRunCommand(['repo', 'init', '--repo-url', constants.REPO_URL,
+ '-q', '-u', url, '-b',
+ '%s' % branch[-1]], cwd=buildroot, input='\n\ny\n')
_RepoSync(buildroot, retries)
diff --git a/buildbot/constants.py b/buildbot/constants.py
index 92d267b..7f3e6b9 100644
--- a/buildbot/constants.py
+++ b/buildbot/constants.py
@@ -9,3 +9,5 @@
# This is only true on buildbots
CROSTOOLS_DIR = os.path.join(os.path.dirname(__file__), '..', '..', 'crostools')
+
+REPO_URL = 'http://git.chromium.org/external/repo.git'
diff --git a/buildbot/repository.py b/buildbot/repository.py
index 882ba3e..42713fb 100755
--- a/buildbot/repository.py
+++ b/buildbot/repository.py
@@ -6,6 +6,7 @@
Repository module to handle different types of repositories the Builders use.
"""
+import constants
import filecmp
import logging
import os
@@ -29,6 +30,8 @@
clobber: Clobbers the directory as part of initialization.
"""
DEFAULT_MANIFEST = 'default'
+ # Use our own repo, in case android.kernel.org (the default location) is down.
+ _INIT_CMD = ['repo', 'init', '--repo-url', constants.REPO_URL]
def __init__(self, repo_url, directory, branch=None, clobber=False):
self.repo_url = repo_url
@@ -43,7 +46,7 @@
assert not os.path.exists(os.path.join(self.directory, '.repo')), \
'Repo already initialized.'
# Base command.
- init_cmd = ['repo', 'init', '--manifest-url', self.repo_url]
+ init_cmd = self._INIT_CMD + ['--manifest-url', self.repo_url]
# Handle branch / manifest options.
if self.branch: init_cmd.extend(['--manifest-branch', self.branch])
@@ -64,7 +67,7 @@
# If no manifest passed in, assume default.
if local_manifest == self.DEFAULT_MANIFEST:
- cros_lib.RunCommand(['repo', 'init', '--manifest-name=default.xml'],
+ cros_lib.RunCommand(self._INIT_CMD + ['--manifest-name=default.xml'],
cwd=self.directory, input='\n\ny\n')
else:
# The 10x speed up magic.
@@ -84,7 +87,7 @@
self._ReinitializeIfNecessary(local_manifest)
- cros_lib.OldRunCommand(['repo', 'sync', '--quiet', '--jobs', '8'],
+ cros_lib.OldRunCommand(['repo', 'sync', '--jobs', '8'],
cwd=self.directory, num_retries=2)
except cros_lib.RunCommandError, e:
err_msg = 'Failed to sync sources %s' % e.message