void
ModulePackageContainer::add(DnfSack * sack)
{
    Pool * pool = dnf_sack_get_pool(sack);
    LibsolvRepo * r;
    Id id;

    FOR_REPOS(id, r) {
        HyRepo hyRepo = static_cast<HyRepo>(r->appdata);
        auto modules_fn = hy_repo_get_string(hyRepo, MODULES_FN);
        if (!modules_fn) {
            continue;
        }
        std::string yamlContent = getFileContent(modules_fn);
        auto repoName = hy_repo_get_string(hyRepo, HY_REPO_NAME);
        add(yamlContent, repoName);
        // update defaults from repo
        try {
            pImpl->defaultConteiner.fromString(yamlContent, 0);
        } catch (const ModuleDefaultsContainer::ConflictException & exception) {
            throw ModuleDefaultsContainer::ConflictException(
                tfm::format(_("Conflicting defaults with repo '%s': %s"), repoName,
                            exception.what()));
        }
    }
示例#2
0
文件: repo-py.cpp 项目: edynox/libhif
static PyObject *
get_str(_RepoObject *self, void *closure)
{
    int str_key = (intptr_t)closure;
    const char *str;
    PyObject *ret;

    str = hy_repo_get_string(self->repo, str_key);
    if (str == NULL) {
        ret = PyString_FromString("");
    } else {
        ret = PyString_FromString(str);
    }
    return ret; // NULL if PyString_FromString failed
}