# message should be produced.
PORTAGE_SYNC_STALE="30"
+# Executed before emerge exit if FEATURES=clean-logs is enabled.
+PORT_LOGDIR_CLEAN="find \"\${PORT_LOGDIR}\" -type f ! -name \"summary.log*\" -mtime +7 -delete"
+
# Minimal CONFIG_PROTECT
CONFIG_PROTECT="/etc"
CONFIG_PROTECT_MASK="/etc/env.d"
with ccache disabled before reporting a bug. Unless you are doing development
work, do not enable ccache.
.TP
+.B clean\-logs
+Enable automatic execution of the command specified by the
+PORT_LOGDIR_CLEAN variable. The default PORT_LOGDIR_CLEAN setting will
+remove all files from PORT_LOGDIR that were last modified at least 7
+days ago.
+.TP
.B collision\-protect
A QA\-feature to ensure that a package doesn't overwrite files it doesn't own.
The \fICOLLISION_IGNORE\fR variable can be used to selectively disable this
will be applied to it. If the directory already exists, portage will not
modify it's permissions.
.TP
+.B PORT_LOGDIR_CLEAN
+This variable should contain a command for portage to call in order
+to clean PORT_LOGDIR. The command string should contain a
+\\${PORT_LOGDIR} place\-holder that will be substituted
+with the value of that variable. This variable will have no effect
+unless \fBclean\-logs\fR is enabled in \fBFEATURES\fR.
+.TP
\fBPORTAGE_BINHOST\fR = \fI[space delimited URI list]\fR
This is a list of hosts from which portage will grab prebuilt\-binary packages.
Each entry in the list must specify the full address of a directory
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
" %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()
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]
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
SUPPORTED_FEATURES = frozenset([
"allow-missing-manifests",
"assume-digests", "binpkg-logs", "buildpkg", "buildsyspkg", "candy",
- "ccache", "chflags", "collision-protect", "compress-build-logs",
+ "ccache", "chflags", "clean-logs",
+ "collision-protect", "compress-build-logs",
"digest", "distcc", "distcc-pump", "distlocks", "ebuild-locks", "fakeroot",
"fail-clean", "fixpackages", "force-mirror", "getbinpkg",
"installsources", "keeptemp", "keepwork", "fixlafiles", "lmirror",
"PORTAGE_RO_DISTDIRS",
"PORTAGE_RSYNC_EXTRA_OPTS", "PORTAGE_RSYNC_OPTS",
"PORTAGE_RSYNC_RETRIES", "PORTAGE_SYNC_STALE",
- "PORTAGE_USE", "PORT_LOGDIR",
+ "PORTAGE_USE", "PORT_LOGDIR", "PORT_LOGDIR_CLEAN",
"QUICKPKG_DEFAULT_OPTS",
"RESUMECOMMAND", "RESUMECOMMAND_FTP",
"RESUMECOMMAND_HTTP", "RESUMECOMMAND_HTTPS",