1 |
commit: d9468f78c67e35f817389d9a36a570506720c343 |
2 |
Author: Zac Medico <zmedico <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu May 26 00:57:05 2011 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu May 26 00:57:05 2011 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=d9468f78 |
7 |
|
8 |
unmerge: fix logging for unsupported EAPI |
9 |
|
10 |
--- |
11 |
pym/portage/dbapi/vartree.py | 55 ++++++++++++++++++++++------------------- |
12 |
1 files changed, 29 insertions(+), 26 deletions(-) |
13 |
|
14 |
diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py |
15 |
index 021191f..62a2332 100644 |
16 |
--- a/pym/portage/dbapi/vartree.py |
17 |
+++ b/pym/portage/dbapi/vartree.py |
18 |
@@ -1670,19 +1670,13 @@ class dblink(object): |
19 |
# We avoid a redundant setcpv call here when |
20 |
# the caller has already taken care of it. |
21 |
self.settings.setcpv(self.mycpv, mydb=self.vartree.dbapi) |
22 |
- if myebuildpath: |
23 |
- try: |
24 |
- doebuild_environment(myebuildpath, "prerm", |
25 |
- settings=self.settings, db=self.vartree.dbapi) |
26 |
- except UnsupportedAPIException as e: |
27 |
- failures += 1 |
28 |
- # Sometimes this happens due to corruption of the EAPI file. |
29 |
- showMessage(_("!!! FAILED prerm: %s\n") % \ |
30 |
- os.path.join(self.dbdir, "EAPI"), |
31 |
- level=logging.ERROR, noiselevel=-1) |
32 |
- showMessage(_unicode_decode("%s\n") % (e,), |
33 |
- level=logging.ERROR, noiselevel=-1) |
34 |
- myebuildpath = None |
35 |
+ |
36 |
+ eapi_unsupported = False |
37 |
+ try: |
38 |
+ doebuild_environment(myebuildpath, "prerm", |
39 |
+ settings=self.settings, db=self.vartree.dbapi) |
40 |
+ except UnsupportedAPIException as e: |
41 |
+ eapi_unsupported = e |
42 |
|
43 |
self._prune_plib_registry(unmerge=True, needed=needed, |
44 |
preserve_paths=preserve_paths) |
45 |
@@ -1692,18 +1686,27 @@ class dblink(object): |
46 |
scheduler = self._scheduler |
47 |
retval = os.EX_OK |
48 |
try: |
49 |
- if myebuildpath: |
50 |
- # Only create builddir_lock if the caller |
51 |
- # has not already acquired the lock. |
52 |
- if not builddir_locked: |
53 |
- builddir_lock = EbuildBuildDir( |
54 |
- scheduler=scheduler, |
55 |
- settings=self.settings) |
56 |
- builddir_lock.lock() |
57 |
- builddir_locked = True |
58 |
- prepare_build_dirs(settings=self.settings, cleanup=True) |
59 |
- log_path = self.settings.get("PORTAGE_LOG_FILE") |
60 |
+ # Only create builddir_lock if the caller |
61 |
+ # has not already acquired the lock. |
62 |
+ if not builddir_locked: |
63 |
+ builddir_lock = EbuildBuildDir( |
64 |
+ scheduler=scheduler, |
65 |
+ settings=self.settings) |
66 |
+ builddir_lock.lock() |
67 |
+ prepare_build_dirs(settings=self.settings, cleanup=True) |
68 |
+ log_path = self.settings.get("PORTAGE_LOG_FILE") |
69 |
|
70 |
+ # Log the error after PORTAGE_LOG_FILE is initialized |
71 |
+ # by prepare_build_dirs above. |
72 |
+ if eapi_unsupported: |
73 |
+ # Sometimes this happens due to corruption of the EAPI file. |
74 |
+ failures += 1 |
75 |
+ showMessage(_("!!! FAILED prerm: %s\n") % \ |
76 |
+ os.path.join(self.dbdir, "EAPI"), |
77 |
+ level=logging.ERROR, noiselevel=-1) |
78 |
+ showMessage(_unicode_decode("%s\n") % (eapi_unsupported,), |
79 |
+ level=logging.ERROR, noiselevel=-1) |
80 |
+ elif myebuildpath: |
81 |
phase = EbuildPhase(background=background, |
82 |
phase=ebuild_phase, scheduler=scheduler, |
83 |
settings=self.settings) |
84 |
@@ -1723,7 +1726,7 @@ class dblink(object): |
85 |
self.vartree.dbapi._fs_unlock() |
86 |
self._clear_contents_cache() |
87 |
|
88 |
- if myebuildpath: |
89 |
+ if myebuildpath and not eapi_unsupported: |
90 |
ebuild_phase = "postrm" |
91 |
phase = EbuildPhase(background=background, |
92 |
phase=ebuild_phase, scheduler=scheduler, |
93 |
@@ -1741,7 +1744,7 @@ class dblink(object): |
94 |
self.vartree.dbapi._bump_mtime(self.mycpv) |
95 |
if builddir_locked: |
96 |
try: |
97 |
- if myebuildpath: |
98 |
+ if myebuildpath and not eapi_unsupported: |
99 |
if retval != os.EX_OK: |
100 |
msg_lines = [] |
101 |
msg = _("The '%(ebuild_phase)s' " |