diff options
author | Zac Medico <zmedico@gentoo.org> | 2008-06-28 09:08:24 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2008-06-28 09:08:24 +0000 |
commit | bcf69af38179859dcc5dd4ebd591933f24f464ad (patch) | |
tree | 3fbddbc29cb5dea7b0d8e8978414548831482d2f | |
parent | c2d14290656a7b6cb8d092158655f8e736f1edf3 (diff) | |
download | portage-bcf69af38179859dcc5dd4ebd591933f24f464ad.tar.gz portage-bcf69af38179859dcc5dd4ebd591933f24f464ad.tar.bz2 portage-bcf69af38179859dcc5dd4ebd591933f24f464ad.zip |
Split out a PackageUninstall class.
svn path=/main/trunk/; revision=10833
-rw-r--r-- | pym/_emerge/__init__.py | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py index 3e10d71e9..edbabdd99 100644 --- a/pym/_emerge/__init__.py +++ b/pym/_emerge/__init__.py @@ -1536,6 +1536,25 @@ class EbuildMerge(Task): blockers=self.find_blockers) return retval +class PackageUninstall(Task): + + __slots__ = ("ldpath_mtimes", "opts", "pkg", "settings") + + def _get_hash_key(self): + hash_key = getattr(self, "_hash_key", None) + if hash_key is None: + self._hash_key = ("PackageUninstall", self.pkg._get_hash_key()) + return self._hash_key + + def execute(self): + try: + unmerge(self.pkg.root_config, self.opts, "unmerge", + [self.pkg.cpv], self.ldpath_mtimes, clean_world=0, + raise_on_error=1) + except UninstallFailure, e: + return e.status + return os.EX_OK + class BinpkgFetcher(Task): __slots__ = ("use_locks", "pkg", "pretend", @@ -6413,12 +6432,11 @@ class MergeTask(object): metadata = pkg.metadata if pkg.installed: if not (buildpkgonly or fetchonly or pretend): - try: - unmerge(root_config, self.myopts, "unmerge", - [pkg.cpv], mtimedb["ldpath"], clean_world=0, - raise_on_error=1) - except UninstallFailure, e: - raise self._pkg_failure(e.status) + uninstall = PackageUninstall(ldpath_mtimes=ldpath_mtimes, + opts=self.myopts, pkg=pkg, settings=pkgsettings) + retval = uninstall.execute() + if retval != os.EX_OK: + raise self._pkg_failure(retval) return if x[0]=="blocks": |