1 |
commit: c9b624a2a93d75654269e9ad39a8c09450cd2fb1 |
2 |
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Mar 25 13:28:32 2018 +0000 |
4 |
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Mar 25 13:28:32 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=c9b624a2 |
7 |
|
8 |
atom_explode: support inversed ranges, e.g. !>P-x.y |
9 |
|
10 |
For bug #608960 we need to be able to handle odd atoms like |
11 |
!<logrotate-2.3.0 (as used by sys-apps/portage). This adds support for |
12 |
this construct. |
13 |
|
14 |
libq/atom_explode.c | 24 ++++++++++++++++++++++-- |
15 |
1 file changed, 22 insertions(+), 2 deletions(-) |
16 |
|
17 |
diff --git a/libq/atom_explode.c b/libq/atom_explode.c |
18 |
index 057bfa1..d5d0840 100644 |
19 |
--- a/libq/atom_explode.c |
20 |
+++ b/libq/atom_explode.c |
21 |
@@ -118,11 +118,31 @@ atom_explode(const char *atom) |
22 |
break; |
23 |
case '!': |
24 |
++atom; |
25 |
- if (atom[0] == '!') { |
26 |
+ switch (atom[0]) { |
27 |
+ case '!': |
28 |
++atom; |
29 |
ret->pfx_op = ATOM_OP_BLOCK_HARD; |
30 |
- } else |
31 |
+ break; |
32 |
+ case '>': |
33 |
+ ++atom; |
34 |
+ if (atom[0] == '=') { |
35 |
+ ++atom; |
36 |
+ ret->pfx_op = ATOM_OP_OLDER; |
37 |
+ } else |
38 |
+ ret->pfx_op = ATOM_OP_OLDER_EQUAL; |
39 |
+ break; |
40 |
+ case '<': |
41 |
+ ++atom; |
42 |
+ if (atom[0] == '=') { |
43 |
+ ++atom; |
44 |
+ ret->pfx_op = ATOM_OP_NEWER_EQUAL; |
45 |
+ } else |
46 |
+ ret->pfx_op = ATOM_OP_NEWER; |
47 |
+ break; |
48 |
+ default: |
49 |
ret->pfx_op = ATOM_OP_BLOCK; |
50 |
+ break; |
51 |
+ } |
52 |
break; |
53 |
} |
54 |
strcpy(ret->CATEGORY, atom); |