For bug #147512, don't print a cryptic error message when an EnvironmentError occurs...
authorZac Medico <zmedico@gentoo.org>
Fri, 12 Jan 2007 03:17:13 +0000 (03:17 -0000)
committerZac Medico <zmedico@gentoo.org>
Fri, 12 Jan 2007 03:17:13 +0000 (03:17 -0000)
svn path=/main/trunk/; revision=5580

bin/emerge
pym/portage.py

index f65176b1d884a2c31f9ce2b33a5b83469f76ae5d..06b75c84f3256baf26b09791da3321243630253c 100755 (executable)
@@ -4964,6 +4964,8 @@ def emerge_main():
        # together with EMERGE_DEFAULT_OPTS (which may vary depending on the
        # the value of --config-root).
        myaction, myopts, myfiles = parse_opts(sys.argv[1:], silent=True)
+       if "--debug" in myopts:
+               os.environ["PORTAGE_DEBUG"] = "1"
        if "--config-root" in myopts:
                os.environ["PORTAGE_CONFIGROOT"] = myopts["--config-root"]
 
index 0952bd5f88cd273debec632a36d2f396a6e19563..be8f58e5a6e7f8cbcf723e597c78bbb48687791f 100644 (file)
@@ -895,6 +895,8 @@ class config:
                @type local_config: Boolean
                """
 
+               debug = os.environ.get("PORTAGE_DEBUG") == "1"
+
                self.already_in_regenerate = 0
 
                self.locked   = 0
@@ -1134,9 +1136,12 @@ class config:
                        except SystemExit, e:
                                raise
                        except Exception, e:
+                               if debug:
+                                       raise
                                writemsg("!!! %s\n" % (e), noiselevel=-1)
-                               writemsg("!!! Incorrect multiline literals can cause this. Do not use them.\n", noiselevel=-1)
-                               writemsg("!!! Errors in this file should be reported on bugs.gentoo.org.\n")
+                               if not isinstance(e, EnvironmentError):
+                                       writemsg("!!! Incorrect multiline literals can cause " + \
+                                               "this. Do not use them.\n", noiselevel=-1)
                                sys.exit(1)
                        self.configlist.append(self.mygcfg)
                        self.configdict["globals"]=self.configlist[-1]
@@ -1158,13 +1163,18 @@ class config:
                                except SystemExit, e:
                                        raise
                                except Exception, e:
+                                       if debug:
+                                               raise
                                        writemsg("!!! %s\n" % (e), noiselevel=-1)
-                                       writemsg("!!! 'rm -Rf /usr/portage/profiles; emerge sync' may fix this. If it does\n",
-                                               noiselevel=-1)
-                                       writemsg("!!! not then please report this to bugs.gentoo.org and, if possible, a dev\n",
-                                               noiselevel=-1)
-                                       writemsg("!!! on #gentoo (irc.freenode.org)\n",
-                                               noiselevel=-1)
+                                       if not isinstance(e, EnvironmentError):
+                                               writemsg("!!! 'rm -Rf /usr/portage/profiles; " + \
+                                                       "emerge sync' may fix this. If it does\n",
+                                                       noiselevel=-1)
+                                               writemsg("!!! not then please report this to " + \
+                                                       "bugs.gentoo.org and, if possible, a dev\n",
+                                                               noiselevel=-1)
+                                               writemsg("!!! on #gentoo (irc.freenode.org)\n",
+                                                       noiselevel=-1)
                                        sys.exit(1)
                        self.configlist.append(self.mygcfg)
                        self.configdict["defaults"]=self.configlist[-1]
@@ -1178,9 +1188,12 @@ class config:
                        except SystemExit, e:
                                raise
                        except Exception, e:
+                               if debug:
+                                       raise
                                writemsg("!!! %s\n" % (e), noiselevel=-1)
-                               writemsg("!!! Incorrect multiline literals can cause this. Do not use them.\n",
-                                       noiselevel=-1)
+                               if not isinstance(e, EnvironmentError):
+                                       writemsg("!!! Incorrect multiline literals can cause " + \
+                                               "this. Do not use them.\n", noiselevel=-1)
                                sys.exit(1)
 
                        # Allow ROOT setting to come from make.conf if it's not overridden