cbuildbot: Early error if --version without --buildbot for external target.
If cbuildbot is run with --version and without --buildbot for an
external target then it fails in the ManifestVersionedSync stage. The
reason is that the external source's manifest-versions checkout is not
fully populated. In particular, it is missing the contents of the
buildspecs directory that is needed to determine the Chrome branch/version
for a particular ChromeOS version.
This change gives a clear error message at the start of cbuildbot if the
options are not compatible.
BUG=chromium:311648
TEST=`buildbot/run_tests`
TEST=`bin/cbuildbot --remote --debug --version 4866.0.0 x86-generic-asan`
gives error.
TEST=`bin/cbuildbot --remote --debug --version 4866.0.0
mario-incremental` does not give error.
TEST=`bin/cbuildbot --remote --buildbot --debug x86-generic-paladin`
runs through.
Change-Id: I08df1c4616764569ef32578495a415c16fd6a346
Reviewed-on: https://chromium-review.googlesource.com/182925
Reviewed-by: Matt Tennant <mtennant@chromium.org>
Commit-Queue: Matt Tennant <mtennant@chromium.org>
Tested-by: Matt Tennant <mtennant@chromium.org>
diff --git a/scripts/cbuildbot.py b/scripts/cbuildbot.py
index eb2e5ec..ca0ea0f 100644
--- a/scripts/cbuildbot.py
+++ b/scripts/cbuildbot.py
@@ -1410,10 +1410,21 @@
# Ensure that all args are legitimate config targets.
invalid_target = False
for arg in args:
- if not _GetConfig(arg):
+ build_config = _GetConfig(arg)
+ if not build_config:
cros_build_lib.Error('No such configuraton target: "%s".', arg)
invalid_target = True
+ # The --version option is not compatible with an external target unless the
+ # --buildbot option is specified. More correctly, only "paladin versions"
+ # will work with external targets, and those are only used with --buildbot.
+ # If --buildbot is specified, then user should know what they are doing and
+ # only specify a version that will work. See crbug.com/311648.
+ elif options.force_version and not options.buildbot:
+ if not build_config.internal:
+ cros_build_lib.Die('Cannot specify --version without --buildbot for an'
+ ' external target (%s).' % arg)
+
if invalid_target:
print 'Please specify one of:'
_PrintValidConfigs()