commit:     6c23cea972914761a0b1d4c79326da9f0352e758
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Thu Nov 26 09:39:13 2015 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Thu Nov 26 09:39:13 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=6c23cea9

main: load all overlays from repos.conf

No code currently uses this, but we'll start to cut over utils.

URL: https://bugs.gentoo.org/553260

 main.c | 23 ++++++++++++++++++-----
 1 file changed, 18 insertions(+), 5 deletions(-)

diff --git a/main.c b/main.c
index c4b9bcc..8c7403b 100644
--- a/main.c
+++ b/main.c
@@ -72,6 +72,8 @@ void init_coredumps(void)
 /* include common library code */
 #include "libq/libq.c"
 
+static DECLARE_ARRAY(overlays);
+
 _q_static
 void no_colors(void)
 {
@@ -424,19 +426,30 @@ contents_entry *contents_parse_line(char *line)
 /* Handle a single file in the repos.conf format. */
 static void read_one_repos_conf(const char *repos_conf)
 {
+       int nsec;
        char *conf;
-       const char *repo, *path;
+       const char *main_repo, *repo, *path;
        dictionary *dict;
 
        dict = iniparser_load(repos_conf);
 
-       repo = iniparser_getstring(dict, "DEFAULT:main-repo", NULL);
-       if (repo) {
+       main_repo = iniparser_getstring(dict, "DEFAULT:main-repo", NULL);
+
+       nsec = iniparser_getnsec(dict);
+       while (nsec-- > 0) {
+               repo = iniparser_getsecname(dict, nsec);
+               if (!strcmp(repo, "DEFAULT"))
+                       continue;
+
                xasprintf(&conf, "%s:location", repo);
                path = iniparser_getstring(dict, conf, NULL);
                if (path) {
-                       free(portdir);
-                       portdir = xstrdup(path);
+                       if (main_repo && !strcmp(repo, main_repo)) {
+                               free(portdir);
+                               portdir = xstrdup(path);
+                       }
+
+                       xarraypush_str(overlays, path);
                }
                free(conf);
        }

Reply via email to