summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2007-05-30 23:23:07 +0000
committerZac Medico <zmedico@gentoo.org>2007-05-30 23:23:07 +0000
commit4e1f35c69030525f0b37eb2ce80308b039b325ee (patch)
tree67db6eb2664a551fa7b16c926efbab2b9e6400a2
parent5dd00bf58f6000404a0559a7e7dc09ef9efacbc4 (diff)
downloadportage-4e1f35c69030525f0b37eb2ce80308b039b325ee.tar.gz
portage-4e1f35c69030525f0b37eb2ce80308b039b325ee.tar.bz2
portage-4e1f35c69030525f0b37eb2ce80308b039b325ee.zip
For bug #180399, raise an appropriate InvalidDependString exception if there is no flag attached directly to a '?' token. (trunk r6678)
svn path=/main/branches/2.1.2/; revision=6679
-rw-r--r--pym/portage_dep.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/pym/portage_dep.py b/pym/portage_dep.py
index 45ff2bcfe..a992992bf 100644
--- a/pym/portage_dep.py
+++ b/pym/portage_dep.py
@@ -185,10 +185,17 @@ def use_reduce(deparray, uselist=[], masklist=[], matchall=0, excludeall=[]):
# Check that each flag matches
ismatch = True
+ missing_flag = False
for head in newdeparray[:-1]:
head = head[:-1]
- if head[0] == "!":
+ if not head:
+ missing_flag = True
+ break
+ if head.startswith("!"):
head_key = head[1:]
+ if not head_key:
+ missing_flag = True
+ break
if not matchall and head_key in uselist or \
head_key in excludeall:
ismatch = False
@@ -199,6 +206,10 @@ def use_reduce(deparray, uselist=[], masklist=[], matchall=0, excludeall=[]):
break
else:
ismatch = False
+ if missing_flag:
+ raise portage_exception.InvalidDependString(
+ "Conditional without flag: \"" + \
+ paren_enclose([head+"?", newdeparray[-1]])+"\"")
# If they all match, process the target
if ismatch: