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

commit:     935b955b36de132aa4755950e8aa00aeadc5aa28
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Wed Feb 19 08:22:42 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Wed Feb 19 08:22:42 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=935b955b

Initial stubbing out of a common SyncBase class

---
 pym/portage/sync/syncbase.py | 92 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 92 insertions(+)

diff --git a/pym/portage/sync/syncbase.py b/pym/portage/sync/syncbase.py
new file mode 100644
index 0000000..d4f2ee7
--- /dev/null
+++ b/pym/portage/sync/syncbase.py
@@ -0,0 +1,92 @@
+
+
+
+class SyncBase(object):
+	'''Base Sync class for subclassing'''
+
+	short_desc = "Perform sync operations on repositories"
+
+	def name():
+		return "BlankSync"
+	name = staticmethod(name)
+
+
+	def can_progressbar(self, func):
+		return False
+
+
+	def __init__(self, bin_command, bin_pkg):
+		self.options = None
+		self.settings = None
+		self.logger = None
+		self.repo = None
+		self.xterm_titles = None
+		self.bin_command = bin_command
+
+		self.has_bin = True
+		if bin_command and portage.process.find_binary(bin_command) is None:
+			msg = ["Command not found: %s" % bin_command,
+			"Type \"emerge %s\" to enable %s support." % (bin_pkg, bin_command)]
+			for l in msg:
+				writemsg_level("!!! %s\n" % l,
+					level=logging.ERROR, noiselevel=-1)
+			self.has_bin = False
+
+
+	def _kwargs(self, kwargs):
+		'''Sets internal variables from kwargs'''
+		self.options = kwargs.get('options', {})
+		self.settings = self.options.get('settings', None)
+		self.logger = self.options.get('logger', None)
+		self.repo = self.options.get('repo', None)
+		self.xterm_titles = self.options.get('xterm_titles', False)
+
+
+	def exists(self, **kwargs):
+		'''Tests whether the repo actually exists'''
+		if kwargs:
+			self._kwargs(kwargs)
+		elif not self.repo:
+			return False
+		spawn_kwargs = self.options.get('spawn_kwargs', None)
+
+		if not os.path.exists(self.repo.location):
+			return False
+		return True
+
+
+	def sync(self, **kwargs):
+		'''Sync the repository'''
+		if kwargs:
+			self._kwargs(kwargs)
+
+		if not self.has_bin:
+			return (1, False)
+
+		if not self.exists():
+			return self.new()
+		return self._sync()
+
+
+	def new(self, **kwargs):
+		'''Do the initial download and install of the repository'''
+		pass
+
+	def _sync(self):
+		'''Update existing repository
+		'''
+		pass
+
+	def post_sync(self, portdb, location, emerge_config):
+		'''repo.sync_type == "Blank":
+		# NOTE: Do this after reloading the config, in case
+		# it did not exist prior to sync, so that the config
+		# and portdb properly account for its existence.
+		'''
+		pass
+
+
+	def verify_config(self):
+		'''Verify the config parameters for teh repository
+		'''
+		pass


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

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

commit:     ccc699916f6e7103db4d467458b78d40797279ca
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Fri Mar 14 15:30:55 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Fri Mar 14 16:18:18 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=ccc69991

portage/sync/syncbase: optimize bin_command handling in __init__().

---
 pym/portage/sync/syncbase.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pym/portage/sync/syncbase.py b/pym/portage/sync/syncbase.py
index 9a840d6..95dcf5f 100644
--- a/pym/portage/sync/syncbase.py
+++ b/pym/portage/sync/syncbase.py
@@ -21,10 +21,10 @@ class SyncBase(object):
 		self.logger = None
 		self.repo = None
 		self.xterm_titles = None
-		self.bin_command = bin_command
+		self.bin_command = portage.process.find_binary(bin_command)
 
 		self.has_bin = True
-		if bin_command and portage.process.find_binary(bin_command) is None:
+		if bin_command and self.bin_command is None:
 			msg = ["Command not found: %s" % bin_command,
 			"Type \"emerge %s\" to enable %s support." % (bin_pkg, bin_command)]
 			for l in msg:


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

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

commit:     5974cf67d2fc4d3ca6346f13db07dc15989f2977
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Fri Mar 14 16:14:26 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Fri Mar 14 16:18:18 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=5974cf67

portage/sync/syncbase.py: Complete rough in.

---
 pym/portage/sync/syncbase.py | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/pym/portage/sync/syncbase.py b/pym/portage/sync/syncbase.py
index 95dcf5f..1d46c40 100644
--- a/pym/portage/sync/syncbase.py
+++ b/pym/portage/sync/syncbase.py
@@ -1,4 +1,12 @@
+'''
+Base class for performing sync operations.
+This class contains common initialization code and functions.
+'''
 
+import os
+
+import portage
+from portage.util import writemsg_level
 
 
 class SyncBase(object):
@@ -21,6 +29,7 @@ class SyncBase(object):
 		self.logger = None
 		self.repo = None
 		self.xterm_titles = None
+		self.spawn_kwargs = None
 		self.bin_command = portage.process.find_binary(bin_command)
 
 		self.has_bin = True
@@ -29,7 +38,7 @@ class SyncBase(object):
 			"Type \"emerge %s\" to enable %s support." % (bin_pkg, bin_command)]
 			for l in msg:
 				writemsg_level("!!! %s\n" % l,
-					level=logging.ERROR, noiselevel=-1)
+					level=self.logger.ERROR, noiselevel=-1)
 			self.has_bin = False
 
 
@@ -40,6 +49,7 @@ class SyncBase(object):
 		self.logger = self.options.get('logger', None)
 		self.repo = self.options.get('repo', None)
 		self.xterm_titles = self.options.get('xterm_titles', False)
+		self.spawn_kwargs = self.options.get('spawn_kwargs', None)
 
 
 	def exists(self, **kwargs):
@@ -48,7 +58,7 @@ class SyncBase(object):
 			self._kwargs(kwargs)
 		elif not self.repo:
 			return False
-		spawn_kwargs = self.options.get('spawn_kwargs', None)
+
 
 		if not os.path.exists(self.repo.location):
 			return False


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

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

commit:     88a00a628fbcff078281ec5d06110db5edd2d5cd
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Fri Mar 14 16:14:26 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sat Mar 29 22:46:20 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=88a00a62

portage/sync/syncbase.py: Complete rough in.

---
 pym/portage/sync/syncbase.py | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/pym/portage/sync/syncbase.py b/pym/portage/sync/syncbase.py
index 95dcf5f..1d46c40 100644
--- a/pym/portage/sync/syncbase.py
+++ b/pym/portage/sync/syncbase.py
@@ -1,4 +1,12 @@
+'''
+Base class for performing sync operations.
+This class contains common initialization code and functions.
+'''
 
+import os
+
+import portage
+from portage.util import writemsg_level
 
 
 class SyncBase(object):
@@ -21,6 +29,7 @@ class SyncBase(object):
 		self.logger = None
 		self.repo = None
 		self.xterm_titles = None
+		self.spawn_kwargs = None
 		self.bin_command = portage.process.find_binary(bin_command)
 
 		self.has_bin = True
@@ -29,7 +38,7 @@ class SyncBase(object):
 			"Type \"emerge %s\" to enable %s support." % (bin_pkg, bin_command)]
 			for l in msg:
 				writemsg_level("!!! %s\n" % l,
-					level=logging.ERROR, noiselevel=-1)
+					level=self.logger.ERROR, noiselevel=-1)
 			self.has_bin = False
 
 
@@ -40,6 +49,7 @@ class SyncBase(object):
 		self.logger = self.options.get('logger', None)
 		self.repo = self.options.get('repo', None)
 		self.xterm_titles = self.options.get('xterm_titles', False)
+		self.spawn_kwargs = self.options.get('spawn_kwargs', None)
 
 
 	def exists(self, **kwargs):
@@ -48,7 +58,7 @@ class SyncBase(object):
 			self._kwargs(kwargs)
 		elif not self.repo:
 			return False
-		spawn_kwargs = self.options.get('spawn_kwargs', None)
+
 
 		if not os.path.exists(self.repo.location):
 			return False


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

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

commit:     325af55df7f3899a1eff0fb93d7d825119a6a9c4
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Mar 30 03:36:25 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sun Mar 30 03:36:25 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=325af55d

Add copyright

---
 pym/portage/sync/syncbase.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/pym/portage/sync/syncbase.py b/pym/portage/sync/syncbase.py
index 1d46c40..7386dc1 100644
--- a/pym/portage/sync/syncbase.py
+++ b/pym/portage/sync/syncbase.py
@@ -1,3 +1,6 @@
+# Copyright 2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
 '''
 Base class for performing sync operations.
 This class contains common initialization code and functions.


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

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

commit:     64a7e5ce9186a3a88ab38dccc517783bc5058424
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Mar 30 08:54:09 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sun Mar 30 08:54:09 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=64a7e5ce

Remove the unused validate_config()

---
 pym/portage/sync/syncbase.py | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/pym/portage/sync/syncbase.py b/pym/portage/sync/syncbase.py
index 7386dc1..802ee58 100644
--- a/pym/portage/sync/syncbase.py
+++ b/pym/portage/sync/syncbase.py
@@ -97,9 +97,3 @@ class SyncBase(object):
 		# and portdb properly account for its existence.
 		'''
 		pass
-
-
-	def verify_config(self):
-		'''Verify the config parameters for teh repository
-		'''
-		pass


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

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

commit:     f4eb2df6df71bcb830b5f456a01b52e4d3b3bd1c
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Mar 30 09:43:12 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sun Mar 30 09:43:12 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=f4eb2df6

validate_config fixes

---
 pym/portage/sync/__init__.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/pym/portage/sync/__init__.py b/pym/portage/sync/__init__.py
index c097893..6d2a732 100644
--- a/pym/portage/sync/__init__.py
+++ b/pym/portage/sync/__init__.py
@@ -43,10 +43,11 @@ def get_syncer(settings=None, logger=None):
 
 def validate_config(repo, logger):
 	'''Validate the repos.conf settings for the repo'''
-	if not check_type(repo, logger):
+	if not check_type(repo, logger, module_names):
 		return False
 
-	if repo.sync_tpye:
+	#print(repo)
+	if repo.sync_type:
 		validated = module_controller.modules[repo.sync_type]['validate_config']
-		return validated(repo, logger)
+		return validated(repo, logger).repo_checks()
 	return True


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

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

commit:     0ac04f83762aa86f7020cd0b5176e66870f9c1ba
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Mar 30 09:43:44 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sun Mar 30 09:43:44 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=0ac04f83

config_check fixes

---
 pym/portage/sync/config_checks.py | 23 ++++++++---------------
 1 file changed, 8 insertions(+), 15 deletions(-)

diff --git a/pym/portage/sync/config_checks.py b/pym/portage/sync/config_checks.py
index 66d69da..8ef1974 100644
--- a/pym/portage/sync/config_checks.py
+++ b/pym/portage/sync/config_checks.py
@@ -11,8 +11,11 @@ subclass it adding and/or overriding classes as needed.
 
 import logging
 
+from portage.localization import _
+from portage.util import writemsg_level
 
-def check_type(repo, logger):
+
+def check_type(repo, logger, module_names):
 	if repo.sync_uri is not None and repo.sync_type is None:
 		writemsg_level("!!! %s\n" %
 			_("Repository '%s' has sync-uri attribute, but is missing sync-type attribute")
@@ -30,24 +33,14 @@ def check_type(repo, logger):
 class CheckSyncConfig(object):
 	'''Base repos.conf settings checks class'''
 
-	def __init__(self, logger=None):
+	def __init__(self, repo=None, logger=None):
 		'''Class init function
 
 		@param logger: optional logging instance,
 			defaults to logging module
 		'''
 		self.logger = logger or logging
-
-
-	def __call__(self, repo, logger=None):
-		'''Class call method
-
-		@param repo: RepoConfig instance
-		@param logger: optional logging instance'''
-		if logger:
-			self.logger = logger
 		self.repo = repo
-		self.repo_checks()
 		self.checks = ['check_uri', 'check_auto_sync']
 
 
@@ -68,8 +61,8 @@ class CheckSyncConfig(object):
 		'''Check the auto_sync setting'''
 		if self.repo.auto_sync is None:
 			writemsg_level("!!! %s\n" % _("Repository '%s' is missing auto_sync attribute")
-				% repo.name, level=self.logger.ERROR, noiselevel=-1)
-		if self.repo.auto_sync.lower() not in ["yes", "true", "no", "false"]:
+				% self.repo.name, level=self.logger.ERROR, noiselevel=-1)
+		elif self.repo.auto_sync.lower() not in ["yes", "true", "no", "false"]:
 			writemsg_level("!!! %s\n" % _("Repository '%s' auto_sync attribute must be one of: %s")
-				% (self.repo.name, '{yes, true, no, false}',
+				% (self.repo.name, '{yes, true, no, false}'),
 				level=self.logger.ERROR, noiselevel=-1)


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

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

commit:     4551c6023417e8ddab2725bf5a0e0ecf618fcbc6
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Apr 21 23:51:55 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=4551c602

clean out some debug stuff

---
 pym/portage/sync/controller.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/pym/portage/sync/controller.py b/pym/portage/sync/controller.py
index 0c341e1..70ec27b 100644
--- a/pym/portage/sync/controller.py
+++ b/pym/portage/sync/controller.py
@@ -58,7 +58,6 @@ class TaskHandler(object):
 				'options': options.copy()
 				}
 			result = getattr(inst, func)(**kwargs)
-			print("TaskHandler, result =", result)
 			if show_progress:
 				# make sure the final progress is displayed
 				self.progress_bar.display()
@@ -135,7 +134,7 @@ class SyncManager(object):
 
 
 	def do_callback(self, result):
-		print("result:", result, "callback()", self.callback)
+		#print("result:", result, "callback()", self.callback)
 		exitcode, updatecache_flg = result
 		if self.callback:
 			self.callback(exitcode, updatecache_flg)


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

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

commit:     1ebdf50910a3efaba00f7c64b865cdfdf1cca9e9
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Wed Feb 19 08:22:42 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Fri May  2 23:05:05 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=1ebdf509

Initial stubbing out of a common SyncBase class

Add copyright
Optimize bin_command handling in __init__().

---
 pym/portage/sync/syncbase.py | 100 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 100 insertions(+)

diff --git a/pym/portage/sync/syncbase.py b/pym/portage/sync/syncbase.py
new file mode 100644
index 0000000..2b6b8c7
--- /dev/null
+++ b/pym/portage/sync/syncbase.py
@@ -0,0 +1,100 @@
+# Copyright 2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+'''
+Base class for performing sync operations.
+This class contains common initialization code and functions.
+'''
+
+
+import os
+
+import portage
+from portage.util import writemsg_level
+
+
+class SyncBase(object):
+	'''Base Sync class for subclassing'''
+
+	short_desc = "Perform sync operations on repositories"
+
+	@staticmethod
+	def name():
+		return "BlankSync"
+
+
+	def can_progressbar(self, func):
+		return False
+
+
+	def __init__(self, bin_command, bin_pkg):
+		self.options = None
+		self.settings = None
+		self.logger = None
+		self.repo = None
+		self.xterm_titles = None
+		self.spawn_kwargs = None
+		self.bin_command = portage.process.find_binary(bin_command)
+
+		self.has_bin = True
+		if bin_command and self.bin_command is None:
+			msg = ["Command not found: %s" % bin_command,
+			"Type \"emerge %s\" to enable %s support." % (bin_pkg, bin_command)]
+			for l in msg:
+				writemsg_level("!!! %s\n" % l,
+					level=self.logger.ERROR, noiselevel=-1)
+			self.has_bin = False
+
+
+	def _kwargs(self, kwargs):
+		'''Sets internal variables from kwargs'''
+		self.options = kwargs.get('options', {})
+		self.settings = self.options.get('settings', None)
+		self.logger = self.options.get('logger', None)
+		self.repo = self.options.get('repo', None)
+		self.xterm_titles = self.options.get('xterm_titles', False)
+		self.spawn_kwargs = self.options.get('spawn_kwargs', None)
+
+
+	def exists(self, **kwargs):
+		'''Tests whether the repo actually exists'''
+		if kwargs:
+			self._kwargs(kwargs)
+		elif not self.repo:
+			return False
+
+
+		if not os.path.exists(self.repo.location):
+			return False
+		return True
+
+
+	def sync(self, **kwargs):
+		'''Sync the repository'''
+		if kwargs:
+			self._kwargs(kwargs)
+
+		if not self.has_bin:
+			return (1, False)
+
+		if not self.exists():
+			return self.new()
+		return self._sync()
+
+
+	def new(self, **kwargs):
+		'''Do the initial download and install of the repository'''
+		pass
+
+	def _sync(self):
+		'''Update existing repository
+		'''
+		pass
+
+	def post_sync(self, portdb, location, emerge_config):
+		'''repo.sync_type == "Blank":
+		# NOTE: Do this after reloading the config, in case
+		# it did not exist prior to sync, so that the config
+		# and portdb properly account for its existence.
+		'''
+		pass


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

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

commit:     fe8570e5f34cc5f0817a80d3724e6e75ccf5e926
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun May 11 16:42:48 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sun May 11 16:42:48 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=fe8570e5

sync/controller.py: fix return traceback

---
 pym/portage/sync/controller.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/pym/portage/sync/controller.py b/pym/portage/sync/controller.py
index 70ec27b..e0e6910 100644
--- a/pym/portage/sync/controller.py
+++ b/pym/portage/sync/controller.py
@@ -150,7 +150,8 @@ class SyncManager(object):
 			if retval != os.EX_OK:
 				writemsg_level(" %s spawn failed of %s\n" % (bad("*"),
 					postsync,), level=logging.ERROR, noiselevel=-1)
-		return retval
+			return retval
+		return os.EX_OK
 
 
 	def pre_sync(self, repo):


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

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

commit:     50176a4724e1f3f14b73e005465862c6db19db39
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun May 11 16:42:48 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=50176a47

sync/controller.py: fix return traceback

---
 pym/portage/sync/controller.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/pym/portage/sync/controller.py b/pym/portage/sync/controller.py
index 70ec27b..e0e6910 100644
--- a/pym/portage/sync/controller.py
+++ b/pym/portage/sync/controller.py
@@ -150,7 +150,8 @@ class SyncManager(object):
 			if retval != os.EX_OK:
 				writemsg_level(" %s spawn failed of %s\n" % (bad("*"),
 					postsync,), level=logging.ERROR, noiselevel=-1)
-		return retval
+			return retval
+		return os.EX_OK
 
 
 	def pre_sync(self, repo):


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

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

commit:     dbc25235b203110f0cffe8e94c47e9b3201759e2
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Wed Feb 19 08:22:42 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Mon Jun 16 15:36:55 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=dbc25235

Initial stubbing out of a common SyncBase class

Add copyright
Optimize bin_command handling in __init__().

---
 pym/portage/sync/syncbase.py | 100 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 100 insertions(+)

diff --git a/pym/portage/sync/syncbase.py b/pym/portage/sync/syncbase.py
new file mode 100644
index 0000000..2b6b8c7
--- /dev/null
+++ b/pym/portage/sync/syncbase.py
@@ -0,0 +1,100 @@
+# Copyright 2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+'''
+Base class for performing sync operations.
+This class contains common initialization code and functions.
+'''
+
+
+import os
+
+import portage
+from portage.util import writemsg_level
+
+
+class SyncBase(object):
+	'''Base Sync class for subclassing'''
+
+	short_desc = "Perform sync operations on repositories"
+
+	@staticmethod
+	def name():
+		return "BlankSync"
+
+
+	def can_progressbar(self, func):
+		return False
+
+
+	def __init__(self, bin_command, bin_pkg):
+		self.options = None
+		self.settings = None
+		self.logger = None
+		self.repo = None
+		self.xterm_titles = None
+		self.spawn_kwargs = None
+		self.bin_command = portage.process.find_binary(bin_command)
+
+		self.has_bin = True
+		if bin_command and self.bin_command is None:
+			msg = ["Command not found: %s" % bin_command,
+			"Type \"emerge %s\" to enable %s support." % (bin_pkg, bin_command)]
+			for l in msg:
+				writemsg_level("!!! %s\n" % l,
+					level=self.logger.ERROR, noiselevel=-1)
+			self.has_bin = False
+
+
+	def _kwargs(self, kwargs):
+		'''Sets internal variables from kwargs'''
+		self.options = kwargs.get('options', {})
+		self.settings = self.options.get('settings', None)
+		self.logger = self.options.get('logger', None)
+		self.repo = self.options.get('repo', None)
+		self.xterm_titles = self.options.get('xterm_titles', False)
+		self.spawn_kwargs = self.options.get('spawn_kwargs', None)
+
+
+	def exists(self, **kwargs):
+		'''Tests whether the repo actually exists'''
+		if kwargs:
+			self._kwargs(kwargs)
+		elif not self.repo:
+			return False
+
+
+		if not os.path.exists(self.repo.location):
+			return False
+		return True
+
+
+	def sync(self, **kwargs):
+		'''Sync the repository'''
+		if kwargs:
+			self._kwargs(kwargs)
+
+		if not self.has_bin:
+			return (1, False)
+
+		if not self.exists():
+			return self.new()
+		return self._sync()
+
+
+	def new(self, **kwargs):
+		'''Do the initial download and install of the repository'''
+		pass
+
+	def _sync(self):
+		'''Update existing repository
+		'''
+		pass
+
+	def post_sync(self, portdb, location, emerge_config):
+		'''repo.sync_type == "Blank":
+		# NOTE: Do this after reloading the config, in case
+		# it did not exist prior to sync, so that the config
+		# and portdb properly account for its existence.
+		'''
+		pass


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

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

commit:     fe3949c9dbd456f3a4dd4f2ad6a817ef31985c0e
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Jun 17 00:42:29 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Tue Jun 17 00:42:29 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=fe3949c9

sync/syncbase.py: Fix the self.has_bin logic

---
 pym/portage/sync/syncbase.py | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/pym/portage/sync/syncbase.py b/pym/portage/sync/syncbase.py
index 2b6b8c7..94d4aab 100644
--- a/pym/portage/sync/syncbase.py
+++ b/pym/portage/sync/syncbase.py
@@ -34,16 +34,18 @@ class SyncBase(object):
 		self.repo = None
 		self.xterm_titles = None
 		self.spawn_kwargs = None
-		self.bin_command = portage.process.find_binary(bin_command)
-
-		self.has_bin = True
-		if bin_command and self.bin_command is None:
-			msg = ["Command not found: %s" % bin_command,
-			"Type \"emerge %s\" to enable %s support." % (bin_pkg, bin_command)]
-			for l in msg:
-				writemsg_level("!!! %s\n" % l,
-					level=self.logger.ERROR, noiselevel=-1)
-			self.has_bin = False
+		self.bin_command = None
+		self.has_bin = False
+		if bin_command:
+			self.bin_command = portage.process.find_binary(bin_command)
+			if self.bin_command is None:
+				msg = ["Command not found: %s" % bin_command,
+				"Type \"emerge %s\" to enable %s support." % (bin_pkg, bin_command)]
+				for l in msg:
+					writemsg_level("!!! %s\n" % l,
+						level=self.logger.ERROR, noiselevel=-1)
+			else:
+				self.has_bin = True
 
 
 	def _kwargs(self, kwargs):


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

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

commit:     c7c969123710e06a954178dbc9bf460e9e2c538e
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Jun 17 18:44:43 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Tue Jun 17 18:44:43 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=c7c96912

portage/sync: Add additional output info for unsupported sync-types

Comment out some debug print()'s

---
 pym/portage/sync/__init__.py      | 5 +++--
 pym/portage/sync/config_checks.py | 4 ++++
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/pym/portage/sync/__init__.py b/pym/portage/sync/__init__.py
index 6d2a732..b74c89e 100644
--- a/pym/portage/sync/__init__.py
+++ b/pym/portage/sync/__init__.py
@@ -11,12 +11,12 @@ sync_manager = None
 
 path = os.path.join(os.path.dirname(__file__), "modules")
 # initial development debug info
-print("module path:", path)
+#print("module path:", path)
 
 module_controller = Modules(path=path, namepath="portage.sync.modules")
 
 # initial development debug info
-print(module_controller.module_names)
+#print(module_controller.module_names)
 module_names = module_controller.module_names[:]
 
 
@@ -43,6 +43,7 @@ def get_syncer(settings=None, logger=None):
 
 def validate_config(repo, logger):
 	'''Validate the repos.conf settings for the repo'''
+	global module_names, module_controller
 	if not check_type(repo, logger, module_names):
 		return False
 

diff --git a/pym/portage/sync/config_checks.py b/pym/portage/sync/config_checks.py
index 8ef1974..db316aa 100644
--- a/pym/portage/sync/config_checks.py
+++ b/pym/portage/sync/config_checks.py
@@ -26,6 +26,10 @@ def check_type(repo, logger, module_names):
 			_("Repository '%s' has sync-type attribute set to unsupported value: '%s'")
 			% (repo.name, repo.sync_type),
 			level=logger.ERROR, noiselevel=-1)
+		writemsg_level("!!! %s\n" %
+			_("Installed sync-types are: '%s'")
+			% (str(module_names)),
+			level=logger.ERROR, noiselevel=-1)
 		return False
 	return True
 


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

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

commit:     634b70ec71f506964f7c80f0985d973de946d159
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Jun 17 00:42:29 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=634b70ec

sync/syncbase.py: Fix the self.has_bin logic

---
 pym/portage/sync/syncbase.py | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/pym/portage/sync/syncbase.py b/pym/portage/sync/syncbase.py
index 2b6b8c7..94d4aab 100644
--- a/pym/portage/sync/syncbase.py
+++ b/pym/portage/sync/syncbase.py
@@ -34,16 +34,18 @@ class SyncBase(object):
 		self.repo = None
 		self.xterm_titles = None
 		self.spawn_kwargs = None
-		self.bin_command = portage.process.find_binary(bin_command)
-
-		self.has_bin = True
-		if bin_command and self.bin_command is None:
-			msg = ["Command not found: %s" % bin_command,
-			"Type \"emerge %s\" to enable %s support." % (bin_pkg, bin_command)]
-			for l in msg:
-				writemsg_level("!!! %s\n" % l,
-					level=self.logger.ERROR, noiselevel=-1)
-			self.has_bin = False
+		self.bin_command = None
+		self.has_bin = False
+		if bin_command:
+			self.bin_command = portage.process.find_binary(bin_command)
+			if self.bin_command is None:
+				msg = ["Command not found: %s" % bin_command,
+				"Type \"emerge %s\" to enable %s support." % (bin_pkg, bin_command)]
+				for l in msg:
+					writemsg_level("!!! %s\n" % l,
+						level=self.logger.ERROR, noiselevel=-1)
+			else:
+				self.has_bin = True
 
 
 	def _kwargs(self, kwargs):


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

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

commit:     48de23887611c26404b3632babc7f14b0e7f26e4
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Jun 17 18:44:43 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=48de2388

portage/sync: Add additional output info for unsupported sync-types

Comment out some debug print()'s

---
 pym/portage/sync/__init__.py      | 5 +++--
 pym/portage/sync/config_checks.py | 4 ++++
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/pym/portage/sync/__init__.py b/pym/portage/sync/__init__.py
index 6d2a732..b74c89e 100644
--- a/pym/portage/sync/__init__.py
+++ b/pym/portage/sync/__init__.py
@@ -11,12 +11,12 @@ sync_manager = None
 
 path = os.path.join(os.path.dirname(__file__), "modules")
 # initial development debug info
-print("module path:", path)
+#print("module path:", path)
 
 module_controller = Modules(path=path, namepath="portage.sync.modules")
 
 # initial development debug info
-print(module_controller.module_names)
+#print(module_controller.module_names)
 module_names = module_controller.module_names[:]
 
 
@@ -43,6 +43,7 @@ def get_syncer(settings=None, logger=None):
 
 def validate_config(repo, logger):
 	'''Validate the repos.conf settings for the repo'''
+	global module_names, module_controller
 	if not check_type(repo, logger, module_names):
 		return False
 

diff --git a/pym/portage/sync/config_checks.py b/pym/portage/sync/config_checks.py
index 8ef1974..db316aa 100644
--- a/pym/portage/sync/config_checks.py
+++ b/pym/portage/sync/config_checks.py
@@ -26,6 +26,10 @@ def check_type(repo, logger, module_names):
 			_("Repository '%s' has sync-type attribute set to unsupported value: '%s'")
 			% (repo.name, repo.sync_type),
 			level=logger.ERROR, noiselevel=-1)
+		writemsg_level("!!! %s\n" %
+			_("Installed sync-types are: '%s'")
+			% (str(module_names)),
+			level=logger.ERROR, noiselevel=-1)
 		return False
 	return True
 


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

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

commit:     ac9cfcb8083170df4a3479172b9f45f1fd6b812c
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Jun 17 00:42:29 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=ac9cfcb8

sync/syncbase.py: Fix the self.has_bin logic

---
 pym/portage/sync/syncbase.py | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/pym/portage/sync/syncbase.py b/pym/portage/sync/syncbase.py
index 2b6b8c7..94d4aab 100644
--- a/pym/portage/sync/syncbase.py
+++ b/pym/portage/sync/syncbase.py
@@ -34,16 +34,18 @@ class SyncBase(object):
 		self.repo = None
 		self.xterm_titles = None
 		self.spawn_kwargs = None
-		self.bin_command = portage.process.find_binary(bin_command)
-
-		self.has_bin = True
-		if bin_command and self.bin_command is None:
-			msg = ["Command not found: %s" % bin_command,
-			"Type \"emerge %s\" to enable %s support." % (bin_pkg, bin_command)]
-			for l in msg:
-				writemsg_level("!!! %s\n" % l,
-					level=self.logger.ERROR, noiselevel=-1)
-			self.has_bin = False
+		self.bin_command = None
+		self.has_bin = False
+		if bin_command:
+			self.bin_command = portage.process.find_binary(bin_command)
+			if self.bin_command is None:
+				msg = ["Command not found: %s" % bin_command,
+				"Type \"emerge %s\" to enable %s support." % (bin_pkg, bin_command)]
+				for l in msg:
+					writemsg_level("!!! %s\n" % l,
+						level=self.logger.ERROR, noiselevel=-1)
+			else:
+				self.has_bin = True
 
 
 	def _kwargs(self, kwargs):


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

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

commit:     48f59294d0f45bc74d7171f2e51265564bf0a651
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Jun 17 18:44:43 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=48f59294

portage/sync: Add additional output info for unsupported sync-types

Comment out some debug print()'s

---
 pym/portage/sync/__init__.py      | 5 +++--
 pym/portage/sync/config_checks.py | 4 ++++
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/pym/portage/sync/__init__.py b/pym/portage/sync/__init__.py
index 6d2a732..b74c89e 100644
--- a/pym/portage/sync/__init__.py
+++ b/pym/portage/sync/__init__.py
@@ -11,12 +11,12 @@ sync_manager = None
 
 path = os.path.join(os.path.dirname(__file__), "modules")
 # initial development debug info
-print("module path:", path)
+#print("module path:", path)
 
 module_controller = Modules(path=path, namepath="portage.sync.modules")
 
 # initial development debug info
-print(module_controller.module_names)
+#print(module_controller.module_names)
 module_names = module_controller.module_names[:]
 
 
@@ -43,6 +43,7 @@ def get_syncer(settings=None, logger=None):
 
 def validate_config(repo, logger):
 	'''Validate the repos.conf settings for the repo'''
+	global module_names, module_controller
 	if not check_type(repo, logger, module_names):
 		return False
 

diff --git a/pym/portage/sync/config_checks.py b/pym/portage/sync/config_checks.py
index 8ef1974..db316aa 100644
--- a/pym/portage/sync/config_checks.py
+++ b/pym/portage/sync/config_checks.py
@@ -26,6 +26,10 @@ def check_type(repo, logger, module_names):
 			_("Repository '%s' has sync-type attribute set to unsupported value: '%s'")
 			% (repo.name, repo.sync_type),
 			level=logger.ERROR, noiselevel=-1)
+		writemsg_level("!!! %s\n" %
+			_("Installed sync-types are: '%s'")
+			% (str(module_names)),
+			level=logger.ERROR, noiselevel=-1)
 		return False
 	return True
 


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

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

commit:     7d1b0163b9b165df2b00b61a32a93782503dc285
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Jun 17 18:44:43 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Thu Sep  4 07:20:43 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=7d1b0163

portage/sync: Add additional output info for unsupported sync-types

Comment out some debug print()'s

---
 pym/portage/sync/__init__.py      | 5 +++--
 pym/portage/sync/config_checks.py | 4 ++++
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/pym/portage/sync/__init__.py b/pym/portage/sync/__init__.py
index 6d2a732..b74c89e 100644
--- a/pym/portage/sync/__init__.py
+++ b/pym/portage/sync/__init__.py
@@ -11,12 +11,12 @@ sync_manager = None
 
 path = os.path.join(os.path.dirname(__file__), "modules")
 # initial development debug info
-print("module path:", path)
+#print("module path:", path)
 
 module_controller = Modules(path=path, namepath="portage.sync.modules")
 
 # initial development debug info
-print(module_controller.module_names)
+#print(module_controller.module_names)
 module_names = module_controller.module_names[:]
 
 
@@ -43,6 +43,7 @@ def get_syncer(settings=None, logger=None):
 
 def validate_config(repo, logger):
 	'''Validate the repos.conf settings for the repo'''
+	global module_names, module_controller
 	if not check_type(repo, logger, module_names):
 		return False
 

diff --git a/pym/portage/sync/config_checks.py b/pym/portage/sync/config_checks.py
index 8ef1974..db316aa 100644
--- a/pym/portage/sync/config_checks.py
+++ b/pym/portage/sync/config_checks.py
@@ -26,6 +26,10 @@ def check_type(repo, logger, module_names):
 			_("Repository '%s' has sync-type attribute set to unsupported value: '%s'")
 			% (repo.name, repo.sync_type),
 			level=logger.ERROR, noiselevel=-1)
+		writemsg_level("!!! %s\n" %
+			_("Installed sync-types are: '%s'")
+			% (str(module_names)),
+			level=logger.ERROR, noiselevel=-1)
 		return False
 	return True
 


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

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

commit:     9a1a8411bc7f93b8ab8cda5cb3d4b2e1df253588
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Fri Sep  5 04:23:30 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Fri Sep  5 04:23:30 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=9a1a8411

fix missed self.settings

---
 pym/portage/sync/controller.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/pym/portage/sync/controller.py b/pym/portage/sync/controller.py
index 0fe723b..6b8678d 100644
--- a/pym/portage/sync/controller.py
+++ b/pym/portage/sync/controller.py
@@ -78,6 +78,7 @@ class SyncManager(object):
 	'''Main sync control module'''
 
 	def __init__(self, settings, logger):
+		self.settings = settings
 		self.logger = logger
 		# Similar to emerge, sync needs a default umask so that created
 		# files have sane permissions.


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

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

commit:     c413d60687355aa98c5113807eaca0ca31272a8e
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Jun 17 00:42:29 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=c413d606

sync/syncbase.py: Fix the self.has_bin logic

---
 pym/portage/sync/syncbase.py | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/pym/portage/sync/syncbase.py b/pym/portage/sync/syncbase.py
index 2b6b8c7..94d4aab 100644
--- a/pym/portage/sync/syncbase.py
+++ b/pym/portage/sync/syncbase.py
@@ -34,16 +34,18 @@ class SyncBase(object):
 		self.repo = None
 		self.xterm_titles = None
 		self.spawn_kwargs = None
-		self.bin_command = portage.process.find_binary(bin_command)
-
-		self.has_bin = True
-		if bin_command and self.bin_command is None:
-			msg = ["Command not found: %s" % bin_command,
-			"Type \"emerge %s\" to enable %s support." % (bin_pkg, bin_command)]
-			for l in msg:
-				writemsg_level("!!! %s\n" % l,
-					level=self.logger.ERROR, noiselevel=-1)
-			self.has_bin = False
+		self.bin_command = None
+		self.has_bin = False
+		if bin_command:
+			self.bin_command = portage.process.find_binary(bin_command)
+			if self.bin_command is None:
+				msg = ["Command not found: %s" % bin_command,
+				"Type \"emerge %s\" to enable %s support." % (bin_pkg, bin_command)]
+				for l in msg:
+					writemsg_level("!!! %s\n" % l,
+						level=self.logger.ERROR, noiselevel=-1)
+			else:
+				self.has_bin = True
 
 
 	def _kwargs(self, kwargs):


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

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

commit:     d9a9523b36a0fe3281c2a29c12fd2ef203d59903
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Jun 17 00:42:29 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=d9a9523b

sync/syncbase.py: Fix the self.has_bin logic

---
 pym/portage/sync/syncbase.py | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/pym/portage/sync/syncbase.py b/pym/portage/sync/syncbase.py
index 2b6b8c7..94d4aab 100644
--- a/pym/portage/sync/syncbase.py
+++ b/pym/portage/sync/syncbase.py
@@ -34,16 +34,18 @@ class SyncBase(object):
 		self.repo = None
 		self.xterm_titles = None
 		self.spawn_kwargs = None
-		self.bin_command = portage.process.find_binary(bin_command)
-
-		self.has_bin = True
-		if bin_command and self.bin_command is None:
-			msg = ["Command not found: %s" % bin_command,
-			"Type \"emerge %s\" to enable %s support." % (bin_pkg, bin_command)]
-			for l in msg:
-				writemsg_level("!!! %s\n" % l,
-					level=self.logger.ERROR, noiselevel=-1)
-			self.has_bin = False
+		self.bin_command = None
+		self.has_bin = False
+		if bin_command:
+			self.bin_command = portage.process.find_binary(bin_command)
+			if self.bin_command is None:
+				msg = ["Command not found: %s" % bin_command,
+				"Type \"emerge %s\" to enable %s support." % (bin_pkg, bin_command)]
+				for l in msg:
+					writemsg_level("!!! %s\n" % l,
+						level=self.logger.ERROR, noiselevel=-1)
+			else:
+				self.has_bin = True
 
 
 	def _kwargs(self, kwargs):


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

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

commit:     2f7aeea093b05516756b817fdb2b9e7dce034f54
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Fri Sep  5 20:14:57 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Fri Sep  5 20:26:15 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=2f7aeea0

portage/sync/controller.py: Remove list copy, module_names list is not modified

---
 pym/portage/sync/controller.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pym/portage/sync/controller.py b/pym/portage/sync/controller.py
index e8fe291..a5c93dc 100644
--- a/pym/portage/sync/controller.py
+++ b/pym/portage/sync/controller.py
@@ -85,7 +85,7 @@ class SyncManager(object):
 		os.umask(0o22)
 
 		self.module_controller = portage.sync.module_controller
-		self.module_names = self.module_controller.module_names[:]
+		self.module_names = self.module_controller.module_names
 
 
 	def get_module_descriptions(self, mod):


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

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

commit:     9e94db4ca1119481be308d36bb0d95680fd9bb82
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Jun 17 18:44:43 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=9e94db4c

portage/sync: Add additional output info for unsupported sync-types

Comment out some debug print()'s

---
 pym/portage/sync/__init__.py      | 5 +++--
 pym/portage/sync/config_checks.py | 4 ++++
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/pym/portage/sync/__init__.py b/pym/portage/sync/__init__.py
index 6d2a732..b74c89e 100644
--- a/pym/portage/sync/__init__.py
+++ b/pym/portage/sync/__init__.py
@@ -11,12 +11,12 @@ sync_manager = None
 
 path = os.path.join(os.path.dirname(__file__), "modules")
 # initial development debug info
-print("module path:", path)
+#print("module path:", path)
 
 module_controller = Modules(path=path, namepath="portage.sync.modules")
 
 # initial development debug info
-print(module_controller.module_names)
+#print(module_controller.module_names)
 module_names = module_controller.module_names[:]
 
 
@@ -43,6 +43,7 @@ def get_syncer(settings=None, logger=None):
 
 def validate_config(repo, logger):
 	'''Validate the repos.conf settings for the repo'''
+	global module_names, module_controller
 	if not check_type(repo, logger, module_names):
 		return False
 

diff --git a/pym/portage/sync/config_checks.py b/pym/portage/sync/config_checks.py
index 8ef1974..db316aa 100644
--- a/pym/portage/sync/config_checks.py
+++ b/pym/portage/sync/config_checks.py
@@ -26,6 +26,10 @@ def check_type(repo, logger, module_names):
 			_("Repository '%s' has sync-type attribute set to unsupported value: '%s'")
 			% (repo.name, repo.sync_type),
 			level=logger.ERROR, noiselevel=-1)
+		writemsg_level("!!! %s\n" %
+			_("Installed sync-types are: '%s'")
+			% (str(module_names)),
+			level=logger.ERROR, noiselevel=-1)
 		return False
 	return True
 


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

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

commit:     4f3ad54ad5abe36eec99dd53586e0c6e404664e6
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Jun 17 18:44:43 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sat Sep 27 01:40:45 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=4f3ad54a

portage/sync: Add additional output info for unsupported sync-types

Comment out some debug print()'s

---
 pym/portage/sync/__init__.py      | 5 +++--
 pym/portage/sync/config_checks.py | 4 ++++
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/pym/portage/sync/__init__.py b/pym/portage/sync/__init__.py
index 6d2a732..b74c89e 100644
--- a/pym/portage/sync/__init__.py
+++ b/pym/portage/sync/__init__.py
@@ -11,12 +11,12 @@ sync_manager = None
 
 path = os.path.join(os.path.dirname(__file__), "modules")
 # initial development debug info
-print("module path:", path)
+#print("module path:", path)
 
 module_controller = Modules(path=path, namepath="portage.sync.modules")
 
 # initial development debug info
-print(module_controller.module_names)
+#print(module_controller.module_names)
 module_names = module_controller.module_names[:]
 
 
@@ -43,6 +43,7 @@ def get_syncer(settings=None, logger=None):
 
 def validate_config(repo, logger):
 	'''Validate the repos.conf settings for the repo'''
+	global module_names, module_controller
 	if not check_type(repo, logger, module_names):
 		return False
 

diff --git a/pym/portage/sync/config_checks.py b/pym/portage/sync/config_checks.py
index 8ef1974..db316aa 100644
--- a/pym/portage/sync/config_checks.py
+++ b/pym/portage/sync/config_checks.py
@@ -26,6 +26,10 @@ def check_type(repo, logger, module_names):
 			_("Repository '%s' has sync-type attribute set to unsupported value: '%s'")
 			% (repo.name, repo.sync_type),
 			level=logger.ERROR, noiselevel=-1)
+		writemsg_level("!!! %s\n" %
+			_("Installed sync-types are: '%s'")
+			% (str(module_names)),
+			level=logger.ERROR, noiselevel=-1)
 		return False
 	return True
 


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

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

commit:     555e2d53ce0c90ad6f98acaaeaafa18b409b3ee2
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Jun 17 00:42:29 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sat Sep 27 01:40:45 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=555e2d53

sync/syncbase.py: Fix the self.has_bin logic

---
 pym/portage/sync/syncbase.py | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/pym/portage/sync/syncbase.py b/pym/portage/sync/syncbase.py
index 2b6b8c7..94d4aab 100644
--- a/pym/portage/sync/syncbase.py
+++ b/pym/portage/sync/syncbase.py
@@ -34,16 +34,18 @@ class SyncBase(object):
 		self.repo = None
 		self.xterm_titles = None
 		self.spawn_kwargs = None
-		self.bin_command = portage.process.find_binary(bin_command)
-
-		self.has_bin = True
-		if bin_command and self.bin_command is None:
-			msg = ["Command not found: %s" % bin_command,
-			"Type \"emerge %s\" to enable %s support." % (bin_pkg, bin_command)]
-			for l in msg:
-				writemsg_level("!!! %s\n" % l,
-					level=self.logger.ERROR, noiselevel=-1)
-			self.has_bin = False
+		self.bin_command = None
+		self.has_bin = False
+		if bin_command:
+			self.bin_command = portage.process.find_binary(bin_command)
+			if self.bin_command is None:
+				msg = ["Command not found: %s" % bin_command,
+				"Type \"emerge %s\" to enable %s support." % (bin_pkg, bin_command)]
+				for l in msg:
+					writemsg_level("!!! %s\n" % l,
+						level=self.logger.ERROR, noiselevel=-1)
+			else:
+				self.has_bin = True
 
 
 	def _kwargs(self, kwargs):


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

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

commit:     a6297ef046527094d32e3f8eadd65928042254e4
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Sep  7 01:40:25 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sat Sep 27 01:40:46 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=a6297ef0

synv/controller.py: Use assert() on tasks, func

---
 pym/portage/sync/controller.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/pym/portage/sync/controller.py b/pym/portage/sync/controller.py
index a5c93dc..21b57f4 100644
--- a/pym/portage/sync/controller.py
+++ b/pym/portage/sync/controller.py
@@ -36,8 +36,9 @@ class TaskHandler(object):
 
 	def run_tasks(self, tasks, func, status=None, verbose=True, options=None):
 		"""Runs the module tasks"""
-		if tasks is None or func is None:
-			return
+		# Ensure we have a task and function
+		assert(tasks)
+		assert(func)
 		for task in tasks:
 			inst = task()
 			show_progress = self.show_progress_bar and self.isatty


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

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

commit:     76271c3768a742c40181cabbe3872383bab9d85c
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Fri Sep  5 20:14:57 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sat Sep 27 01:40:45 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=76271c37

portage/sync/controller.py: Remove list copy, module_names list is not modified

---
 pym/portage/sync/controller.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pym/portage/sync/controller.py b/pym/portage/sync/controller.py
index e8fe291..a5c93dc 100644
--- a/pym/portage/sync/controller.py
+++ b/pym/portage/sync/controller.py
@@ -85,7 +85,7 @@ class SyncManager(object):
 		os.umask(0o22)
 
 		self.module_controller = portage.sync.module_controller
-		self.module_names = self.module_controller.module_names[:]
+		self.module_names = self.module_controller.module_names
 
 
 	def get_module_descriptions(self, mod):


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

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

commit:     edc3076b97cf4ada2bd6eb0f084919d7adee1199
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 27 05:05:01 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sat Sep 27 05:05:01 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=edc3076b

Sync: Implement native postsync.d hook code

As per bug 522032, pass the repo.name and repo.sync_uri to the hooks.
With this information, the hooks can be taylored to operate for only certain repos, or only when all repos have been synced.

---
 pym/portage/sync/controller.py | 36 +++++++++++++++++++++++++-----------
 1 file changed, 25 insertions(+), 11 deletions(-)

diff --git a/pym/portage/sync/controller.py b/pym/portage/sync/controller.py
index 21b57f4..a88d4c5 100644
--- a/pym/portage/sync/controller.py
+++ b/pym/portage/sync/controller.py
@@ -87,6 +87,19 @@ class SyncManager(object):
 
 		self.module_controller = portage.sync.module_controller
 		self.module_names = self.module_controller.module_names
+		postsync_dir = os.path.join(self.settings["PORTAGE_CONFIGROOT"],
+			portage.USER_CONFIG_PATH, "postsync.d")
+		hooks = []
+		for root, dirs, names in os.walk(postsync_dir, topdown=True):
+			#print("root:", root, "dirs:", dirs, "names:", names)
+			for name in names:
+				filepath = os.path.join(root, name)
+				if os.access(filepath, os.X_OK):
+					hooks.append((filepath, name))
+				else:
+					writemsg_level(" %s postsync.d hook: '%s' is not executable\n"
+						% (warn("*"), name,), level=logging.WARN, noiselevel=2)
+		self.hooks = hooks
 
 
 	def get_module_descriptions(self, mod):
@@ -129,7 +142,7 @@ class SyncManager(object):
 		taskmaster = TaskHandler(callback=self.do_callback)
 		taskmaster.run_tasks(tasks, func, status, options=task_opts)
 
-		self.perform_post_sync_hook(repo.sync_uri)
+		self.perform_post_sync_hook(repo.name, repo.sync_uri)
 
 		return self.exitcode, None
 
@@ -142,17 +155,18 @@ class SyncManager(object):
 		return
 
 
-	def perform_post_sync_hook(self, dosyncuri):
-		postsync = os.path.join(self.settings["PORTAGE_CONFIGROOT"],
-			portage.USER_CONFIG_PATH, "bin", "post_sync")
-		if os.access(postsync, os.X_OK):
-			retval = portage.process.spawn([postsync, dosyncuri],
-				env=self.settings.environ())
+	def perform_post_sync_hook(self, reponame, dosyncuri='None'):
+		succeeded = os.EX_OK
+		for filepath, hook in self.hooks:
+			writemsg_level("Spawning post_sync hook: %s\n" % (hook,),
+				level=logging.ERROR, noiselevel=4)
+			retval = portage.process.spawn([filepath,
+				reponame, dosyncuri], env=self.settings.environ())
 			if retval != os.EX_OK:
-				writemsg_level(" %s spawn failed of %s\n" % (bad("*"),
-					postsync,), level=logging.ERROR, noiselevel=-1)
-			return retval
-		return os.EX_OK
+				writemsg_level(" %s Spawn failed for: %s, %s\n" % (bad("*"),
+					hook, filepath), level=logging.ERROR, noiselevel=-1)
+				succeeded = retval
+		return succeeded
 
 
 	def pre_sync(self, repo):


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

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

commit:     ffc8ec31e7c08ea4f1d680b8dd53eb6fe311b161
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Sep  7 01:40:25 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Mon Sep 29 17:20:22 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=ffc8ec31

synv/controller.py: Use assert() on tasks, func

---
 pym/portage/sync/controller.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/pym/portage/sync/controller.py b/pym/portage/sync/controller.py
index a5c93dc..21b57f4 100644
--- a/pym/portage/sync/controller.py
+++ b/pym/portage/sync/controller.py
@@ -36,8 +36,9 @@ class TaskHandler(object):
 
 	def run_tasks(self, tasks, func, status=None, verbose=True, options=None):
 		"""Runs the module tasks"""
-		if tasks is None or func is None:
-			return
+		# Ensure we have a task and function
+		assert(tasks)
+		assert(func)
 		for task in tasks:
 			inst = task()
 			show_progress = self.show_progress_bar and self.isatty


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

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

commit:     fe2309bb2c7a0a15538b7cd515847f6188f334c0
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Jun 17 00:42:29 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=fe2309bb

sync/syncbase.py: Fix the self.has_bin logic

---
 pym/portage/sync/syncbase.py | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/pym/portage/sync/syncbase.py b/pym/portage/sync/syncbase.py
index 2b6b8c7..94d4aab 100644
--- a/pym/portage/sync/syncbase.py
+++ b/pym/portage/sync/syncbase.py
@@ -34,16 +34,18 @@ class SyncBase(object):
 		self.repo = None
 		self.xterm_titles = None
 		self.spawn_kwargs = None
-		self.bin_command = portage.process.find_binary(bin_command)
-
-		self.has_bin = True
-		if bin_command and self.bin_command is None:
-			msg = ["Command not found: %s" % bin_command,
-			"Type \"emerge %s\" to enable %s support." % (bin_pkg, bin_command)]
-			for l in msg:
-				writemsg_level("!!! %s\n" % l,
-					level=self.logger.ERROR, noiselevel=-1)
-			self.has_bin = False
+		self.bin_command = None
+		self.has_bin = False
+		if bin_command:
+			self.bin_command = portage.process.find_binary(bin_command)
+			if self.bin_command is None:
+				msg = ["Command not found: %s" % bin_command,
+				"Type \"emerge %s\" to enable %s support." % (bin_pkg, bin_command)]
+				for l in msg:
+					writemsg_level("!!! %s\n" % l,
+						level=self.logger.ERROR, noiselevel=-1)
+			else:
+				self.has_bin = True
 
 
 	def _kwargs(self, kwargs):


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

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

commit:     2c004b23fa92185a53d3efd3cd42c20526f14c3b
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Jun 17 18:44:43 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=2c004b23

portage/sync: Add additional output info for unsupported sync-types

Comment out some debug print()'s

---
 pym/portage/sync/__init__.py      | 5 +++--
 pym/portage/sync/config_checks.py | 4 ++++
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/pym/portage/sync/__init__.py b/pym/portage/sync/__init__.py
index 6d2a732..b74c89e 100644
--- a/pym/portage/sync/__init__.py
+++ b/pym/portage/sync/__init__.py
@@ -11,12 +11,12 @@ sync_manager = None
 
 path = os.path.join(os.path.dirname(__file__), "modules")
 # initial development debug info
-print("module path:", path)
+#print("module path:", path)
 
 module_controller = Modules(path=path, namepath="portage.sync.modules")
 
 # initial development debug info
-print(module_controller.module_names)
+#print(module_controller.module_names)
 module_names = module_controller.module_names[:]
 
 
@@ -43,6 +43,7 @@ def get_syncer(settings=None, logger=None):
 
 def validate_config(repo, logger):
 	'''Validate the repos.conf settings for the repo'''
+	global module_names, module_controller
 	if not check_type(repo, logger, module_names):
 		return False
 

diff --git a/pym/portage/sync/config_checks.py b/pym/portage/sync/config_checks.py
index 8ef1974..db316aa 100644
--- a/pym/portage/sync/config_checks.py
+++ b/pym/portage/sync/config_checks.py
@@ -26,6 +26,10 @@ def check_type(repo, logger, module_names):
 			_("Repository '%s' has sync-type attribute set to unsupported value: '%s'")
 			% (repo.name, repo.sync_type),
 			level=logger.ERROR, noiselevel=-1)
+		writemsg_level("!!! %s\n" %
+			_("Installed sync-types are: '%s'")
+			% (str(module_names)),
+			level=logger.ERROR, noiselevel=-1)
 		return False
 	return True
 


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

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

commit:     4b64e7be52dcc857b670370034da605f1acbe8fa
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Fri Sep  5 20:14:57 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Mon Sep 29 17:20:22 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=4b64e7be

portage/sync/controller.py: Remove list copy, module_names list is not modified

---
 pym/portage/sync/controller.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pym/portage/sync/controller.py b/pym/portage/sync/controller.py
index e8fe291..a5c93dc 100644
--- a/pym/portage/sync/controller.py
+++ b/pym/portage/sync/controller.py
@@ -85,7 +85,7 @@ class SyncManager(object):
 		os.umask(0o22)
 
 		self.module_controller = portage.sync.module_controller
-		self.module_names = self.module_controller.module_names[:]
+		self.module_names = self.module_controller.module_names
 
 
 	def get_module_descriptions(self, mod):


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

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

commit:     703691cd611e29c810de08e6452f14454376125a
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 27 05:05:01 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Mon Sep 29 17:20:22 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=703691cd

Sync: Implement native postsync.d hook code

As per bug 522032, pass the repo.name and repo.sync_uri to the hooks.
With this information, the hooks can be taylored to operate for only certain repos, or only when all repos have been synced.

---
 pym/portage/sync/controller.py | 36 +++++++++++++++++++++++++-----------
 1 file changed, 25 insertions(+), 11 deletions(-)

diff --git a/pym/portage/sync/controller.py b/pym/portage/sync/controller.py
index 21b57f4..a88d4c5 100644
--- a/pym/portage/sync/controller.py
+++ b/pym/portage/sync/controller.py
@@ -87,6 +87,19 @@ class SyncManager(object):
 
 		self.module_controller = portage.sync.module_controller
 		self.module_names = self.module_controller.module_names
+		postsync_dir = os.path.join(self.settings["PORTAGE_CONFIGROOT"],
+			portage.USER_CONFIG_PATH, "postsync.d")
+		hooks = []
+		for root, dirs, names in os.walk(postsync_dir, topdown=True):
+			#print("root:", root, "dirs:", dirs, "names:", names)
+			for name in names:
+				filepath = os.path.join(root, name)
+				if os.access(filepath, os.X_OK):
+					hooks.append((filepath, name))
+				else:
+					writemsg_level(" %s postsync.d hook: '%s' is not executable\n"
+						% (warn("*"), name,), level=logging.WARN, noiselevel=2)
+		self.hooks = hooks
 
 
 	def get_module_descriptions(self, mod):
@@ -129,7 +142,7 @@ class SyncManager(object):
 		taskmaster = TaskHandler(callback=self.do_callback)
 		taskmaster.run_tasks(tasks, func, status, options=task_opts)
 
-		self.perform_post_sync_hook(repo.sync_uri)
+		self.perform_post_sync_hook(repo.name, repo.sync_uri)
 
 		return self.exitcode, None
 
@@ -142,17 +155,18 @@ class SyncManager(object):
 		return
 
 
-	def perform_post_sync_hook(self, dosyncuri):
-		postsync = os.path.join(self.settings["PORTAGE_CONFIGROOT"],
-			portage.USER_CONFIG_PATH, "bin", "post_sync")
-		if os.access(postsync, os.X_OK):
-			retval = portage.process.spawn([postsync, dosyncuri],
-				env=self.settings.environ())
+	def perform_post_sync_hook(self, reponame, dosyncuri='None'):
+		succeeded = os.EX_OK
+		for filepath, hook in self.hooks:
+			writemsg_level("Spawning post_sync hook: %s\n" % (hook,),
+				level=logging.ERROR, noiselevel=4)
+			retval = portage.process.spawn([filepath,
+				reponame, dosyncuri], env=self.settings.environ())
 			if retval != os.EX_OK:
-				writemsg_level(" %s spawn failed of %s\n" % (bad("*"),
-					postsync,), level=logging.ERROR, noiselevel=-1)
-			return retval
-		return os.EX_OK
+				writemsg_level(" %s Spawn failed for: %s, %s\n" % (bad("*"),
+					hook, filepath), level=logging.ERROR, noiselevel=-1)
+				succeeded = retval
+		return succeeded
 
 
 	def pre_sync(self, repo):


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

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

commit:     6d671d0bece90ae9943b03577f372fc8ff76e905
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Jun 17 18:44:43 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=6d671d0b

portage/sync: Add additional output info for unsupported sync-types

Comment out some debug print()'s

---
 pym/portage/sync/__init__.py      | 5 +++--
 pym/portage/sync/config_checks.py | 4 ++++
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/pym/portage/sync/__init__.py b/pym/portage/sync/__init__.py
index 6d2a732..b74c89e 100644
--- a/pym/portage/sync/__init__.py
+++ b/pym/portage/sync/__init__.py
@@ -11,12 +11,12 @@ sync_manager = None
 
 path = os.path.join(os.path.dirname(__file__), "modules")
 # initial development debug info
-print("module path:", path)
+#print("module path:", path)
 
 module_controller = Modules(path=path, namepath="portage.sync.modules")
 
 # initial development debug info
-print(module_controller.module_names)
+#print(module_controller.module_names)
 module_names = module_controller.module_names[:]
 
 
@@ -43,6 +43,7 @@ def get_syncer(settings=None, logger=None):
 
 def validate_config(repo, logger):
 	'''Validate the repos.conf settings for the repo'''
+	global module_names, module_controller
 	if not check_type(repo, logger, module_names):
 		return False
 

diff --git a/pym/portage/sync/config_checks.py b/pym/portage/sync/config_checks.py
index 8ef1974..db316aa 100644
--- a/pym/portage/sync/config_checks.py
+++ b/pym/portage/sync/config_checks.py
@@ -26,6 +26,10 @@ def check_type(repo, logger, module_names):
 			_("Repository '%s' has sync-type attribute set to unsupported value: '%s'")
 			% (repo.name, repo.sync_type),
 			level=logger.ERROR, noiselevel=-1)
+		writemsg_level("!!! %s\n" %
+			_("Installed sync-types are: '%s'")
+			% (str(module_names)),
+			level=logger.ERROR, noiselevel=-1)
 		return False
 	return True
 


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

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

commit:     b3e50b1b1c0facc3c190ba948b3404b4e25dc3ef
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 27 05:05:01 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Tue Sep 30 00:42:28 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=b3e50b1b

Sync: Implement native postsync.d hook code

As per bug 522032, pass the repo.name and repo.sync_uri to the hooks.
With this information, the hooks can be taylored to operate for only certain repos, or only when all repos have been synced.

---
 pym/portage/sync/controller.py | 36 +++++++++++++++++++++++++-----------
 1 file changed, 25 insertions(+), 11 deletions(-)

diff --git a/pym/portage/sync/controller.py b/pym/portage/sync/controller.py
index 21b57f4..a88d4c5 100644
--- a/pym/portage/sync/controller.py
+++ b/pym/portage/sync/controller.py
@@ -87,6 +87,19 @@ class SyncManager(object):
 
 		self.module_controller = portage.sync.module_controller
 		self.module_names = self.module_controller.module_names
+		postsync_dir = os.path.join(self.settings["PORTAGE_CONFIGROOT"],
+			portage.USER_CONFIG_PATH, "postsync.d")
+		hooks = []
+		for root, dirs, names in os.walk(postsync_dir, topdown=True):
+			#print("root:", root, "dirs:", dirs, "names:", names)
+			for name in names:
+				filepath = os.path.join(root, name)
+				if os.access(filepath, os.X_OK):
+					hooks.append((filepath, name))
+				else:
+					writemsg_level(" %s postsync.d hook: '%s' is not executable\n"
+						% (warn("*"), name,), level=logging.WARN, noiselevel=2)
+		self.hooks = hooks
 
 
 	def get_module_descriptions(self, mod):
@@ -129,7 +142,7 @@ class SyncManager(object):
 		taskmaster = TaskHandler(callback=self.do_callback)
 		taskmaster.run_tasks(tasks, func, status, options=task_opts)
 
-		self.perform_post_sync_hook(repo.sync_uri)
+		self.perform_post_sync_hook(repo.name, repo.sync_uri)
 
 		return self.exitcode, None
 
@@ -142,17 +155,18 @@ class SyncManager(object):
 		return
 
 
-	def perform_post_sync_hook(self, dosyncuri):
-		postsync = os.path.join(self.settings["PORTAGE_CONFIGROOT"],
-			portage.USER_CONFIG_PATH, "bin", "post_sync")
-		if os.access(postsync, os.X_OK):
-			retval = portage.process.spawn([postsync, dosyncuri],
-				env=self.settings.environ())
+	def perform_post_sync_hook(self, reponame, dosyncuri='None'):
+		succeeded = os.EX_OK
+		for filepath, hook in self.hooks:
+			writemsg_level("Spawning post_sync hook: %s\n" % (hook,),
+				level=logging.ERROR, noiselevel=4)
+			retval = portage.process.spawn([filepath,
+				reponame, dosyncuri], env=self.settings.environ())
 			if retval != os.EX_OK:
-				writemsg_level(" %s spawn failed of %s\n" % (bad("*"),
-					postsync,), level=logging.ERROR, noiselevel=-1)
-			return retval
-		return os.EX_OK
+				writemsg_level(" %s Spawn failed for: %s, %s\n" % (bad("*"),
+					hook, filepath), level=logging.ERROR, noiselevel=-1)
+				succeeded = retval
+		return succeeded
 
 
 	def pre_sync(self, repo):


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

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

commit:     79e2ff8b1bbda62eb1113f128c84ad8af50e24f8
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Sep  7 01:40:25 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Tue Sep 30 00:42:27 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=79e2ff8b

sync/controller.py: Use assert() on tasks, func

---
 pym/portage/sync/controller.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/pym/portage/sync/controller.py b/pym/portage/sync/controller.py
index a5c93dc..21b57f4 100644
--- a/pym/portage/sync/controller.py
+++ b/pym/portage/sync/controller.py
@@ -36,8 +36,9 @@ class TaskHandler(object):
 
 	def run_tasks(self, tasks, func, status=None, verbose=True, options=None):
 		"""Runs the module tasks"""
-		if tasks is None or func is None:
-			return
+		# Ensure we have a task and function
+		assert(tasks)
+		assert(func)
 		for task in tasks:
 			inst = task()
 			show_progress = self.show_progress_bar and self.isatty


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

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

commit:     399ec5c64ac6a341b7db169709b35682656abc3d
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Jun 17 00:42:29 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=399ec5c6

sync/syncbase.py: Fix the self.has_bin logic

---
 pym/portage/sync/syncbase.py | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/pym/portage/sync/syncbase.py b/pym/portage/sync/syncbase.py
index 2b6b8c7..94d4aab 100644
--- a/pym/portage/sync/syncbase.py
+++ b/pym/portage/sync/syncbase.py
@@ -34,16 +34,18 @@ class SyncBase(object):
 		self.repo = None
 		self.xterm_titles = None
 		self.spawn_kwargs = None
-		self.bin_command = portage.process.find_binary(bin_command)
-
-		self.has_bin = True
-		if bin_command and self.bin_command is None:
-			msg = ["Command not found: %s" % bin_command,
-			"Type \"emerge %s\" to enable %s support." % (bin_pkg, bin_command)]
-			for l in msg:
-				writemsg_level("!!! %s\n" % l,
-					level=self.logger.ERROR, noiselevel=-1)
-			self.has_bin = False
+		self.bin_command = None
+		self.has_bin = False
+		if bin_command:
+			self.bin_command = portage.process.find_binary(bin_command)
+			if self.bin_command is None:
+				msg = ["Command not found: %s" % bin_command,
+				"Type \"emerge %s\" to enable %s support." % (bin_pkg, bin_command)]
+				for l in msg:
+					writemsg_level("!!! %s\n" % l,
+						level=self.logger.ERROR, noiselevel=-1)
+			else:
+				self.has_bin = True
 
 
 	def _kwargs(self, kwargs):


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

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

commit:     99d191360a1d0d84f82ab899fdeba111bc3cd16b
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Fri Sep  5 20:14:57 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Tue Sep 30 00:42:27 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=99d19136

portage/sync/controller.py: Remove list copy, module_names list is not modified

---
 pym/portage/sync/controller.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pym/portage/sync/controller.py b/pym/portage/sync/controller.py
index e8fe291..a5c93dc 100644
--- a/pym/portage/sync/controller.py
+++ b/pym/portage/sync/controller.py
@@ -85,7 +85,7 @@ class SyncManager(object):
 		os.umask(0o22)
 
 		self.module_controller = portage.sync.module_controller
-		self.module_names = self.module_controller.module_names[:]
+		self.module_names = self.module_controller.module_names
 
 
 	def get_module_descriptions(self, mod):


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

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

commit:     c41be414d849554b4fc985e2537eb82208e308d2
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Sep  7 01:40:25 2014 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Oct 20 03:48:35 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=c41be414

sync/controller.py: Use assert() on tasks, func

---
 pym/portage/sync/controller.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/pym/portage/sync/controller.py b/pym/portage/sync/controller.py
index a5c93dc..21b57f4 100644
--- a/pym/portage/sync/controller.py
+++ b/pym/portage/sync/controller.py
@@ -36,8 +36,9 @@ class TaskHandler(object):
 
 	def run_tasks(self, tasks, func, status=None, verbose=True, options=None):
 		"""Runs the module tasks"""
-		if tasks is None or func is None:
-			return
+		# Ensure we have a task and function
+		assert(tasks)
+		assert(func)
 		for task in tasks:
 			inst = task()
 			show_progress = self.show_progress_bar and self.isatty


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

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

commit:     43949f10920b5ca96d02e390a93af6cd59dd83d9
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 27 05:05:01 2014 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Oct 20 03:48:35 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=43949f10

Sync: Implement native postsync.d hook code

As per bug 522032, pass the repo.name and repo.sync_uri to the hooks.
With this information, the hooks can be taylored to operate for only certain repos, or only when all repos have been synced.

---
 pym/portage/sync/controller.py | 36 +++++++++++++++++++++++++-----------
 1 file changed, 25 insertions(+), 11 deletions(-)

diff --git a/pym/portage/sync/controller.py b/pym/portage/sync/controller.py
index 21b57f4..a88d4c5 100644
--- a/pym/portage/sync/controller.py
+++ b/pym/portage/sync/controller.py
@@ -87,6 +87,19 @@ class SyncManager(object):
 
 		self.module_controller = portage.sync.module_controller
 		self.module_names = self.module_controller.module_names
+		postsync_dir = os.path.join(self.settings["PORTAGE_CONFIGROOT"],
+			portage.USER_CONFIG_PATH, "postsync.d")
+		hooks = []
+		for root, dirs, names in os.walk(postsync_dir, topdown=True):
+			#print("root:", root, "dirs:", dirs, "names:", names)
+			for name in names:
+				filepath = os.path.join(root, name)
+				if os.access(filepath, os.X_OK):
+					hooks.append((filepath, name))
+				else:
+					writemsg_level(" %s postsync.d hook: '%s' is not executable\n"
+						% (warn("*"), name,), level=logging.WARN, noiselevel=2)
+		self.hooks = hooks
 
 
 	def get_module_descriptions(self, mod):
@@ -129,7 +142,7 @@ class SyncManager(object):
 		taskmaster = TaskHandler(callback=self.do_callback)
 		taskmaster.run_tasks(tasks, func, status, options=task_opts)
 
-		self.perform_post_sync_hook(repo.sync_uri)
+		self.perform_post_sync_hook(repo.name, repo.sync_uri)
 
 		return self.exitcode, None
 
@@ -142,17 +155,18 @@ class SyncManager(object):
 		return
 
 
-	def perform_post_sync_hook(self, dosyncuri):
-		postsync = os.path.join(self.settings["PORTAGE_CONFIGROOT"],
-			portage.USER_CONFIG_PATH, "bin", "post_sync")
-		if os.access(postsync, os.X_OK):
-			retval = portage.process.spawn([postsync, dosyncuri],
-				env=self.settings.environ())
+	def perform_post_sync_hook(self, reponame, dosyncuri='None'):
+		succeeded = os.EX_OK
+		for filepath, hook in self.hooks:
+			writemsg_level("Spawning post_sync hook: %s\n" % (hook,),
+				level=logging.ERROR, noiselevel=4)
+			retval = portage.process.spawn([filepath,
+				reponame, dosyncuri], env=self.settings.environ())
 			if retval != os.EX_OK:
-				writemsg_level(" %s spawn failed of %s\n" % (bad("*"),
-					postsync,), level=logging.ERROR, noiselevel=-1)
-			return retval
-		return os.EX_OK
+				writemsg_level(" %s Spawn failed for: %s, %s\n" % (bad("*"),
+					hook, filepath), level=logging.ERROR, noiselevel=-1)
+				succeeded = retval
+		return succeeded
 
 
 	def pre_sync(self, repo):


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

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

commit:     76d4733300675dc601dccb303e938c142a3ac85d
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Fri Sep  5 20:14:57 2014 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Oct 20 03:48:35 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=76d47333

portage/sync/controller.py: Remove list copy, module_names list is not modified

---
 pym/portage/sync/controller.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pym/portage/sync/controller.py b/pym/portage/sync/controller.py
index e8fe291..a5c93dc 100644
--- a/pym/portage/sync/controller.py
+++ b/pym/portage/sync/controller.py
@@ -85,7 +85,7 @@ class SyncManager(object):
 		os.umask(0o22)
 
 		self.module_controller = portage.sync.module_controller
-		self.module_names = self.module_controller.module_names[:]
+		self.module_names = self.module_controller.module_names
 
 
 	def get_module_descriptions(self, mod):


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

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

commit:     4daeac0d831593646cf85112739bc2eec3a5b60f
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Jun 17 18:44:43 2014 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Oct 20 03:48:35 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=4daeac0d

portage/sync: Add additional output info for unsupported sync-types

Comment out some debug print()'s

---
 pym/portage/sync/__init__.py      | 5 +++--
 pym/portage/sync/config_checks.py | 4 ++++
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/pym/portage/sync/__init__.py b/pym/portage/sync/__init__.py
index 6d2a732..b74c89e 100644
--- a/pym/portage/sync/__init__.py
+++ b/pym/portage/sync/__init__.py
@@ -11,12 +11,12 @@ sync_manager = None
 
 path = os.path.join(os.path.dirname(__file__), "modules")
 # initial development debug info
-print("module path:", path)
+#print("module path:", path)
 
 module_controller = Modules(path=path, namepath="portage.sync.modules")
 
 # initial development debug info
-print(module_controller.module_names)
+#print(module_controller.module_names)
 module_names = module_controller.module_names[:]
 
 
@@ -43,6 +43,7 @@ def get_syncer(settings=None, logger=None):
 
 def validate_config(repo, logger):
 	'''Validate the repos.conf settings for the repo'''
+	global module_names, module_controller
 	if not check_type(repo, logger, module_names):
 		return False
 

diff --git a/pym/portage/sync/config_checks.py b/pym/portage/sync/config_checks.py
index 8ef1974..db316aa 100644
--- a/pym/portage/sync/config_checks.py
+++ b/pym/portage/sync/config_checks.py
@@ -26,6 +26,10 @@ def check_type(repo, logger, module_names):
 			_("Repository '%s' has sync-type attribute set to unsupported value: '%s'")
 			% (repo.name, repo.sync_type),
 			level=logger.ERROR, noiselevel=-1)
+		writemsg_level("!!! %s\n" %
+			_("Installed sync-types are: '%s'")
+			% (str(module_names)),
+			level=logger.ERROR, noiselevel=-1)
 		return False
 	return True
 


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

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

commit:     d9b53a5f15f773b99491ec42c990b605679828a2
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Jun 17 00:42:29 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=d9b53a5f

sync/syncbase.py: Fix the self.has_bin logic

---
 pym/portage/sync/syncbase.py | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/pym/portage/sync/syncbase.py b/pym/portage/sync/syncbase.py
index 2b6b8c7..94d4aab 100644
--- a/pym/portage/sync/syncbase.py
+++ b/pym/portage/sync/syncbase.py
@@ -34,16 +34,18 @@ class SyncBase(object):
 		self.repo = None
 		self.xterm_titles = None
 		self.spawn_kwargs = None
-		self.bin_command = portage.process.find_binary(bin_command)
-
-		self.has_bin = True
-		if bin_command and self.bin_command is None:
-			msg = ["Command not found: %s" % bin_command,
-			"Type \"emerge %s\" to enable %s support." % (bin_pkg, bin_command)]
-			for l in msg:
-				writemsg_level("!!! %s\n" % l,
-					level=self.logger.ERROR, noiselevel=-1)
-			self.has_bin = False
+		self.bin_command = None
+		self.has_bin = False
+		if bin_command:
+			self.bin_command = portage.process.find_binary(bin_command)
+			if self.bin_command is None:
+				msg = ["Command not found: %s" % bin_command,
+				"Type \"emerge %s\" to enable %s support." % (bin_pkg, bin_command)]
+				for l in msg:
+					writemsg_level("!!! %s\n" % l,
+						level=self.logger.ERROR, noiselevel=-1)
+			else:
+				self.has_bin = True
 
 
 	def _kwargs(self, kwargs):


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

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

commit:     d74cf2881d8c005ce99169460c938c142898f846
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Mon Oct 20 20:44:41 2014 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Oct 20 20:44:41 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=d74cf288

_sync_callback: check for md5-cache, not cache

This fixes FEATURES=metadata-transfer to work again now that the
metadata/cache directory has been replaced with metadata/md5-cache.

---
 pym/portage/sync/controller.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/pym/portage/sync/controller.py b/pym/portage/sync/controller.py
index a88d4c5..0b308e8 100644
--- a/pym/portage/sync/controller.py
+++ b/pym/portage/sync/controller.py
@@ -226,7 +226,8 @@ class SyncManager(object):
 			updatecache_flg = False
 
 		if updatecache_flg and \
-			os.path.exists(os.path.join(self.repo.location, 'metadata', 'cache')):
+			os.path.exists(os.path.join(
+			self.repo.location, 'metadata', 'md5-cache')):
 
 			# Only update cache for repo.location since that's
 			# the only one that's been synced here.


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

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

commit:     d643687f0a86a4d9e05759b1e674471ddd71514c
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 27 05:05:01 2014 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Oct 21 05:04:08 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=d643687f

Sync: Implement native postsync.d hook code

As per bug 522032, pass the repo.name and repo.sync_uri to the hooks.
With this information, the hooks can be taylored to operate for only certain repos, or only when all repos have been synced.

---
 pym/portage/sync/controller.py | 36 +++++++++++++++++++++++++-----------
 1 file changed, 25 insertions(+), 11 deletions(-)

diff --git a/pym/portage/sync/controller.py b/pym/portage/sync/controller.py
index 21b57f4..a88d4c5 100644
--- a/pym/portage/sync/controller.py
+++ b/pym/portage/sync/controller.py
@@ -87,6 +87,19 @@ class SyncManager(object):
 
 		self.module_controller = portage.sync.module_controller
 		self.module_names = self.module_controller.module_names
+		postsync_dir = os.path.join(self.settings["PORTAGE_CONFIGROOT"],
+			portage.USER_CONFIG_PATH, "postsync.d")
+		hooks = []
+		for root, dirs, names in os.walk(postsync_dir, topdown=True):
+			#print("root:", root, "dirs:", dirs, "names:", names)
+			for name in names:
+				filepath = os.path.join(root, name)
+				if os.access(filepath, os.X_OK):
+					hooks.append((filepath, name))
+				else:
+					writemsg_level(" %s postsync.d hook: '%s' is not executable\n"
+						% (warn("*"), name,), level=logging.WARN, noiselevel=2)
+		self.hooks = hooks
 
 
 	def get_module_descriptions(self, mod):
@@ -129,7 +142,7 @@ class SyncManager(object):
 		taskmaster = TaskHandler(callback=self.do_callback)
 		taskmaster.run_tasks(tasks, func, status, options=task_opts)
 
-		self.perform_post_sync_hook(repo.sync_uri)
+		self.perform_post_sync_hook(repo.name, repo.sync_uri)
 
 		return self.exitcode, None
 
@@ -142,17 +155,18 @@ class SyncManager(object):
 		return
 
 
-	def perform_post_sync_hook(self, dosyncuri):
-		postsync = os.path.join(self.settings["PORTAGE_CONFIGROOT"],
-			portage.USER_CONFIG_PATH, "bin", "post_sync")
-		if os.access(postsync, os.X_OK):
-			retval = portage.process.spawn([postsync, dosyncuri],
-				env=self.settings.environ())
+	def perform_post_sync_hook(self, reponame, dosyncuri='None'):
+		succeeded = os.EX_OK
+		for filepath, hook in self.hooks:
+			writemsg_level("Spawning post_sync hook: %s\n" % (hook,),
+				level=logging.ERROR, noiselevel=4)
+			retval = portage.process.spawn([filepath,
+				reponame, dosyncuri], env=self.settings.environ())
 			if retval != os.EX_OK:
-				writemsg_level(" %s spawn failed of %s\n" % (bad("*"),
-					postsync,), level=logging.ERROR, noiselevel=-1)
-			return retval
-		return os.EX_OK
+				writemsg_level(" %s Spawn failed for: %s, %s\n" % (bad("*"),
+					hook, filepath), level=logging.ERROR, noiselevel=-1)
+				succeeded = retval
+		return succeeded
 
 
 	def pre_sync(self, repo):


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

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

commit:     3c19665cff788e306b2c6df40cfc211014aca37e
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Jun 17 00:42:29 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=3c19665c

sync/syncbase.py: Fix the self.has_bin logic

---
 pym/portage/sync/syncbase.py | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/pym/portage/sync/syncbase.py b/pym/portage/sync/syncbase.py
index 2b6b8c7..94d4aab 100644
--- a/pym/portage/sync/syncbase.py
+++ b/pym/portage/sync/syncbase.py
@@ -34,16 +34,18 @@ class SyncBase(object):
 		self.repo = None
 		self.xterm_titles = None
 		self.spawn_kwargs = None
-		self.bin_command = portage.process.find_binary(bin_command)
-
-		self.has_bin = True
-		if bin_command and self.bin_command is None:
-			msg = ["Command not found: %s" % bin_command,
-			"Type \"emerge %s\" to enable %s support." % (bin_pkg, bin_command)]
-			for l in msg:
-				writemsg_level("!!! %s\n" % l,
-					level=self.logger.ERROR, noiselevel=-1)
-			self.has_bin = False
+		self.bin_command = None
+		self.has_bin = False
+		if bin_command:
+			self.bin_command = portage.process.find_binary(bin_command)
+			if self.bin_command is None:
+				msg = ["Command not found: %s" % bin_command,
+				"Type \"emerge %s\" to enable %s support." % (bin_pkg, bin_command)]
+				for l in msg:
+					writemsg_level("!!! %s\n" % l,
+						level=self.logger.ERROR, noiselevel=-1)
+			else:
+				self.has_bin = True
 
 
 	def _kwargs(self, kwargs):


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

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

commit:     8e06a34946af44d6664897904a509b752af2a095
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Sep  7 01:40:25 2014 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Oct 21 05:04:08 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=8e06a349

sync/controller.py: Use assert() on tasks, func

---
 pym/portage/sync/controller.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/pym/portage/sync/controller.py b/pym/portage/sync/controller.py
index a5c93dc..21b57f4 100644
--- a/pym/portage/sync/controller.py
+++ b/pym/portage/sync/controller.py
@@ -36,8 +36,9 @@ class TaskHandler(object):
 
 	def run_tasks(self, tasks, func, status=None, verbose=True, options=None):
 		"""Runs the module tasks"""
-		if tasks is None or func is None:
-			return
+		# Ensure we have a task and function
+		assert(tasks)
+		assert(func)
 		for task in tasks:
 			inst = task()
 			show_progress = self.show_progress_bar and self.isatty


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

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

commit:     68857d8b0701bae54149224fe2583e1d36998610
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Fri Sep  5 20:14:57 2014 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Oct 21 05:04:08 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=68857d8b

portage/sync/controller.py: Remove list copy, module_names list is not modified

---
 pym/portage/sync/controller.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pym/portage/sync/controller.py b/pym/portage/sync/controller.py
index e8fe291..a5c93dc 100644
--- a/pym/portage/sync/controller.py
+++ b/pym/portage/sync/controller.py
@@ -85,7 +85,7 @@ class SyncManager(object):
 		os.umask(0o22)
 
 		self.module_controller = portage.sync.module_controller
-		self.module_names = self.module_controller.module_names[:]
+		self.module_names = self.module_controller.module_names
 
 
 	def get_module_descriptions(self, mod):


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

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

commit:     ea5bb221981399f5d66c43daf6d1dd6fc69b16e5
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Jun 17 18:44:43 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=ea5bb221

portage/sync: Add additional output info for unsupported sync-types

Comment out some debug print()'s

---
 pym/portage/sync/__init__.py      | 5 +++--
 pym/portage/sync/config_checks.py | 4 ++++
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/pym/portage/sync/__init__.py b/pym/portage/sync/__init__.py
index 6d2a732..b74c89e 100644
--- a/pym/portage/sync/__init__.py
+++ b/pym/portage/sync/__init__.py
@@ -11,12 +11,12 @@ sync_manager = None
 
 path = os.path.join(os.path.dirname(__file__), "modules")
 # initial development debug info
-print("module path:", path)
+#print("module path:", path)
 
 module_controller = Modules(path=path, namepath="portage.sync.modules")
 
 # initial development debug info
-print(module_controller.module_names)
+#print(module_controller.module_names)
 module_names = module_controller.module_names[:]
 
 
@@ -43,6 +43,7 @@ def get_syncer(settings=None, logger=None):
 
 def validate_config(repo, logger):
 	'''Validate the repos.conf settings for the repo'''
+	global module_names, module_controller
 	if not check_type(repo, logger, module_names):
 		return False
 

diff --git a/pym/portage/sync/config_checks.py b/pym/portage/sync/config_checks.py
index 8ef1974..db316aa 100644
--- a/pym/portage/sync/config_checks.py
+++ b/pym/portage/sync/config_checks.py
@@ -26,6 +26,10 @@ def check_type(repo, logger, module_names):
 			_("Repository '%s' has sync-type attribute set to unsupported value: '%s'")
 			% (repo.name, repo.sync_type),
 			level=logger.ERROR, noiselevel=-1)
+		writemsg_level("!!! %s\n" %
+			_("Installed sync-types are: '%s'")
+			% (str(module_names)),
+			level=logger.ERROR, noiselevel=-1)
 		return False
 	return True
 


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

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

commit:     7f0072b2ebc700ecdb1cce8ca11f8e840e778cef
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Mon Oct 20 20:44:41 2014 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Oct 21 05:04:08 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=7f0072b2

_sync_callback: check for md5-cache, not cache

This fixes FEATURES=metadata-transfer to work again now that the
metadata/cache directory has been replaced with metadata/md5-cache.

---
 pym/portage/sync/controller.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/pym/portage/sync/controller.py b/pym/portage/sync/controller.py
index a88d4c5..0b308e8 100644
--- a/pym/portage/sync/controller.py
+++ b/pym/portage/sync/controller.py
@@ -226,7 +226,8 @@ class SyncManager(object):
 			updatecache_flg = False
 
 		if updatecache_flg and \
-			os.path.exists(os.path.join(self.repo.location, 'metadata', 'cache')):
+			os.path.exists(os.path.join(
+			self.repo.location, 'metadata', 'md5-cache')):
 
 			# Only update cache for repo.location since that's
 			# the only one that's been synced here.


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

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

commit:     5bbbffc41f9be7107f2933542d63f4150e998902
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Jun 17 00:42:29 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=5bbbffc4

sync/syncbase.py: Fix the self.has_bin logic

---
 pym/portage/sync/syncbase.py | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/pym/portage/sync/syncbase.py b/pym/portage/sync/syncbase.py
index 2b6b8c7..94d4aab 100644
--- a/pym/portage/sync/syncbase.py
+++ b/pym/portage/sync/syncbase.py
@@ -34,16 +34,18 @@ class SyncBase(object):
 		self.repo = None
 		self.xterm_titles = None
 		self.spawn_kwargs = None
-		self.bin_command = portage.process.find_binary(bin_command)
-
-		self.has_bin = True
-		if bin_command and self.bin_command is None:
-			msg = ["Command not found: %s" % bin_command,
-			"Type \"emerge %s\" to enable %s support." % (bin_pkg, bin_command)]
-			for l in msg:
-				writemsg_level("!!! %s\n" % l,
-					level=self.logger.ERROR, noiselevel=-1)
-			self.has_bin = False
+		self.bin_command = None
+		self.has_bin = False
+		if bin_command:
+			self.bin_command = portage.process.find_binary(bin_command)
+			if self.bin_command is None:
+				msg = ["Command not found: %s" % bin_command,
+				"Type \"emerge %s\" to enable %s support." % (bin_pkg, bin_command)]
+				for l in msg:
+					writemsg_level("!!! %s\n" % l,
+						level=self.logger.ERROR, noiselevel=-1)
+			else:
+				self.has_bin = True
 
 
 	def _kwargs(self, kwargs):


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

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

commit:     0e2474d19ddc5905a79a01a78c2efe7bbc0c8950
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Jun 17 18:44:43 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=0e2474d1

portage/sync: Add additional output info for unsupported sync-types

Comment out some debug print()'s

---
 pym/portage/sync/__init__.py      | 5 +++--
 pym/portage/sync/config_checks.py | 4 ++++
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/pym/portage/sync/__init__.py b/pym/portage/sync/__init__.py
index 6d2a732..b74c89e 100644
--- a/pym/portage/sync/__init__.py
+++ b/pym/portage/sync/__init__.py
@@ -11,12 +11,12 @@ sync_manager = None
 
 path = os.path.join(os.path.dirname(__file__), "modules")
 # initial development debug info
-print("module path:", path)
+#print("module path:", path)
 
 module_controller = Modules(path=path, namepath="portage.sync.modules")
 
 # initial development debug info
-print(module_controller.module_names)
+#print(module_controller.module_names)
 module_names = module_controller.module_names[:]
 
 
@@ -43,6 +43,7 @@ def get_syncer(settings=None, logger=None):
 
 def validate_config(repo, logger):
 	'''Validate the repos.conf settings for the repo'''
+	global module_names, module_controller
 	if not check_type(repo, logger, module_names):
 		return False
 

diff --git a/pym/portage/sync/config_checks.py b/pym/portage/sync/config_checks.py
index 8ef1974..db316aa 100644
--- a/pym/portage/sync/config_checks.py
+++ b/pym/portage/sync/config_checks.py
@@ -26,6 +26,10 @@ def check_type(repo, logger, module_names):
 			_("Repository '%s' has sync-type attribute set to unsupported value: '%s'")
 			% (repo.name, repo.sync_type),
 			level=logger.ERROR, noiselevel=-1)
+		writemsg_level("!!! %s\n" %
+			_("Installed sync-types are: '%s'")
+			% (str(module_names)),
+			level=logger.ERROR, noiselevel=-1)
 		return False
 	return True
 


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

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

commit:     b37601d61b23eadf7bfb4e9661878c152ab95006
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Fri Sep  5 20:14:57 2014 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon Dec  1 21:49:41 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=b37601d6

portage/sync/controller.py: Remove list copy, module_names list is not modified

---
 pym/portage/sync/controller.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pym/portage/sync/controller.py b/pym/portage/sync/controller.py
index e8fe291..a5c93dc 100644
--- a/pym/portage/sync/controller.py
+++ b/pym/portage/sync/controller.py
@@ -85,7 +85,7 @@ class SyncManager(object):
 		os.umask(0o22)
 
 		self.module_controller = portage.sync.module_controller
-		self.module_names = self.module_controller.module_names[:]
+		self.module_names = self.module_controller.module_names
 
 
 	def get_module_descriptions(self, mod):


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

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

commit:     b7596a9efe18011f71cee32006843edd4e72f46c
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Mon Oct 20 20:44:41 2014 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon Dec  1 21:49:41 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=b7596a9e

_sync_callback: check for md5-cache, not cache

This fixes FEATURES=metadata-transfer to work again now that the
metadata/cache directory has been replaced with metadata/md5-cache.

---
 pym/portage/sync/controller.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/pym/portage/sync/controller.py b/pym/portage/sync/controller.py
index a88d4c5..0b308e8 100644
--- a/pym/portage/sync/controller.py
+++ b/pym/portage/sync/controller.py
@@ -226,7 +226,8 @@ class SyncManager(object):
 			updatecache_flg = False
 
 		if updatecache_flg and \
-			os.path.exists(os.path.join(self.repo.location, 'metadata', 'cache')):
+			os.path.exists(os.path.join(
+			self.repo.location, 'metadata', 'md5-cache')):
 
 			# Only update cache for repo.location since that's
 			# the only one that's been synced here.


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

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

commit:     dcfa5037f819bb6b5efe71dd0c983df7e0652c5c
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Sep  7 01:40:25 2014 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon Dec  1 21:49:41 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=dcfa5037

sync/controller.py: Use assert() on tasks, func

---
 pym/portage/sync/controller.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/pym/portage/sync/controller.py b/pym/portage/sync/controller.py
index a5c93dc..21b57f4 100644
--- a/pym/portage/sync/controller.py
+++ b/pym/portage/sync/controller.py
@@ -36,8 +36,9 @@ class TaskHandler(object):
 
 	def run_tasks(self, tasks, func, status=None, verbose=True, options=None):
 		"""Runs the module tasks"""
-		if tasks is None or func is None:
-			return
+		# Ensure we have a task and function
+		assert(tasks)
+		assert(func)
 		for task in tasks:
 			inst = task()
 			show_progress = self.show_progress_bar and self.isatty


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

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

commit:     462c077d732d50aadd21318e55e6ecda55aff9ff
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 27 05:05:01 2014 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon Dec  1 21:49:41 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=462c077d

Sync: Implement native postsync.d hook code

As per bug 522032, pass the repo.name and repo.sync_uri to the hooks.
With this information, the hooks can be taylored to operate for only certain repos, or only when all repos have been synced.

---
 pym/portage/sync/controller.py | 36 +++++++++++++++++++++++++-----------
 1 file changed, 25 insertions(+), 11 deletions(-)

diff --git a/pym/portage/sync/controller.py b/pym/portage/sync/controller.py
index 21b57f4..a88d4c5 100644
--- a/pym/portage/sync/controller.py
+++ b/pym/portage/sync/controller.py
@@ -87,6 +87,19 @@ class SyncManager(object):
 
 		self.module_controller = portage.sync.module_controller
 		self.module_names = self.module_controller.module_names
+		postsync_dir = os.path.join(self.settings["PORTAGE_CONFIGROOT"],
+			portage.USER_CONFIG_PATH, "postsync.d")
+		hooks = []
+		for root, dirs, names in os.walk(postsync_dir, topdown=True):
+			#print("root:", root, "dirs:", dirs, "names:", names)
+			for name in names:
+				filepath = os.path.join(root, name)
+				if os.access(filepath, os.X_OK):
+					hooks.append((filepath, name))
+				else:
+					writemsg_level(" %s postsync.d hook: '%s' is not executable\n"
+						% (warn("*"), name,), level=logging.WARN, noiselevel=2)
+		self.hooks = hooks
 
 
 	def get_module_descriptions(self, mod):
@@ -129,7 +142,7 @@ class SyncManager(object):
 		taskmaster = TaskHandler(callback=self.do_callback)
 		taskmaster.run_tasks(tasks, func, status, options=task_opts)
 
-		self.perform_post_sync_hook(repo.sync_uri)
+		self.perform_post_sync_hook(repo.name, repo.sync_uri)
 
 		return self.exitcode, None
 
@@ -142,17 +155,18 @@ class SyncManager(object):
 		return
 
 
-	def perform_post_sync_hook(self, dosyncuri):
-		postsync = os.path.join(self.settings["PORTAGE_CONFIGROOT"],
-			portage.USER_CONFIG_PATH, "bin", "post_sync")
-		if os.access(postsync, os.X_OK):
-			retval = portage.process.spawn([postsync, dosyncuri],
-				env=self.settings.environ())
+	def perform_post_sync_hook(self, reponame, dosyncuri='None'):
+		succeeded = os.EX_OK
+		for filepath, hook in self.hooks:
+			writemsg_level("Spawning post_sync hook: %s\n" % (hook,),
+				level=logging.ERROR, noiselevel=4)
+			retval = portage.process.spawn([filepath,
+				reponame, dosyncuri], env=self.settings.environ())
 			if retval != os.EX_OK:
-				writemsg_level(" %s spawn failed of %s\n" % (bad("*"),
-					postsync,), level=logging.ERROR, noiselevel=-1)
-			return retval
-		return os.EX_OK
+				writemsg_level(" %s Spawn failed for: %s, %s\n" % (bad("*"),
+					hook, filepath), level=logging.ERROR, noiselevel=-1)
+				succeeded = retval
+		return succeeded
 
 
 	def pre_sync(self, repo):


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

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

commit:     f51290f5c93eff9d4167ee01792a50172989c375
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Jun 17 18:44:43 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Thu Dec  4 19:56:33 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=f51290f5

portage/sync: Add additional output info for unsupported sync-types

Comment out some debug print()'s

---
 pym/portage/sync/__init__.py      | 5 +++--
 pym/portage/sync/config_checks.py | 4 ++++
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/pym/portage/sync/__init__.py b/pym/portage/sync/__init__.py
index 6d2a732..b74c89e 100644
--- a/pym/portage/sync/__init__.py
+++ b/pym/portage/sync/__init__.py
@@ -11,12 +11,12 @@ sync_manager = None
 
 path = os.path.join(os.path.dirname(__file__), "modules")
 # initial development debug info
-print("module path:", path)
+#print("module path:", path)
 
 module_controller = Modules(path=path, namepath="portage.sync.modules")
 
 # initial development debug info
-print(module_controller.module_names)
+#print(module_controller.module_names)
 module_names = module_controller.module_names[:]
 
 
@@ -43,6 +43,7 @@ def get_syncer(settings=None, logger=None):
 
 def validate_config(repo, logger):
 	'''Validate the repos.conf settings for the repo'''
+	global module_names, module_controller
 	if not check_type(repo, logger, module_names):
 		return False
 

diff --git a/pym/portage/sync/config_checks.py b/pym/portage/sync/config_checks.py
index 8ef1974..db316aa 100644
--- a/pym/portage/sync/config_checks.py
+++ b/pym/portage/sync/config_checks.py
@@ -26,6 +26,10 @@ def check_type(repo, logger, module_names):
 			_("Repository '%s' has sync-type attribute set to unsupported value: '%s'")
 			% (repo.name, repo.sync_type),
 			level=logger.ERROR, noiselevel=-1)
+		writemsg_level("!!! %s\n" %
+			_("Installed sync-types are: '%s'")
+			% (str(module_names)),
+			level=logger.ERROR, noiselevel=-1)
 		return False
 	return True
 


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

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

commit:     54bcea5d7acf3e79653f4fe0f1e8e3ed552ae342
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Jun 17 00:42:29 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Thu Dec  4 19:56:33 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=54bcea5d

sync/syncbase.py: Fix the self.has_bin logic

---
 pym/portage/sync/syncbase.py | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/pym/portage/sync/syncbase.py b/pym/portage/sync/syncbase.py
index 2b6b8c7..94d4aab 100644
--- a/pym/portage/sync/syncbase.py
+++ b/pym/portage/sync/syncbase.py
@@ -34,16 +34,18 @@ class SyncBase(object):
 		self.repo = None
 		self.xterm_titles = None
 		self.spawn_kwargs = None
-		self.bin_command = portage.process.find_binary(bin_command)
-
-		self.has_bin = True
-		if bin_command and self.bin_command is None:
-			msg = ["Command not found: %s" % bin_command,
-			"Type \"emerge %s\" to enable %s support." % (bin_pkg, bin_command)]
-			for l in msg:
-				writemsg_level("!!! %s\n" % l,
-					level=self.logger.ERROR, noiselevel=-1)
-			self.has_bin = False
+		self.bin_command = None
+		self.has_bin = False
+		if bin_command:
+			self.bin_command = portage.process.find_binary(bin_command)
+			if self.bin_command is None:
+				msg = ["Command not found: %s" % bin_command,
+				"Type \"emerge %s\" to enable %s support." % (bin_pkg, bin_command)]
+				for l in msg:
+					writemsg_level("!!! %s\n" % l,
+						level=self.logger.ERROR, noiselevel=-1)
+			else:
+				self.has_bin = True
 
 
 	def _kwargs(self, kwargs):


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

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

commit:     7f28745b044f54862732e77185c0492667af42a5
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Sep  7 01:40:25 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Thu Dec  4 19:56:34 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=7f28745b

sync/controller.py: Use assert() on tasks, func

---
 pym/portage/sync/controller.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/pym/portage/sync/controller.py b/pym/portage/sync/controller.py
index e1aabb7..9e483e9 100644
--- a/pym/portage/sync/controller.py
+++ b/pym/portage/sync/controller.py
@@ -36,8 +36,9 @@ class TaskHandler(object):
 
 	def run_tasks(self, tasks, func, status=None, verbose=True, options=None):
 		"""Runs the module tasks"""
-		if tasks is None or func is None:
-			return
+		# Ensure we have a task and function
+		assert(tasks)
+		assert(func)
 		for task in tasks:
 			inst = task()
 			show_progress = self.show_progress_bar and self.isatty


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

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

commit:     213b1da7b74a7b392292fca077f9e187eb10a503
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Mon Oct 20 20:44:41 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Thu Dec  4 19:56:34 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=213b1da7

_sync_callback: check for md5-cache, not cache

This fixes FEATURES=metadata-transfer to work again now that the
metadata/cache directory has been replaced with metadata/md5-cache.

---
 pym/portage/sync/controller.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/pym/portage/sync/controller.py b/pym/portage/sync/controller.py
index c860e1a..5c58865 100644
--- a/pym/portage/sync/controller.py
+++ b/pym/portage/sync/controller.py
@@ -227,7 +227,8 @@ class SyncManager(object):
 			updatecache_flg = False
 
 		if updatecache_flg and \
-			os.path.exists(os.path.join(self.repo.location, 'metadata', 'cache')):
+			os.path.exists(os.path.join(
+			self.repo.location, 'metadata', 'md5-cache')):
 
 			# Only update cache for repo.location since that's
 			# the only one that's been synced here.


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

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

commit:     174fbc3b24168c7b42270accb4e69707b946a484
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Fri Sep  5 20:14:57 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Thu Dec  4 19:56:34 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=174fbc3b

portage/sync/controller.py: Remove list copy, module_names list is not modified

---
 pym/portage/sync/controller.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pym/portage/sync/controller.py b/pym/portage/sync/controller.py
index 10ae0a8..e1aabb7 100644
--- a/pym/portage/sync/controller.py
+++ b/pym/portage/sync/controller.py
@@ -85,7 +85,7 @@ class SyncManager(object):
 		os.umask(0o22)
 
 		self.module_controller = portage.sync.module_controller
-		self.module_names = self.module_controller.module_names[:]
+		self.module_names = self.module_controller.module_names
 
 
 	def get_module_descriptions(self, mod):


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

* [gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/
  2014-12-04 20:16 [gentoo-commits] proj/portage:master " Brian Dolbec
@ 2014-12-04 20:04 ` Brian Dolbec
  0 siblings, 0 replies; 66+ messages in thread
From: Brian Dolbec @ 2014-12-04 20:04 UTC (permalink / raw
  To: gentoo-commits

commit:     737ccc31d83f73395a22f4a19bb13fbc1e94208a
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 27 05:05:01 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Thu Dec  4 19:56:34 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=737ccc31

Sync: Implement native postsync.d hook code

As per bug 522032, pass the repo.name and repo.sync_uri to the hooks.
With this information, the hooks can be taylored to operate for only certain repos, or only when all repos have been synced.

---
 pym/portage/sync/controller.py | 36 +++++++++++++++++++++++++-----------
 1 file changed, 25 insertions(+), 11 deletions(-)

diff --git a/pym/portage/sync/controller.py b/pym/portage/sync/controller.py
index 9e483e9..c860e1a 100644
--- a/pym/portage/sync/controller.py
+++ b/pym/portage/sync/controller.py
@@ -87,6 +87,19 @@ class SyncManager(object):
 
 		self.module_controller = portage.sync.module_controller
 		self.module_names = self.module_controller.module_names
+		postsync_dir = os.path.join(self.settings["PORTAGE_CONFIGROOT"],
+			portage.USER_CONFIG_PATH, "postsync.d")
+		hooks = []
+		for root, dirs, names in os.walk(postsync_dir, topdown=True):
+			#print("root:", root, "dirs:", dirs, "names:", names)
+			for name in names:
+				filepath = os.path.join(root, name)
+				if os.access(filepath, os.X_OK):
+					hooks.append((filepath, name))
+				else:
+					writemsg_level(" %s postsync.d hook: '%s' is not executable\n"
+						% (warn("*"), name,), level=logging.WARN, noiselevel=2)
+		self.hooks = hooks
 
 
 	def get_module_descriptions(self, mod):
@@ -129,7 +142,7 @@ class SyncManager(object):
 		taskmaster = TaskHandler(callback=self.do_callback)
 		taskmaster.run_tasks(tasks, func, status, options=task_opts)
 
-		self.perform_post_sync_hook(repo.sync_uri)
+		self.perform_post_sync_hook(repo.name, repo.sync_uri)
 
 		return self.exitcode, None
 
@@ -143,17 +156,18 @@ class SyncManager(object):
 		return
 
 
-	def perform_post_sync_hook(self, dosyncuri):
-		postsync = os.path.join(self.settings["PORTAGE_CONFIGROOT"],
-			portage.USER_CONFIG_PATH, "bin", "post_sync")
-		if os.access(postsync, os.X_OK):
-			retval = portage.process.spawn([postsync, dosyncuri],
-				env=self.settings.environ())
+	def perform_post_sync_hook(self, reponame, dosyncuri=''):
+		succeeded = os.EX_OK
+		for filepath, hook in self.hooks:
+			writemsg_level("Spawning post_sync hook: %s\n" % (hook,),
+				level=logging.ERROR, noiselevel=4)
+			retval = portage.process.spawn([filepath,
+				reponame, dosyncuri], env=self.settings.environ())
 			if retval != os.EX_OK:
-				writemsg_level(" %s spawn failed of %s\n" % (bad("*"),
-					postsync,), level=logging.ERROR, noiselevel=-1)
-			return retval
-		return os.EX_OK
+				writemsg_level(" %s Spawn failed for: %s, %s\n" % (bad("*"),
+					hook, filepath), level=logging.ERROR, noiselevel=-1)
+				succeeded = retval
+		return succeeded
 
 
 	def pre_sync(self, repo):


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

* [gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/
  2014-12-04 20:16 [gentoo-commits] proj/portage:master " Brian Dolbec
@ 2014-12-04 20:04 ` Brian Dolbec
  0 siblings, 0 replies; 66+ messages in thread
From: Brian Dolbec @ 2014-12-04 20:04 UTC (permalink / raw
  To: gentoo-commits

commit:     5e37e1aebb371b0ee36a70e0e166af8398cff926
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Thu Dec  4 19:49:22 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Thu Dec  4 19:58:35 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=5e37e1ae

portage/sync/controller.py: Wrap variables with _unicode_decode for writemsg_level() calls

Fixes "BytesWarning: str() on a bytes instance" errors in py3.

---
 pym/portage/sync/controller.py | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/pym/portage/sync/controller.py b/pym/portage/sync/controller.py
index b7c668c..21aa7a7 100644
--- a/pym/portage/sync/controller.py
+++ b/pym/portage/sync/controller.py
@@ -20,6 +20,7 @@ bad = create_color_func("BAD")
 warn = create_color_func("WARN")
 from portage.package.ebuild.doebuild import _check_temp_dir
 from portage.metadata import action_metadata
+from portage import _unicode_decode
 
 
 class TaskHandler(object):
@@ -98,7 +99,7 @@ class SyncManager(object):
 					hooks.append((filepath, name))
 				else:
 					writemsg_level(" %s postsync.d hook: '%s' is not executable\n"
-						% (warn("*"), name,), level=logging.WARN, noiselevel=2)
+						% (warn("*"), _unicode_decode(name),), level=logging.WARN, noiselevel=2)
 		self.hooks = hooks
 
 
@@ -159,13 +160,15 @@ class SyncManager(object):
 	def perform_post_sync_hook(self, reponame, dosyncuri='', repolocation=''):
 		succeeded = os.EX_OK
 		for filepath, hook in self.hooks:
-			writemsg_level("Spawning post_sync hook: %s\n" % (hook,),
+			writemsg_level("Spawning post_sync hook: %s\n"
+				% (_unicode_decode(hook)),
 				level=logging.ERROR, noiselevel=4)
 			retval = portage.process.spawn([filepath,
 				reponame, dosyncuri, repolocation], env=self.settings.environ())
 			if retval != os.EX_OK:
 				writemsg_level(" %s Spawn failed for: %s, %s\n" % (bad("*"),
-					hook, filepath), level=logging.ERROR, noiselevel=-1)
+					_unicode_decode(hook), filepath),
+					level=logging.ERROR, noiselevel=-1)
 				succeeded = retval
 		return succeeded
 
@@ -182,7 +185,8 @@ class SyncManager(object):
 		except OSError:
 			st = None
 		if st is None:
-			writemsg_level(">>> '%s' not found, creating it." % repo.location)
+			writemsg_level(">>> '%s' not found, creating it."
+				% _unicode_decode(repo.location))
 			portage.util.ensure_dirs(repo.location, mode=0o755)
 			st = os.stat(repo.location)
 


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

* [gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/
  2014-12-04 20:16 [gentoo-commits] proj/portage:master " Brian Dolbec
@ 2014-12-04 20:04 ` Brian Dolbec
  0 siblings, 0 replies; 66+ messages in thread
From: Brian Dolbec @ 2014-12-04 20:04 UTC (permalink / raw
  To: gentoo-commits

commit:     fc65d8afbbfdcc52073d07818288c693ad04596a
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Thu Dec  4 17:03:20 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Thu Dec  4 19:56:36 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=fc65d8af

portage/sync/controller.py: Add repo location to parameters passed to post_sync hooks

---
 pym/portage/sync/controller.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/pym/portage/sync/controller.py b/pym/portage/sync/controller.py
index 5c58865..b7c668c 100644
--- a/pym/portage/sync/controller.py
+++ b/pym/portage/sync/controller.py
@@ -142,7 +142,7 @@ class SyncManager(object):
 		taskmaster = TaskHandler(callback=self.do_callback)
 		taskmaster.run_tasks(tasks, func, status, options=task_opts)
 
-		self.perform_post_sync_hook(repo.name, repo.sync_uri)
+		self.perform_post_sync_hook(repo.name, repo.sync_uri, repo.location)
 
 		return self.exitcode, None
 
@@ -156,13 +156,13 @@ class SyncManager(object):
 		return
 
 
-	def perform_post_sync_hook(self, reponame, dosyncuri=''):
+	def perform_post_sync_hook(self, reponame, dosyncuri='', repolocation=''):
 		succeeded = os.EX_OK
 		for filepath, hook in self.hooks:
 			writemsg_level("Spawning post_sync hook: %s\n" % (hook,),
 				level=logging.ERROR, noiselevel=4)
 			retval = portage.process.spawn([filepath,
-				reponame, dosyncuri], env=self.settings.environ())
+				reponame, dosyncuri, repolocation], env=self.settings.environ())
 			if retval != os.EX_OK:
 				writemsg_level(" %s Spawn failed for: %s, %s\n" % (bad("*"),
 					hook, filepath), level=logging.ERROR, noiselevel=-1)


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

end of thread, other threads:[~2014-12-04 20:04 UTC | newest]

Thread overview: 66+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-14 16:23 [gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/ Brian Dolbec
  -- strict thread matches above, loose matches on Subject: below --
2014-12-04 20:16 [gentoo-commits] proj/portage:master " Brian Dolbec
2014-12-04 20:04 ` [gentoo-commits] proj/portage:plugin-sync " Brian Dolbec
2014-12-04 20:16 [gentoo-commits] proj/portage:master " Brian Dolbec
2014-12-04 20:04 ` [gentoo-commits] proj/portage:plugin-sync " Brian Dolbec
2014-12-04 20:16 [gentoo-commits] proj/portage:master " Brian Dolbec
2014-12-04 20:04 ` [gentoo-commits] proj/portage:plugin-sync " Brian Dolbec
2014-12-04 20:04 Brian Dolbec
2014-12-04 20:04 Brian Dolbec
2014-12-04 20:04 Brian Dolbec
2014-12-04 20:04 Brian Dolbec
2014-12-04 20:04 Brian Dolbec
2014-12-01 21:50 Michał Górny
2014-12-01 21:50 Michał Górny
2014-12-01 21:50 Michał Górny
2014-12-01 21:50 Michał Górny
2014-12-01 21:50 Michał Górny
2014-12-01 21:50 Michał Górny
2014-10-21  5:05 Zac Medico
2014-10-21  5:05 Zac Medico
2014-10-21  5:05 Zac Medico
2014-10-21  5:05 Zac Medico
2014-10-21  5:05 Zac Medico
2014-10-21  5:05 Zac Medico
2014-10-20 20:46 Zac Medico
2014-10-20  3:54 Zac Medico
2014-10-20  3:54 Zac Medico
2014-10-20  3:54 Zac Medico
2014-10-20  3:54 Zac Medico
2014-10-20  3:54 Zac Medico
2014-09-30  0:46 Brian Dolbec
2014-09-30  0:46 Brian Dolbec
2014-09-30  0:46 Brian Dolbec
2014-09-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-29 18:29 Brian Dolbec
2014-09-29 18:29 Brian Dolbec
2014-09-29 18:29 Brian Dolbec
2014-09-27  5:05 Brian Dolbec
2014-09-27  2:20 Brian Dolbec
2014-09-27  2:20 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-05  4:38 Brian Dolbec
2014-09-05  4:38 Brian Dolbec
2014-09-04  1:18 Brian Dolbec
2014-09-04  1:18 Brian Dolbec
2014-09-03 23:36 Brian Dolbec
2014-09-03 23:36 Brian Dolbec
2014-08-19 20:19 Brian Dolbec
2014-06-17  0:42 Brian Dolbec
2014-06-16 15:46 Brian Dolbec
2014-06-16 15:18 Brian Dolbec
2014-05-11 17:22 Brian Dolbec
2014-05-02 23:13 Brian Dolbec
2014-04-22  2:36 Brian Dolbec
2014-04-22  2:36 Brian Dolbec
2014-04-22  2:36 Brian Dolbec
2014-04-22  2:36 Brian Dolbec
2014-04-22  2:36 Brian Dolbec
2014-04-22  2:36 Brian Dolbec
2014-03-14 16:23 Brian Dolbec
2014-02-19  8:29 Brian Dolbec

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