From 82047a9d4820ec34fd35b627c7e87e8fcc436994 Mon Sep 17 00:00:00 2001 From: Chris Sosa Date: Thu, 12 Aug 2010 10:07:35 -0700 Subject: [PATCH] Add some information to cbuildbot output. TEST=Ran cbuildbot locally. Review URL: http://codereview.chromium.org/3137006 Change-Id: I8c80334480a4a2e4bb32234d323c0b129bed4692 --- bin/cbuildbot.py | 20 +++++++++++++++----- bin/cbuildbot_config.py | 6 ++++++ 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/bin/cbuildbot.py b/bin/cbuildbot.py index 046ba2c11d..5bcb047880 100755 --- a/bin/cbuildbot.py +++ b/bin/cbuildbot.py @@ -1,10 +1,15 @@ #!/usr/bin/python +# Copyright (c) 2010 The Chromium OS Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + import errno import optparse import os import shutil import subprocess +import sys from cbuildbot_config import config @@ -13,8 +18,8 @@ from cbuildbot_config import config def RunCommand(cmd, error_ok=False, error_message=None, exit_code=False, redirect_stdout=False, redirect_stderr=False, cwd=None, input=None): - # Useful for debugging: - # print >>sys.stderr, "RunCommand:", ' '.join(cmd) + # Print out the command before running. + print >>sys.stderr, "CBUILDBOT -- RunCommand:", ' '.join(cmd) if redirect_stdout: stdout = subprocess.PIPE else: @@ -104,7 +109,8 @@ def _GetConfig(config_name): def main(): # Parse options - parser = optparse.OptionParser() + usage = "usage: %prog [options] cbuildbot_config" + parser = optparse.OptionParser(usage=usage) parser.add_option('-r', '--buildroot', help='root directory where build occurs', default=".") parser.add_option('-n', '--buildnumber', @@ -112,8 +118,12 @@ def main(): (options, args) = parser.parse_args() buildroot = options.buildroot - buildconfig = _GetConfig(args[0]) - + if len(args) == 1: + buildconfig = _GetConfig(args[0]) + else: + print >>sys.stderr, "Missing configuration description" + parser.print_usage() + sys.exit(1) try: if not os.path.isdir(buildroot): _FullCheckout(buildroot) diff --git a/bin/cbuildbot_config.py b/bin/cbuildbot_config.py index a7e71dd6d2..2528a73dff 100644 --- a/bin/cbuildbot_config.py +++ b/bin/cbuildbot_config.py @@ -1,3 +1,9 @@ +#!/usr/bin/python + +# Copyright (c) 2010 The Chromium OS Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + config = {} config['default'] = { 'board' : 'x86-generic',