Gentoo Archives: gentoo-commits

From: "Mike Frysinger (vapier)" <vapier@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-projects commit in portage-utils: qdepends.c
Date: Sun, 29 Sep 2013 10:03:11
Message-Id: 20130929100306.C4B652004C@flycatcher.gentoo.org
1 vapier 13/09/29 10:03:06
2
3 Modified: qdepends.c
4 Log:
5 qdepends: check for whitespace around node elements as PMS requires it and it makes parsing of USE deps possible #470180
6
7 Revision Changes Path
8 1.62 portage-utils/qdepends.c
9
10 file : http://sources.gentoo.org/viewvc.cgi/gentoo-projects/portage-utils/qdepends.c?rev=1.62&view=markup
11 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-projects/portage-utils/qdepends.c?rev=1.62&content-type=text/plain
12 diff : http://sources.gentoo.org/viewvc.cgi/gentoo-projects/portage-utils/qdepends.c?r1=1.61&r2=1.62
13
14 Index: qdepends.c
15 ===================================================================
16 RCS file: /var/cvsroot/gentoo-projects/portage-utils/qdepends.c,v
17 retrieving revision 1.61
18 retrieving revision 1.62
19 diff -u -r1.61 -r1.62
20 --- qdepends.c 29 Sep 2013 10:01:55 -0000 1.61
21 +++ qdepends.c 29 Sep 2013 10:03:06 -0000 1.62
22 @@ -1,7 +1,7 @@
23 /*
24 * Copyright 2005-2013 Gentoo Foundation
25 * Distributed under the terms of the GNU General Public License v2
26 - * $Header: /var/cvsroot/gentoo-projects/portage-utils/qdepends.c,v 1.61 2013/09/29 10:01:55 vapier Exp $
27 + * $Header: /var/cvsroot/gentoo-projects/portage-utils/qdepends.c,v 1.62 2013/09/29 10:03:06 vapier Exp $
28 *
29 * Copyright 2005-2010 Ned Ludd - <solar@g.o>
30 * Copyright 2005-2013 Mike Frysinger - <vapier@g.o>
31 @@ -32,7 +32,7 @@
32 "Pretty format specified depend strings",
33 COMMON_OPTS_HELP
34 };
35 -static const char qdepends_rcsid[] = "$Id: qdepends.c,v 1.61 2013/09/29 10:01:55 vapier Exp $";
36 +static const char qdepends_rcsid[] = "$Id: qdepends.c,v 1.62 2013/09/29 10:03:06 vapier Exp $";
37 #define qdepends_usage(ret) usage(ret, QDEPENDS_FLAGS, qdepends_long_opts, qdepends_opts_help, lookup_applet_idx("qdepends"))
38
39 static char qdep_name_only = 0;
40 @@ -146,6 +146,7 @@
41
42 _q_static dep_node *dep_grow_tree(const char *depend)
43 {
44 + bool saw_whitespace;
45 signed long paren_balanced;
46 const char *ptr, *word;
47 int curr_attach;
48 @@ -175,8 +176,10 @@
49 word = NULL; \
50 } while (0)
51
52 + saw_whitespace = true;
53 for (ptr = depend; *ptr; ++ptr) {
54 if (isspace(*ptr)) {
55 + saw_whitespace = true;
56 _maybe_consume_word(DEP_NORM);
57 continue;
58 }
59 @@ -192,6 +195,8 @@
60 continue;
61 }
62 case '|': {
63 + if (!saw_whitespace)
64 + break;
65 if (ptr[1] != '|') {
66 warnf("Found a | but not ||");
67 goto error_out;
68 @@ -203,6 +208,8 @@
69 }
70 case '(': {
71 ++paren_balanced;
72 + if (!saw_whitespace)
73 + break;
74 if (prev_type == DEP_OR || prev_type == DEP_USE) {
75 _maybe_consume_word(DEP_NORM);
76 prev_type = DEP_NULL;
77 @@ -219,6 +226,8 @@
78 }
79 case ')': {
80 --paren_balanced;
81 + if (!saw_whitespace)
82 + break;
83 _maybe_consume_word(DEP_NORM);
84
85 if (curr_node->parent == NULL) {
86 @@ -233,6 +242,7 @@
87 if (!word)
88 word = ptr;
89 }
90 + saw_whitespace = false;
91
92 /* fall through to the paren failure below */
93 if (paren_balanced < 0)