From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id E85F81391DB for ; Mon, 16 Jun 2014 15:18:56 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 3A641E0D59; Mon, 16 Jun 2014 15:18:52 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 61117E0D54 for ; Mon, 16 Jun 2014 15:18:51 +0000 (UTC) Received: from spoonbill.gentoo.org (spoonbill.gentoo.org [81.93.255.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id D3EEF34000E for ; Mon, 16 Jun 2014 15:18:49 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by spoonbill.gentoo.org (Postfix) with ESMTP id 26BC3187F0 for ; Mon, 16 Jun 2014 15:18:47 +0000 (UTC) From: "Brian Dolbec" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Brian Dolbec" Message-ID: <1399954662.2dafe8ee49925a2b15a5937b5e5c6e09ad69af8b.dol-sen@gentoo> Subject: [gentoo-commits] proj/portage:plugin-sync commit in: pym/_emerge/ X-VCS-Repository: proj/portage X-VCS-Files: pym/_emerge/actions.py X-VCS-Directories: pym/_emerge/ X-VCS-Committer: dol-sen X-VCS-Committer-Name: Brian Dolbec X-VCS-Revision: 2dafe8ee49925a2b15a5937b5e5c6e09ad69af8b X-VCS-Branch: plugin-sync Date: Mon, 16 Jun 2014 15:18:47 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 39d1411a-a4a1-4bfb-a218-66082fa40e9f X-Archives-Hash: e2fe5c407c703b2e39964099f1c74234 commit: 2dafe8ee49925a2b15a5937b5e5c6e09ad69af8b Author: Brian Dolbec gentoo org> AuthorDate: Tue Apr 22 02:18:07 2014 +0000 Commit: Brian Dolbec gmail com> CommitDate: Tue May 13 04:17:42 2014 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=2dafe8ee _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 e375fc1..30acf78 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 @@ -1839,84 +1837,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