summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cnf/make.globals2
-rw-r--r--man/make.conf.54
-rw-r--r--pym/portage/dbapi/vartree.py10
3 files changed, 15 insertions, 1 deletions
diff --git a/cnf/make.globals b/cnf/make.globals
index 167f61d53..4693e2062 100644
--- a/cnf/make.globals
+++ b/cnf/make.globals
@@ -39,7 +39,7 @@ RESUMECOMMAND="/usr/bin/wget -c -t 5 -T 60 --passive-ftp -O \"\${DISTDIR}/\${FIL
# Default user options
FEATURES="assume-digests distlocks fixpackages parallel-fetch protect-owned
- sandbox sfperms strict unmerge-orphans userfetch"
+ sandbox sfperms strict unmerge-logs unmerge-orphans userfetch"
# Ignore file collisions in /lib/modules since files inside this directory
# are never unmerged, and therefore collisions must be ignored in order for
diff --git a/man/make.conf.5 b/man/make.conf.5
index 2b5a7645f..229e50b3f 100644
--- a/man/make.conf.5
+++ b/man/make.conf.5
@@ -373,6 +373,10 @@ continue to execute the remaining phases as if the failure had not occurred.
Note that the test phase for a specific package may be disabled by masking
the "test" \fBUSE\fR flag in \fBpackage.use.mask\fR (see \fBportage\fR(5)).
.TP
+.B unmerge\-logs
+Keep logs from successful unmerge phases. This is relevant only when
+\fBPORT_LOGDIR\fR is set.
+.TP
.B unmerge\-orphans
If a file is not claimed by another package in the same slot and it is not
protected by \fICONFIG_PROTECT\fR, unmerge it even if the modification time or
diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index fe9e8e67f..88ec7b3c7 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -2038,6 +2038,7 @@ class dblink(object):
catdir_lock = None
scheduler = self._scheduler
retval = -1
+ failures = 0
try:
if myebuildpath:
catdir_lock = lockdir(catdir)
@@ -2065,6 +2066,7 @@ class dblink(object):
# XXX: Decide how to handle failures here.
if retval != os.EX_OK:
+ failures += 1
writemsg(_("!!! FAILED prerm: %s\n") % retval, noiselevel=-1)
self._unmerge_pkgfiles(pkgfiles, others_in_slot)
@@ -2087,6 +2089,7 @@ class dblink(object):
# XXX: Decide how to handle failures here.
if retval != os.EX_OK:
+ failures += 1
writemsg(_("!!! FAILED postrm: %s\n") % retval, noiselevel=-1)
# Skip this if another package in the same slot has just been
@@ -2188,6 +2191,13 @@ class dblink(object):
unlockdir(catdir_lock)
if log_path is not None:
+
+ if not failures and 'unmerge-logs' not in self.settings.features:
+ try:
+ os.unlink(log_path)
+ except OSError:
+ pass
+
try:
st = os.stat(log_path)
except OSError: