Create a backward compatibility mode for dep_check() so that emerge can use it to...
authorZac Medico <zmedico@gentoo.org>
Thu, 21 Dec 2006 07:44:30 +0000 (07:44 -0000)
committerZac Medico <zmedico@gentoo.org>
Thu, 21 Dec 2006 07:44:30 +0000 (07:44 -0000)
svn path=/main/trunk/; revision=5345

pym/portage.py
pym/portage_dep.py

index 5cceb6556d56dcbf9812d4ea8bd0c6539cb9bd35..8b39c621f089b3deb74e072982d3a3b149aa75af 100644 (file)
@@ -3647,7 +3647,8 @@ def _expand_new_virtuals(mysplit, edebug, mydbapi, mysettings, myroot="/",
                        newsplit.append(_expand_new_virtuals(x, edebug, mydbapi,
                                mysettings, myroot=myroot, trees=trees, **kwargs))
                        continue
-               if not isvalidatom(x, allow_blockers=True):
+               if portage_dep._dep_check_strict and \
+                       not isvalidatom(x, allow_blockers=True):
                        raise portage_exception.ParseError(
                                "invalid atom: '%s'" % x)
                mykey = dep_getkey(x)
index a482ab2f4457bac3608e5d9ac9efde427d511351..ef6486f197510ce07c377e6efd35ac32c7a183c3 100644 (file)
@@ -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)