summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2007-05-30 23:22:29 +0000
committerZac Medico <zmedico@gentoo.org>2007-05-30 23:22:29 +0000
commit14f7e73efb00e2d51c34bc4a1854852ca0cc5962 (patch)
tree3b37dfd0c45b9f8024bb610127a2618105b98d50
parentcc2e6123deac772c34e8fb1794c590226a162828 (diff)
downloadportage-14f7e73efb00e2d51c34bc4a1854852ca0cc5962.tar.gz
portage-14f7e73efb00e2d51c34bc4a1854852ca0cc5962.tar.bz2
portage-14f7e73efb00e2d51c34bc4a1854852ca0cc5962.zip
For bug #180399, raise an appropriate InvalidDependString exception if there is no flag attached directly to a '?' token.
svn path=/main/trunk/; revision=6678
-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 5b39778f9..9717e69d1 100644
--- a/pym/portage/dep.py
+++ b/pym/portage/dep.py
@@ -241,10 +241,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
@@ -255,6 +262,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: