commit: be7090b77585c7c4af0d46ca0cde805d370c6cc0 Author: Fabian Groffen <grobian <AT> gentoo <DOT> org> AuthorDate: Thu May 19 08:15:34 2022 +0000 Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org> CommitDate: Thu May 19 08:15:34 2022 +0000 URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=be7090b7
libq/atom: make atom_compare consider BUILDID PR: https://github.com/gentoo/portage-utils/pull/16 Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org> libq/atom.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/libq/atom.c b/libq/atom.c index d1eb9a4..6f88698 100644 --- a/libq/atom.c +++ b/libq/atom.c @@ -954,16 +954,24 @@ atom_compare_flg(const depend_atom *data, const depend_atom *query, int flags) * 6: return A < B * 7: end if */ - /* Make sure the -r# is the same. 3.7 */ + /* first handle wildcarding cases */ if ((sfx_op == ATOM_OP_STAR && query->PR_int == 0) || pfx_op == ATOM_OP_PV_EQUAL || - flags & ATOM_COMP_NOREV || - data->PR_int == query->PR_int) + flags & ATOM_COMP_NOREV) return _atom_compare_match(EQUAL, pfx_op); - else if (data->PR_int < query->PR_int) + /* Make sure the -r# is the same. 3.7 */ + if (data->PR_int < query->PR_int) + return _atom_compare_match(OLDER, pfx_op); + else if (data->PR_int > query->PR_int) + return _atom_compare_match(NEWER, pfx_op); + + /* binpkg-multi-instance support */ + if (data->BUILDID < query->BUILDID) return _atom_compare_match(OLDER, pfx_op); - else + if (data->BUILDID > query->BUILDID) return _atom_compare_match(NEWER, pfx_op); + + return _atom_compare_match(EQUAL, pfx_op); } atom_equality