def main(): """The main function allows converting a git repo the is stup for "normal" tito to use classed defined here instead """ options = parse_args() rel_eng_dir = os.path.join(find_git_root(), tito_config_dir()) releasers_filename = os.path.join(rel_eng_dir, RELEASERS_CONF_FILENAME) releasers_config = RawConfigParser() releasers_config.read(releasers_filename) print("Read configuration file: {0}".format(releasers_filename)) for section in releasers_config.sections(): print(" found section: {0}".format(section)) if releasers_config.has_option(section, 'releaser'): old_releaser = releasers_config.get(section, 'releaser') print(" releaser is set to: {0}".format(old_releaser)) if old_releaser.startswith('tito.release.'): new_releaser = old_releaser.replace('tito.release.', 'mocktito.', 1) print(" replaced with: {0}".format(new_releaser)) releasers_config.set(section, 'releaser', new_releaser) elif old_releaser.startswith('mocktito.'): pass else: stderr.write("Found a releaser type I don't know, aborting\n") exit(1) if options.extra_yum_repos: print(" adding extra yum repos") releasers_config.set(section, EXTRA_YUM_REPOS, "\n".join(options.extra_yum_repos)) if options.extra_yum_repos_for: print(" adding extra yum repos for branches") releasers_config.set(section, EXTRA_YUM_REPOS_FOR, json.dumps(options.extra_yum_repos_for)) with open(releasers_filename, 'w') as rfp: releasers_config.write(rfp)
def main(): """The main function allows converting a git repo the is stup for "normal" tito to use classed defined here instead """ options = parse_args() rel_eng_dir = os.path.join(find_git_root(), tito_config_dir()) releasers_filename = os.path.join(rel_eng_dir, RELEASERS_CONF_FILENAME) releasers_config = RawConfigParser() releasers_config.read(releasers_filename) print("Read configuration file: {0}".format(releasers_filename)) for section in releasers_config.sections(): print(" found section: {0}".format(section)) if releasers_config.has_option(section, "releaser"): old_releaser = releasers_config.get(section, "releaser") print(" releaser is set to: {0}".format(old_releaser)) if old_releaser.startswith("tito.release."): new_releaser = old_releaser.replace("tito.release.", "mocktito.", 1) print(" replaced with: {0}".format(new_releaser)) releasers_config.set(section, "releaser", new_releaser) elif old_releaser.startswith("mocktito."): pass else: stderr.write("Found a releaser type I don't know, aborting\n") exit(1) if options.extra_yum_repos: print(" adding extra yum repos") releasers_config.set(section, EXTRA_YUM_REPOS, "\n".join(options.extra_yum_repos)) if options.extra_yum_repos_for: print(" adding extra yum repos for branches") releasers_config.set(section, EXTRA_YUM_REPOS_FOR, json.dumps(options.extra_yum_repos_for)) with open(releasers_filename, "w") as rfp: releasers_config.write(rfp)
def _read_releaser_config(self): """ Read the releaser targets from .tito/releasers.conf. """ rel_eng_dir = os.path.join(find_git_root(), tito_config_dir()) filename = os.path.join(rel_eng_dir, RELEASERS_CONF_FILENAME) config = RawConfigParser() config.read(filename) return config
def _read_config(self): """ Read global build.py configuration from the .tito dir of the git repository we're being run from. NOTE: We always load the latest config file, not tito.props as it was for the tag being operated on. """ # List of filepaths to config files we'll be loading: rel_eng_dir = os.path.join(find_git_root(), tito_config_dir()) filename = os.path.join(rel_eng_dir, TITO_PROPS) if not os.path.exists(filename): error_out("Unable to locate branch configuration: %s" "\nPlease run 'tito init'" % filename) # Load the global config. Later, when we know what tag/package we're # building, we may also load that and potentially override some global # settings. config = RawConfigParser() config.read(filename) self._check_legacy_globalconfig(config) return config