Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(493)

Side by Side Diff: bin/cbuildbot.py

Issue 3165052: Add ability for cbuildbot master to synchronize with cbuildbot slaves. (Closed) Base URL: http://src.chromium.org/git/crosutils.git
Patch Set: Remove extra dep Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | bin/cbuildbot_comm.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 2
3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. 3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 """CBuildbot is wrapper around the build process used by the pre-flight queue""" 7 """CBuildbot is wrapper around the build process used by the pre-flight queue"""
8 8
9 import errno 9 import errno
10 import re
10 import optparse 11 import optparse
11 import os 12 import os
12 import re
13 import shutil
14 import subprocess 13 import subprocess
15 import sys 14 import sys
16 15
16 import cbuildbot_comm
17 from cbuildbot_config import config 17 from cbuildbot_config import config
18 18
19 _DEFAULT_RETRIES = 3 19 _DEFAULT_RETRIES = 3
20 20
21 # ======================== Utility functions ================================ 21 # ======================== Utility functions ================================
22 22
23 def RunCommand(cmd, print_cmd=True, error_ok=False, error_message=None, 23 def RunCommand(cmd, print_cmd=True, error_ok=False, error_message=None,
24 exit_code=False, redirect_stdout=False, redirect_stderr=False, 24 exit_code=False, redirect_stdout=False, redirect_stderr=False,
25 cwd=None, input=None, enter_chroot=False): 25 cwd=None, input=None, enter_chroot=False):
26 """Runs a shell command. 26 """Runs a shell command.
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 chroot_path = os.path.join(buildroot, 'chroot') 364 chroot_path = os.path.join(buildroot, 'chroot')
365 if not os.path.isdir(chroot_path): 365 if not os.path.isdir(chroot_path):
366 _MakeChroot(buildroot) 366 _MakeChroot(buildroot)
367 boardpath = os.path.join(chroot_path, 'build', buildconfig['board']) 367 boardpath = os.path.join(chroot_path, 'build', buildconfig['board'])
368 if not os.path.isdir(boardpath): 368 if not os.path.isdir(boardpath):
369 _SetupBoard(buildroot, board=buildconfig['board']) 369 _SetupBoard(buildroot, board=buildconfig['board'])
370 if buildconfig['uprev']: 370 if buildconfig['uprev']:
371 _UprevPackages(buildroot, revisionfile, board=buildconfig['board']) 371 _UprevPackages(buildroot, revisionfile, board=buildconfig['board'])
372 _Build(buildroot) 372 _Build(buildroot)
373 if buildconfig['uprev']: 373 if buildconfig['uprev']:
374 _UprevPush(buildroot) 374 if buildconfig['master']:
375 _UprevCleanup(buildroot) 375 # Master bot needs to check if the other slaves completed.
376 if cbuildbot_comm.HaveSlavesCompleted(config):
377 _UprevPush(buildroot)
378 _UprevCleanup(buildroot)
379 else:
380 # At least one of the slaves failed or we timed out.
381 _UprevCleanup(buildroot)
382 sys.stderr('CBUILDBOT - One of the slaves has failed!!!')
383 sys.exit(1)
384 else:
385 # Publish my status to the master.
386 cbuildbot_comm.PublishStatus(cbuildbot_comm.STATUS_BUILD_COMPLETE)
387 _UprevCleanup(buildroot)
376 except: 388 except:
377 # something went wrong, cleanup (being paranoid) for next build 389 # Something went wrong, cleanup (being paranoid) for next build.
378 if clobber: 390 if clobber:
379 RunCommand(['sudo', 'rm', '-rf', buildroot], print_cmd=False) 391 RunCommand(['sudo', 'rm', '-rf', buildroot], print_cmd=False)
392 # Send failure to master bot.
393 if not buildconfig['master']:
394 cbuildbot_comm.PublishStatus(cbuildbot_comm.STATUS_BUILD_FAILED)
380 raise 395 raise
381 396
382 397
383 if __name__ == '__main__': 398 if __name__ == '__main__':
384 main() 399 main()
OLDNEW
« no previous file with comments | « no previous file | bin/cbuildbot_comm.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698