From: Zac Medico Date: Mon, 26 Jun 2006 04:02:42 +0000 (-0000) Subject: Ensure that the PORTAGE_DEBUG environment variable has a valid integer value. X-Git-Tag: v2.1.1~376 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=c862f984b1fa92a56af4cc7b010f675b3fb84e4e;p=portage.git Ensure that the PORTAGE_DEBUG environment variable has a valid integer value. svn path=/main/trunk/; revision=3664 --- diff --git a/bin/emerge b/bin/emerge index b41a219a3..1acde4c24 100755 --- a/bin/emerge +++ b/bin/emerge @@ -3568,13 +3568,30 @@ def emerge_main(): portage.settings.lock() # Set various debug markers... They should be merged somehow. - if ("--debug" in myopts): - portage.settings.unlock() - portage.settings["PORTAGE_DEBUG"]="1" - portage.settings.backup_changes("PORTAGE_DEBUG") + settings.unlock() + PORTAGE_DEBUG = 0 + try: + PORTAGE_DEBUG = int(settings.get("PORTAGE_DEBUG", str(PORTAGE_DEBUG))) + if PORTAGE_DEBUG not in (0, 1): + portage.writemsg("!!! Invalid value: PORTAGE_DEBUG='%i'\n" % \ + PORTAGE_DEBUG, noiselevel=-1) + portage.writemsg("!!! PORTAGE_DEBUG must be either 0 or 1\n", + noiselevel=-1) + PORTAGE_DEBUG = 0 + except ValueError, e: + portage.writemsg("!!! %s\n" % str(e), noiselevel=-1) + portage.writemsg("!!! Unable to parse integer: PORTAGE_DEBUG='%s'\n" %\ + settings["PORTAGE_DEBUG"], noiselevel=-1) + del e + if "--debug" in myopts: + PORTAGE_DEBUG = 1 + settings["PORTAGE_DEBUG"] = str(PORTAGE_DEBUG) + settings.backup_changes("PORTAGE_DEBUG") + settings.lock() + + if settings.get("PORTAGE_DEBUG", "") == "1": portage.debug=1 - portage.settings.lock() - if "python-trace" in portage.settings.features: + if "python-trace" in settings.features: import portage_debug portage_debug.set_trace(True)