1 |
Author: zmedico |
2 |
Date: 2008-06-28 09:08:24 +0000 (Sat, 28 Jun 2008) |
3 |
New Revision: 10833 |
4 |
|
5 |
Modified: |
6 |
main/trunk/pym/_emerge/__init__.py |
7 |
Log: |
8 |
Split out a PackageUninstall class. |
9 |
|
10 |
|
11 |
Modified: main/trunk/pym/_emerge/__init__.py |
12 |
=================================================================== |
13 |
--- main/trunk/pym/_emerge/__init__.py 2008-06-28 07:00:45 UTC (rev 10832) |
14 |
+++ main/trunk/pym/_emerge/__init__.py 2008-06-28 09:08:24 UTC (rev 10833) |
15 |
@@ -1536,6 +1536,25 @@ |
16 |
blockers=self.find_blockers) |
17 |
return retval |
18 |
|
19 |
+class PackageUninstall(Task): |
20 |
+ |
21 |
+ __slots__ = ("ldpath_mtimes", "opts", "pkg", "settings") |
22 |
+ |
23 |
+ def _get_hash_key(self): |
24 |
+ hash_key = getattr(self, "_hash_key", None) |
25 |
+ if hash_key is None: |
26 |
+ self._hash_key = ("PackageUninstall", self.pkg._get_hash_key()) |
27 |
+ return self._hash_key |
28 |
+ |
29 |
+ def execute(self): |
30 |
+ try: |
31 |
+ unmerge(self.pkg.root_config, self.opts, "unmerge", |
32 |
+ [self.pkg.cpv], self.ldpath_mtimes, clean_world=0, |
33 |
+ raise_on_error=1) |
34 |
+ except UninstallFailure, e: |
35 |
+ return e.status |
36 |
+ return os.EX_OK |
37 |
+ |
38 |
class BinpkgFetcher(Task): |
39 |
|
40 |
__slots__ = ("use_locks", "pkg", "pretend", |
41 |
@@ -6413,12 +6432,11 @@ |
42 |
metadata = pkg.metadata |
43 |
if pkg.installed: |
44 |
if not (buildpkgonly or fetchonly or pretend): |
45 |
- try: |
46 |
- unmerge(root_config, self.myopts, "unmerge", |
47 |
- [pkg.cpv], mtimedb["ldpath"], clean_world=0, |
48 |
- raise_on_error=1) |
49 |
- except UninstallFailure, e: |
50 |
- raise self._pkg_failure(e.status) |
51 |
+ uninstall = PackageUninstall(ldpath_mtimes=ldpath_mtimes, |
52 |
+ opts=self.myopts, pkg=pkg, settings=pkgsettings) |
53 |
+ retval = uninstall.execute() |
54 |
+ if retval != os.EX_OK: |
55 |
+ raise self._pkg_failure(retval) |
56 |
return |
57 |
|
58 |
if x[0]=="blocks": |
59 |
|
60 |
-- |
61 |
gentoo-commits@l.g.o mailing list |