aboutsummaryrefslogtreecommitdiff
path: root/build_chromeos.py
diff options
context:
space:
mode:
authorCaroline Tice <cmtice@google.com>2017-04-06 17:16:05 -0700
committerchrome-bot <chrome-bot@chromium.org>2017-04-08 19:40:20 -0700
commitf6ef4395fe1896ba68c80e52cb24763b0fcfe7f8 (patch)
tree7612123711db98f0746e56b66368d16b388192bd /build_chromeos.py
parent8c18be1425c8a4ecfc059a7c637fc93f33edab1f (diff)
downloadtoolchain-utils-f6ef4395fe1896ba68c80e52cb24763b0fcfe7f8.tar.gz
[toolchain-utils] Fix remaining lint errors in toolchain-utils.
In addition to fixing the lint errors, this also fixes the Python formatting issues (ran tc_pyformat on nearly all the files). BUG=chromium:570450 TEST=Ran all crosperf & bisect tool unit tests. Ran afe_lock_machine.py (check machine status) Ran full crosperf test (octane, speedometer, BootPerf) on alex. Change-Id: Ic86f9192801ac67769f3de30f1c5f0d203ce0831 Reviewed-on: https://chromium-review.googlesource.com/471886 Commit-Ready: Caroline Tice <cmtice@chromium.org> Tested-by: Caroline Tice <cmtice@chromium.org> Reviewed-by: Manoj Gupta <manojgupta@chromium.org>
Diffstat (limited to 'build_chromeos.py')
-rwxr-xr-xbuild_chromeos.py167
1 files changed, 87 insertions, 80 deletions
diff --git a/build_chromeos.py b/build_chromeos.py
index cb68fd00..6b4f4dcd 100755
--- a/build_chromeos.py
+++ b/build_chromeos.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python2
+#!/usr/bin/env python2
#
# Copyright 2010 Google Inc. All Rights Reserved.
"""Script to checkout the ChromeOS source.
@@ -35,73 +35,81 @@ def Main(argv):
cmd_executer = command_executer.GetCommandExecuter()
parser = argparse.ArgumentParser()
- parser.add_argument('--chromeos_root',
- dest='chromeos_root',
- help='Target directory for ChromeOS installation.')
- parser.add_argument('--clobber_chroot',
- dest='clobber_chroot',
- action='store_true',
- help='Delete the chroot and start fresh',
- default=False)
- parser.add_argument('--clobber_board',
- dest='clobber_board',
- action='store_true',
- help='Delete the board and start fresh',
- default=False)
- parser.add_argument('--rebuild',
- dest='rebuild',
- action='store_true',
- help='Rebuild all board packages except the toolchain.',
- default=False)
- parser.add_argument('--cflags',
- dest='cflags',
- default='',
- help='CFLAGS for the ChromeOS packages')
- parser.add_argument('--cxxflags',
- dest='cxxflags',
- default='',
- help='CXXFLAGS for the ChromeOS packages')
- parser.add_argument('--ldflags',
- dest='ldflags',
- default='',
- help='LDFLAGS for the ChromeOS packages')
- parser.add_argument('--board',
- dest='board',
- help='ChromeOS target board, e.g. x86-generic')
- parser.add_argument('--package',
- dest='package',
- help='The package needs to be built')
- parser.add_argument('--label',
- dest='label',
- help='Optional label symlink to point to build dir.')
- parser.add_argument('--dev',
- dest='dev',
- default=False,
- action='store_true',
- help=('Make the final image in dev mode (eg writable, '
- 'more space on image). Defaults to False.'))
- parser.add_argument('--debug',
- dest='debug',
- default=False,
- action='store_true',
- help=("Optional. Build chrome browser with \"-g -O0\". "
- "Notice, this also turns on \'--dev\'. "
- 'Defaults to False.'))
- parser.add_argument('--env',
- dest='env',
- default='',
- help='Env to pass to build_packages.')
- parser.add_argument('--vanilla',
- dest='vanilla',
- default=False,
- action='store_true',
- help='Use default ChromeOS toolchain.')
- parser.add_argument('--vanilla_image',
- dest='vanilla_image',
- default=False,
- action='store_true',
- help=('Use prebuild packages for building the image. '
- 'It also implies the --vanilla option is set.'))
+ parser.add_argument(
+ '--chromeos_root',
+ dest='chromeos_root',
+ help='Target directory for ChromeOS installation.')
+ parser.add_argument(
+ '--clobber_chroot',
+ dest='clobber_chroot',
+ action='store_true',
+ help='Delete the chroot and start fresh',
+ default=False)
+ parser.add_argument(
+ '--clobber_board',
+ dest='clobber_board',
+ action='store_true',
+ help='Delete the board and start fresh',
+ default=False)
+ parser.add_argument(
+ '--rebuild',
+ dest='rebuild',
+ action='store_true',
+ help='Rebuild all board packages except the toolchain.',
+ default=False)
+ parser.add_argument(
+ '--cflags',
+ dest='cflags',
+ default='',
+ help='CFLAGS for the ChromeOS packages')
+ parser.add_argument(
+ '--cxxflags',
+ dest='cxxflags',
+ default='',
+ help='CXXFLAGS for the ChromeOS packages')
+ parser.add_argument(
+ '--ldflags',
+ dest='ldflags',
+ default='',
+ help='LDFLAGS for the ChromeOS packages')
+ parser.add_argument(
+ '--board', dest='board', help='ChromeOS target board, e.g. x86-generic')
+ parser.add_argument(
+ '--package', dest='package', help='The package needs to be built')
+ parser.add_argument(
+ '--label',
+ dest='label',
+ help='Optional label symlink to point to build dir.')
+ parser.add_argument(
+ '--dev',
+ dest='dev',
+ default=False,
+ action='store_true',
+ help=('Make the final image in dev mode (eg writable, '
+ 'more space on image). Defaults to False.'))
+ parser.add_argument(
+ '--debug',
+ dest='debug',
+ default=False,
+ action='store_true',
+ help=("Optional. Build chrome browser with \"-g -O0\". "
+ "Notice, this also turns on \'--dev\'. "
+ 'Defaults to False.'))
+ parser.add_argument(
+ '--env', dest='env', default='', help='Env to pass to build_packages.')
+ parser.add_argument(
+ '--vanilla',
+ dest='vanilla',
+ default=False,
+ action='store_true',
+ help='Use default ChromeOS toolchain.')
+ parser.add_argument(
+ '--vanilla_image',
+ dest='vanilla_image',
+ default=False,
+ action='store_true',
+ help=('Use prebuild packages for building the image. '
+ 'It also implies the --vanilla option is set.'))
options = parser.parse_args(argv[1:])
@@ -137,9 +145,7 @@ def Main(argv):
build_packages_env, {'USE': 'chrome_internal afdo_use'})
build_packages_command = misc.GetBuildPackagesCommand(
- board=options.board,
- usepkg=options.vanilla_image,
- debug=options.debug)
+ board=options.board, usepkg=options.vanilla_image, debug=options.debug)
if options.package:
build_packages_command += ' {0}'.format(options.package)
@@ -147,9 +153,10 @@ def Main(argv):
build_image_command = misc.GetBuildImageCommand(options.board, options.dev)
if options.vanilla or options.vanilla_image:
- command = misc.GetSetupBoardCommand(options.board,
- usepkg=options.vanilla_image,
- force=options.clobber_board)
+ command = misc.GetSetupBoardCommand(
+ options.board,
+ usepkg=options.vanilla_image,
+ force=options.clobber_board)
command += '; ' + build_packages_env + ' ' + build_packages_command
command += '&& ' + build_packages_env + ' ' + build_image_command
ret = cmd_executer.ChrootRunCommand(options.chromeos_root, command)
@@ -237,10 +244,10 @@ def Main(argv):
"LDFLAGS=\"$(portageq-%s envvar LDFLAGS) %s\" "
'CHROME_ORIGIN=SERVER_SOURCE '
'%s '
- '%s --skip_chroot_upgrade' % (options.board, options.cflags,
- options.board, options.cxxflags,
- options.board, options.ldflags,
- build_packages_env, build_packages_command))
+ '%s --skip_chroot_upgrade' %
+ (options.board, options.cflags, options.board, options.cxxflags,
+ options.board, options.ldflags, build_packages_env,
+ build_packages_command))
logger.GetLogger().LogFatalIf(ret, 'build_packages failed')
if options.package:
@@ -269,8 +276,8 @@ def Main(argv):
os.path.dirname(real_image_dir_path), options.label))
ret = cmd_executer.RunCommand(command)
- logger.GetLogger().LogFatalIf(ret, 'Failed to apply symlink label %s' %
- options.label)
+ logger.GetLogger().LogFatalIf(
+ ret, 'Failed to apply symlink label %s' % options.label)
return ret