commit:     877ffc6770b2f81ece5ed94b3fbdd86e3e29b524
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Thu Jan  1 15:10:43 2026 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Thu Jan  1 15:10:43 2026 +0000
URL:        https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=877ffc67

libq/atom: fix BUILDID handling

- retain BUILDID in atom_clone
- ignore BUILDID in comparisons if either side has it unset (=0)

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

 libq/atom.c | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/libq/atom.c b/libq/atom.c
index b80610d..6dd4827 100644
--- a/libq/atom.c
+++ b/libq/atom.c
@@ -476,11 +476,12 @@ atom_clone(depend_atom *atom)
        }
 
        ret->blocker = atom->blocker;
-       ret->pfx_op = atom->pfx_op;
-       ret->sfx_op = atom->pfx_op;
-       ret->PR_int = atom->PR_int;
-       ret->letter = atom->letter;
+       ret->pfx_op  = atom->pfx_op;
+       ret->sfx_op  = atom->pfx_op;
+       ret->PR_int  = atom->PR_int;
+       ret->letter  = atom->letter;
        ret->slotdep = atom->slotdep;
+       ret->BUILDID = atom->BUILDID;
 
        if (atom->suffixes != NULL) {
                for (slen = 0; atom->suffixes[slen].suffix != VER_NORM; slen++)
@@ -1012,10 +1013,14 @@ atom_compare_flg(const depend_atom *data, const 
depend_atom *query, int flags)
                return _atom_compare_match(NEWER, pfx_op);
 
        /* binpkg-multi-instance support */
-       if (data->BUILDID < query->BUILDID)
-               return _atom_compare_match(OLDER, pfx_op);
-       if (data->BUILDID > query->BUILDID)
-               return _atom_compare_match(NEWER, pfx_op);
+       if (data->BUILDID > 0 &&
+               query->BUILDID > 0)
+       {
+               if (data->BUILDID < query->BUILDID)
+                       return _atom_compare_match(OLDER, pfx_op);
+               if (data->BUILDID > query->BUILDID)
+                       return _atom_compare_match(NEWER, pfx_op);
+       }
 
        return _atom_compare_match(EQUAL, pfx_op);
 }

Reply via email to