commit:     dc57e7c6442231395767823b53ae92b3b9f73945
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Sun Jan  4 09:47:03 2026 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Sun Jan  4 09:47:03 2026 +0000
URL:        https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=dc57e7c6

libq/atom: support our own BUILDID notation in atom_explode too

Next to guesswork when given a filename, support our own explicit
notation for BUILDID, such that they can be given as atoms e.g. with
qmerge to select a specific build.

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

 libq/atom.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/libq/atom.c b/libq/atom.c
index ef1d1b7..2bbd6a1 100644
--- a/libq/atom.c
+++ b/libq/atom.c
@@ -341,6 +341,14 @@ 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;

Reply via email to