diff options
author | Zac Medico <zmedico@gentoo.org> | 2007-11-21 08:48:12 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2007-11-21 08:48:12 +0000 |
commit | e1a3306d601b5ebcc5e50a5f2c190680a29ffb9e (patch) | |
tree | 7306b02d5896e744daacddd9a010cd3d6594d90e /pym | |
parent | ec69d9ccbb3695e21a4324bd9ed27c14ea2469f9 (diff) | |
download | portage-e1a3306d601b5ebcc5e50a5f2c190680a29ffb9e.tar.gz portage-e1a3306d601b5ebcc5e50a5f2c190680a29ffb9e.tar.bz2 portage-e1a3306d601b5ebcc5e50a5f2c190680a29ffb9e.zip |
Generate an eerror elog message when an ebuild prerm or
postrm phase fails. (trunk r8577)
svn path=/main/branches/2.1.2/; revision=8580
Diffstat (limited to 'pym')
-rw-r--r-- | pym/portage.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/pym/portage.py b/pym/portage.py index 8081737f1..7964e1cdd 100644 --- a/pym/portage.py +++ b/pym/portage.py @@ -7672,6 +7672,7 @@ class dblink: # Now, don't assume that the name of the ebuild is the same as the # name of the dir; the package may have been moved. myebuildpath = None + ebuild_phase = "prerm" mystuff = listdir(self.dbdir, EmptyOnError=1) for x in mystuff: if x.endswith(".ebuild"): @@ -7725,6 +7726,7 @@ class dblink: self._unmerge_pkgfiles(pkgfiles, others_in_slot) if myebuildpath: + ebuild_phase = "postrm" retval = doebuild(myebuildpath, "postrm", self.myroot, self.settings, use_cache=0, tree="vartree", mydbapi=self.vartree.dbapi, vartree=self.vartree) @@ -7738,6 +7740,22 @@ class dblink: if builddir_lock: try: if myebuildpath: + if retval != os.EX_OK: + msg = ("The '%s' " % ebuild_phase) + \ + ("phase of the '%s' package " % self.mycpv) + \ + ("has failed with exit value %s. " % retval) + \ + "The problem occurred while executing " + \ + ("the ebuild located at '%s'. " % myebuildpath) + \ + "If necessary, manually remove the ebuild " + \ + "in order to skip the execution of removal phases." + from textwrap import wrap + cmd = "source '%s/isolated-functions.sh' ; " % \ + PORTAGE_BIN_PATH + for l in wrap(msg, 72): + cmd += "eerror \"%s\" ; " % l + portage_exec.spawn(["bash", "-c", cmd], + env=self.settings.environ()) + # process logs created during pre/postrm elog_process(self.mycpv, self.settings) if retval == os.EX_OK: |