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)