summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2009-07-20 22:43:41 +0000
committerZac Medico <zmedico@gentoo.org>2009-07-20 22:43:41 +0000
commit8c70715b17035030d5729972e01b2c2d3d842967 (patch)
tree1ea272da8dbe923a9e7c545106619c232395b778
parentRemove empty log files inside dblink.unmerge(). Thanks to Diego Pettenò (diff)
downloadportage-idfetch-8c70715b17035030d5729972e01b2c2d3d842967.tar.gz
portage-idfetch-8c70715b17035030d5729972e01b2c2d3d842967.tar.bz2
portage-idfetch-8c70715b17035030d5729972e01b2c2d3d842967.zip
FEATURES=unmerge-logs
Keep logs from successful unmerge phases. This is relevant only when PORT_LOGDIR is set. Thanks to Diego Pettenò <flameeyes@gentoo.org> for the suggestion. svn path=/main/trunk/; revision=13844
-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 167f61d5..4693e206 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 2b5a7645..229e50b3 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 fe9e8e67..88ec7b3c 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: