For bug #183431, catch a ParseError caused by a corrupt profile and dump an error...
authorZac Medico <zmedico@gentoo.org>
Thu, 28 Jun 2007 04:57:05 +0000 (04:57 -0000)
committerZac Medico <zmedico@gentoo.org>
Thu, 28 Jun 2007 04:57:05 +0000 (04:57 -0000)
svn path=/main/trunk/; revision=7073

pym/portage/__init__.py

index 2f9c8ee3cfcae505e7ccbf1392ab70503ee2de82..4494af05ff13069a86643d78444500d4e72d935c 100644 (file)
@@ -1020,7 +1020,14 @@ class config(object):
                                                                        "Parent '%s' not found: '%s'" %  \
                                                                        (parentPath, parentsFile))
                                        self.profiles.append(currentPath)
-                               addProfile(os.path.realpath(self.profile_path))
+                               try:
+                                       addProfile(os.path.realpath(self.profile_path))
+                               except portage.exception.ParseError, e:
+                                       writemsg("!!! Unable to parse profile: '%s'\n" % \
+                                               self.profile_path, noiselevel=-1)
+                                       writemsg("!!! ParseError: %s\n" % str(e), noiselevel=-1)
+                                       del e
+                                       self.profiles = []
                        if local_config:
                                custom_prof = os.path.join(
                                        config_root, CUSTOM_PROFILE_PATH.lstrip(os.path.sep))