diff --git libpkg/pkg_config.c libpkg/pkg_config.c index ef2d466..3ab4139 100644 --- libpkg/pkg_config.c +++ libpkg/pkg_config.c @@ -379,6 +379,12 @@ static struct config_entry c[] = { NULL, "Save SAT problem to the specified dot file" }, + { + PKG_OBJECT, + "REPOSITORIES", + NULL, + "Repository config in pkg.conf" + }, }; static bool parsed = false; @@ -638,6 +644,20 @@ add_repo(const ucl_object_t *obj, struct pkg_repo *r, const char *rname, pkg_ini } static void +add_repo_obj(const ucl_object_t *obj, const char *file, pkg_init_flags flags) +{ + struct pkg_repo *r; + const char *key; + + key = ucl_object_key(obj); + pkg_debug(1, "PkgConfig: parsing repo key '%s' in file '%s'", key, file); + r = pkg_repo_find(key); + if (r != NULL) + pkg_debug(1, "PkgConfig: overwriting repository %s", key); + add_repo(obj, r, key, flags); +} + +static void walk_repo_obj(const ucl_object_t *obj, const char *file, pkg_init_flags flags) { const ucl_object_t *cur; @@ -1085,6 +1105,11 @@ pkg_ini(const char *path, const char *reposdir, pkg_init_flags flags) /* load the repositories */ load_repositories(reposdir, flags); + object = ucl_object_find_key(config, "REPOSITORIES"); + while ((cur = ucl_iterate_object(object, &it, true))) { + add_repo_obj(cur, path, flags); + } + /* bypass resolv.conf with specified NAMESERVER if any */ nsname = pkg_object_string(pkg_config_get("NAMESERVER")); if (nsname != NULL) {