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

Unified Diff: bin/cbuildbot.py

Issue 3174021: Add a flag to pick up timestamp of commits and print information if found. (Closed) Base URL: ssh://git@chromiumos-git//crosutils.git
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bin/cbuildbot.py
diff --git a/bin/cbuildbot.py b/bin/cbuildbot.py
index 9ea7270ee29c5b121e0d97c3e757babe28b3f0f9..66c4871d5277a029314ca9b618128569e4892935 100755
--- a/bin/cbuildbot.py
+++ b/bin/cbuildbot.py
@@ -17,11 +17,12 @@ _DEFAULT_RETRIES=3
# Utility functions
-def RunCommand(cmd, error_ok=False, error_message=None, exit_code=False,
- redirect_stdout=False, redirect_stderr=False, cwd=None,
- input=None):
+def RunCommand(cmd, print_cmd=True, error_ok=False, error_message=None,
+ exit_code=False, redirect_stdout=False, redirect_stderr=False,
+ cwd=None, input=None):
# Print out the command before running.
- print >>sys.stderr, "CBUILDBOT -- RunCommand:", ' '.join(cmd)
+ if print_cmd:
+ print >> sys.stderr, "CBUILDBOT -- RunCommand:", ' '.join(cmd)
if redirect_stdout:
stdout = subprocess.PIPE
else:
@@ -47,7 +48,7 @@ def RunCommand(cmd, error_ok=False, error_message=None, exit_code=False,
def MakeDir(path, parents=False):
try:
os.makedirs(path)
- except OSError,e:
+ except OSError, e:
if e.errno == errno.EEXIST and parents:
pass
else:
@@ -100,12 +101,26 @@ def _Build(buildroot):
cwd = os.path.join(buildroot, 'src', 'scripts')
RunCommand(['./build_packages'], cwd=cwd)
-def _UprevPackages(buildroot):
+def _UprevAllPackages(buildroot):
cwd = os.path.join(buildroot, 'src', 'scripts')
RunCommand(['./enter_chroot.sh', '--', './cros_mark_all_as_stable',
'--tracking_branch="cros/master"'],
cwd=cwd)
+def _UprevPackages(buildroot, revisionfile):
+ revisions = None
+ if (revision_file):
+ rev_file = revisionfile.open(revisionfile)
+ revisions = rev_file.read()
+ rev_file.close()
+
+ # Note: Revisions == "None" indicates a Force Build.
+ if revisions and revisions != 'None':
+ print 'CBUILDBOT - Revision list found %s' % revisions
+ print 'Revision list not yet propagating to build, marking all instead'
+
+ _UprevAllPackages(buildroot)
+
def _UprevCleanup(buildroot):
cwd = os.path.join(buildroot, 'src', 'scripts')
RunCommand(['./cros_mark_as_stable', '--srcroot=..',
@@ -137,13 +152,21 @@ def main():
help='root directory where build occurs', default=".")
parser.add_option('-n', '--buildnumber',
help='build number', type='int', default=0)
+ parser.add_option('-f', '--revisionfile',
+ help='file where new revisions are stored')
+ parser.add_option('--noclobber', action='store_false', dest='clobber',
+ default=True,
+ help='Disables clobbering the buildroot on failure')
(options, args) = parser.parse_args()
buildroot = options.buildroot
+ revisionfile = options.revisionfile
+ clobber = options.clobber
+
if len(args) == 1:
buildconfig = _GetConfig(args[0])
else:
- print >>sys.stderr, "Missing configuration description"
+ print >> sys.stderr, "Missing configuration description"
parser.print_usage()
sys.exit(1)
try:
@@ -158,14 +181,15 @@ def main():
if not os.path.isdir(boardpath):
_SetupBoard(buildroot, board=buildconfig['board'])
if buildconfig['uprev']:
- _UprevPackages(buildroot)
+ _UprevPackages(buildroot, revisionfile)
_Build(buildroot)
if buildconfig['uprev']:
_UprevPush(buildroot)
_UprevCleanup(buildroot)
except:
# something went wrong, cleanup (being paranoid) for next build
- RunCommand(['sudo', 'rm', '-rf', buildroot])
+ if clobber:
+ RunCommand(['sudo', 'rm', '-rf', buildroot], print_cmd=False)
raise
if __name__ == '__main__':
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698