diff options
author | Fabian Groffen <grobian@gentoo.org> | 2022-05-19 10:15:34 +0200 |
---|---|---|
committer | Fabian Groffen <grobian@gentoo.org> | 2022-05-19 10:15:34 +0200 |
commit | be7090b77585c7c4af0d46ca0cde805d370c6cc0 (patch) | |
tree | 66d5e660fb8f87338c2cf4ec7395d76f328b957c | |
parent | libq/atom.h: add BUILDID to atom for binpkg-multi-instance support (diff) | |
download | portage-utils-be7090b77585c7c4af0d46ca0cde805d370c6cc0.tar.gz portage-utils-be7090b77585c7c4af0d46ca0cde805d370c6cc0.tar.bz2 portage-utils-be7090b77585c7c4af0d46ca0cde805d370c6cc0.zip |
libq/atom: make atom_compare consider BUILDID
PR: https://github.com/gentoo/portage-utils/pull/16
Signed-off-by: Fabian Groffen <grobian@gentoo.org>
-rw-r--r-- | libq/atom.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/libq/atom.c b/libq/atom.c index d1eb9a45..6f88698a 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 |