Gentoo Archives: gentoo-portage-dev

From: Alexandru Elisei <alexandru.elisei@×××××.com>
To: gentoo-portage-dev@l.g.o
Subject: [gentoo-portage-dev] [PATCH] emerge: make emerge --sync print messages from SyncRepos.auto_sync()
Date: Sat, 04 Feb 2017 17:49:37
Message-Id: CAB-4s4k1CKzVsJM+WkyiLKrDv-QwsDajAP01PV_MKDqpnu=brg@mail.gmail.com
1 Emerge will only display messages if --quiet is not set.
2
3 The word 'emaint' has been removed from two messages to avoid confusion.
4 ---
5 pym/_emerge/actions.py | 7 +++++--
6 pym/portage/emaint/modules/sync/sync.py | 7 +++----
7 2 files changed, 8 insertions(+), 6 deletions(-)
8
9 diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py
10 index ccb6a5d..71e362e 100644
11 --- a/pym/_emerge/actions.py
12 +++ b/pym/_emerge/actions.py
13 @@ -68,6 +68,7 @@ from portage._global_updates import _global_updates
14 from portage.sync.old_tree_timestamp import old_tree_timestamp_warn
15 from portage.localization import _
16 from portage.metadata import action_metadata
17 +from portage.emaint.main import print_results
18
19 from _emerge.clear_caches import clear_caches
20 from _emerge.countdown import countdown
21 @@ -1999,8 +2000,10 @@ def action_sync(emerge_config, trees=DeprecationWarning,
22
23 syncer = SyncRepos(emerge_config)
24
25 -
26 - success, msgs = syncer.auto_sync(options={'return-messages': False})
27 + return_messages = "--quiet" not in emerge_config.opts
28 + success, msgs = syncer.auto_sync(options={'return-messages': return_messages})
29 + if return_messages:
30 + print_results(msgs)
31
32 return os.EX_OK if success else 1
33
34 diff --git a/pym/portage/emaint/modules/sync/sync.py
35 b/pym/portage/emaint/modules/sync/sync.py
36 index 076297a..ca5461d 100644
37 --- a/pym/portage/emaint/modules/sync/sync.py
38 +++ b/pym/portage/emaint/modules/sync/sync.py
39 @@ -123,9 +123,8 @@ class SyncRepos(object):
40 available = self._get_repos(auto_sync_only=False)
41 selected = self._match_repos(repos, available)
42 if not selected:
43 - msgs = [red(" * ") + "Emaint sync, The specified repos were not found: %s"
44 - % (bold(", ".join(repos))) + "\n ...returning"
45 - ]
46 + msgs = [red(" * ") + "The specified repos were not found: %s" %
47 + (bold(", ".join(repos))) + "\n ...returning"]
48 if return_messages:
49 return (False, msgs)
50 return (False, None)
51 @@ -208,7 +207,7 @@ class SyncRepos(object):
52 selected_repos = [repo for repo in selected_repos if repo.sync_type
53 is not None]
54 msgs = []
55 if not selected_repos:
56 - msgs.append("Emaint sync, nothing to sync... returning")
57 + msgs.append("Nothing to sync... returning")
58 if return_messages:
59 msgs.extend(self.rmessage([('None', os.EX_OK)], 'sync'))
60 return (True, msgs)
61 --
62 2.10.2

Replies