commit:     4a767991a765dcdacdd3c3239aec8c17356b9dd7
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Sat May 11 09:11:50 2019 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Sat May 11 09:11:50 2019 +0000
URL:        https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=4a767991

libq/tree: make tree_get_atom split SLOT if appropriate

Now SLOT and SUBSLOT are true different things, ensure we parse it
properly.

Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>

 libq/tree.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/libq/tree.c b/libq/tree.c
index 8384458..0659426 100644
--- a/libq/tree.c
+++ b/libq/tree.c
@@ -1020,6 +1020,18 @@ tree_get_atom(tree_pkg_ctx *pkg_ctx, bool complete)
                        if (pkg_ctx->atom->REPO == NULL)
                                pkg_ctx->atom->REPO = pkg_ctx->repo;
                }
+
+               /* this is a bit atom territory, but since we pulled in SLOT we
+                * need to split it up in SLOT and SUBSLOT for atom_format to
+                * behave properly, this may be redundant but this probably
+                * isn't much of an issue */
+               if (pkg_ctx->atom->SUBSLOT == NULL && pkg_ctx->atom->SLOT != 
NULL) {
+                       char *ptr;
+                       if ((ptr = strchr(pkg_ctx->atom->SLOT, '/')) != NULL) {
+                               *ptr++ = '\0';
+                               pkg_ctx->atom->SUBSLOT = ptr;
+                       }
+               }
        }
 
        return pkg_ctx->atom;

Reply via email to