By default, ensure that Chrome is deployed when copying.
Sometimes I've pointed deploy_chrome at the wrong directory and it didn't
notice. This is bad. We should add some checks.
- By default, we enforce that files built by the "chrome" build target are
present.
- With --strict, we enforce that all files are present (including optional
files).
- With --sloppy, we enforce that just one file copied.
Also clean up the Rsync output a bit and checksum files before copying to
avoid unnecessary copies and add unit tests.
BUG=none
TEST=Unit tests. Run with unexpected input.
Change-Id: Ie8f655be6e8181a71827587485c9678807b834a9
Reviewed-on: https://gerrit.chromium.org/gerrit/44430
Commit-Queue: David James <davidjames@chromium.org>
Reviewed-by: David James <davidjames@chromium.org>
Tested-by: David James <davidjames@chromium.org>
diff --git a/scripts/deploy_chrome.py b/scripts/deploy_chrome.py
index d122781..41041b3 100644
--- a/scripts/deploy_chrome.py
+++ b/scripts/deploy_chrome.py
@@ -162,7 +162,8 @@
logging.info('Copying Chrome to device...')
# Show the output (status) for this command.
self.host.Rsync('%s/' % os.path.abspath(self.staging_dir), '/',
- inplace=True, debug_level=logging.INFO)
+ inplace=True, debug_level=logging.INFO,
+ verbose=self.options.verbose)
if self.options.startui:
logging.info('Starting Chrome...')
self.host.RemoteSh('start ui')
@@ -227,12 +228,14 @@
group = optparse.OptionGroup(parser, 'Advanced Options')
group.add_option('-l', '--local-pkg-path', type='path',
help='Path to local chrome prebuilt package to deploy.')
+ group.add_option('--sloppy', action='store_true', default=False,
+ help='Ignore when mandatory artifacts are missing.')
group.add_option('--strict', action='store_true', default=False,
help='Stage artifacts based on the GYP_DEFINES environment '
- 'variable and --staging-flags, if set.')
+ 'variable and --staging-flags, if set. Enforce that '
+ 'all optional artifacts are deployed.')
group.add_option('--staging-flags', default=None, type='gyp_defines',
- help='Requires --strict to be set. Extra flags to '
- 'control staging. Valid flags are - %s'
+ help='Extra flags to control staging. Valid flags are - %s'
% ', '.join(chrome_util.STAGING_FLAGS))
parser.add_option_group(group)
@@ -274,7 +277,9 @@
parser.error('--strict and --staging-flags require --build-dir to be '
'set.')
if options.staging_flags and not options.strict:
- parser.error('--strict requires --staging-flags to be set.')
+ parser.error('--staging-flags requires --strict to be set.')
+ if options.sloppy and options.strict:
+ parser.error('Cannot specify both --strict and --sloppy.')
return options, args
@@ -347,7 +352,8 @@
'bin', os.path.basename(strip_bin))
chrome_util.StageChromeFromBuildDir(
staging_dir, options.build_dir, strip_bin, strict=options.strict,
- gyp_defines=options.gyp_defines, staging_flags=options.staging_flags)
+ sloppy=options.sloppy, gyp_defines=options.gyp_defines,
+ staging_flags=options.staging_flags)
else:
pkg_path = options.local_pkg_path
if options.gs_path: