summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2006-12-21 00:32:10 +0000
committerZac Medico <zmedico@gentoo.org>2006-12-21 00:32:10 +0000
commit4873e71dd032f3f1fc00cb98f9d17ea9d3b1b390 (patch)
treea784cf6c662f34ab4933340757c801616341c2fa
parent8bb13608b4a192a794996f26a3e31bb516a0c6c2 (diff)
downloadportage-4873e71dd032f3f1fc00cb98f9d17ea9d3b1b390.tar.gz
portage-4873e71dd032f3f1fc00cb98f9d17ea9d3b1b390.tar.bz2
portage-4873e71dd032f3f1fc00cb98f9d17ea9d3b1b390.zip
When a removal phase fails, tell the user where the ebuild is and advise them that the ebuild can be removed in order to skip the removal phases.
svn path=/main/trunk/; revision=5340
-rwxr-xr-xbin/emerge21
-rw-r--r--pym/portage.py14
2 files changed, 29 insertions, 6 deletions
diff --git a/bin/emerge b/bin/emerge
index 744db7b9e..8d310da48 100755
--- a/bin/emerge
+++ b/bin/emerge
@@ -3230,11 +3230,32 @@ def unmerge(settings, myopts, vartree, unmerge_action, unmerge_files,
vartree=vartree, ldpath_mtimes=ldpath_mtimes)
if retval != os.EX_OK:
emergelog(xterm_titles, " !!! unmerge FAILURE: "+y)
+ ebuild = vartree.dbapi.findname(y)
+ show_unmerge_failure_message(y, ebuild, retval)
+ sys.exit(retval)
else:
clean_world(vartree.dbapi, y)
emergelog(xterm_titles, " >>> unmerge success: "+y)
return 1
+def show_unmerge_failure_message(pkg, ebuild, retval):
+
+ from formatter import AbstractFormatter, DumbWriter
+ f = AbstractFormatter(DumbWriter(maxcol=72))
+
+ msg = []
+ msg.append("A removal phase of the '%s' package " % pkg)
+ msg.append("has failed with exit value %s. " % retval)
+ msg.append("The problem occurred while executing ")
+ msg.append("the ebuild located at '%s'. " % ebuild)
+ msg.append("If necessary, manually remove the ebuild " )
+ msg.append("in order to skip the execution of removal phases.")
+
+ print
+ for x in msg:
+ f.add_flowing_data(x)
+ f.end_paragraph(1)
+
def chk_updated_info_files(root, infodirs, prev_mtimes, retval):
print
diff --git a/pym/portage.py b/pym/portage.py
index 3de43de21..40cb23246 100644
--- a/pym/portage.py
+++ b/pym/portage.py
@@ -3581,11 +3581,12 @@ def unmerge(cat, pkg, myroot, mysettings, mytrimworld=1, vartree=None, ldpath_mt
try:
mylink.lockdb()
if mylink.exists():
- mylink.unmerge(trimworld=mytrimworld, cleanup=1,
+ retval = mylink.unmerge(trimworld=mytrimworld, cleanup=1,
ldpath_mtimes=ldpath_mtimes)
- mylink.delete()
- return 0
- return 1
+ if retval == os.EX_OK:
+ mylink.delete()
+ return retval
+ return os.EX_OK
finally:
mylink.unlockdb()
@@ -6380,7 +6381,7 @@ class dblink:
# XXX: Decide how to handle failures here.
if retval != os.EX_OK:
writemsg("!!! FAILED prerm: %s\n" % retval, noiselevel=-1)
- sys.exit(123)
+ return retval
self._unmerge_pkgfiles(pkgfiles)
@@ -6395,7 +6396,7 @@ class dblink:
# XXX: Decide how to handle failures here.
if retval != os.EX_OK:
writemsg("!!! FAILED postrm: %s\n" % retval, noiselevel=-1)
- sys.exit(123)
+ return retval
doebuild(myebuildpath, "cleanrm", self.myroot, self.settings,
tree="vartree", mydbapi=self.vartree.dbapi,
vartree=self.vartree)
@@ -6418,6 +6419,7 @@ class dblink:
portage_locks.unlockdir(catdir_lock)
env_update(target_root=self.myroot, prev_mtimes=ldpath_mtimes,
contents=contents)
+ return os.EX_OK
def _unmerge_pkgfiles(self, pkgfiles):