From 8c70715b17035030d5729972e01b2c2d3d842967 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Mon, 20 Jul 2009 22:43:41 +0000 Subject: FEATURES=unmerge-logs Keep logs from successful unmerge phases. This is relevant only when PORT_LOGDIR is set. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Thanks to Diego Pettenò for the suggestion. svn path=/main/trunk/; revision=13844 --- pym/portage/dbapi/vartree.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'pym') 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: -- cgit v1.2.3-1-g7c22