Faster checkout and cleanup of old builds.

Change-Id: Id81fe4e7bd9cae7a51a45b6ea8a535c4ea9430f8

BUG=
TEST=Ran locally on top of previous build area.

Review URL: http://codereview.chromium.org/3337007
This commit is contained in:
Chris Sosa 2010-09-02 15:10:48 -07:00
parent ebce8543fc
commit 7de6531962

View File

@ -47,9 +47,13 @@ def RepoSync(buildroot, rw_checkout=False, retries=_DEFAULT_RETRIES):
retries -- Number of retries to try before failing on the sync.
"""
# Get the number of processors to use with repo sync.
num_procs = int(RunCommand('grep -c processor /proc/cpuinfo'.split(),
print_cmd=False, redirect_stdout=True))
while retries > 0:
try:
RunCommand(['repo', 'sync'], cwd=buildroot)
RunCommand(['repo', 'sync', '--jobs=%d' % (num_procs)], cwd=buildroot)
if rw_checkout:
# Always re-run in case of new git repos or repo sync
# failed in a previous run because of a forced Stop Build.
@ -238,7 +242,12 @@ def _Build(buildroot):
cwd = os.path.join(buildroot, 'src', 'scripts')
RunCommand(['./build_packages'], cwd=cwd, enter_chroot=True)
def _WipeOldOutput(buildroot):
RunCommand(['rm', '-rf', 'src/build/images'], cwd=buildroot)
def _BuildImage(buildroot):
_WipeOldOutput(buildroot)
cwd = os.path.join(buildroot, 'src', 'scripts')
RunCommand(['./build_image', '--replace'], cwd=cwd, enter_chroot=True)