commit: c9b624a2a93d75654269e9ad39a8c09450cd2fb1
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Sun Mar 25 13:28:32 2018 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Sun Mar 25 13:28:32 2018 +0000
URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=c9b624a2
atom_explode: support inversed ranges, e.g. !>P-x.y
For bug #608960 we need to be able to handle odd atoms like
!<logrotate-2.3.0 (as used by sys-apps/portage). This adds support for
this construct.
libq/atom_explode.c | 24 ++++++++++++++++++++++--
1 file changed, 22 insertions(+), 2 deletions(-)
diff --git a/libq/atom_explode.c b/libq/atom_explode.c
index 057bfa1..d5d0840 100644
--- a/libq/atom_explode.c
+++ b/libq/atom_explode.c
@@ -118,11 +118,31 @@ atom_explode(const char *atom)
break;
case '!':
++atom;
- if (atom[0] == '!') {
+ switch (atom[0]) {
+ case '!':
++atom;
ret->pfx_op = ATOM_OP_BLOCK_HARD;
- } else
+ break;
+ case '>':
+ ++atom;
+ if (atom[0] == '=') {
+ ++atom;
+ ret->pfx_op = ATOM_OP_OLDER;
+ } else
+ ret->pfx_op = ATOM_OP_OLDER_EQUAL;
+ break;
+ case '<':
+ ++atom;
+ if (atom[0] == '=') {
+ ++atom;
+ ret->pfx_op = ATOM_OP_NEWER_EQUAL;
+ } else
+ ret->pfx_op = ATOM_OP_NEWER;
+ break;
+ default:
ret->pfx_op = ATOM_OP_BLOCK;
+ break;
+ }
break;
}
strcpy(ret->CATEGORY, atom);