Gentoo Archives: gentoo-commits

From: Mike Frysinger <vapier@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage-utils:master commit in: /
Date: Thu, 26 Nov 2015 10:39:42
Message-Id: 1448530753.6c23cea972914761a0b1d4c79326da9f0352e758.vapier@gentoo
1 commit: 6c23cea972914761a0b1d4c79326da9f0352e758
2 Author: Mike Frysinger <vapier <AT> gentoo <DOT> org>
3 AuthorDate: Thu Nov 26 09:39:13 2015 +0000
4 Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
5 CommitDate: Thu Nov 26 09:39:13 2015 +0000
6 URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=6c23cea9
7
8 main: load all overlays from repos.conf
9
10 No code currently uses this, but we'll start to cut over utils.
11
12 URL: https://bugs.gentoo.org/553260
13
14 main.c | 23 ++++++++++++++++++-----
15 1 file changed, 18 insertions(+), 5 deletions(-)
16
17 diff --git a/main.c b/main.c
18 index c4b9bcc..8c7403b 100644
19 --- a/main.c
20 +++ b/main.c
21 @@ -72,6 +72,8 @@ void init_coredumps(void)
22 /* include common library code */
23 #include "libq/libq.c"
24
25 +static DECLARE_ARRAY(overlays);
26 +
27 _q_static
28 void no_colors(void)
29 {
30 @@ -424,19 +426,30 @@ contents_entry *contents_parse_line(char *line)
31 /* Handle a single file in the repos.conf format. */
32 static void read_one_repos_conf(const char *repos_conf)
33 {
34 + int nsec;
35 char *conf;
36 - const char *repo, *path;
37 + const char *main_repo, *repo, *path;
38 dictionary *dict;
39
40 dict = iniparser_load(repos_conf);
41
42 - repo = iniparser_getstring(dict, "DEFAULT:main-repo", NULL);
43 - if (repo) {
44 + main_repo = iniparser_getstring(dict, "DEFAULT:main-repo", NULL);
45 +
46 + nsec = iniparser_getnsec(dict);
47 + while (nsec-- > 0) {
48 + repo = iniparser_getsecname(dict, nsec);
49 + if (!strcmp(repo, "DEFAULT"))
50 + continue;
51 +
52 xasprintf(&conf, "%s:location", repo);
53 path = iniparser_getstring(dict, conf, NULL);
54 if (path) {
55 - free(portdir);
56 - portdir = xstrdup(path);
57 + if (main_repo && !strcmp(repo, main_repo)) {
58 + free(portdir);
59 + portdir = xstrdup(path);
60 + }
61 +
62 + xarraypush_str(overlays, path);
63 }
64 free(conf);
65 }