1 |
commit: 264c4a0c2a855a35d634851abd189302e6f87280 |
2 |
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Sep 5 20:08:36 2014 +0000 |
4 |
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com> |
5 |
CommitDate: Tue Sep 30 00:42:27 2014 +0000 |
6 |
URL: http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=264c4a0c |
7 |
|
8 |
portage/sync/controller.sync(): Migrate writemsg() call to return the error message to caller |
9 |
|
10 |
Highlight the "ERROR" string portion usig bad(), remove 1 linefeed. |
11 |
This puts the error in the emaint sync message list. |
12 |
|
13 |
--- |
14 |
pym/portage/emaint/modules/sync/sync.py | 6 +++--- |
15 |
pym/portage/sync/controller.py | 13 ++++++------- |
16 |
2 files changed, 9 insertions(+), 10 deletions(-) |
17 |
|
18 |
diff --git a/pym/portage/emaint/modules/sync/sync.py b/pym/portage/emaint/modules/sync/sync.py |
19 |
index 9b0d82c..4369a2a 100644 |
20 |
--- a/pym/portage/emaint/modules/sync/sync.py |
21 |
+++ b/pym/portage/emaint/modules/sync/sync.py |
22 |
@@ -179,11 +179,11 @@ class SyncRepos(object): |
23 |
sync_manager = get_syncer(self.emerge_config.target_config.settings, emergelog) |
24 |
retvals = [] |
25 |
for repo in selected_repos: |
26 |
- #print("syncing repo:", repo.name) |
27 |
if repo.sync_type is not None: |
28 |
- returncode = sync_manager.sync(self.emerge_config, repo) |
29 |
- #if returncode != os.EX_OK: |
30 |
+ returncode, message = sync_manager.sync(self.emerge_config, repo) |
31 |
retvals.append((repo.name, returncode)) |
32 |
+ if message: |
33 |
+ msgs.append(message) |
34 |
|
35 |
# Reload the whole config. |
36 |
portage._sync_mode = False |
37 |
|
38 |
diff --git a/pym/portage/sync/controller.py b/pym/portage/sync/controller.py |
39 |
index 2b3dbad..e8fe291 100644 |
40 |
--- a/pym/portage/sync/controller.py |
41 |
+++ b/pym/portage/sync/controller.py |
42 |
@@ -103,14 +103,13 @@ class SyncManager(object): |
43 |
if repo.sync_type in self.module_names[1:]: |
44 |
tasks = [self.module_controller.get_class(repo.sync_type)] |
45 |
else: |
46 |
- portage.util.writemsg( |
47 |
- "\nERROR: Sync module '%s' is not an installed/known type'\n\n" |
48 |
- % (repo.sync_type), noiselevel=-1) |
49 |
- return self.exitcode |
50 |
+ msg = "\n%s: Sync module '%s' is not an installed/known type'\n" \ |
51 |
+ % (bad("ERROR"), repo.sync_type) |
52 |
+ return self.exitcode, msg |
53 |
|
54 |
rval = self.pre_sync(repo) |
55 |
if rval != os.EX_OK: |
56 |
- return rval |
57 |
+ return rval, None |
58 |
|
59 |
# need to pass the kwargs dict to the modules |
60 |
# so they are available if needed. |
61 |
@@ -131,7 +130,7 @@ class SyncManager(object): |
62 |
|
63 |
self.perform_post_sync_hook(repo.sync_uri) |
64 |
|
65 |
- return self.exitcode |
66 |
+ return self.exitcode, None |
67 |
|
68 |
|
69 |
def do_callback(self, result): |
70 |
@@ -167,7 +166,7 @@ class SyncManager(object): |
71 |
except OSError: |
72 |
st = None |
73 |
if st is None: |
74 |
- print(">>> '%s' not found, creating it." % repo.location) |
75 |
+ writemsg_level(">>> '%s' not found, creating it." % repo.location) |
76 |
portage.util.ensure_dirs(repo.location, mode=0o755) |
77 |
st = os.stat(repo.location) |