* [gentoo-commits] proj/portage:master commit in: pym/portage/emaint/modules/sync/
@ 2014-12-04 20:16 Brian Dolbec
2014-12-04 20:04 ` [gentoo-commits] proj/portage:plugin-sync " Brian Dolbec
0 siblings, 1 reply; 11+ messages in thread
From: Brian Dolbec @ 2014-12-04 20:16 UTC (permalink / raw
To: gentoo-commits
commit: f9ae6e5a3de3dfdf536b5928c4ad5cfef376f1cc
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Fri Sep 5 04:37:10 2014 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Thu Dec 4 19:56:34 2014 +0000
URL: http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=f9ae6e5a
emaint sync: Fix bug 522032, add a one time only post-sync hook call
After all repos have been synced, the emaint sync module runs another post-sync hook call
passing it the '' value as the repo name.
This value can be read by the post-sync hook to decide if it needs to run or pass.
This allows flexible, precise control over post-sync hooks for multiple repositories.
Caveat: Current app-portage/portage-utils post_sync hook script does not pass on any parameters
to the postsync.d/* scripts that it intiates.
---
pym/portage/emaint/modules/sync/sync.py | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/pym/portage/emaint/modules/sync/sync.py b/pym/portage/emaint/modules/sync/sync.py
index b657133..86d16a3 100644
--- a/pym/portage/emaint/modules/sync/sync.py
+++ b/pym/portage/emaint/modules/sync/sync.py
@@ -192,10 +192,15 @@ class SyncRepos(object):
msgs.extend(self._check_updates())
display_news_notification(self.emerge_config.target_config,
self.emerge_config.opts)
+ # run the post_sync_hook one last time for
+ # run only at sync completion hooks
+ rcode = sync_manager.perform_post_sync_hook('')
if retvals:
msgs.extend(self.rmessage(retvals, 'sync'))
else:
msgs.append(self.rmessage(('None', os.EX_OK), 'sync'))
+ if rcode:
+ msgs.append(self.rmessage('None', rcode), 'post-sync')
if return_messages:
return msgs
return
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/emaint/modules/sync/
2014-12-04 20:16 [gentoo-commits] proj/portage:master commit in: pym/portage/emaint/modules/sync/ Brian Dolbec
@ 2014-12-04 20:04 ` Brian Dolbec
0 siblings, 0 replies; 11+ messages in thread
From: Brian Dolbec @ 2014-12-04 20:04 UTC (permalink / raw
To: gentoo-commits
commit: f9ae6e5a3de3dfdf536b5928c4ad5cfef376f1cc
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Fri Sep 5 04:37:10 2014 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Thu Dec 4 19:56:34 2014 +0000
URL: http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=f9ae6e5a
emaint sync: Fix bug 522032, add a one time only post-sync hook call
After all repos have been synced, the emaint sync module runs another post-sync hook call
passing it the '' value as the repo name.
This value can be read by the post-sync hook to decide if it needs to run or pass.
This allows flexible, precise control over post-sync hooks for multiple repositories.
Caveat: Current app-portage/portage-utils post_sync hook script does not pass on any parameters
to the postsync.d/* scripts that it intiates.
---
pym/portage/emaint/modules/sync/sync.py | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/pym/portage/emaint/modules/sync/sync.py b/pym/portage/emaint/modules/sync/sync.py
index b657133..86d16a3 100644
--- a/pym/portage/emaint/modules/sync/sync.py
+++ b/pym/portage/emaint/modules/sync/sync.py
@@ -192,10 +192,15 @@ class SyncRepos(object):
msgs.extend(self._check_updates())
display_news_notification(self.emerge_config.target_config,
self.emerge_config.opts)
+ # run the post_sync_hook one last time for
+ # run only at sync completion hooks
+ rcode = sync_manager.perform_post_sync_hook('')
if retvals:
msgs.extend(self.rmessage(retvals, 'sync'))
else:
msgs.append(self.rmessage(('None', os.EX_OK), 'sync'))
+ if rcode:
+ msgs.append(self.rmessage('None', rcode), 'post-sync')
if return_messages:
return msgs
return
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/emaint/modules/sync/
@ 2017-02-28 18:43 Zac Medico
0 siblings, 0 replies; 11+ messages in thread
From: Zac Medico @ 2017-02-28 18:43 UTC (permalink / raw
To: gentoo-commits
commit: 9d14e63a814cab949ac49eb4d780b5545954da57
Author: Alexandru Elisei <alexandru.elisei <AT> gmail <DOT> com>
AuthorDate: Mon Feb 27 14:15:44 2017 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Feb 28 18:41:58 2017 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=9d14e63a
sync.py: recognize repo aliases when updating repositories (bug 610852)
Also when doing emerge --sync and using multiple repo names or aliases
duplicates are discarded.
X-Gentoo-Bug: 610852
X-Gentoo-Bug-Url: https://bugs.gentoo.org/show_bug.cgi?id=610852
pym/portage/emaint/modules/sync/sync.py | 28 ++++++++++++++++++++--------
1 file changed, 20 insertions(+), 8 deletions(-)
diff --git a/pym/portage/emaint/modules/sync/sync.py b/pym/portage/emaint/modules/sync/sync.py
index 9e3ca069e..ebdc362e1 100644
--- a/pym/portage/emaint/modules/sync/sync.py
+++ b/pym/portage/emaint/modules/sync/sync.py
@@ -137,9 +137,9 @@ class SyncRepos(object):
@staticmethod
def _match_repos(repos, available):
- '''Internal search, matches up the repo.name in repos
+ '''Internal search, matches up the repo name or alias in repos.
- @param repos: list, of repo names to match
+ @param repos: list of repo names or aliases to match
@param avalable: list of repo objects to search
@return: list of repo objects that match
'''
@@ -147,6 +147,9 @@ class SyncRepos(object):
for repo in available:
if repo.name in repos:
selected.append(repo)
+ elif (repo.aliases is not None and
+ any(alias in repos for alias in repo.aliases)):
+ selected.append(repo)
return selected
@@ -154,14 +157,23 @@ class SyncRepos(object):
msgs = []
repos = self.emerge_config.target_config.settings.repositories
if match_repos is not None:
+ # Discard duplicate repository names or aliases.
+ match_repos = set(match_repos)
repos = self._match_repos(match_repos, repos)
if len(repos) < len(match_repos):
- available = [repo.name for repo in repos]
- missing = [repo for repo in match_repos if repo not in available]
- msgs.append(red(" * ") + "The specified repo(s) were not found: %s" %
- (" ".join(repo for repo in missing)) + \
- "\n ...returning")
- return (False, repos, msgs)
+ # Build a set of all the matched repos' names and aliases so we
+ # can do a set difference for names that are missing.
+ repo_names = set()
+ for repo in repos:
+ repo_names.add(repo.name)
+ if repo.aliases is not None:
+ repo_names.update(repo.aliases)
+ missing = match_repos - repo_names
+ if missing:
+ msgs.append(red(" * ") + "The specified repo(s) were not found: %s" %
+ (" ".join(repo_name for repo_name in missing)) + \
+ "\n ...returning")
+ return (False, repos, msgs)
if auto_sync_only:
repos = self._filter_auto(repos)
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/emaint/modules/sync/
@ 2017-02-25 1:23 Zac Medico
0 siblings, 0 replies; 11+ messages in thread
From: Zac Medico @ 2017-02-25 1:23 UTC (permalink / raw
To: gentoo-commits
commit: 79103f99799c9365389290e812213c46e006c019
Author: Alexandru Elisei <alexandru.elisei <AT> gmail <DOT> com>
AuthorDate: Tue Feb 21 12:02:38 2017 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sat Feb 25 01:13:44 2017 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=79103f99
sync.py: validate repos in _get_repos() (bug 567478, 576282, 601054)
SyncRepos._get_repos() now receives an optional match argument, which
represents the names of the repositories to retrieve.
SyncRepos._get_repos() will return a tuple of (result, repos, messages).
Result is True on success and False on failure, repos is a list of
repository objects and messages is a list of errors or warnings
generated while getting the repos.
Repos given to emerge --sync are no longer treated separately.
After commit 75f0936 multiple repos can be given to SyncRepos.repo()
via emerge --sync. SyncRepos._get_repos() will fail if at least one
of these repos cannot be synced (the repo is missing or has sync
disabled).
If no repos are specified, SyncRepos._get_repos() ignores repos with
sync-type empty as per the portage.5 man file. If repos are specified,
the function will fail. This check was previously done in _sync(), which
could lead to a situation when a repo given to emerge --sync or
emaint sync --repo was not synced and the operation was considered
successful.
SyncRepos._get_repos() also validates repos by checking for a non-empty
sync-uri. Finding a repo with an empty sync-uri is considered a failure
and the appropriate message will be generated.
pym/portage/emaint/modules/sync/sync.py | 120 +++++++++++++++-----------------
1 file changed, 58 insertions(+), 62 deletions(-)
diff --git a/pym/portage/emaint/modules/sync/sync.py b/pym/portage/emaint/modules/sync/sync.py
index 08a92a7a8..9e3ca069e 100644
--- a/pym/portage/emaint/modules/sync/sync.py
+++ b/pym/portage/emaint/modules/sync/sync.py
@@ -89,47 +89,50 @@ class SyncRepos(object):
def auto_sync(self, **kwargs):
'''Sync auto-sync enabled repos'''
options = kwargs.get('options', None)
- selected = self._get_repos(True)
if options:
return_messages = options.get('return-messages', False)
else:
return_messages = False
- return self._sync(selected, return_messages,
- emaint_opts=options)
+ success, repos, msgs = self._get_repos(auto_sync_only=True)
+ if not success:
+ if return_messages:
+ return (False, msgs)
+ return (False, None)
+ return self._sync(repos, return_messages, emaint_opts=options)
def all_repos(self, **kwargs):
'''Sync all repos defined in repos.conf'''
- selected = self._get_repos(auto_sync_only=False)
options = kwargs.get('options', None)
if options:
return_messages = options.get('return-messages', False)
else:
return_messages = False
- return self._sync(selected, return_messages,
- emaint_opts=options)
+ success, repos, msgs = self._get_repos(auto_sync_only=False)
+ if not success:
+ if return_messages:
+ return (False, msgs)
+ return (False, None)
+ return self._sync(repos, return_messages, emaint_opts=options)
def repo(self, **kwargs):
'''Sync the specified repo'''
options = kwargs.get('options', None)
if options:
- repos = options.get('repo', '')
+ repo_names = options.get('repo', '')
return_messages = options.get('return-messages', False)
else:
return_messages = False
- if isinstance(repos, _basestring):
- repos = repos.split()
- available = self._get_repos(auto_sync_only=False)
- selected = self._match_repos(repos, available)
- if not selected:
- msgs = [red(" * ") + "The specified repos were not found: %s" %
- (bold(", ".join(repos))) + "\n ...returning"]
+ if isinstance(repo_names, _basestring):
+ repo_names = repo_names.split()
+ success, repos, msgs = self._get_repos(auto_sync_only=False,
+ match_repos=repo_names)
+ if not success:
if return_messages:
return (False, msgs)
return (False, None)
- return self._sync(selected, return_messages,
- emaint_opts=options)
+ return self._sync(repos, return_messages, emaint_opts=options)
@staticmethod
@@ -147,44 +150,40 @@ class SyncRepos(object):
return selected
- def _get_repos(self, auto_sync_only=True):
- selected_repos = []
- unknown_repo_names = []
- missing_sync_type = []
- if self.emerge_config.args:
- for repo_name in self.emerge_config.args:
- #print("_get_repos(): repo_name =", repo_name)
- try:
- repo = self.emerge_config.target_config.settings.repositories[repo_name]
- except KeyError:
- unknown_repo_names.append(repo_name)
- else:
- selected_repos.append(repo)
- if repo.sync_type is None:
- missing_sync_type.append(repo)
-
- if unknown_repo_names:
- writemsg_level("!!! %s\n" % _("Unknown repo(s): %s") %
- " ".join(unknown_repo_names),
- level=logging.ERROR, noiselevel=-1)
-
- if missing_sync_type:
- writemsg_level("!!! %s\n" %
- _("Missing sync-type for repo(s): %s") %
- " ".join(repo.name for repo in missing_sync_type),
- level=logging.ERROR, noiselevel=-1)
-
- if unknown_repo_names or missing_sync_type:
- writemsg_level("Missing or unknown repos... returning",
- level=logging.INFO, noiselevel=2)
- return []
+ def _get_repos(self, auto_sync_only=True, match_repos=None):
+ msgs = []
+ repos = self.emerge_config.target_config.settings.repositories
+ if match_repos is not None:
+ repos = self._match_repos(match_repos, repos)
+ if len(repos) < len(match_repos):
+ available = [repo.name for repo in repos]
+ missing = [repo for repo in match_repos if repo not in available]
+ msgs.append(red(" * ") + "The specified repo(s) were not found: %s" %
+ (" ".join(repo for repo in missing)) + \
+ "\n ...returning")
+ return (False, repos, msgs)
- else:
- selected_repos.extend(self.emerge_config.target_config.settings.repositories)
- #print("_get_repos(), selected =", selected_repos)
if auto_sync_only:
- return self._filter_auto(selected_repos)
- return selected_repos
+ repos = self._filter_auto(repos)
+
+ sync_disabled = [repo for repo in repos if repo.sync_type is None]
+ if sync_disabled:
+ repos = [repo for repo in repos if repo.sync_type is not None]
+ if match_repos is not None:
+ msgs.append(red(" * " ) + "The specified repo(s) have sync disabled: %s" %
+ " ".join(repo.name for repo in sync_disabled) + \
+ "\n ...returning")
+ return (False, repos, msgs)
+
+ missing_sync_uri = [repo for repo in repos if repo.sync_uri is None]
+ if missing_sync_uri:
+ repos = [repo for repo in repos if repo.sync_uri is not None]
+ msgs.append(red(" * ") + "The specified repo(s) are missing sync-uri: %s" %
+ " ".join(repo.name for repo in missing_sync_uri) + \
+ "\n ...returning")
+ return (False, repos, msgs)
+
+ return (True, repos, msgs)
def _filter_auto(self, repos):
@@ -195,8 +194,13 @@ class SyncRepos(object):
return selected
- def _sync(self, selected_repos, return_messages,
- emaint_opts=None):
+ def _sync(self, selected_repos, return_messages, emaint_opts=None):
+ msgs = []
+ if not selected_repos:
+ if return_messages:
+ msgs.append("Nothing to sync... returning")
+ return (True, msgs)
+ return (True, None)
if emaint_opts is not None:
for k, v in emaint_opts.items():
@@ -204,14 +208,6 @@ class SyncRepos(object):
k = "--" + k.replace("_", "-")
self.emerge_config.opts[k] = v
- selected_repos = [repo for repo in selected_repos if repo.sync_type is not None]
- msgs = []
- if not selected_repos:
- msgs.append("Nothing to sync... returning")
- if return_messages:
- msgs.extend(self.rmessage([('None', os.EX_OK)], 'sync'))
- return (True, msgs)
- return (True, None)
# Portage needs to ensure a sane umask for the files it creates.
os.umask(0o22)
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/emaint/modules/sync/
@ 2017-01-26 19:09 Zac Medico
0 siblings, 0 replies; 11+ messages in thread
From: Zac Medico @ 2017-01-26 19:09 UTC (permalink / raw
To: gentoo-commits
commit: 9305bccfb29807f54a9dc514d3aea70639eb2c49
Author: Alexandru Elisei <alexandru.elisei <AT> gmail <DOT> com>
AuthorDate: Thu Jan 26 18:38:46 2017 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu Jan 26 19:08:54 2017 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=9305bccf
sync.py: set returncode when task failed in SyncScheduler._task_exit()
If task.returncode is not os.EX_OK then returncode isn't defined when
trying to append the (repo, returncode) tuple to self.retvals. This will
raise an UnboundLocalError exception.
This reverts the changes to the function made by commit f143e58.
Fixes: f143e58dd3fd ("emaint: exit with non-zero status code when module fails (bug 567478)")
pym/portage/emaint/modules/sync/sync.py | 1 +
1 file changed, 1 insertion(+)
diff --git a/pym/portage/emaint/modules/sync/sync.py b/pym/portage/emaint/modules/sync/sync.py
index b190b3c..076297a 100644
--- a/pym/portage/emaint/modules/sync/sync.py
+++ b/pym/portage/emaint/modules/sync/sync.py
@@ -362,6 +362,7 @@ class SyncScheduler(AsyncScheduler):
# that hooks will be called in a backward-compatible manner
# even if all sync tasks have failed.
hooks_enabled = True
+ returncode = task.returncode
if task.returncode == os.EX_OK:
returncode, message, updatecache_flg, hooks_enabled = task.result
if message:
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/emaint/modules/sync/
@ 2015-08-21 2:12 Zac Medico
0 siblings, 0 replies; 11+ messages in thread
From: Zac Medico @ 2015-08-21 2:12 UTC (permalink / raw
To: gentoo-commits
commit: bafb62bb32432094f1c413a9a7e2dc902ff11a5a
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Fri Aug 21 00:02:26 2015 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Fri Aug 21 02:10:59 2015 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=bafb62bb
SyncRepos._sync: call postsync.d hooks earlier (bug 558322)
Execute the hooks immediately after all repos have synced.
X-Gentoo-Bug: 558322
X-Gentoo-Bug-url: https://bugs.gentoo.org/show_bug.cgi?id=558322
Acked-by: Brian Dolbec <dolsen <AT> gentoo.org>
pym/portage/emaint/modules/sync/sync.py | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/pym/portage/emaint/modules/sync/sync.py b/pym/portage/emaint/modules/sync/sync.py
index 601118f..57c779d 100644
--- a/pym/portage/emaint/modules/sync/sync.py
+++ b/pym/portage/emaint/modules/sync/sync.py
@@ -233,13 +233,6 @@ class SyncRepos(object):
retvals = sync_scheduler.retvals
msgs.extend(sync_scheduler.msgs)
- # Reload the whole config.
- portage._sync_mode = False
- self._reload_config()
- self._do_pkg_moves()
- msgs.extend(self._check_updates())
- display_news_notification(self.emerge_config.target_config,
- self.emerge_config.opts)
# run the post_sync_hook one last time for
# run only at sync completion hooks
rcode = sync_manager.perform_post_sync_hook('')
@@ -249,6 +242,15 @@ class SyncRepos(object):
msgs.extend(self.rmessage([('None', os.EX_OK)], 'sync'))
if rcode:
msgs.extend(self.rmessage([('None', rcode)], 'post-sync'))
+
+ # Reload the whole config.
+ portage._sync_mode = False
+ self._reload_config()
+ self._do_pkg_moves()
+ msgs.extend(self._check_updates())
+ display_news_notification(self.emerge_config.target_config,
+ self.emerge_config.opts)
+
if return_messages:
return msgs
return
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/emaint/modules/sync/
@ 2015-08-16 8:39 Zac Medico
0 siblings, 0 replies; 11+ messages in thread
From: Zac Medico @ 2015-08-16 8:39 UTC (permalink / raw
To: gentoo-commits
commit: 3b7a45a161be5c44c8b2a63da0ef8a65d73765be
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun Aug 16 07:11:02 2015 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun Aug 16 08:38:15 2015 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=3b7a45a1
SyncScheduler: only sync the selected masters
Since commit 496ff326dc18890889d1ea5d2aec590394635960, master
repositories have been synced even when not selected.
Fixes: 496ff326dc18 ("sync repositories in parallel (bug 557426)")
Acked-by: Brian Dolbec <dolsen <AT> gentoo.org>
pym/portage/emaint/modules/sync/sync.py | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/pym/portage/emaint/modules/sync/sync.py b/pym/portage/emaint/modules/sync/sync.py
index 879d0f0..601118f 100644
--- a/pym/portage/emaint/modules/sync/sync.py
+++ b/pym/portage/emaint/modules/sync/sync.py
@@ -328,12 +328,15 @@ class SyncScheduler(AsyncScheduler):
self._leaf_nodes = []
self._repo_map = {}
self._running_repos = set()
+ selected_repo_names = frozenset(repo.name
+ for repo in self._selected_repos)
for repo in self._selected_repos:
self._repo_map[repo.name] = repo
self._sync_graph.add(repo.name, None)
for master in repo.masters:
- self._repo_map[master.name] = master
- self._sync_graph.add(master.name, repo.name)
+ if master.name in selected_repo_names:
+ self._repo_map[master.name] = master
+ self._sync_graph.add(master.name, repo.name)
self._update_leaf_nodes()
def _task_exit(self, task):
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/emaint/modules/sync/
@ 2014-12-04 20:16 Brian Dolbec
0 siblings, 0 replies; 11+ messages in thread
From: Brian Dolbec @ 2014-12-04 20:16 UTC (permalink / raw
To: gentoo-commits
commit: d86cafaf0cb68f8745306f22f423b7db20b18715
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue Oct 21 20:55:20 2014 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Thu Dec 4 19:56:35 2014 +0000
URL: http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=d86cafaf
SyncRepos: fix rmessage usage
---
pym/portage/emaint/modules/sync/sync.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pym/portage/emaint/modules/sync/sync.py b/pym/portage/emaint/modules/sync/sync.py
index e9f5e0b..845e8c7 100644
--- a/pym/portage/emaint/modules/sync/sync.py
+++ b/pym/portage/emaint/modules/sync/sync.py
@@ -208,9 +208,9 @@ class SyncRepos(object):
if retvals:
msgs.extend(self.rmessage(retvals, 'sync'))
else:
- msgs.append(self.rmessage(('None', os.EX_OK), 'sync'))
+ msgs.extend(self.rmessage([('None', os.EX_OK)], 'sync'))
if rcode:
- msgs.append(self.rmessage('None', rcode), 'post-sync')
+ msgs.extend(self.rmessage([('None', rcode)], 'post-sync'))
if return_messages:
return msgs
return
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/emaint/modules/sync/
@ 2014-12-04 20:16 Brian Dolbec
0 siblings, 0 replies; 11+ messages in thread
From: Brian Dolbec @ 2014-12-04 20:16 UTC (permalink / raw
To: gentoo-commits
commit: 19f5d813acf9e5c591107c383dadf3399d3dfa0a
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Fri Sep 5 04:28:16 2014 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Thu Dec 4 19:56:34 2014 +0000
URL: http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=19f5d813
emaint sync: Migrate print statements to emaint style messages
Comment out some debug prints.
---
pym/portage/emaint/modules/sync/sync.py | 62 +++++++++++++++++++--------------
1 file changed, 36 insertions(+), 26 deletions(-)
diff --git a/pym/portage/emaint/modules/sync/sync.py b/pym/portage/emaint/modules/sync/sync.py
index ab7591d..b657133 100644
--- a/pym/portage/emaint/modules/sync/sync.py
+++ b/pym/portage/emaint/modules/sync/sync.py
@@ -70,20 +70,22 @@ class SyncRepos(object):
'''Sync auto-sync enabled repos'''
options = kwargs.get('options', None)
selected = self._get_repos(True)
- if options.get('return-messages', False):
- return self.rmessage(self._sync(selected), 'sync')
- return self._sync(selected)
+ if options:
+ return_messages = options.get('return-messages', False)
+ else:
+ return_messages = False
+ return self._sync(selected, return_messages)
def all_repos(self, **kwargs):
'''Sync all repos defined in repos.conf'''
selected = self._get_repos(auto_sync_only=False)
options = kwargs.get('options', None)
- if options.get('return-messages', False):
- return self.rmessage(
- self._sync(selected),
- 'sync')
- return self._sync(selected)
+ if options:
+ return_messages = options.get('return-messages', False)
+ else:
+ return_messages = False
+ return self._sync(selected, return_messages)
def repo(self, **kwargs):
@@ -98,9 +100,7 @@ class SyncRepos(object):
repos = repos.split()
available = self._get_repos(auto_sync_only=False)
selected = self._match_repos(repos, available)
- if return_messages:
- return self.rmessage(self._sync(selected), 'sync')
- return self._sync(selected)
+ return self._sync(selected, return_messages)
@staticmethod
@@ -124,7 +124,7 @@ class SyncRepos(object):
missing_sync_type = []
if self.emerge_config.args:
for repo_name in self.emerge_config.args:
- print("_get_repos(): repo_name =", repo_name)
+ #print("_get_repos(): repo_name =", repo_name)
try:
repo = self.emerge_config.target_config.settings.repositories[repo_name]
except KeyError:
@@ -146,7 +146,8 @@ class SyncRepos(object):
level=logging.ERROR, noiselevel=-1)
if unknown_repo_names or missing_sync_type:
- print("missing or unknown repos... returning")
+ writemsg_level("Missing or unknown repos... returning",
+ level=logging.INFO, noiselevel=2)
return []
else:
@@ -165,17 +166,20 @@ class SyncRepos(object):
return selected
- def _sync(self, selected_repos):
+ def _sync(self, selected_repos, return_messages):
+ msgs = []
if not selected_repos:
- print("_sync(), nothing to sync... returning")
- return [('None', os.EX_OK)]
+ msgs.append("Emaint sync, nothing to sync... returning")
+ if return_messages:
+ return msgs.append(self.rmessage(('None', os.EX_OK), 'sync'))
+ return
# Portage needs to ensure a sane umask for the files it creates.
os.umask(0o22)
sync_manager = get_syncer(self.emerge_config.target_config.settings, emergelog)
retvals = []
for repo in selected_repos:
- print("syncing repo:", repo.name)
+ #print("syncing repo:", repo.name)
if repo.sync_type is not None:
returncode = sync_manager.sync(self.emerge_config, repo)
#if returncode != os.EX_OK:
@@ -185,12 +189,16 @@ class SyncRepos(object):
portage._sync_mode = False
self._reload_config()
self._do_pkg_moves()
- self._check_updates()
+ msgs.extend(self._check_updates())
display_news_notification(self.emerge_config.target_config,
self.emerge_config.opts)
if retvals:
- return retvals
- return [('None', os.EX_OK)]
+ msgs.extend(self.rmessage(retvals, 'sync'))
+ else:
+ msgs.append(self.rmessage(('None', os.EX_OK), 'sync'))
+ if return_messages:
+ return msgs
+ return
def _do_pkg_moves(self):
@@ -214,13 +222,15 @@ class SyncRepos(object):
portage.util.shlex_split(
self.emerge_config.target_config.settings.get("CONFIG_PROTECT", "")))
+ msgs = []
if mybestpv != mypvs and "--quiet" not in self.emerge_config.opts:
- print()
- print(warn(" * ")+bold("An update to portage is available.")+" It is _highly_ recommended")
- print(warn(" * ")+"that you update portage now, before any other packages are updated.")
- print()
- print(warn(" * ")+"To update portage, run 'emerge --oneshot portage' now.")
- print()
+ msgs.append('')
+ msgs.append(warn(" * ")+bold("An update to portage is available.")+" It is _highly_ recommended")
+ msgs.append(warn(" * ")+"that you update portage now, before any other packages are updated.")
+ msgs.append('')
+ msgs.append(warn(" * ")+"To update portage, run 'emerge --oneshot portage' now.")
+ msgs.append('')
+ return msgs
def _reload_config(self):
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/emaint/modules/sync/
@ 2014-12-04 20:04 Brian Dolbec
2014-12-04 20:16 ` [gentoo-commits] proj/portage:master " Brian Dolbec
0 siblings, 1 reply; 11+ messages in thread
From: Brian Dolbec @ 2014-12-04 20:04 UTC (permalink / raw
To: gentoo-commits
commit: d3b91ee6493a9a5ac63e47e119ed7b73a2119e94
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Thu Dec 4 18:20:13 2014 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Thu Dec 4 19:58:27 2014 +0000
URL: http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=d3b91ee6
emaint/modules/sync/sync.py: Fix a bug in the output if a specified repo did not exist
---
pym/portage/emaint/modules/sync/sync.py | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/pym/portage/emaint/modules/sync/sync.py b/pym/portage/emaint/modules/sync/sync.py
index 1dade6f..77c685c 100644
--- a/pym/portage/emaint/modules/sync/sync.py
+++ b/pym/portage/emaint/modules/sync/sync.py
@@ -9,7 +9,7 @@ import portage
portage._internal_caller = True
portage._sync_mode = True
from portage.localization import _
-from portage.output import bold, create_color_func
+from portage.output import bold, red, create_color_func
from portage._global_updates import _global_updates
from portage.sync.controller import SyncManager
from portage.util import writemsg_level
@@ -116,6 +116,13 @@ class SyncRepos(object):
repos = repos.split()
available = self._get_repos(auto_sync_only=False)
selected = self._match_repos(repos, available)
+ if not selected:
+ msgs = [red(" * ") + "Emaint sync, The specified repos were not found: %s"
+ % (bold(", ".join(repos))) + "\n ...returning"
+ ]
+ if return_messages:
+ return msgs
+ return
return self._sync(selected, return_messages)
@@ -187,7 +194,8 @@ class SyncRepos(object):
if not selected_repos:
msgs.append("Emaint sync, nothing to sync... returning")
if return_messages:
- return msgs.append(self.rmessage(('None', os.EX_OK), 'sync'))
+ msgs.extend(self.rmessage([('None', os.EX_OK)], 'sync'))
+ return msgs
return
# Portage needs to ensure a sane umask for the files it creates.
os.umask(0o22)
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/emaint/modules/sync/
2014-12-04 20:04 [gentoo-commits] proj/portage:plugin-sync " Brian Dolbec
@ 2014-12-04 20:16 ` Brian Dolbec
0 siblings, 0 replies; 11+ messages in thread
From: Brian Dolbec @ 2014-12-04 20:16 UTC (permalink / raw
To: gentoo-commits
commit: d3b91ee6493a9a5ac63e47e119ed7b73a2119e94
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Thu Dec 4 18:20:13 2014 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Thu Dec 4 19:58:27 2014 +0000
URL: http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=d3b91ee6
emaint/modules/sync/sync.py: Fix a bug in the output if a specified repo did not exist
---
pym/portage/emaint/modules/sync/sync.py | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/pym/portage/emaint/modules/sync/sync.py b/pym/portage/emaint/modules/sync/sync.py
index 1dade6f..77c685c 100644
--- a/pym/portage/emaint/modules/sync/sync.py
+++ b/pym/portage/emaint/modules/sync/sync.py
@@ -9,7 +9,7 @@ import portage
portage._internal_caller = True
portage._sync_mode = True
from portage.localization import _
-from portage.output import bold, create_color_func
+from portage.output import bold, red, create_color_func
from portage._global_updates import _global_updates
from portage.sync.controller import SyncManager
from portage.util import writemsg_level
@@ -116,6 +116,13 @@ class SyncRepos(object):
repos = repos.split()
available = self._get_repos(auto_sync_only=False)
selected = self._match_repos(repos, available)
+ if not selected:
+ msgs = [red(" * ") + "Emaint sync, The specified repos were not found: %s"
+ % (bold(", ".join(repos))) + "\n ...returning"
+ ]
+ if return_messages:
+ return msgs
+ return
return self._sync(selected, return_messages)
@@ -187,7 +194,8 @@ class SyncRepos(object):
if not selected_repos:
msgs.append("Emaint sync, nothing to sync... returning")
if return_messages:
- return msgs.append(self.rmessage(('None', os.EX_OK), 'sync'))
+ msgs.extend(self.rmessage([('None', os.EX_OK)], 'sync'))
+ return msgs
return
# Portage needs to ensure a sane umask for the files it creates.
os.umask(0o22)
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/emaint/modules/sync/
@ 2014-12-04 20:04 Brian Dolbec
2014-12-04 20:16 ` [gentoo-commits] proj/portage:master " Brian Dolbec
0 siblings, 1 reply; 11+ messages in thread
From: Brian Dolbec @ 2014-12-04 20:04 UTC (permalink / raw
To: gentoo-commits
commit: 75f86cc121deed1df25c2cbafe22483828397c67
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Wed Oct 22 12:30:19 2014 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Thu Dec 4 19:56:35 2014 +0000
URL: http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=75f86cc1
SyncRepos: parse EMERGE_DEFAULT_OPTS
We need to parse EMERGE_DEFAULT_OPTS, for settings like
--package-moves=n.
---
pym/portage/emaint/modules/sync/sync.py | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/pym/portage/emaint/modules/sync/sync.py b/pym/portage/emaint/modules/sync/sync.py
index 845e8c7..1dade6f 100644
--- a/pym/portage/emaint/modules/sync/sync.py
+++ b/pym/portage/emaint/modules/sync/sync.py
@@ -58,6 +58,13 @@ class SyncRepos(object):
emerge_config = load_emerge_config(
action='sync', args=_files, opts=opts)
+ # Parse EMERGE_DEFAULT_OPTS, for settings like
+ # --package-moves=n.
+ cmdline = portage.util.shlex_split(
+ emerge_config.target_config.settings.get(
+ "EMERGE_DEFAULT_OPTS", ""))
+ emerge_config.opts = parse_opts(cmdline, silent=True)[1]
+
if hasattr(portage, 'settings'):
# cleanly destroy global objects
portage._reset_legacy_globals()
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/emaint/modules/sync/
2014-12-04 20:04 [gentoo-commits] proj/portage:plugin-sync " Brian Dolbec
@ 2014-12-04 20:16 ` Brian Dolbec
0 siblings, 0 replies; 11+ messages in thread
From: Brian Dolbec @ 2014-12-04 20:16 UTC (permalink / raw
To: gentoo-commits
commit: 75f86cc121deed1df25c2cbafe22483828397c67
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Wed Oct 22 12:30:19 2014 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Thu Dec 4 19:56:35 2014 +0000
URL: http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=75f86cc1
SyncRepos: parse EMERGE_DEFAULT_OPTS
We need to parse EMERGE_DEFAULT_OPTS, for settings like
--package-moves=n.
---
pym/portage/emaint/modules/sync/sync.py | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/pym/portage/emaint/modules/sync/sync.py b/pym/portage/emaint/modules/sync/sync.py
index 845e8c7..1dade6f 100644
--- a/pym/portage/emaint/modules/sync/sync.py
+++ b/pym/portage/emaint/modules/sync/sync.py
@@ -58,6 +58,13 @@ class SyncRepos(object):
emerge_config = load_emerge_config(
action='sync', args=_files, opts=opts)
+ # Parse EMERGE_DEFAULT_OPTS, for settings like
+ # --package-moves=n.
+ cmdline = portage.util.shlex_split(
+ emerge_config.target_config.settings.get(
+ "EMERGE_DEFAULT_OPTS", ""))
+ emerge_config.opts = parse_opts(cmdline, silent=True)[1]
+
if hasattr(portage, 'settings'):
# cleanly destroy global objects
portage._reset_legacy_globals()
^ permalink raw reply related [flat|nested] 11+ messages in thread
end of thread, other threads:[~2017-02-28 18:43 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-04 20:16 [gentoo-commits] proj/portage:master commit in: pym/portage/emaint/modules/sync/ Brian Dolbec
2014-12-04 20:04 ` [gentoo-commits] proj/portage:plugin-sync " Brian Dolbec
-- strict thread matches above, loose matches on Subject: below --
2017-02-28 18:43 [gentoo-commits] proj/portage:master " Zac Medico
2017-02-25 1:23 Zac Medico
2017-01-26 19:09 Zac Medico
2015-08-21 2:12 Zac Medico
2015-08-16 8:39 Zac Medico
2014-12-04 20:16 Brian Dolbec
2014-12-04 20:16 Brian Dolbec
2014-12-04 20:04 [gentoo-commits] proj/portage:plugin-sync " Brian Dolbec
2014-12-04 20:16 ` [gentoo-commits] proj/portage:master " Brian Dolbec
2014-12-04 20:04 [gentoo-commits] proj/portage:plugin-sync " Brian Dolbec
2014-12-04 20:16 ` [gentoo-commits] proj/portage:master " Brian Dolbec
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox