summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2011-06-03 19:11:09 -0700
committerZac Medico <zmedico@gentoo.org>2011-06-03 19:11:09 -0700
commit93db38b4bddc4e2775f9d2f8222137c5778b934b (patch)
tree0d530763f1105c1725bafface4165a7a580117c6
parentb194947c9a379c8ab5a43ecd5fdef9478df0c197 (diff)
downloadportage-93db38b4bddc4e2775f9d2f8222137c5778b934b.tar.gz
portage-93db38b4bddc4e2775f9d2f8222137c5778b934b.tar.bz2
portage-93db38b4bddc4e2775f9d2f8222137c5778b934b.zip
emergelog: only enable when called by emerge
We disable emergelog by default, since it's called from dblink.merge() and we don't want that to trigger log writes unless it's really called via emerge.
-rw-r--r--pym/_emerge/emergelog.py5
-rw-r--r--pym/_emerge/main.py16
2 files changed, 11 insertions, 10 deletions
diff --git a/pym/_emerge/emergelog.py b/pym/_emerge/emergelog.py
index f30356ea1..87e46e266 100644
--- a/pym/_emerge/emergelog.py
+++ b/pym/_emerge/emergelog.py
@@ -13,8 +13,11 @@ from portage import _unicode_encode
from portage.data import secpass
from portage.output import xtermTitle
+# emergelog is disabled by default, since it's called from
+# dblink.merge() we don't want that to trigger log writes
+# unless it's really called via emerge.
+_disable = True
_emerge_log_dir = '/var/log'
-_disable = False
def emergelog(xterm_titles, mystr, short_msg=None):
diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py
index ea3282a1d..7b9ab6152 100644
--- a/pym/_emerge/main.py
+++ b/pym/_emerge/main.py
@@ -1746,6 +1746,9 @@ def emerge_main(args=None):
portage_group_warning()
return 1
+ # Disable emergelog for everything except build or unmerge operations.
+ # This helps minimize parallel emerge.log entries that can confuse log
+ # parsers like genlop.
disable_emergelog = False
for x in ("--pretend", "--fetchonly", "--fetch-all-uri"):
if x in myopts:
@@ -1753,14 +1756,10 @@ def emerge_main(args=None):
break
if myaction in ("search", "info"):
disable_emergelog = True
- if disable_emergelog:
- """ Disable emergelog for everything except build or unmerge
- operations. This helps minimize parallel emerge.log entries that can
- confuse log parsers. We especially want it disabled during
- parallel-fetch, which uses --resume --fetchonly."""
- _emerge.emergelog._disable = True
- else:
+ _emerge.emergelog._disable = disable_emergelog
+
+ if not disable_emergelog:
if 'EMERGE_LOG_DIR' in settings:
try:
# At least the parent needs to exist for the lock file.
@@ -1771,8 +1770,7 @@ def emerge_main(args=None):
(settings['EMERGE_LOG_DIR'], e),
noiselevel=-1, level=logging.ERROR)
else:
- global _emerge_log_dir
- _emerge_log_dir = settings['EMERGE_LOG_DIR']
+ _emerge.emergelog._emerge_log_dir = settings["EMERGE_LOG_DIR"]
if not "--pretend" in myopts:
emergelog(xterm_titles, "Started emerge on: "+\