For bug #163083, handle an UnsupportedAPIException thrown from the prerm phase. ... v2.1.2-r2
authorZac Medico <zmedico@gentoo.org>
Sun, 21 Jan 2007 22:16:08 +0000 (22:16 -0000)
committerZac Medico <zmedico@gentoo.org>
Sun, 21 Jan 2007 22:16:08 +0000 (22:16 -0000)
svn path=/main/branches/2.1.2/; revision=5750

pym/portage.py
pym/portage_exception.py

index 7ead873272872b24d748a39b94a9877ba21ccd42..050a8fb64c02073f1108246314190488d19a78d6 100644 (file)
@@ -6819,8 +6819,15 @@ class dblink:
 
                self.settings.load_infodir(self.dbdir)
                if myebuildpath:
-                       doebuild_environment(myebuildpath, "prerm", self.myroot,
-                               self.settings, 0, 0, self.vartree.dbapi)
+                       try:
+                               doebuild_environment(myebuildpath, "prerm", self.myroot,
+                                       self.settings, 0, 0, self.vartree.dbapi)
+                       except portage_exception.UnsupportedAPIException, e:
+                               # Sometimes this happens due to corruption of the EAPI file.
+                               writemsg("!!! FAILED prerm: %s\n" % \
+                                       os.path.join(self.dbdir, "EAPI"), noiselevel=-1)
+                               writemsg("%s\n" % str(e), noiselevel=-1)
+                               return 1
                        catdir = os.path.dirname(self.settings["PORTAGE_BUILDDIR"])
                        portage_util.ensure_dirs(os.path.dirname(catdir),
                                uid=portage_uid, gid=portage_gid, mode=070, mask=0)
index 76f2be20aaf934f74ec429c9f3d512b2d1ecac74..4be72cf965e0f3616dcf76e3c625f84cf8b65842 100644 (file)
@@ -76,8 +76,8 @@ class InvalidAtom(PortagePackageException):
 
 class UnsupportedAPIException(PortagePackageException):
        """Unsupported API"""
-       def __init__(self, cpv, api):
-               self.cpv, self.api = cpv, api
+       def __init__(self, cpv, eapi):
+               self.cpv, self.eapi = cpv, eapi
        def __str__(self):
                return "Unable to do any operations on '%s', due to the fact it's EAPI is higher then this portage versions.  Please upgrade to a portage version that supports EAPI %s" % (self.cpv, self.eapi)