def main(self): BaseCliModule.main(self) if self.global_config.has_option(GLOBALCONFIG_SECTION, "block_tagging"): debug("block_tagging defined in tito.props") error_out("Tagging has been disabled in this git branch.") build_dir = lookup_build_dir(self.user_config) package_name = get_project_name(tag=None) self.pkg_config = self._read_project_config(package_name, build_dir, None, None) tagger_class = None if self.pkg_config.has_option("buildconfig", "tagger"): tagger_class = get_class_by_name(self.pkg_config.get("buildconfig", "tagger")) else: tagger_class = get_class_by_name(self.global_config.get( GLOBALCONFIG_SECTION, DEFAULT_TAGGER)) debug("Using tagger class: %s" % tagger_class) tagger = tagger_class(global_config=self.global_config, keep_version=self.options.keep_version) tagger.run(self.options)
def main(self): BaseCliModule.main(self) build_dir = lookup_build_dir(self.user_config) package_name = get_project_name(tag=self.options.tag) build_tag = None build_version = None # Determine which package version we should build: if self.options.tag: build_tag = self.options.tag build_version = build_tag[len(package_name + "-"):] else: build_version = get_latest_tagged_version(package_name) if build_version == None: error_out(["Unable to lookup latest package info.", "Perhaps you need to tag first?"]) build_tag = "%s-%s" % (package_name, build_version) if not self.options.test: check_tag_exists(build_tag, offline=self.options.offline) self.pkg_config = self._read_project_config(package_name, build_dir, self.options.tag, self.options.no_cleanup) builder = self._create_builder(package_name, build_tag, build_version, self.options, self.pkg_config, build_dir) builder.run(self.options)
def _read_global_config(self): """ Read global build.py configuration from the rel-eng dir of the git repository we're being run from. """ rel_eng_dir = os.path.join(find_git_root(), "rel-eng") filename = os.path.join(rel_eng_dir, GLOBAL_BUILD_PROPS_FILENAME) if not os.path.exists(filename): # HACK: Try the old filename location, pre-tito rename: oldfilename = os.path.join(rel_eng_dir, "global.build.py.props") if not os.path.exists(oldfilename): error_out("Unable to locate branch configuration: %s\nPlease run 'tito init'" % filename) config = ConfigParser.ConfigParser() config.read(filename) # Verify the config contains what we need from it: required_global_config = [ (GLOBALCONFIG_SECTION, DEFAULT_BUILDER), (GLOBALCONFIG_SECTION, DEFAULT_TAGGER), ] for section, option in required_global_config: if not config.has_section(section) or not \ config.has_option(section, option): error_out("%s missing required config: %s %s" % ( filename, section, option)) return config
def _validate_options(self): if self.options.srpm and self.options.rpm: error_out("Cannot combine --srpm and --rpm") if self.options.test and self.options.tag: error_out("Cannot build test version of specific tag.") if (self.options.srpm or self.options.rpm) and self.options.release: error_out("Cannot combine --srpm/--rpm with --release.") if self.options.release and (self.options.cvs_release or self.options.koji_release): error_out(["Cannot combine --cvs-release/--koji-release with --release.", "(--release includes both)"]) if self.options.release and self.options.test: error_out("Cannot combine --release with --test.")