def _GetNewestManifestVersion(self): """Gets the latest uploaded SDK version. Returns: Version number in the format '3929.0.0'. """ branch = git.GetChromiteTrackingBranch() version_file = '%s/LATEST-%s' % (self.gs_base, branch) full_version = self.gs_ctx.Cat(version_file).output assert full_version.startswith('R') return full_version.split('-')[1]
def _GetBootstrapStage(self): """Constructs and returns the BootStrapStage object. We return None when there are no chromite patches to test, and --test-bootstrap wasn't passed in. """ stage = None patches_needed = sync_stages.BootstrapStage.BootstrapPatchesNeeded( self._run, self.patch_pool) chromite_branch = git.GetChromiteTrackingBranch() if (patches_needed or self._run.options.test_bootstrap or chromite_branch != self._run.options.branch): stage = sync_stages.BootstrapStage(self._run, self.patch_pool) return stage
def testFactoryFirmwareValidity(self): """Ensures that firmware/factory branches have at least 1 valid name.""" tracking_branch = git.GetChromiteTrackingBranch() for branch in ['firmware', 'factory']: if tracking_branch.startswith(branch): saw_config_for_branch = False for build_name in self.all_configs: if build_name.endswith('-%s' % branch): self.assertFalse('release' in build_name, 'Factory|Firmware release builders should not ' 'contain release in their name.') saw_config_for_branch = True self.assertTrue( saw_config_for_branch, 'No config found for %s branch. ' 'As this is the %s branch, all release configs that are being used ' 'must end in %s.' % (branch, tracking_branch, branch))
def _GetNewestFullVersion(self, version=None): """Gets the full version number of the latest build for the given |version|. Args: version: The version number or branch to look at. By default, look at builds on the current branch. Returns: Version number in the format 'R30-3929.0.0'. """ if version is None: version = git.GetChromiteTrackingBranch() version_file = '%s/LATEST-%s' % (self.gs_base, version) try: full_version = self.gs_ctx.Cat(version_file) assert full_version.startswith('R') return full_version except gs.GSNoSuchKey: return None
def _PostParseCheck(parser, options, site_config): """Perform some usage validation after we've parsed the arguments Args: parser: Option parser that was used to parse arguments. options: The options returned by optparse. site_config: config_lib.SiteConfig containing all config info. """ if not options.branch: options.branch = git.GetChromiteTrackingBranch() # Because the default cache dir depends on other options, FindCacheDir # always returns None, and we setup the default here. if options.cache_dir is None: # Note, options.sourceroot is set regardless of the path # actually existing. options.cache_dir = os.path.join(options.buildroot, '.cache') options.cache_dir = os.path.abspath(options.cache_dir) parser.ConfigureCacheDir(options.cache_dir) osutils.SafeMakedirsNonRoot(options.cache_dir) # Ensure that all args are legitimate config targets. if options.build_config_name not in site_config: cros_build_lib.Die('Unkonwn build config: "%s"' % options.build_config_name) build_config = site_config[options.build_config_name] is_payloads_build = build_config.build_type == constants.PAYLOADS_TYPE if options.channels and not is_payloads_build: cros_build_lib.Die('--channel must only be used with a payload config,' ' not target (%s).' % options.build_config_name) if not options.channels and is_payloads_build: cros_build_lib.Die( 'payload configs (%s) require --channel to do anything' ' useful.' % options.build_config_name) # If the build config explicitly forces the debug flag, set the debug flag # as if it was set from the command line. if build_config.debug: options.debug = True if not (config_lib.isTryjobConfig(build_config) or options.buildbot): cros_build_lib.Die( 'Refusing to run non-tryjob config as a tryjob.\n' 'Please "repo sync && cros tryjob --list %s" for alternatives.\n' 'See go/cros-explicit-tryjob-build-configs-psa.', build_config.name) # 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. if (options.force_version and not (options.buildbot or build_config.internal)): cros_build_lib.Die('Cannot specify --version without --buildbot for an' ' external target (%s).' % options.build_config_name)