commit:     f1c5463c944bb646ac1bdf61dd5a74f64dcaa33b
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Mon Dec 27 18:12:06 2021 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Mon Dec 27 18:12:06 2021 +0000
URL:        https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=f1c5463c

qmerge: resolve user sets from etc/portage/sets

Based on suggested patch from Barnabás Virágh in bug #816237.  Look
inside sets subdir.  While at it, accept @-prefixed syntax, e.g. @world.

Bug: https://bugs.gentoo.org/816237
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>

 qmerge.c | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/qmerge.c b/qmerge.c
index 1ad7179..75f03c0 100644
--- a/qmerge.c
+++ b/qmerge.c
@@ -1928,10 +1928,14 @@ qmerge_add_set_system(void *data, char *buf)
 static set *
 qmerge_add_set(char *buf, set *q)
 {
-       if (strcmp(buf, "world") == 0)
+       /* accept @world next to just "world" */
+       if (*buf == '@')
+               buf++;
+
+       if (strcmp(buf, "world") == 0) {
                return qmerge_add_set_file(CONFIG_EPREFIX, "/var/lib/portage",
-                               "world", q);
-       else if (strcmp(buf, "all") == 0) {
+                                                                  "world", q);
+       } else if (strcmp(buf, "all") == 0) {
                tree_ctx *ctx = tree_open_vdb(portroot, portvdb);
                set *ret = NULL;
                if (ctx != NULL) {
@@ -1939,12 +1943,13 @@ qmerge_add_set(char *buf, set *q)
                        tree_close(ctx);
                }
                return ret;
-       } else if (strcmp(buf, "system") == 0)
+       } else if (strcmp(buf, "system") == 0) {
                return q_profile_walk("packages", qmerge_add_set_system, q);
-       else if (buf[0] == '@')
+       } else if (buf[0] == '@') {
                /* TODO: use configroot */
-               return qmerge_add_set_file(CONFIG_EPREFIX, "/etc/portage", 
buf+1, q);
-       else {
+               return qmerge_add_set_file(CONFIG_EPREFIX,
+                                                                  
"/etc/portage/sets", buf+1, q);
+       } else {
                rmspace(buf);
                return add_set(buf, q);
        }

Reply via email to