Beispiel #1
0
def write_repo_config(context, repo, config, path=None):
    path = path or os.path.join(context.dnf.installroot, "etc/yum.repos.d/")

    conf_text = "[%s]\n" % repo
    for key, value in config.items():
        if value:
            conf_text += ("%s=%s\n" % (key, value)).format(repo=repo,
                                                           context=context)

    create_file_with_contents(os.path.join(path, repo + ".repo"), conf_text)
Beispiel #2
0
def write_config(context):
    config_dir = os.path.join(context.dnf.installroot, "etc/dnf")
    ensure_directory_exists(config_dir)

    conf_text = ""
    # sort and put [main] first
    for section, values in \
            sorted(list(context.dnf.config.items()), key=lambda i: "" if i[0] == "[main]" else i[0]):
        conf_text += "%s\n" % section
        for k, v in values.items():
            if v != "":
                conf_text += "%s=%s\n" % (k, v.format(context=context))

    create_file_with_contents(os.path.join(config_dir, "dnf.conf"), conf_text)
Beispiel #3
0
def step_impl(context, filepath):
    full_path = prepend_installroot(context, filepath)
    ensure_directory_exists(os.path.dirname(full_path))
    create_file_with_contents(full_path, context.text.format(context=context))