1 |
commit: 6d6c6c1c7c066ce642b58190c4d6df5a6e5e1a40 |
2 |
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Jan 1 19:52:01 2020 +0000 |
4 |
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Jan 1 19:52:01 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=6d6c6c1c |
7 |
|
8 |
libq/dep: fix parsing of USE-deps |
9 |
|
10 |
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org> |
11 |
|
12 |
TODO.md | 3 --- |
13 |
libq/dep.c | 14 +++++++++++--- |
14 |
2 files changed, 11 insertions(+), 6 deletions(-) |
15 |
|
16 |
diff --git a/TODO.md b/TODO.md |
17 |
index cd4f2b2..191e91c 100644 |
18 |
--- a/TODO.md |
19 |
+++ b/TODO.md |
20 |
@@ -48,9 +48,6 @@ |
21 |
|
22 |
# qdepends |
23 |
|
24 |
-- add -S/-v/-R behavior like qlist #574934 |
25 |
-- bring back -k? (but seems solved by using qlist -IF%{SLOT} pkg) |
26 |
-- -Qt acts weird (if not, incorrect) |
27 |
- -v should lookup whether packages are installed for || cases/colouring |
28 |
|
29 |
# qpkg |
30 |
|
31 |
diff --git a/libq/dep.c b/libq/dep.c |
32 |
index 49edf10..0507326 100644 |
33 |
--- a/libq/dep.c |
34 |
+++ b/libq/dep.c |
35 |
@@ -110,7 +110,8 @@ dep_grow_tree(const char *depend) |
36 |
|
37 |
#define _maybe_consume_word(t) \ |
38 |
do { \ |
39 |
- if (!word) break; \ |
40 |
+ if (word == NULL) \ |
41 |
+ break; \ |
42 |
new_node = _dep_grow_node(t, word, ptr-word); \ |
43 |
if (!ret) \ |
44 |
ret = curr_node = new_node; \ |
45 |
@@ -124,8 +125,8 @@ dep_grow_tree(const char *depend) |
46 |
} while (0) |
47 |
|
48 |
saw_whitespace = true; |
49 |
- for (ptr = depend; *ptr; ++ptr) { |
50 |
- if (isspace(*ptr)) { |
51 |
+ for (ptr = depend; *ptr != '\0'; ptr++) { |
52 |
+ if (isspace((int)*ptr)) { |
53 |
saw_whitespace = true; |
54 |
_maybe_consume_word(DEP_NORM); |
55 |
continue; |
56 |
@@ -185,6 +186,13 @@ dep_grow_tree(const char *depend) |
57 |
curr_attach = _DEP_NEIGH; |
58 |
break; |
59 |
} |
60 |
+ case '[': { |
61 |
+ /* USE-dep, seek to matching ']', since they cannot be |
62 |
+ * nested, this is simple */ |
63 |
+ while (*ptr != '\0' && *ptr != ']') |
64 |
+ ptr++; |
65 |
+ break; |
66 |
+ } |
67 |
default: |
68 |
if (!word) |
69 |
word = ptr; |