if logdir is None or not os.path.isdir(logdir):
return
- options = {
- 'eerror': portage.output.EOutput().eerror,
- # uncomment next line to output a succeeded message
- #'einfo': portage.output.EOutput().einfo
- }
cleanlogs = CleanLogs()
- cleanlogs.clean(settings=settings, options=options)
+ errors = cleanlogs.clean(settings=settings)
+ if errors:
+ out = portage.output.EOutput()
+ for msg in errors:
+ out.eerror(msg)
def setconfig_fallback(root_config):
setconfig = root_config.setconfig
options: dict:
'NUM': int: number of days
'pretend': boolean
- 'eerror': defaults to None, optional output module to output errors.
- 'einfo': defaults to None, optional output module to output info msgs.
"""
messages = []
num_of_days = None
+ pretend = False
if kwargs:
# convuluted, I know, but portage.settings does not exist in
# kwargs.get() when called from _emerge.main.clean_logs()
if options:
num_of_days = options.get('NUM', None)
pretend = options.get('pretend', False)
- eerror = options.get('eerror', None)
- einfo = options.get('einfo', None)
clean_cmd = settings.get("PORT_LOGDIR_CLEAN")
if clean_cmd:
if not clean_cmd:
return []
rval = self._clean_logs(clean_cmd, settings)
- messages += self._convert_errors(rval, eerror, einfo)
+ messages += self._convert_errors(rval)
return messages
@staticmethod
- def _convert_errors(rval, eerror=None, einfo=None):
+ def _convert_errors(rval):
msg = []
if rval != os.EX_OK:
msg.append("PORT_LOGDIR_CLEAN command returned %s"
% ("%d" % rval if rval else "None"))
msg.append("See the make.conf(5) man page for "
"PORT_LOGDIR_CLEAN usage instructions.")
- if eerror:
- for m in msg:
- eerror(m)
- else:
- msg.append("PORT_LOGDIR_CLEAN command succeeded")
- if einfo:
- for m in msg:
- einfo(m)
return msg