summaryrefslogtreecommitdiffstats
path: root/pym/_emerge/main.py
diff options
context:
space:
mode:
Diffstat (limited to 'pym/_emerge/main.py')
-rw-r--r--pym/_emerge/main.py35
1 files changed, 33 insertions, 2 deletions
diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py
index 343fd5812..b3e047c9d 100644
--- a/pym/_emerge/main.py
+++ b/pym/_emerge/main.py
@@ -28,7 +28,8 @@ import portage.exception
from portage.data import secpass
from portage.dbapi.dep_expand import dep_expand
from portage.util import normalize_path as normpath
-from portage.util import shlex_split, writemsg_level, writemsg_stdout
+from portage.util import (shlex_split, varexpand,
+ writemsg_level, writemsg_stdout)
from portage._sets import SETPREFIX
from portage._global_updates import _global_updates
@@ -388,6 +389,8 @@ def post_emerge(myaction, myopts, myfiles,
" %s spawn failed of %s\n" % (bad("*"), postemerge,),
level=logging.ERROR, noiselevel=-1)
+ clean_logs(settings)
+
if "--quiet" not in myopts and \
myaction is None and "@world" in myfiles:
show_depclean_suggestion()
@@ -1222,7 +1225,6 @@ def ionice(settings):
if not ionice_cmd:
return
- from portage.util import varexpand
variables = {"PID" : str(os.getpid())}
cmd = [varexpand(x, mydict=variables) for x in ionice_cmd]
@@ -1238,6 +1240,35 @@ def ionice(settings):
out.eerror("PORTAGE_IONICE_COMMAND returned %d" % (rval,))
out.eerror("See the make.conf(5) man page for PORTAGE_IONICE_COMMAND usage instructions.")
+def clean_logs(settings):
+
+ if "clean-logs" not in settings.features:
+ return
+
+ clean_cmd = settings.get("PORT_LOGDIR_CLEAN")
+ if clean_cmd:
+ clean_cmd = shlex_split(clean_cmd)
+ if not clean_cmd:
+ return
+
+ logdir = settings.get("PORT_LOGDIR")
+ if logdir is None or not os.path.isdir(logdir):
+ return
+
+ variables = {"PORT_LOGDIR" : logdir}
+ cmd = [varexpand(x, mydict=variables) for x in clean_cmd]
+
+ try:
+ rval = portage.process.spawn(cmd, env=os.environ)
+ except portage.exception.CommandNotFound:
+ rval = 127
+
+ if rval != os.EX_OK:
+ out = portage.output.EOutput()
+ out.eerror("PORT_LOGDIR_CLEAN returned %d" % (rval,))
+ out.eerror("See the make.conf(5) man page for "
+ "PORT_LOGDIR_CLEAN usage instructions.")
+
def setconfig_fallback(root_config):
from portage._sets.base import DummyPackageSet
from portage._sets.files import WorldSelectedSet