From: "Brian Dolbec" <brian.dolbec@gmail.com>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/portage:plugin-sync commit in: pym/_emerge/
Date: Wed, 3 Sep 2014 23:36:24 +0000 (UTC) [thread overview]
Message-ID: <1409787293.b946ac57b6ada686fb2ba2f528ca5a3d46361583.dol-sen@gentoo> (raw)
commit: b946ac57b6ada686fb2ba2f528ca5a3d46361583
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Apr 22 02:18:07 2014 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Wed Sep 3 23:34:53 2014 +0000
URL: http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=b946ac57
_emerge/actions: Migrate action_sync to the new emaint sync module
---
pym/_emerge/actions.py | 83 +++-----------------------------------------------
1 file changed, 5 insertions(+), 78 deletions(-)
diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py
index 92d1bc6..bd068a7 100644
--- a/pym/_emerge/actions.py
+++ b/pym/_emerge/actions.py
@@ -27,13 +27,13 @@ portage.proxy.lazyimport.lazyimport(globals(),
'portage.debug',
'portage.news:count_unread_news,display_news_notifications',
'portage.util._get_vm_info:get_vm_info',
+ 'portage.emaint.modules.sync.sync:SyncRepos',
'_emerge.chk_updated_cfg_files:chk_updated_cfg_files',
'_emerge.help:help@emerge_help',
'_emerge.post_emerge:display_news_notification,post_emerge',
'_emerge.stdout_spinner:stdout_spinner',
)
-from portage.localization import _
from portage import os
from portage import shutil
from portage import eapi_is_supported, _encodings, _unicode_decode
@@ -45,7 +45,7 @@ from portage.dbapi._expand_new_virt import expand_new_virt
from portage.dep import Atom
from portage.eclass_cache import hashed_path
from portage.exception import InvalidAtom, InvalidData, ParseError
-from portage.output import blue, bold, colorize, create_color_func, darkgreen, \
+from portage.output import blue, colorize, create_color_func, darkgreen, \
red, xtermTitle, xtermTitleReset, yellow
good = create_color_func("GOOD")
bad = create_color_func("BAD")
@@ -62,8 +62,6 @@ from portage.util._async.run_main_scheduler import run_main_scheduler
from portage.util._async.SchedulerInterface import SchedulerInterface
from portage.util._eventloop.global_event_loop import global_event_loop
from portage._global_updates import _global_updates
-from portage.sync import get_syncer
-from portage.sync.getaddrinfo_validate import getaddrinfo_validate
from portage.sync.old_tree_timestamp import old_tree_timestamp_warn
from portage.metadata import action_metadata
@@ -1843,84 +1841,13 @@ def action_sync(emerge_config, trees=DeprecationWarning,
emerge_config = load_emerge_config(
action=action, args=[], trees=trees, opts=opts)
- xterm_titles = "notitles" not in \
- emerge_config.target_config.settings.features
- emergelog(xterm_titles, " === sync")
-
- selected_repos = []
- unknown_repo_names = []
- missing_sync_type = []
- if emerge_config.args:
- for repo_name in emerge_config.args:
- try:
- repo = 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)
+ syncer = SyncRepos(emerge_config)
- 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:
- return 1
-
- else:
- selected_repos.extend(emerge_config.target_config.settings.repositories)
-
- sync_manager = get_syncer(emerge_config.target_config.settings, emergelog)
- retvals = []
- for repo in selected_repos:
- if repo.sync_type is not None:
- returncode = sync_manager.sync(emerge_config, repo)
- if returncode != os.EX_OK:
- retvals.append(returncode)
-
- # Reload the whole config from scratch.
- portage._sync_mode = False
- load_emerge_config(emerge_config=emerge_config)
- adjust_configs(emerge_config.opts, emerge_config.trees)
- if emerge_config.opts.get('--package-moves') != 'n' and \
- _global_updates(emerge_config.trees,
- emerge_config.target_config.mtimedb["updates"],
- quiet=("--quiet" in emerge_config.opts)):
- emerge_config.target_config.mtimedb.commit()
- # Reload the whole config from scratch.
- load_emerge_config(emerge_config=emerge_config)
- adjust_configs(emerge_config.opts, emerge_config.trees)
-
- mybestpv = emerge_config.target_config.trees['porttree'].dbapi.xmatch(
- "bestmatch-visible", portage.const.PORTAGE_PACKAGE_ATOM)
- mypvs = portage.best(
- emerge_config.target_config.trees['vartree'].dbapi.match(
- portage.const.PORTAGE_PACKAGE_ATOM))
-
- chk_updated_cfg_files(emerge_config.target_config.root,
- portage.util.shlex_split(
- emerge_config.target_config.settings.get("CONFIG_PROTECT", "")))
-
- if mybestpv != mypvs and "--quiet" not in 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()
+ retvals = syncer.auto_sync(options={'return-messages': False})
- display_news_notification(emerge_config.target_config, emerge_config.opts)
if retvals:
- return retvals[0]
+ return retvals[0][1]
return os.EX_OK
next reply other threads:[~2014-09-03 23:36 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-03 23:36 Brian Dolbec [this message]
-- strict thread matches above, loose matches on Subject: below --
2014-12-01 21:50 [gentoo-commits] proj/portage:plugin-sync commit in: pym/_emerge/ Michał Górny
2014-10-21 5:05 Zac Medico
2014-10-21 5:05 Zac Medico
2014-10-20 3:54 Zac Medico
2014-10-20 3:54 Zac Medico
2014-10-20 3:54 Zac Medico
2014-09-30 0:46 Brian Dolbec
2014-09-30 0:46 Brian Dolbec
2014-09-30 0:46 Brian Dolbec
2014-09-29 18:29 Brian Dolbec
2014-09-29 18:29 Brian Dolbec
2014-09-27 2:20 Brian Dolbec
2014-09-27 2:20 Brian Dolbec
2014-09-05 21:15 Brian Dolbec
2014-09-05 21:15 Brian Dolbec
2014-09-05 21:15 Brian Dolbec
2014-09-05 4:38 Brian Dolbec
2014-09-04 1:18 Brian Dolbec
2014-09-03 23:36 Brian Dolbec
2014-09-03 23:36 Brian Dolbec
2014-06-16 22:45 Brian Dolbec
2014-06-16 22:45 Brian Dolbec
2014-06-16 22:45 Brian Dolbec
2014-06-16 15:46 Brian Dolbec
2014-06-16 15:46 Brian Dolbec
2014-06-16 15:46 Brian Dolbec
2014-06-16 15:18 Brian Dolbec
2014-06-16 15:18 Brian Dolbec
2014-06-16 15:18 Brian Dolbec
2014-05-11 17:22 Brian Dolbec
2014-05-02 23:13 Brian Dolbec
2014-05-02 23:13 Brian Dolbec
2014-04-22 2:36 Brian Dolbec
2014-04-22 2:36 Brian Dolbec
2014-01-29 4:10 Brian Dolbec
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1409787293.b946ac57b6ada686fb2ba2f528ca5a3d46361583.dol-sen@gentoo \
--to=brian.dolbec@gmail.com \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox