public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/portage:plugin-sync commit in: pym/_emerge/
@ 2014-01-29  4:10 Brian Dolbec
  0 siblings, 0 replies; 36+ messages in thread
From: Brian Dolbec @ 2014-01-29  4:10 UTC (permalink / raw
  To: gentoo-commits

commit:     eff4e326f6feaad6bd1b807bc24eac771419e4ac
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Wed Jan 29 04:05:30 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Wed Jan 29 04:05:30 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=eff4e326

Move the SyncManager initialization out of the loop

Make the returncode not bail out of syncing the remaining repos.

---
 pym/_emerge/actions.py | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py
index 6306f4d..6f4de04 100644
--- a/pym/_emerge/actions.py
+++ b/pym/_emerge/actions.py
@@ -1875,13 +1875,13 @@ def action_sync(emerge_config, trees=DeprecationWarning,
 	else:
 		selected_repos.extend(emerge_config.target_config.settings.repositories)
 
+	sync_manager = SyncManager(emerge_config.target_config.settings, emergelog)
+	retvals = []
 	for repo in selected_repos:
 		if repo.sync_type is not None:
-			sync_manager = SyncManager(emerge_config.target_config.settings,
-				emergelog)
 			returncode = sync_manager.sync(emerge_config, repo)
 			if returncode != os.EX_OK:
-				return returncode
+				retvals.append(returncode)
 
 	# Reload the whole config from scratch.
 	portage._sync_mode = False
@@ -1916,6 +1916,8 @@ def action_sync(emerge_config, trees=DeprecationWarning,
 		print()
 
 	display_news_notification(emerge_config.target_config, emerge_config.opts)
+	if retvals:
+		return retvals[0]
 	return os.EX_OK
 
 


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [gentoo-commits] proj/portage:plugin-sync commit in: pym/_emerge/
@ 2014-04-22  2:36 Brian Dolbec
  0 siblings, 0 replies; 36+ messages in thread
From: Brian Dolbec @ 2014-04-22  2:36 UTC (permalink / raw
  To: gentoo-commits

commit:     4b358c994bb15a33d5b4d81da7afaab2ecd71270
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Apr 21 18:23:36 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Mon Apr 21 18:23:36 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=4b358c99

_emerge/main.py: remove redundant portage._sync_mode setting

---
 pym/_emerge/main.py | 2 --
 1 file changed, 2 deletions(-)

diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py
index da223a6..6676cba 100644
--- a/pym/_emerge/main.py
+++ b/pym/_emerge/main.py
@@ -1010,8 +1010,6 @@ def emerge_main(args=None):
 
 	# Portage needs to ensure a sane umask for the files it creates.
 	os.umask(0o22)
-	if myaction == "sync":
-		portage._sync_mode = True
 	emerge_config = load_emerge_config(
 		action=myaction, args=myfiles, opts=myopts)
 	rval = profile_check(emerge_config.trees, emerge_config.action)


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [gentoo-commits] proj/portage:plugin-sync commit in: pym/_emerge/
@ 2014-04-22  2:36 Brian Dolbec
  0 siblings, 0 replies; 36+ messages in thread
From: Brian Dolbec @ 2014-04-22  2:36 UTC (permalink / raw
  To: gentoo-commits

commit:     0979ca74b8a903abbf94f93785e88ddf377b6eed
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: Tue Apr 22 02:22:59 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=0979ca74

_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 ccfe2e7..65645e4 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
-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
 
 


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [gentoo-commits] proj/portage:plugin-sync commit in: pym/_emerge/
@ 2014-05-02 23:13 Brian Dolbec
  0 siblings, 0 replies; 36+ messages in thread
From: Brian Dolbec @ 2014-05-02 23:13 UTC (permalink / raw
  To: gentoo-commits

commit:     9d7ce27d80c3ecdd0f86a2fd71aa7f962b9946c0
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Apr 21 18:23:36 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Fri May  2 23:09:17 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=9d7ce27d

_emerge/main.py: remove redundant portage._sync_mode setting

---
 pym/_emerge/main.py | 2 --
 1 file changed, 2 deletions(-)

diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py
index eddb16c..3e9d7d1 100644
--- a/pym/_emerge/main.py
+++ b/pym/_emerge/main.py
@@ -1020,8 +1020,6 @@ def emerge_main(args=None):
 
 	# Portage needs to ensure a sane umask for the files it creates.
 	os.umask(0o22)
-	if myaction == "sync":
-		portage._sync_mode = True
 	emerge_config = load_emerge_config(
 		action=myaction, args=myfiles, opts=myopts)
 	rval = profile_check(emerge_config.trees, emerge_config.action)


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [gentoo-commits] proj/portage:plugin-sync commit in: pym/_emerge/
@ 2014-05-02 23:13 Brian Dolbec
  0 siblings, 0 replies; 36+ messages in thread
From: Brian Dolbec @ 2014-05-02 23:13 UTC (permalink / raw
  To: gentoo-commits

commit:     3d01ff3eada5aa19f5e592b2bf7af8ce06170d78
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: Fri May  2 23:11:06 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=3d01ff3e

_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
 
 


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [gentoo-commits] proj/portage:plugin-sync commit in: pym/_emerge/
@ 2014-05-11 17:22 Brian Dolbec
  0 siblings, 0 replies; 36+ messages in thread
From: Brian Dolbec @ 2014-05-11 17:22 UTC (permalink / raw
  To: gentoo-commits

commit:     e65c2ff6bd962557787c6baa895dadcbb9c0a48a
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun May 11 17:05:17 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sun May 11 17:21:12 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=e65c2ff6

_emerge/main.py: Set portage._sync_mode for --sync

This allows repos with non-existent directories to be available.
If the new repo is set for auto-sync, then it can be created with the sync module's new().

---
 pym/_emerge/main.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py
index 3e9d7d1..785301b 100644
--- a/pym/_emerge/main.py
+++ b/pym/_emerge/main.py
@@ -1017,6 +1017,10 @@ def emerge_main(args=None):
 	elif myaction == "moo":
 		print(COWSAY_MOO % platform.system())
 		return os.EX_OK
+	elif myaction == "sync":
+		# need to set this to True now in order for the repository config
+		# loading to allow new repos with non-existent directories
+		portage._sync_mode = True
 
 	# Portage needs to ensure a sane umask for the files it creates.
 	os.umask(0o22)


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [gentoo-commits] proj/portage:plugin-sync commit in: pym/_emerge/
@ 2014-06-16 15:18 Brian Dolbec
  0 siblings, 0 replies; 36+ messages in thread
From: Brian Dolbec @ 2014-06-16 15:18 UTC (permalink / raw
  To: gentoo-commits

commit:     7bee1cfbc2c43c23ed2ddd066490b5b1d9f72c7f
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Apr 21 18:23:36 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Tue May 13 04:17:41 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=7bee1cfb

_emerge/main.py: remove redundant portage._sync_mode setting

---
 pym/_emerge/main.py | 2 --
 1 file changed, 2 deletions(-)

diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py
index eddb16c..3e9d7d1 100644
--- a/pym/_emerge/main.py
+++ b/pym/_emerge/main.py
@@ -1020,8 +1020,6 @@ def emerge_main(args=None):
 
 	# Portage needs to ensure a sane umask for the files it creates.
 	os.umask(0o22)
-	if myaction == "sync":
-		portage._sync_mode = True
 	emerge_config = load_emerge_config(
 		action=myaction, args=myfiles, opts=myopts)
 	rval = profile_check(emerge_config.trees, emerge_config.action)


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [gentoo-commits] proj/portage:plugin-sync commit in: pym/_emerge/
@ 2014-06-16 15:18 Brian Dolbec
  0 siblings, 0 replies; 36+ messages in thread
From: Brian Dolbec @ 2014-06-16 15:18 UTC (permalink / raw
  To: gentoo-commits

commit:     2dafe8ee49925a2b15a5937b5e5c6e09ad69af8b
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: 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
 
 


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [gentoo-commits] proj/portage:plugin-sync commit in: pym/_emerge/
@ 2014-06-16 15:18 Brian Dolbec
  0 siblings, 0 replies; 36+ messages in thread
From: Brian Dolbec @ 2014-06-16 15:18 UTC (permalink / raw
  To: gentoo-commits

commit:     3005866289d8c674a8c62c696757b6567fa49a77
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun May 11 17:05:17 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Tue May 13 04:24:34 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=30058662

_emerge/main.py: Set portage._sync_mode for --sync

This allows repos with non-existent directories to be available.
If the new repo is set for auto-sync, then it can be created with the sync module's new().

---
 pym/_emerge/main.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py
index 3e9d7d1..785301b 100644
--- a/pym/_emerge/main.py
+++ b/pym/_emerge/main.py
@@ -1017,6 +1017,10 @@ def emerge_main(args=None):
 	elif myaction == "moo":
 		print(COWSAY_MOO % platform.system())
 		return os.EX_OK
+	elif myaction == "sync":
+		# need to set this to True now in order for the repository config
+		# loading to allow new repos with non-existent directories
+		portage._sync_mode = True
 
 	# Portage needs to ensure a sane umask for the files it creates.
 	os.umask(0o22)


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [gentoo-commits] proj/portage:plugin-sync commit in: pym/_emerge/
@ 2014-06-16 15:46 Brian Dolbec
  0 siblings, 0 replies; 36+ messages in thread
From: Brian Dolbec @ 2014-06-16 15:46 UTC (permalink / raw
  To: gentoo-commits

commit:     c1b3eb39c5e9a323c92838429880502a25652b33
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Apr 21 18:23:36 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Mon Jun 16 15:36:56 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=c1b3eb39

_emerge/main.py: remove redundant portage._sync_mode setting

---
 pym/_emerge/main.py | 2 --
 1 file changed, 2 deletions(-)

diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py
index 1a920f7..3c0a300 100644
--- a/pym/_emerge/main.py
+++ b/pym/_emerge/main.py
@@ -1033,8 +1033,6 @@ def emerge_main(args=None):
 
 	# Portage needs to ensure a sane umask for the files it creates.
 	os.umask(0o22)
-	if myaction == "sync":
-		portage._sync_mode = True
 	emerge_config = load_emerge_config(
 		action=myaction, args=myfiles, opts=myopts)
 	rval = profile_check(emerge_config.trees, emerge_config.action)


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [gentoo-commits] proj/portage:plugin-sync commit in: pym/_emerge/
@ 2014-06-16 15:46 Brian Dolbec
  0 siblings, 0 replies; 36+ messages in thread
From: Brian Dolbec @ 2014-06-16 15:46 UTC (permalink / raw
  To: gentoo-commits

commit:     2328c189885f3c9f23d49780c22b9f3ed6972d2b
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: Mon Jun 16 15:36:57 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=2328c189

_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 ee4b1db..820dfd2 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
 
@@ -1841,84 +1839,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
 
 


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [gentoo-commits] proj/portage:plugin-sync commit in: pym/_emerge/
@ 2014-06-16 15:46 Brian Dolbec
  0 siblings, 0 replies; 36+ messages in thread
From: Brian Dolbec @ 2014-06-16 15:46 UTC (permalink / raw
  To: gentoo-commits

commit:     f368ffb3a50c072c5914afd28741e4098abb93a7
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun May 11 17:05:17 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Mon Jun 16 15:36:57 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=f368ffb3

_emerge/main.py: Set portage._sync_mode for --sync

This allows repos with non-existent directories to be available.
If the new repo is set for auto-sync, then it can be created with the sync module's new().

---
 pym/_emerge/main.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py
index 3c0a300..ca834ea 100644
--- a/pym/_emerge/main.py
+++ b/pym/_emerge/main.py
@@ -1030,6 +1030,10 @@ def emerge_main(args=None):
 	elif myaction == "moo":
 		print(COWSAY_MOO % platform.system())
 		return os.EX_OK
+	elif myaction == "sync":
+		# need to set this to True now in order for the repository config
+		# loading to allow new repos with non-existent directories
+		portage._sync_mode = True
 
 	# Portage needs to ensure a sane umask for the files it creates.
 	os.umask(0o22)


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [gentoo-commits] proj/portage:plugin-sync commit in: pym/_emerge/
@ 2014-06-16 22:45 Brian Dolbec
  0 siblings, 0 replies; 36+ messages in thread
From: Brian Dolbec @ 2014-06-16 22:45 UTC (permalink / raw
  To: gentoo-commits

commit:     2ca735f3dfea3ff3de1e6ab0315a471555c14b4d
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Apr 21 18:23:36 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Mon Jun 16 22:43:11 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=2ca735f3

_emerge/main.py: remove redundant portage._sync_mode setting

---
 pym/_emerge/main.py | 2 --
 1 file changed, 2 deletions(-)

diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py
index 1a920f7..3c0a300 100644
--- a/pym/_emerge/main.py
+++ b/pym/_emerge/main.py
@@ -1033,8 +1033,6 @@ def emerge_main(args=None):
 
 	# Portage needs to ensure a sane umask for the files it creates.
 	os.umask(0o22)
-	if myaction == "sync":
-		portage._sync_mode = True
 	emerge_config = load_emerge_config(
 		action=myaction, args=myfiles, opts=myopts)
 	rval = profile_check(emerge_config.trees, emerge_config.action)


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [gentoo-commits] proj/portage:plugin-sync commit in: pym/_emerge/
@ 2014-06-16 22:45 Brian Dolbec
  0 siblings, 0 replies; 36+ messages in thread
From: Brian Dolbec @ 2014-06-16 22:45 UTC (permalink / raw
  To: gentoo-commits

commit:     40c5f40eff910a6fba36f5892abb81e48244fc23
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: Mon Jun 16 22:43:11 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=40c5f40e

_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 ee4b1db..820dfd2 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
 
@@ -1841,84 +1839,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
 
 


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [gentoo-commits] proj/portage:plugin-sync commit in: pym/_emerge/
@ 2014-06-16 22:45 Brian Dolbec
  0 siblings, 0 replies; 36+ messages in thread
From: Brian Dolbec @ 2014-06-16 22:45 UTC (permalink / raw
  To: gentoo-commits

commit:     4edc85bbf8028bef2ff78a25f5db522cab2e53f1
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun May 11 17:05:17 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Mon Jun 16 22:44:15 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=4edc85bb

_emerge/main.py: Set portage._sync_mode for --sync

This allows repos with non-existent directories to be available.
If the new repo is set for auto-sync, then it can be created with the sync module's new().

---
 pym/_emerge/main.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py
index 3c0a300..ca834ea 100644
--- a/pym/_emerge/main.py
+++ b/pym/_emerge/main.py
@@ -1030,6 +1030,10 @@ def emerge_main(args=None):
 	elif myaction == "moo":
 		print(COWSAY_MOO % platform.system())
 		return os.EX_OK
+	elif myaction == "sync":
+		# need to set this to True now in order for the repository config
+		# loading to allow new repos with non-existent directories
+		portage._sync_mode = True
 
 	# Portage needs to ensure a sane umask for the files it creates.
 	os.umask(0o22)


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [gentoo-commits] proj/portage:plugin-sync commit in: pym/_emerge/
@ 2014-09-03 23:36 Brian Dolbec
  0 siblings, 0 replies; 36+ messages in thread
From: Brian Dolbec @ 2014-09-03 23:36 UTC (permalink / raw
  To: gentoo-commits

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
 
 


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [gentoo-commits] proj/portage:plugin-sync commit in: pym/_emerge/
@ 2014-09-03 23:36 Brian Dolbec
  0 siblings, 0 replies; 36+ messages in thread
From: Brian Dolbec @ 2014-09-03 23:36 UTC (permalink / raw
  To: gentoo-commits

commit:     96996b249d31ddb6618dc6624431f8a15884d29e
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Apr 21 18:23:36 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=96996b24

_emerge/main.py: remove redundant portage._sync_mode setting

---
 pym/_emerge/main.py | 2 --
 1 file changed, 2 deletions(-)

diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py
index 52aa9c5..4b51b39 100644
--- a/pym/_emerge/main.py
+++ b/pym/_emerge/main.py
@@ -1036,8 +1036,6 @@ def emerge_main(args=None):
 
 	# Portage needs to ensure a sane umask for the files it creates.
 	os.umask(0o22)
-	if myaction == "sync":
-		portage._sync_mode = True
 	emerge_config = load_emerge_config(
 		action=myaction, args=myfiles, opts=myopts)
 	rval = profile_check(emerge_config.trees, emerge_config.action)


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [gentoo-commits] proj/portage:plugin-sync commit in: pym/_emerge/
@ 2014-09-03 23:36 Brian Dolbec
  0 siblings, 0 replies; 36+ messages in thread
From: Brian Dolbec @ 2014-09-03 23:36 UTC (permalink / raw
  To: gentoo-commits

commit:     3bb14da30d7adfce0a3435e6c12ceac9393c55e8
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun May 11 17:05:17 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Wed Sep  3 23:34:54 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=3bb14da3

_emerge/main.py: Set portage._sync_mode for --sync

This allows repos with non-existent directories to be available.
If the new repo is set for auto-sync, then it can be created with the sync module's new().

---
 pym/_emerge/main.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py
index 4b51b39..7e8a800 100644
--- a/pym/_emerge/main.py
+++ b/pym/_emerge/main.py
@@ -1033,6 +1033,10 @@ def emerge_main(args=None):
 	elif myaction == "moo":
 		print(COWSAY_MOO % platform.system())
 		return os.EX_OK
+	elif myaction == "sync":
+		# need to set this to True now in order for the repository config
+		# loading to allow new repos with non-existent directories
+		portage._sync_mode = True
 
 	# Portage needs to ensure a sane umask for the files it creates.
 	os.umask(0o22)


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [gentoo-commits] proj/portage:plugin-sync commit in: pym/_emerge/
@ 2014-09-04  1:18 Brian Dolbec
  0 siblings, 0 replies; 36+ messages in thread
From: Brian Dolbec @ 2014-09-04  1:18 UTC (permalink / raw
  To: gentoo-commits

commit:     1803a407e1a4876cfa7db2a0bc8c3549f58a4a39
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun May 11 17:05:17 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Thu Sep  4 01:18:02 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=1803a407

_emerge/main.py: Set portage._sync_mode for --sync

This allows repos with non-existent directories to be available.
If the new repo is set for auto-sync, then it can be created with the sync module's new().

---
 pym/_emerge/main.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py
index 4b51b39..7e8a800 100644
--- a/pym/_emerge/main.py
+++ b/pym/_emerge/main.py
@@ -1033,6 +1033,10 @@ def emerge_main(args=None):
 	elif myaction == "moo":
 		print(COWSAY_MOO % platform.system())
 		return os.EX_OK
+	elif myaction == "sync":
+		# need to set this to True now in order for the repository config
+		# loading to allow new repos with non-existent directories
+		portage._sync_mode = True
 
 	# Portage needs to ensure a sane umask for the files it creates.
 	os.umask(0o22)


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [gentoo-commits] proj/portage:plugin-sync commit in: pym/_emerge/
@ 2014-09-05  4:38 Brian Dolbec
  0 siblings, 0 replies; 36+ messages in thread
From: Brian Dolbec @ 2014-09-05  4:38 UTC (permalink / raw
  To: gentoo-commits

commit:     c91c71bf8c604fa28df5922a362ddf35fcfc691c
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun May 11 17:05:17 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Thu Sep  4 07:20:42 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=c91c71bf

_emerge/main.py: Set portage._sync_mode for --sync

This allows repos with non-existent directories to be available.
If the new repo is set for auto-sync, then it can be created with the sync module's new().

---
 pym/_emerge/main.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py
index 4b51b39..7e8a800 100644
--- a/pym/_emerge/main.py
+++ b/pym/_emerge/main.py
@@ -1033,6 +1033,10 @@ def emerge_main(args=None):
 	elif myaction == "moo":
 		print(COWSAY_MOO % platform.system())
 		return os.EX_OK
+	elif myaction == "sync":
+		# need to set this to True now in order for the repository config
+		# loading to allow new repos with non-existent directories
+		portage._sync_mode = True
 
 	# Portage needs to ensure a sane umask for the files it creates.
 	os.umask(0o22)


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [gentoo-commits] proj/portage:plugin-sync commit in: pym/_emerge/
@ 2014-09-05 21:15 Brian Dolbec
  0 siblings, 0 replies; 36+ messages in thread
From: Brian Dolbec @ 2014-09-05 21:15 UTC (permalink / raw
  To: gentoo-commits

commit:     6f4015dbb198cee7796727707df4dcb8ffc7e56b
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun May 11 17:05:17 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Fri Sep  5 20:26:14 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=6f4015db

_emerge/main.py: Set portage._sync_mode for --sync

This allows repos with non-existent directories to be available.
If the new repo is set for auto-sync, then it can be created with the sync module's new().

---
 pym/_emerge/main.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py
index 4b51b39..7e8a800 100644
--- a/pym/_emerge/main.py
+++ b/pym/_emerge/main.py
@@ -1033,6 +1033,10 @@ def emerge_main(args=None):
 	elif myaction == "moo":
 		print(COWSAY_MOO % platform.system())
 		return os.EX_OK
+	elif myaction == "sync":
+		# need to set this to True now in order for the repository config
+		# loading to allow new repos with non-existent directories
+		portage._sync_mode = True
 
 	# Portage needs to ensure a sane umask for the files it creates.
 	os.umask(0o22)


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [gentoo-commits] proj/portage:plugin-sync commit in: pym/_emerge/
@ 2014-09-05 21:15 Brian Dolbec
  0 siblings, 0 replies; 36+ messages in thread
From: Brian Dolbec @ 2014-09-05 21:15 UTC (permalink / raw
  To: gentoo-commits

commit:     dcca563605be37cfe8225ac8f17e57735d6e1505
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Apr 21 18:23:36 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Fri Sep  5 20:26:12 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=dcca5636

_emerge/main.py: remove redundant portage._sync_mode setting

---
 pym/_emerge/main.py | 2 --
 1 file changed, 2 deletions(-)

diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py
index 52aa9c5..4b51b39 100644
--- a/pym/_emerge/main.py
+++ b/pym/_emerge/main.py
@@ -1036,8 +1036,6 @@ def emerge_main(args=None):
 
 	# Portage needs to ensure a sane umask for the files it creates.
 	os.umask(0o22)
-	if myaction == "sync":
-		portage._sync_mode = True
 	emerge_config = load_emerge_config(
 		action=myaction, args=myfiles, opts=myopts)
 	rval = profile_check(emerge_config.trees, emerge_config.action)


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [gentoo-commits] proj/portage:plugin-sync commit in: pym/_emerge/
@ 2014-09-05 21:15 Brian Dolbec
  0 siblings, 0 replies; 36+ messages in thread
From: Brian Dolbec @ 2014-09-05 21:15 UTC (permalink / raw
  To: gentoo-commits

commit:     f708956d7b56f7ac1f4f65799ed67bd9c25f41f0
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: Fri Sep  5 20:26:13 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=f708956d

_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
 
 


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [gentoo-commits] proj/portage:plugin-sync commit in: pym/_emerge/
@ 2014-09-27  2:20 Brian Dolbec
  0 siblings, 0 replies; 36+ messages in thread
From: Brian Dolbec @ 2014-09-27  2:20 UTC (permalink / raw
  To: gentoo-commits

commit:     5b9fd7efd9f67796336a3ccf16aac50d5c326baf
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: Sat Sep 27 01:40:15 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=5b9fd7ef

_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 b76eaca..6a4ea42 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
 
 


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [gentoo-commits] proj/portage:plugin-sync commit in: pym/_emerge/
@ 2014-09-27  2:20 Brian Dolbec
  0 siblings, 0 replies; 36+ messages in thread
From: Brian Dolbec @ 2014-09-27  2:20 UTC (permalink / raw
  To: gentoo-commits

commit:     09d6d24c6ac6c30abdbd0b5085780df530f7ddd5
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun May 11 17:05:17 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sat Sep 27 01:40:44 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=09d6d24c

_emerge/main.py: Set portage._sync_mode for --sync

This allows repos with non-existent directories to be available.
If the new repo is set for auto-sync, then it can be created with the sync module's new().

---
 pym/_emerge/main.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py
index 4b51b39..7e8a800 100644
--- a/pym/_emerge/main.py
+++ b/pym/_emerge/main.py
@@ -1033,6 +1033,10 @@ def emerge_main(args=None):
 	elif myaction == "moo":
 		print(COWSAY_MOO % platform.system())
 		return os.EX_OK
+	elif myaction == "sync":
+		# need to set this to True now in order for the repository config
+		# loading to allow new repos with non-existent directories
+		portage._sync_mode = True
 
 	# Portage needs to ensure a sane umask for the files it creates.
 	os.umask(0o22)


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [gentoo-commits] proj/portage:plugin-sync commit in: pym/_emerge/
@ 2014-09-29 18:29 Brian Dolbec
  0 siblings, 0 replies; 36+ messages in thread
From: Brian Dolbec @ 2014-09-29 18:29 UTC (permalink / raw
  To: gentoo-commits

commit:     53fc07602de0c0bed667051fca037dcac109ff91
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: Mon Sep 29 17:20:20 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=53fc0760

_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 b76eaca..6a4ea42 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
 
 


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [gentoo-commits] proj/portage:plugin-sync commit in: pym/_emerge/
@ 2014-09-29 18:29 Brian Dolbec
  0 siblings, 0 replies; 36+ messages in thread
From: Brian Dolbec @ 2014-09-29 18:29 UTC (permalink / raw
  To: gentoo-commits

commit:     e2b3790d3ea8d017e7ae9885d336878780996e8b
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun May 11 17:05:17 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Mon Sep 29 17:20:21 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=e2b3790d

_emerge/main.py: Set portage._sync_mode for --sync

This allows repos with non-existent directories to be available.
If the new repo is set for auto-sync, then it can be created with the sync module's new().

---
 pym/_emerge/main.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py
index 4b51b39..7e8a800 100644
--- a/pym/_emerge/main.py
+++ b/pym/_emerge/main.py
@@ -1033,6 +1033,10 @@ def emerge_main(args=None):
 	elif myaction == "moo":
 		print(COWSAY_MOO % platform.system())
 		return os.EX_OK
+	elif myaction == "sync":
+		# need to set this to True now in order for the repository config
+		# loading to allow new repos with non-existent directories
+		portage._sync_mode = True
 
 	# Portage needs to ensure a sane umask for the files it creates.
 	os.umask(0o22)


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [gentoo-commits] proj/portage:plugin-sync commit in: pym/_emerge/
@ 2014-09-30  0:46 Brian Dolbec
  0 siblings, 0 replies; 36+ messages in thread
From: Brian Dolbec @ 2014-09-30  0:46 UTC (permalink / raw
  To: gentoo-commits

commit:     68e8d242e9dc6dbb2b851a774e0bd12659873e77
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: Tue Sep 30 00:42:25 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=68e8d242

_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 a0e53fe..7dc58aa 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
 
 


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [gentoo-commits] proj/portage:plugin-sync commit in: pym/_emerge/
@ 2014-09-30  0:46 Brian Dolbec
  0 siblings, 0 replies; 36+ messages in thread
From: Brian Dolbec @ 2014-09-30  0:46 UTC (permalink / raw
  To: gentoo-commits

commit:     193304069d73127c7734b0817d0d4e1f509b2d76
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Apr 21 18:23:36 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Tue Sep 30 00:42:06 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=19330406

_emerge/main.py: Remove redundant portage._sync_mode setting

---
 pym/_emerge/main.py | 2 --
 1 file changed, 2 deletions(-)

diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py
index 3883f72..492cc25 100644
--- a/pym/_emerge/main.py
+++ b/pym/_emerge/main.py
@@ -1049,8 +1049,6 @@ def emerge_main(args=None):
 
 	# Portage needs to ensure a sane umask for the files it creates.
 	os.umask(0o22)
-	if myaction == "sync":
-		portage._sync_mode = True
 	emerge_config = load_emerge_config(
 		action=myaction, args=myfiles, opts=myopts)
 	rval = profile_check(emerge_config.trees, emerge_config.action)


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [gentoo-commits] proj/portage:plugin-sync commit in: pym/_emerge/
@ 2014-09-30  0:46 Brian Dolbec
  0 siblings, 0 replies; 36+ messages in thread
From: Brian Dolbec @ 2014-09-30  0:46 UTC (permalink / raw
  To: gentoo-commits

commit:     1939495d8fcdd90e4e19b3d9aba24d4cf153358a
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun May 11 17:05:17 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Tue Sep 30 00:42:26 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=1939495d

_emerge/main.py: Set portage._sync_mode for --sync

This allows repos with non-existent directories to be available.
If the new repo is set for auto-sync, then it can be created with the sync module's new().

---
 pym/_emerge/main.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py
index 492cc25..f698614 100644
--- a/pym/_emerge/main.py
+++ b/pym/_emerge/main.py
@@ -1046,6 +1046,10 @@ def emerge_main(args=None):
 	elif myaction == "moo":
 		print(COWSAY_MOO % platform.system())
 		return os.EX_OK
+	elif myaction == "sync":
+		# need to set this to True now in order for the repository config
+		# loading to allow new repos with non-existent directories
+		portage._sync_mode = True
 
 	# Portage needs to ensure a sane umask for the files it creates.
 	os.umask(0o22)


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [gentoo-commits] proj/portage:plugin-sync commit in: pym/_emerge/
@ 2014-10-20  3:54 Zac Medico
  0 siblings, 0 replies; 36+ messages in thread
From: Zac Medico @ 2014-10-20  3:54 UTC (permalink / raw
  To: gentoo-commits

commit:     a7ffeed1ec206953fb41c274264f79eb61d90dbd
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Apr 22 02:18:07 2014 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Oct 20 03:48:33 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=a7ffeed1

_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 a0e53fe..7dc58aa 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
 
 


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [gentoo-commits] proj/portage:plugin-sync commit in: pym/_emerge/
@ 2014-10-20  3:54 Zac Medico
  0 siblings, 0 replies; 36+ messages in thread
From: Zac Medico @ 2014-10-20  3:54 UTC (permalink / raw
  To: gentoo-commits

commit:     a60913589efdd7e933c4a74ed8f8bb179b96e361
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Apr 21 18:23:36 2014 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Oct 20 03:48:33 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=a6091358

_emerge/main.py: Remove redundant portage._sync_mode setting

---
 pym/_emerge/main.py | 2 --
 1 file changed, 2 deletions(-)

diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py
index f5f2ec4..a986cfe 100644
--- a/pym/_emerge/main.py
+++ b/pym/_emerge/main.py
@@ -1049,8 +1049,6 @@ def emerge_main(args=None):
 
 	# Portage needs to ensure a sane umask for the files it creates.
 	os.umask(0o22)
-	if myaction == "sync":
-		portage._sync_mode = True
 	emerge_config = load_emerge_config(
 		action=myaction, args=myfiles, opts=myopts)
 	rval = profile_check(emerge_config.trees, emerge_config.action)


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [gentoo-commits] proj/portage:plugin-sync commit in: pym/_emerge/
@ 2014-10-20  3:54 Zac Medico
  0 siblings, 0 replies; 36+ messages in thread
From: Zac Medico @ 2014-10-20  3:54 UTC (permalink / raw
  To: gentoo-commits

commit:     6c4362b52e545f3ffa1fad9a5ae9f89688aabb6c
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun May 11 17:05:17 2014 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Oct 20 03:48:34 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=6c4362b5

_emerge/main.py: Set portage._sync_mode for --sync

This allows repos with non-existent directories to be available.
If the new repo is set for auto-sync, then it can be created with the sync module's new().

---
 pym/_emerge/main.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py
index a986cfe..b74005d 100644
--- a/pym/_emerge/main.py
+++ b/pym/_emerge/main.py
@@ -1046,6 +1046,10 @@ def emerge_main(args=None):
 	elif myaction == "moo":
 		print(COWSAY_MOO % platform.system())
 		return os.EX_OK
+	elif myaction == "sync":
+		# need to set this to True now in order for the repository config
+		# loading to allow new repos with non-existent directories
+		portage._sync_mode = True
 
 	# Portage needs to ensure a sane umask for the files it creates.
 	os.umask(0o22)


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [gentoo-commits] proj/portage:plugin-sync commit in: pym/_emerge/
@ 2014-10-21  5:05 Zac Medico
  0 siblings, 0 replies; 36+ messages in thread
From: Zac Medico @ 2014-10-21  5:05 UTC (permalink / raw
  To: gentoo-commits

commit:     389e9197367975bca0ded04998b099b1a2418f61
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Apr 22 02:18:07 2014 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Oct 21 05:04:06 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=389e9197

_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 a0e53fe..7dc58aa 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
 
 


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [gentoo-commits] proj/portage:plugin-sync commit in: pym/_emerge/
@ 2014-10-21  5:05 Zac Medico
  0 siblings, 0 replies; 36+ messages in thread
From: Zac Medico @ 2014-10-21  5:05 UTC (permalink / raw
  To: gentoo-commits

commit:     769b3e7b56e038152e8aac220c189e7410a30048
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun May 11 17:05:17 2014 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Oct 21 05:04:07 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=769b3e7b

_emerge/main.py: Set portage._sync_mode for --sync

This allows repos with non-existent directories to be available.
If the new repo is set for auto-sync, then it can be created with the sync module's new().

---
 pym/_emerge/main.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py
index a986cfe..b74005d 100644
--- a/pym/_emerge/main.py
+++ b/pym/_emerge/main.py
@@ -1046,6 +1046,10 @@ def emerge_main(args=None):
 	elif myaction == "moo":
 		print(COWSAY_MOO % platform.system())
 		return os.EX_OK
+	elif myaction == "sync":
+		# need to set this to True now in order for the repository config
+		# loading to allow new repos with non-existent directories
+		portage._sync_mode = True
 
 	# Portage needs to ensure a sane umask for the files it creates.
 	os.umask(0o22)


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [gentoo-commits] proj/portage:plugin-sync commit in: pym/_emerge/
@ 2014-12-01 21:50 Michał Górny
  0 siblings, 0 replies; 36+ messages in thread
From: Michał Górny @ 2014-12-01 21:50 UTC (permalink / raw
  To: gentoo-commits

commit:     e757fbbee36c06c537edf1f6581190a2ce81a31c
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun May 11 17:05:17 2014 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon Dec  1 21:49:40 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=e757fbbe

_emerge/main.py: Set portage._sync_mode for --sync

This allows repos with non-existent directories to be available.
If the new repo is set for auto-sync, then it can be created with the sync module's new().

---
 pym/_emerge/main.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py
index 85cdc24..1506207 100644
--- a/pym/_emerge/main.py
+++ b/pym/_emerge/main.py
@@ -1057,6 +1057,10 @@ def emerge_main(args=None):
 	elif myaction == "moo":
 		print(COWSAY_MOO % platform.system())
 		return os.EX_OK
+	elif myaction == "sync":
+		# need to set this to True now in order for the repository config
+		# loading to allow new repos with non-existent directories
+		portage._sync_mode = True
 
 	# Portage needs to ensure a sane umask for the files it creates.
 	os.umask(0o22)


^ permalink raw reply related	[flat|nested] 36+ messages in thread

end of thread, other threads:[~2014-12-01 21:50 UTC | newest]

Thread overview: 36+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-30  0:46 [gentoo-commits] proj/portage:plugin-sync commit in: pym/_emerge/ Brian Dolbec
  -- strict thread matches above, loose matches on Subject: below --
2014-12-01 21:50 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-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-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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox