commit: 526f1def3c90a31d58effe4b7e191a39f4e953b0
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 4 13:06:44 2026 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Sun Jan 4 13:06:44 2026 +0000
URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=526f1def
libq/atom: perform BUILDID detection sooner in atom_explode
We wouldn't catch it under all conditions, unfortunately needs to be run
on more data, e.g. more expensive.
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
libq/atom.c | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/libq/atom.c b/libq/atom.c
index 2bbd6a1..c3c0be7 100644
--- a/libq/atom.c
+++ b/libq/atom.c
@@ -298,6 +298,16 @@ atom_explode_cat(const char *atom, const char *cat)
return ret;
}
+ /* portage-utils addition: BUILDID is present as ~BUILDID, remove it
+ * from here if we find it, our extension may never be part of the
+ * official PF/PVR */
+ if ((ptr = strchr(ret->PF, '~')) != NULL &&
+ isdigit(ptr[1]))
+ {
+ ret->BUILDID = atoi(&ptr[1]);
+ *ptr = '\0';
+ }
+
/* CATEGORY should be all set here, PF contains everything up to
* SLOT, REPO or '*'
* PMS 3.1.2 says PN must not end in a hyphen followed by
@@ -326,6 +336,7 @@ atom_explode_cat(const char *atom, const char *cat)
lastpv = pv;
continue; /* valid, keep searching */
}
+
ret->letter = '\0';
}
ptr = lastpv;
@@ -341,14 +352,6 @@ atom_explode_cat(const char *atom, const char *cat)
ret->PVR = ptr;
snprintf(ret->PN, slen, "%.*s", (int)(ret->PVR - 1 - ret->PF), ret->PF);
- /* portage-utils addition: BUILDID is present as ~BUILDID, remove it
- * from here if we find it, our extension may never be part of the
- * official PF/PVR */
- if ((ptr = strchr(ptr, '~')) != NULL) {
- ret->BUILDID = atoi(&ptr[1]);
- *ptr = '\0';
- }
-
/* find -r# */
pv = NULL;
ptr = ret->PVR + strlen(ret->PVR) - 1;