summaryrefslogtreecommitdiffstats
path: root/pym/portage_dep.py
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2006-12-21 07:44:30 +0000
committerZac Medico <zmedico@gentoo.org>2006-12-21 07:44:30 +0000
commit18de7eb55f69953e368a279e46a7568ad71fa7ca (patch)
tree88833223f12bd12e0e890231058d60977225dd17 /pym/portage_dep.py
parent0c6496355ef118ba8beb88b24e6e046289584760 (diff)
downloadportage-18de7eb55f69953e368a279e46a7568ad71fa7ca.tar.gz
portage-18de7eb55f69953e368a279e46a7568ad71fa7ca.tar.bz2
portage-18de7eb55f69953e368a279e46a7568ad71fa7ca.zip
Create a backward compatibility mode for dep_check() so that emerge can use it to gracefully deal with installed packages that have invalid atoms or dep syntax.
svn path=/main/trunk/; revision=5345
Diffstat (limited to 'pym/portage_dep.py')
-rw-r--r--pym/portage_dep.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/pym/portage_dep.py b/pym/portage_dep.py
index a482ab2f4..ef6486f19 100644
--- a/pym/portage_dep.py
+++ b/pym/portage_dep.py
@@ -103,6 +103,11 @@ def paren_enclose(mylist):
mystrparts.append(x)
return " ".join(mystrparts)
+# This is just for use by emerge so that it can enable a backward compatibility
+# mode in order to gracefully deal with installed packages that have invalid
+# atoms or dep syntax.
+_dep_check_strict = True
+
def use_reduce(deparray, uselist=[], masklist=[], matchall=0, excludeall=[]):
"""
Takes a paren_reduce'd array and reduces the use? conditionals out
@@ -127,6 +132,8 @@ def use_reduce(deparray, uselist=[], masklist=[], matchall=0, excludeall=[]):
if deparray and deparray[-1] and deparray[-1][-1] == "?":
raise portage_exception.InvalidDependString("Conditional without target in \""+paren_enclose(deparray)+"\"")
+ global _dep_check_strict
+
mydeparray = deparray[:]
rlist = []
while mydeparray:
@@ -186,6 +193,9 @@ def use_reduce(deparray, uselist=[], masklist=[], matchall=0, excludeall=[]):
additions = use_reduce(target, uselist, masklist, matchall, excludeall)
if additions:
rlist.append(additions)
+ elif not _dep_check_strict:
+ # The old deprecated behavior.
+ rlist.append(target)
else:
raise portage_exception.InvalidDependString(
"Conditional without parenthesis: '%s?'" % head)