public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/git/
@ 2014-02-08  4:03 Chris Reffett
  0 siblings, 0 replies; 28+ messages in thread
From: Chris Reffett @ 2014-02-08  4:03 UTC (permalink / raw
  To: gentoo-commits

commit:     5b4ede32eb16add16c152f72cbf5fbb6b61dea67
Author:     Chris Reffett <creffett <AT> gentoo <DOT> org>
AuthorDate: Sat Feb  8 03:20:40 2014 +0000
Commit:     Chris Reffett <creffett <AT> gentoo <DOT> org>
CommitDate: Sat Feb  8 03:21:49 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=5b4ede32

Move several git vars to be part of the object like in rsync

---
 pym/portage/sync/modules/git/git.py | 53 ++++++++++++++++++++++---------------
 1 file changed, 31 insertions(+), 22 deletions(-)

diff --git a/pym/portage/sync/modules/git/git.py b/pym/portage/sync/modules/git/git.py
index bce992e..0c75dc7 100644
--- a/pym/portage/sync/modules/git/git.py
+++ b/pym/portage/sync/modules/git/git.py
@@ -28,7 +28,12 @@ class GitSync(object):
 
 
 	def __init__(self):
+		self.options = None
 		self.settings = None
+		self.logger = None
+		self.repo = None
+		self.xterm_titles = None
+
 		self.has_git = True
 		if portage.process.find_binary("git") is None:
 			msg = ["Command not found: git",
@@ -39,6 +44,13 @@ class GitSync(object):
 			self.has_git = False
 
 
+	def _kwargs(self, 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 sync(self, **kwargs):
 		''' Update existing git repository, and ignore the syncuri. We are
 		going to trust the user and assume that the user is in the branch
@@ -46,51 +58,48 @@ class GitSync(object):
 		git directly.
 		'''
 		if kwargs:
-			options = kwargs.get('options', {})
-			emerge_config = options.get('emerge_config', None)
-			logger = options.get('logger', None)
-			repo = options.get('repo', None)
-			portdb = options.get('portdb', None)
-			spawn_kwargs = options.get('spawn_kwargs', None)
-			xterm_titles = options.get('xterm_titles', False)
+			self._kwargs(kwargs)
+			emerge_config = self.options.get('emerge_config', None)
+			spawn_kwargs = self.options.get('spawn_kwargs', None)
+			portdb = self.options.get('portdb', None)
 
 		if not self.has_git:
-			return repo.location, 1, False
+			return self.repo.location, 1, False
 
 		# Test if the directory is a valid git repo, and run
 		# git clone if not
 		exitcode = portage.process.spawn_bash("cd %s ; git rev-parse" %\
-			(portage._shell_quote(repo.location),),
+			(portage._shell_quote(self.repo.location),),
 			**portage._native_kwargs(spawn_kwargs))
 		if exitcode == 128:
 			msg = "!!! Git repo does not already exist, cloning from upstream..."
-			logger(xterm_titles, msg)
+			self.logger(self.xterm_titles, msg)
 			writemsg_level(msg + "\n")
 			exitcode = portage.process.spawn_bash("cd %s ; git clone %s ." % \
-				(portage._shell_quote(repo.location),
-				portage._shell_quote(repo.sync_uri)),
+				(portage._shell_quote(self.repo.location),
+				portage._shell_quote(self.repo.sync_uri)),
 				**portage._native_kwargs(spawn_kwargs))
 			if exitcode != os.EX_OK:
-				msg = "!!! git clone error in %s." % repo.location
-				logger(xterm_titles, msg)
+				msg = "!!! git clone error in %s." % self.repo.location
+				self.logger(self.xterm_titles, msg)
 				writemsg_level(msg + "\n", level=logging.ERROR, noiselevel=-1)
 			return (exitcode, False)
 		else:
-			msg = ">>> Starting git pull in %s..." % repo.location
-			logger(xterm_titles, msg )
+			msg = ">>> Starting git pull in %s..." % self.repo.location
+			self.logger(self.xterm_titles, msg )
 			writemsg_level(msg + "\n")
 			exitcode = portage.process.spawn_bash("cd %s ; git pull" % \
-				(portage._shell_quote(repo.location),),
+				(portage._shell_quote(self.repo.location),),
 			**portage._native_kwargs(spawn_kwargs))
 			if exitcode != os.EX_OK:
-				msg = "!!! git pull error in %s." % repo.location
-				logger(xterm_titles, msg)
+				msg = "!!! git pull error in %s." % self.repo.location
+				self.logger(self.xterm_titles, msg)
 				writemsg_level(msg + "\n", level=logging.ERROR, noiselevel=-1)
 				return (exitcode, False)
-		msg = ">>> Git pull in %s successful" % repo.location
-		logger(xterm_titles, msg)
+		msg = ">>> Git pull in %s successful" % self.repo.location
+		self.logger(self.xterm_titles, msg)
 		writemsg_level(msg + "\n")
-		return self.post_sync(portdb, repo.location, emerge_config)
+		return self.post_sync(portdb, self.repo.location, emerge_config)
 
 
 	def post_sync(self, portdb, location, emerge_config):


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

* [gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/git/
@ 2014-02-08  4:03 Chris Reffett
  0 siblings, 0 replies; 28+ messages in thread
From: Chris Reffett @ 2014-02-08  4:03 UTC (permalink / raw
  To: gentoo-commits

commit:     54c30b589b6807abc9985ab0baf9ab63c3e30bcd
Author:     Chris Reffett <creffett <AT> gentoo <DOT> org>
AuthorDate: Fri Feb  7 22:46:22 2014 +0000
Commit:     Chris Reffett <creffett <AT> gentoo <DOT> org>
CommitDate: Sat Feb  8 03:21:48 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=54c30b58

Add auto-clone support for git sync

Make the git sync module clone the upstream repository if the directory
specified in repos.conf isn't a git directory. Fixes bug 485402.

---
 pym/portage/sync/modules/git/git.py | 35 +++++++++++++++++++++++++++--------
 1 file changed, 27 insertions(+), 8 deletions(-)

diff --git a/pym/portage/sync/modules/git/git.py b/pym/portage/sync/modules/git/git.py
index 2f855bd..bce992e 100644
--- a/pym/portage/sync/modules/git/git.py
+++ b/pym/portage/sync/modules/git/git.py
@@ -57,17 +57,36 @@ class GitSync(object):
 		if not self.has_git:
 			return repo.location, 1, False
 
-		msg = ">>> Starting git pull in %s..." % repo.location
-		logger(xterm_titles, msg )
-		writemsg_level(msg + "\n")
-		exitcode = portage.process.spawn_bash("cd %s ; git pull" % \
+		# Test if the directory is a valid git repo, and run
+		# git clone if not
+		exitcode = portage.process.spawn_bash("cd %s ; git rev-parse" %\
 			(portage._shell_quote(repo.location),),
 			**portage._native_kwargs(spawn_kwargs))
-		if exitcode != os.EX_OK:
-			msg = "!!! git pull error in %s." % repo.location
+		if exitcode == 128:
+			msg = "!!! Git repo does not already exist, cloning from upstream..."
 			logger(xterm_titles, msg)
-			writemsg_level(msg + "\n", level=logging.ERROR, noiselevel=-1)
-			return exitcode
+			writemsg_level(msg + "\n")
+			exitcode = portage.process.spawn_bash("cd %s ; git clone %s ." % \
+				(portage._shell_quote(repo.location),
+				portage._shell_quote(repo.sync_uri)),
+				**portage._native_kwargs(spawn_kwargs))
+			if exitcode != os.EX_OK:
+				msg = "!!! git clone error in %s." % repo.location
+				logger(xterm_titles, msg)
+				writemsg_level(msg + "\n", level=logging.ERROR, noiselevel=-1)
+			return (exitcode, False)
+		else:
+			msg = ">>> Starting git pull in %s..." % repo.location
+			logger(xterm_titles, msg )
+			writemsg_level(msg + "\n")
+			exitcode = portage.process.spawn_bash("cd %s ; git pull" % \
+				(portage._shell_quote(repo.location),),
+			**portage._native_kwargs(spawn_kwargs))
+			if exitcode != os.EX_OK:
+				msg = "!!! git pull error in %s." % repo.location
+				logger(xterm_titles, msg)
+				writemsg_level(msg + "\n", level=logging.ERROR, noiselevel=-1)
+				return (exitcode, False)
 		msg = ">>> Git pull in %s successful" % repo.location
 		logger(xterm_titles, msg)
 		writemsg_level(msg + "\n")


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

* [gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/git/
@ 2014-02-08  4:03 Chris Reffett
  0 siblings, 0 replies; 28+ messages in thread
From: Chris Reffett @ 2014-02-08  4:03 UTC (permalink / raw
  To: gentoo-commits

commit:     28bb54f8d527979ad56375b73f70a43a28429755
Author:     Chris Reffett <creffett <AT> gentoo <DOT> org>
AuthorDate: Sat Feb  8 04:02:18 2014 +0000
Commit:     Chris Reffett <creffett <AT> gentoo <DOT> org>
CommitDate: Sat Feb  8 04:02:18 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=28bb54f8

Add exists() and new() functions, make sync() private and add new sync
pointing either to new() or _sync().

---
 pym/portage/sync/modules/git/git.py | 109 +++++++++++++++++++++++++-----------
 1 file changed, 75 insertions(+), 34 deletions(-)

diff --git a/pym/portage/sync/modules/git/git.py b/pym/portage/sync/modules/git/git.py
index 0c75dc7..833d7d9 100644
--- a/pym/portage/sync/modules/git/git.py
+++ b/pym/portage/sync/modules/git/git.py
@@ -51,7 +51,71 @@ class GitSync(object):
 		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
+		exitcode = portage.process.spawn_bash("cd %s ; git rev-parse" %\
+			(portage._shell_quote(self.repo.location),),
+			**portage._native_kwargs(spawn_kwargs))
+		if exitcode == 128:
+			return False
+		return True
+
+
 	def sync(self, **kwargs):
+		'''Sync/Clone the repository'''
+		if kwargs:
+			self._kwargs(kwargs)
+
+		if not self.has_git:
+			return (1, False)
+
+		if not self.exists():
+			return self.new()
+		return self._sync()
+
+
+	def new(self, **kwargs):
+		'''Do the initial clone of the repository'''
+		if kwargs:
+			self._kwargs(kwargs)
+                emerge_config = self.options.get('emerge_config', None)
+		spawn_kwargs = self.options.get('spawn_kwargs', None)
+		portdb = self.options.get('portdb', None)
+		try:
+			if not os.path.exists(self.repo.location):
+				os.makedirs(self.repo.location)
+				self.logger(self.xterm_titles,
+					'Created new directory %s' % self.repo.location)
+		except IOError:
+			return (1, False)
+		msg = ">>> Cloning git repository from upstream into %s..." % self.repo.location
+		self.logger(self.xterm_titles, msg)
+		writemsg_level(msg + "\n")
+		exitcode = portage.process.spawn_bash("cd %s ; git clone %s ." % \
+			(portage._shell_quote(self.repo.location),
+			portage._shell_quote(self.repo.sync_uri)),
+			**portage._native_kwargs(spawn_kwargs))
+		if exitcode != os.EX_OK:
+			msg = "!!! git clone error in %s" % self.repo.location
+			self.logger(self.xterm_titles, msg)
+			writemsg_level(msg + "\n", level=logging.ERROR, noiselevel=-1)
+		return (exitcode, False)
+		msg = ">>> Git clone successful"
+		self.logger(self.xterm_titles, msg)
+		writemsg_level(msg + "\n")
+		return self.post_sync(portdb, self.repo.location, emerge_config)
+
+
+	def _sync(self, **kwargs):
 		''' Update existing git repository, and ignore the syncuri. We are
 		going to trust the user and assume that the user is in the branch
 		that he/she wants updated. We'll let the user manage branches with
@@ -59,44 +123,22 @@ class GitSync(object):
 		'''
 		if kwargs:
 			self._kwargs(kwargs)
-			emerge_config = self.options.get('emerge_config', None)
-			spawn_kwargs = self.options.get('spawn_kwargs', None)
-			portdb = self.options.get('portdb', None)
-
-		if not self.has_git:
-			return self.repo.location, 1, False
+		emerge_config = self.options.get('emerge_config', None)
+		spawn_kwargs = self.options.get('spawn_kwargs', None)
+		portdb = self.options.get('portdb', None)
 
-		# Test if the directory is a valid git repo, and run
-		# git clone if not
-		exitcode = portage.process.spawn_bash("cd %s ; git rev-parse" %\
+		msg = ">>> Starting git pull in %s..." % self.repo.location
+		self.logger(self.xterm_titles, msg)
+		writemsg_level(msg + "\n")
+		exitcode = portage.process.spawn_bash("cd %s ; git pull" % \
 			(portage._shell_quote(self.repo.location),),
 			**portage._native_kwargs(spawn_kwargs))
-		if exitcode == 128:
-			msg = "!!! Git repo does not already exist, cloning from upstream..."
+		if exitcode != os.EX_OK:
+			msg = "!!! git pull error in %s" % self.repo.location
 			self.logger(self.xterm_titles, msg)
-			writemsg_level(msg + "\n")
-			exitcode = portage.process.spawn_bash("cd %s ; git clone %s ." % \
-				(portage._shell_quote(self.repo.location),
-				portage._shell_quote(self.repo.sync_uri)),
-				**portage._native_kwargs(spawn_kwargs))
-			if exitcode != os.EX_OK:
-				msg = "!!! git clone error in %s." % self.repo.location
-				self.logger(self.xterm_titles, msg)
-				writemsg_level(msg + "\n", level=logging.ERROR, noiselevel=-1)
+			writemsg_level(msg + "\n", level=logging.ERROR, noiselevel=-1)
 			return (exitcode, False)
-		else:
-			msg = ">>> Starting git pull in %s..." % self.repo.location
-			self.logger(self.xterm_titles, msg )
-			writemsg_level(msg + "\n")
-			exitcode = portage.process.spawn_bash("cd %s ; git pull" % \
-				(portage._shell_quote(self.repo.location),),
-			**portage._native_kwargs(spawn_kwargs))
-			if exitcode != os.EX_OK:
-				msg = "!!! git pull error in %s." % self.repo.location
-				self.logger(self.xterm_titles, msg)
-				writemsg_level(msg + "\n", level=logging.ERROR, noiselevel=-1)
-				return (exitcode, False)
-		msg = ">>> Git pull in %s successful" % self.repo.location
+		msg = ">>> Git pull successful" % self.repo.location
 		self.logger(self.xterm_titles, msg)
 		writemsg_level(msg + "\n")
 		return self.post_sync(portdb, self.repo.location, emerge_config)
@@ -119,4 +161,3 @@ class GitSync(object):
 		if exitcode == os.EX_OK:
 			updatecache_flg = True
 		return (exitcode, updatecache_flg)
-


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

* [gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/git/
@ 2014-02-08 15:41 Chris Reffett
  0 siblings, 0 replies; 28+ messages in thread
From: Chris Reffett @ 2014-02-08 15:41 UTC (permalink / raw
  To: gentoo-commits

commit:     233c4594cd372ab663edc36b85b3b7766049db06
Author:     Chris Reffett <2011creffett <AT> tjhsst <DOT> edu>
AuthorDate: Sat Feb  8 15:22:58 2014 +0000
Commit:     Chris Reffett <creffett <AT> gentoo <DOT> org>
CommitDate: Sat Feb  8 15:22:58 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=233c4594

Fix mixed spaces/tabs, update _sync to not take kwargs since it's
an internal function

---
 pym/portage/sync/modules/git/git.py | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/pym/portage/sync/modules/git/git.py b/pym/portage/sync/modules/git/git.py
index 833d7d9..f942045 100644
--- a/pym/portage/sync/modules/git/git.py
+++ b/pym/portage/sync/modules/git/git.py
@@ -45,6 +45,7 @@ class GitSync(object):
 
 
 	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)
@@ -53,7 +54,7 @@ class GitSync(object):
 
 
 	def exists(self, **kwargs):
-                '''Tests whether the repo actually exists'''
+		'''Tests whether the repo actually exists'''
 		if kwargs:
 			self._kwargs(kwargs)
 		elif not self.repo:
@@ -87,7 +88,7 @@ class GitSync(object):
 		'''Do the initial clone of the repository'''
 		if kwargs:
 			self._kwargs(kwargs)
-                emerge_config = self.options.get('emerge_config', None)
+		emerge_config = self.options.get('emerge_config', None)
 		spawn_kwargs = self.options.get('spawn_kwargs', None)
 		portdb = self.options.get('portdb', None)
 		try:
@@ -115,14 +116,14 @@ class GitSync(object):
 		return self.post_sync(portdb, self.repo.location, emerge_config)
 
 
-	def _sync(self, **kwargs):
+	def _sync(self):
 		''' Update existing git repository, and ignore the syncuri. We are
 		going to trust the user and assume that the user is in the branch
 		that he/she wants updated. We'll let the user manage branches with
 		git directly.
 		'''
-		if kwargs:
-			self._kwargs(kwargs)
+		# No kwargs call here; this is internal, so it should have been
+		# called by something which set the internal variables
 		emerge_config = self.options.get('emerge_config', None)
 		spawn_kwargs = self.options.get('spawn_kwargs', None)
 		portdb = self.options.get('portdb', None)


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

* [gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/git/
@ 2014-02-10  4:07 Chris Reffett
  0 siblings, 0 replies; 28+ messages in thread
From: Chris Reffett @ 2014-02-10  4:07 UTC (permalink / raw
  To: gentoo-commits

commit:     a628872018e48c1e1e0fffb4eca6af5a239e0586
Author:     Chris Reffett <2011creffett <AT> tjhsst <DOT> edu>
AuthorDate: Mon Feb 10 04:06:46 2014 +0000
Commit:     Chris Reffett <creffett <AT> gentoo <DOT> org>
CommitDate: Mon Feb 10 04:06:46 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=a6288720

Update module spec for git

---
 pym/portage/sync/modules/git/__init__.py | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/pym/portage/sync/modules/git/__init__.py b/pym/portage/sync/modules/git/__init__.py
index 39d7296..4ceaa84 100644
--- a/pym/portage/sync/modules/git/__init__.py
+++ b/pym/portage/sync/modules/git/__init__.py
@@ -2,7 +2,7 @@
 # Distributed under the terms of the GNU General Public License v2
 
 """Git plug-in module for portage.
-   Performs a git pull on repositories
+Performs a git pull on repositories
 """
 
 
@@ -14,8 +14,21 @@ module_spec = {
 			'name': "git",
 			'class': "GitSync",
 			'description': __doc__,
-			'functions': ['sync',],
-			'func_desc': {'sync': 'Performs a git pull on the repository'}
-			}
+			'functions': ['sync', 'new', 'exists'],
+			'func_desc': {
+				'sync': 'Performs a git pull on the repository',
+				'new': 'Creates the new repository at the specified location',
+				'exists': 'Returns a boolean of whether the specified dir ' +
+					'exists and is a valid Git repository',
+			},
+			'func_parameters': {
+				'kwargs': {
+					'type': dict,
+					'description': 'Standard python **kwargs parameter format' +
+						'Please refer to the sync modules specs at ' +
+						'"https://wiki.gentoo.org:Project:Portage" for details',
+				},
+			},
 		}
 	}
+}


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

* [gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/git/
@ 2014-02-19 15:37 Brian Dolbec
  0 siblings, 0 replies; 28+ messages in thread
From: Brian Dolbec @ 2014-02-19 15:37 UTC (permalink / raw
  To: gentoo-commits

commit:     2ad15a792d7b894662297dfac0cfb45787919532
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Wed Feb 19 15:32:32 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Wed Feb 19 15:32:32 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=2ad15a79

Git Sync: fix missing %s in the success message.

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

diff --git a/pym/portage/sync/modules/git/git.py b/pym/portage/sync/modules/git/git.py
index f942045..a820786 100644
--- a/pym/portage/sync/modules/git/git.py
+++ b/pym/portage/sync/modules/git/git.py
@@ -139,7 +139,7 @@ class GitSync(object):
 			self.logger(self.xterm_titles, msg)
 			writemsg_level(msg + "\n", level=logging.ERROR, noiselevel=-1)
 			return (exitcode, False)
-		msg = ">>> Git pull successful" % self.repo.location
+		msg = ">>> Git pull successful: %s" % self.repo.location
 		self.logger(self.xterm_titles, msg)
 		writemsg_level(msg + "\n")
 		return self.post_sync(portdb, self.repo.location, emerge_config)


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

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

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

portage/sync/modules/git: Use SyncBase class.

---
 pym/portage/sync/modules/git/git.py | 53 +++++--------------------------------
 1 file changed, 6 insertions(+), 47 deletions(-)

diff --git a/pym/portage/sync/modules/git/git.py b/pym/portage/sync/modules/git/git.py
index 6806ef3..21394b9 100644
--- a/pym/portage/sync/modules/git/git.py
+++ b/pym/portage/sync/modules/git/git.py
@@ -11,9 +11,10 @@ good = create_color_func("GOOD")
 bad = create_color_func("BAD")
 warn = create_color_func("WARN")
 from .timestamps import git_sync_timestamps
+from portage.sync.syncbase import SyncBase
 
 
-class GitSync(object):
+class GitSync(SyncBase):
 	'''Git sync class'''
 
 	short_desc = "Perform sync operations on git based repositories"
@@ -23,34 +24,8 @@ class GitSync(object):
 		return "GitSync"
 
 
-	def can_progressbar(self, func):
-		return False
-
-
 	def __init__(self):
-		self.options = None
-		self.settings = None
-		self.logger = None
-		self.repo = None
-		self.xterm_titles = None
-
-		self.has_git = True
-		if portage.process.find_binary("git") is None:
-			msg = ["Command not found: git",
-			"Type \"emerge %s\" to enable git support." % portage.const.GIT_PACKAGE_ATOM]
-			for l in msg:
-				writemsg_level("!!! %s\n" % l,
-					level=logging.ERROR, noiselevel=-1)
-			self.has_git = 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)
+		SyncBase.__init__(self, "git", portage.const.GIT_PACKAGE_ATOM)
 
 
 	def exists(self, **kwargs):
@@ -59,37 +34,22 @@ class GitSync(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
 		exitcode = portage.process.spawn_bash("cd %s ; git rev-parse" %\
 			(portage._shell_quote(self.repo.location),),
-			**portage._native_kwargs(spawn_kwargs))
+			**portage._native_kwargs(self.spawn_kwargs))
 		if exitcode == 128:
 			return False
 		return True
 
 
-	def sync(self, **kwargs):
-		'''Sync/Clone the repository'''
-		if kwargs:
-			self._kwargs(kwargs)
-
-		if not self.has_git:
-			return (1, False)
-
-		if not self.exists():
-			return self.new()
-		return self._sync()
-
-
 	def new(self, **kwargs):
 		'''Do the initial clone of the repository'''
 		if kwargs:
 			self._kwargs(kwargs)
 		emerge_config = self.options.get('emerge_config', None)
-		spawn_kwargs = self.options.get('spawn_kwargs', None)
 		portdb = self.options.get('portdb', None)
 		try:
 			if not os.path.exists(self.repo.location):
@@ -104,7 +64,7 @@ class GitSync(object):
 		exitcode = portage.process.spawn_bash("cd %s ; git clone %s ." % \
 			(portage._shell_quote(self.repo.location),
 			portage._shell_quote(self.repo.sync_uri)),
-			**portage._native_kwargs(spawn_kwargs))
+			**portage._native_kwargs(self.spawn_kwargs))
 		if exitcode != os.EX_OK:
 			msg = "!!! git clone error in %s" % self.repo.location
 			self.logger(self.xterm_titles, msg)
@@ -125,7 +85,6 @@ class GitSync(object):
 		# No kwargs call here; this is internal, so it should have been
 		# called by something which set the internal variables
 		emerge_config = self.options.get('emerge_config', None)
-		spawn_kwargs = self.options.get('spawn_kwargs', None)
 		portdb = self.options.get('portdb', None)
 
 		msg = ">>> Starting git pull in %s..." % self.repo.location
@@ -133,7 +92,7 @@ class GitSync(object):
 		writemsg_level(msg + "\n")
 		exitcode = portage.process.spawn_bash("cd %s ; git pull" % \
 			(portage._shell_quote(self.repo.location),),
-			**portage._native_kwargs(spawn_kwargs))
+			**portage._native_kwargs(self.spawn_kwargs))
 		if exitcode != os.EX_OK:
 			msg = "!!! git pull error in %s" % self.repo.location
 			self.logger(self.xterm_titles, msg)


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

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

commit:     5bbce62a42963edf643380adadf36fa4e0fb6daa
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Fri Mar 14 15:55:07 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=5bbce62a

portage/sync/modules/git: Use SyncBase class.

---
 pym/portage/sync/modules/git/git.py | 53 +++++--------------------------------
 1 file changed, 6 insertions(+), 47 deletions(-)

diff --git a/pym/portage/sync/modules/git/git.py b/pym/portage/sync/modules/git/git.py
index 6806ef3..21394b9 100644
--- a/pym/portage/sync/modules/git/git.py
+++ b/pym/portage/sync/modules/git/git.py
@@ -11,9 +11,10 @@ good = create_color_func("GOOD")
 bad = create_color_func("BAD")
 warn = create_color_func("WARN")
 from .timestamps import git_sync_timestamps
+from portage.sync.syncbase import SyncBase
 
 
-class GitSync(object):
+class GitSync(SyncBase):
 	'''Git sync class'''
 
 	short_desc = "Perform sync operations on git based repositories"
@@ -23,34 +24,8 @@ class GitSync(object):
 		return "GitSync"
 
 
-	def can_progressbar(self, func):
-		return False
-
-
 	def __init__(self):
-		self.options = None
-		self.settings = None
-		self.logger = None
-		self.repo = None
-		self.xterm_titles = None
-
-		self.has_git = True
-		if portage.process.find_binary("git") is None:
-			msg = ["Command not found: git",
-			"Type \"emerge %s\" to enable git support." % portage.const.GIT_PACKAGE_ATOM]
-			for l in msg:
-				writemsg_level("!!! %s\n" % l,
-					level=logging.ERROR, noiselevel=-1)
-			self.has_git = 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)
+		SyncBase.__init__(self, "git", portage.const.GIT_PACKAGE_ATOM)
 
 
 	def exists(self, **kwargs):
@@ -59,37 +34,22 @@ class GitSync(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
 		exitcode = portage.process.spawn_bash("cd %s ; git rev-parse" %\
 			(portage._shell_quote(self.repo.location),),
-			**portage._native_kwargs(spawn_kwargs))
+			**portage._native_kwargs(self.spawn_kwargs))
 		if exitcode == 128:
 			return False
 		return True
 
 
-	def sync(self, **kwargs):
-		'''Sync/Clone the repository'''
-		if kwargs:
-			self._kwargs(kwargs)
-
-		if not self.has_git:
-			return (1, False)
-
-		if not self.exists():
-			return self.new()
-		return self._sync()
-
-
 	def new(self, **kwargs):
 		'''Do the initial clone of the repository'''
 		if kwargs:
 			self._kwargs(kwargs)
 		emerge_config = self.options.get('emerge_config', None)
-		spawn_kwargs = self.options.get('spawn_kwargs', None)
 		portdb = self.options.get('portdb', None)
 		try:
 			if not os.path.exists(self.repo.location):
@@ -104,7 +64,7 @@ class GitSync(object):
 		exitcode = portage.process.spawn_bash("cd %s ; git clone %s ." % \
 			(portage._shell_quote(self.repo.location),
 			portage._shell_quote(self.repo.sync_uri)),
-			**portage._native_kwargs(spawn_kwargs))
+			**portage._native_kwargs(self.spawn_kwargs))
 		if exitcode != os.EX_OK:
 			msg = "!!! git clone error in %s" % self.repo.location
 			self.logger(self.xterm_titles, msg)
@@ -125,7 +85,6 @@ class GitSync(object):
 		# No kwargs call here; this is internal, so it should have been
 		# called by something which set the internal variables
 		emerge_config = self.options.get('emerge_config', None)
-		spawn_kwargs = self.options.get('spawn_kwargs', None)
 		portdb = self.options.get('portdb', None)
 
 		msg = ">>> Starting git pull in %s..." % self.repo.location
@@ -133,7 +92,7 @@ class GitSync(object):
 		writemsg_level(msg + "\n")
 		exitcode = portage.process.spawn_bash("cd %s ; git pull" % \
 			(portage._shell_quote(self.repo.location),),
-			**portage._native_kwargs(spawn_kwargs))
+			**portage._native_kwargs(self.spawn_kwargs))
 		if exitcode != os.EX_OK:
 			msg = "!!! git pull error in %s" % self.repo.location
 			self.logger(self.xterm_titles, msg)


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

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

commit:     9f1e5834998fef10b7dd20cfa30f4418ca8c41a7
Author:     Chris Reffett <2011creffett <AT> tjhsst <DOT> edu>
AuthorDate: Sat Feb  8 15:22:58 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Wed Apr 30 07:38:46 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=9f1e5834

Fix mixed spaces/tabs, update _sync to not take kwargs since it's
an internal function

---
 pym/portage/sync/modules/git/git.py | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/pym/portage/sync/modules/git/git.py b/pym/portage/sync/modules/git/git.py
index baf43fe..741daf3 100644
--- a/pym/portage/sync/modules/git/git.py
+++ b/pym/portage/sync/modules/git/git.py
@@ -45,6 +45,7 @@ class GitSync(object):
 
 
 	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)
@@ -53,7 +54,7 @@ class GitSync(object):
 
 
 	def exists(self, **kwargs):
-                '''Tests whether the repo actually exists'''
+		'''Tests whether the repo actually exists'''
 		if kwargs:
 			self._kwargs(kwargs)
 		elif not self.repo:
@@ -87,7 +88,7 @@ class GitSync(object):
 		'''Do the initial clone of the repository'''
 		if kwargs:
 			self._kwargs(kwargs)
-                emerge_config = self.options.get('emerge_config', None)
+		emerge_config = self.options.get('emerge_config', None)
 		spawn_kwargs = self.options.get('spawn_kwargs', None)
 		portdb = self.options.get('portdb', None)
 		try:
@@ -115,14 +116,14 @@ class GitSync(object):
 		return self.post_sync(portdb, self.repo.location, emerge_config)
 
 
-	def _sync(self, **kwargs):
+	def _sync(self):
 		''' Update existing git repository, and ignore the syncuri. We are
 		going to trust the user and assume that the user is in the branch
 		that he/she wants updated. We'll let the user manage branches with
 		git directly.
 		'''
-		if kwargs:
-			self._kwargs(kwargs)
+		# No kwargs call here; this is internal, so it should have been
+		# called by something which set the internal variables
 		emerge_config = self.options.get('emerge_config', None)
 		spawn_kwargs = self.options.get('spawn_kwargs', None)
 		portdb = self.options.get('portdb', None)


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

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

commit:     7955f98073945624f0aba2f2f8dbbd1c0ce4e80e
Author:     Chris Reffett <2011creffett <AT> tjhsst <DOT> edu>
AuthorDate: Mon Feb 10 04:06:46 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Wed Apr 30 07:38:46 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=7955f980

Update module spec for git

---
 pym/portage/sync/modules/git/__init__.py | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/pym/portage/sync/modules/git/__init__.py b/pym/portage/sync/modules/git/__init__.py
index 09de13d..4ceaa84 100644
--- a/pym/portage/sync/modules/git/__init__.py
+++ b/pym/portage/sync/modules/git/__init__.py
@@ -14,10 +14,21 @@ module_spec = {
 			'name': "git",
 			'class': "GitSync",
 			'description': __doc__,
-			'functions': ['sync',],
+			'functions': ['sync', 'new', 'exists'],
 			'func_desc': {
-				'sync', 'Performs a git pull on the repository',
-				}
-			}
+				'sync': 'Performs a git pull on the repository',
+				'new': 'Creates the new repository at the specified location',
+				'exists': 'Returns a boolean of whether the specified dir ' +
+					'exists and is a valid Git repository',
+			},
+			'func_parameters': {
+				'kwargs': {
+					'type': dict,
+					'description': 'Standard python **kwargs parameter format' +
+						'Please refer to the sync modules specs at ' +
+						'"https://wiki.gentoo.org:Project:Portage" for details',
+				},
+			},
 		}
 	}
+}


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

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

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

Git Sync: fix missing %s in the success message.

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

diff --git a/pym/portage/sync/modules/git/git.py b/pym/portage/sync/modules/git/git.py
index 741daf3..6806ef3 100644
--- a/pym/portage/sync/modules/git/git.py
+++ b/pym/portage/sync/modules/git/git.py
@@ -139,7 +139,7 @@ class GitSync(object):
 			self.logger(self.xterm_titles, msg)
 			writemsg_level(msg + "\n", level=logging.ERROR, noiselevel=-1)
 			return (exitcode, False)
-		msg = ">>> Git pull successful" % self.repo.location
+		msg = ">>> Git pull successful: %s" % self.repo.location
 		self.logger(self.xterm_titles, msg)
 		writemsg_level(msg + "\n")
 		return self.post_sync(portdb, self.repo.location, emerge_config)


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

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

commit:     533f07434f5cb2671e01f6c4225494e910f2154f
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Fri Mar 14 15:55:07 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Fri May  2 23:08:10 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=533f0743

portage/sync/modules/git: Use SyncBase class.

Use self.bin_command for the binary call.

---
 pym/portage/sync/modules/git/git.py | 56 ++++++-------------------------------
 1 file changed, 8 insertions(+), 48 deletions(-)

diff --git a/pym/portage/sync/modules/git/git.py b/pym/portage/sync/modules/git/git.py
index 6806ef3..5e0e5df 100644
--- a/pym/portage/sync/modules/git/git.py
+++ b/pym/portage/sync/modules/git/git.py
@@ -11,9 +11,10 @@ good = create_color_func("GOOD")
 bad = create_color_func("BAD")
 warn = create_color_func("WARN")
 from .timestamps import git_sync_timestamps
+from portage.sync.syncbase import SyncBase
 
 
-class GitSync(object):
+class GitSync(SyncBase):
 	'''Git sync class'''
 
 	short_desc = "Perform sync operations on git based repositories"
@@ -23,34 +24,8 @@ class GitSync(object):
 		return "GitSync"
 
 
-	def can_progressbar(self, func):
-		return False
-
-
 	def __init__(self):
-		self.options = None
-		self.settings = None
-		self.logger = None
-		self.repo = None
-		self.xterm_titles = None
-
-		self.has_git = True
-		if portage.process.find_binary("git") is None:
-			msg = ["Command not found: git",
-			"Type \"emerge %s\" to enable git support." % portage.const.GIT_PACKAGE_ATOM]
-			for l in msg:
-				writemsg_level("!!! %s\n" % l,
-					level=logging.ERROR, noiselevel=-1)
-			self.has_git = 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)
+		SyncBase.__init__(self, "git", portage.const.GIT_PACKAGE_ATOM)
 
 
 	def exists(self, **kwargs):
@@ -59,37 +34,22 @@ class GitSync(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
 		exitcode = portage.process.spawn_bash("cd %s ; git rev-parse" %\
 			(portage._shell_quote(self.repo.location),),
-			**portage._native_kwargs(spawn_kwargs))
+			**portage._native_kwargs(self.spawn_kwargs))
 		if exitcode == 128:
 			return False
 		return True
 
 
-	def sync(self, **kwargs):
-		'''Sync/Clone the repository'''
-		if kwargs:
-			self._kwargs(kwargs)
-
-		if not self.has_git:
-			return (1, False)
-
-		if not self.exists():
-			return self.new()
-		return self._sync()
-
-
 	def new(self, **kwargs):
 		'''Do the initial clone of the repository'''
 		if kwargs:
 			self._kwargs(kwargs)
 		emerge_config = self.options.get('emerge_config', None)
-		spawn_kwargs = self.options.get('spawn_kwargs', None)
 		portdb = self.options.get('portdb', None)
 		try:
 			if not os.path.exists(self.repo.location):
@@ -101,10 +61,11 @@ class GitSync(object):
 		msg = ">>> Cloning git repository from upstream into %s..." % self.repo.location
 		self.logger(self.xterm_titles, msg)
 		writemsg_level(msg + "\n")
-		exitcode = portage.process.spawn_bash("cd %s ; git clone %s ." % \
+		exitcode = portage.process.spawn_bash("cd %s ; %s clone %s ." % \
 			(portage._shell_quote(self.repo.location),
+			self.bin_command,
 			portage._shell_quote(self.repo.sync_uri)),
-			**portage._native_kwargs(spawn_kwargs))
+			**portage._native_kwargs(self.spawn_kwargs))
 		if exitcode != os.EX_OK:
 			msg = "!!! git clone error in %s" % self.repo.location
 			self.logger(self.xterm_titles, msg)
@@ -125,7 +86,6 @@ class GitSync(object):
 		# No kwargs call here; this is internal, so it should have been
 		# called by something which set the internal variables
 		emerge_config = self.options.get('emerge_config', None)
-		spawn_kwargs = self.options.get('spawn_kwargs', None)
 		portdb = self.options.get('portdb', None)
 
 		msg = ">>> Starting git pull in %s..." % self.repo.location
@@ -133,7 +93,7 @@ class GitSync(object):
 		writemsg_level(msg + "\n")
 		exitcode = portage.process.spawn_bash("cd %s ; git pull" % \
 			(portage._shell_quote(self.repo.location),),
-			**portage._native_kwargs(spawn_kwargs))
+			**portage._native_kwargs(self.spawn_kwargs))
 		if exitcode != os.EX_OK:
 			msg = "!!! git pull error in %s" % self.repo.location
 			self.logger(self.xterm_titles, msg)


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

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

commit:     faa2b6eec24d01093ce97d6efc8da65f5084c3af
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Fri Mar 14 15:55:07 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Mon Jun 16 15:36:56 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=faa2b6ee

portage/sync/modules/git: Use SyncBase class.

Use self.bin_command for the binary call.

---
 pym/portage/sync/modules/git/git.py | 56 ++++++-------------------------------
 1 file changed, 8 insertions(+), 48 deletions(-)

diff --git a/pym/portage/sync/modules/git/git.py b/pym/portage/sync/modules/git/git.py
index 6806ef3..5e0e5df 100644
--- a/pym/portage/sync/modules/git/git.py
+++ b/pym/portage/sync/modules/git/git.py
@@ -11,9 +11,10 @@ good = create_color_func("GOOD")
 bad = create_color_func("BAD")
 warn = create_color_func("WARN")
 from .timestamps import git_sync_timestamps
+from portage.sync.syncbase import SyncBase
 
 
-class GitSync(object):
+class GitSync(SyncBase):
 	'''Git sync class'''
 
 	short_desc = "Perform sync operations on git based repositories"
@@ -23,34 +24,8 @@ class GitSync(object):
 		return "GitSync"
 
 
-	def can_progressbar(self, func):
-		return False
-
-
 	def __init__(self):
-		self.options = None
-		self.settings = None
-		self.logger = None
-		self.repo = None
-		self.xterm_titles = None
-
-		self.has_git = True
-		if portage.process.find_binary("git") is None:
-			msg = ["Command not found: git",
-			"Type \"emerge %s\" to enable git support." % portage.const.GIT_PACKAGE_ATOM]
-			for l in msg:
-				writemsg_level("!!! %s\n" % l,
-					level=logging.ERROR, noiselevel=-1)
-			self.has_git = 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)
+		SyncBase.__init__(self, "git", portage.const.GIT_PACKAGE_ATOM)
 
 
 	def exists(self, **kwargs):
@@ -59,37 +34,22 @@ class GitSync(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
 		exitcode = portage.process.spawn_bash("cd %s ; git rev-parse" %\
 			(portage._shell_quote(self.repo.location),),
-			**portage._native_kwargs(spawn_kwargs))
+			**portage._native_kwargs(self.spawn_kwargs))
 		if exitcode == 128:
 			return False
 		return True
 
 
-	def sync(self, **kwargs):
-		'''Sync/Clone the repository'''
-		if kwargs:
-			self._kwargs(kwargs)
-
-		if not self.has_git:
-			return (1, False)
-
-		if not self.exists():
-			return self.new()
-		return self._sync()
-
-
 	def new(self, **kwargs):
 		'''Do the initial clone of the repository'''
 		if kwargs:
 			self._kwargs(kwargs)
 		emerge_config = self.options.get('emerge_config', None)
-		spawn_kwargs = self.options.get('spawn_kwargs', None)
 		portdb = self.options.get('portdb', None)
 		try:
 			if not os.path.exists(self.repo.location):
@@ -101,10 +61,11 @@ class GitSync(object):
 		msg = ">>> Cloning git repository from upstream into %s..." % self.repo.location
 		self.logger(self.xterm_titles, msg)
 		writemsg_level(msg + "\n")
-		exitcode = portage.process.spawn_bash("cd %s ; git clone %s ." % \
+		exitcode = portage.process.spawn_bash("cd %s ; %s clone %s ." % \
 			(portage._shell_quote(self.repo.location),
+			self.bin_command,
 			portage._shell_quote(self.repo.sync_uri)),
-			**portage._native_kwargs(spawn_kwargs))
+			**portage._native_kwargs(self.spawn_kwargs))
 		if exitcode != os.EX_OK:
 			msg = "!!! git clone error in %s" % self.repo.location
 			self.logger(self.xterm_titles, msg)
@@ -125,7 +86,6 @@ class GitSync(object):
 		# No kwargs call here; this is internal, so it should have been
 		# called by something which set the internal variables
 		emerge_config = self.options.get('emerge_config', None)
-		spawn_kwargs = self.options.get('spawn_kwargs', None)
 		portdb = self.options.get('portdb', None)
 
 		msg = ">>> Starting git pull in %s..." % self.repo.location
@@ -133,7 +93,7 @@ class GitSync(object):
 		writemsg_level(msg + "\n")
 		exitcode = portage.process.spawn_bash("cd %s ; git pull" % \
 			(portage._shell_quote(self.repo.location),),
-			**portage._native_kwargs(spawn_kwargs))
+			**portage._native_kwargs(self.spawn_kwargs))
 		if exitcode != os.EX_OK:
 			msg = "!!! git pull error in %s" % self.repo.location
 			self.logger(self.xterm_titles, msg)


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

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

commit:     b4007bbb3a5cb25d4360c21c34bfb4e9928f9383
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Wed Feb 19 15:32:32 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=b4007bbb

Git Sync: fix missing %s in the success message.

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

diff --git a/pym/portage/sync/modules/git/git.py b/pym/portage/sync/modules/git/git.py
index 741daf3..6806ef3 100644
--- a/pym/portage/sync/modules/git/git.py
+++ b/pym/portage/sync/modules/git/git.py
@@ -139,7 +139,7 @@ class GitSync(object):
 			self.logger(self.xterm_titles, msg)
 			writemsg_level(msg + "\n", level=logging.ERROR, noiselevel=-1)
 			return (exitcode, False)
-		msg = ">>> Git pull successful" % self.repo.location
+		msg = ">>> Git pull successful: %s" % self.repo.location
 		self.logger(self.xterm_titles, msg)
 		writemsg_level(msg + "\n")
 		return self.post_sync(portdb, self.repo.location, emerge_config)


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

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

commit:     2c41472a5d3dd5c23326538776e9149a6f71935b
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Fri Mar 14 15:55:07 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Mon Jun 16 22:43:10 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=2c41472a

portage/sync/modules/git: Use SyncBase class.

Use self.bin_command for the binary call.

---
 pym/portage/sync/modules/git/git.py | 56 ++++++-------------------------------
 1 file changed, 8 insertions(+), 48 deletions(-)

diff --git a/pym/portage/sync/modules/git/git.py b/pym/portage/sync/modules/git/git.py
index 6806ef3..5e0e5df 100644
--- a/pym/portage/sync/modules/git/git.py
+++ b/pym/portage/sync/modules/git/git.py
@@ -11,9 +11,10 @@ good = create_color_func("GOOD")
 bad = create_color_func("BAD")
 warn = create_color_func("WARN")
 from .timestamps import git_sync_timestamps
+from portage.sync.syncbase import SyncBase
 
 
-class GitSync(object):
+class GitSync(SyncBase):
 	'''Git sync class'''
 
 	short_desc = "Perform sync operations on git based repositories"
@@ -23,34 +24,8 @@ class GitSync(object):
 		return "GitSync"
 
 
-	def can_progressbar(self, func):
-		return False
-
-
 	def __init__(self):
-		self.options = None
-		self.settings = None
-		self.logger = None
-		self.repo = None
-		self.xterm_titles = None
-
-		self.has_git = True
-		if portage.process.find_binary("git") is None:
-			msg = ["Command not found: git",
-			"Type \"emerge %s\" to enable git support." % portage.const.GIT_PACKAGE_ATOM]
-			for l in msg:
-				writemsg_level("!!! %s\n" % l,
-					level=logging.ERROR, noiselevel=-1)
-			self.has_git = 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)
+		SyncBase.__init__(self, "git", portage.const.GIT_PACKAGE_ATOM)
 
 
 	def exists(self, **kwargs):
@@ -59,37 +34,22 @@ class GitSync(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
 		exitcode = portage.process.spawn_bash("cd %s ; git rev-parse" %\
 			(portage._shell_quote(self.repo.location),),
-			**portage._native_kwargs(spawn_kwargs))
+			**portage._native_kwargs(self.spawn_kwargs))
 		if exitcode == 128:
 			return False
 		return True
 
 
-	def sync(self, **kwargs):
-		'''Sync/Clone the repository'''
-		if kwargs:
-			self._kwargs(kwargs)
-
-		if not self.has_git:
-			return (1, False)
-
-		if not self.exists():
-			return self.new()
-		return self._sync()
-
-
 	def new(self, **kwargs):
 		'''Do the initial clone of the repository'''
 		if kwargs:
 			self._kwargs(kwargs)
 		emerge_config = self.options.get('emerge_config', None)
-		spawn_kwargs = self.options.get('spawn_kwargs', None)
 		portdb = self.options.get('portdb', None)
 		try:
 			if not os.path.exists(self.repo.location):
@@ -101,10 +61,11 @@ class GitSync(object):
 		msg = ">>> Cloning git repository from upstream into %s..." % self.repo.location
 		self.logger(self.xterm_titles, msg)
 		writemsg_level(msg + "\n")
-		exitcode = portage.process.spawn_bash("cd %s ; git clone %s ." % \
+		exitcode = portage.process.spawn_bash("cd %s ; %s clone %s ." % \
 			(portage._shell_quote(self.repo.location),
+			self.bin_command,
 			portage._shell_quote(self.repo.sync_uri)),
-			**portage._native_kwargs(spawn_kwargs))
+			**portage._native_kwargs(self.spawn_kwargs))
 		if exitcode != os.EX_OK:
 			msg = "!!! git clone error in %s" % self.repo.location
 			self.logger(self.xterm_titles, msg)
@@ -125,7 +86,6 @@ class GitSync(object):
 		# No kwargs call here; this is internal, so it should have been
 		# called by something which set the internal variables
 		emerge_config = self.options.get('emerge_config', None)
-		spawn_kwargs = self.options.get('spawn_kwargs', None)
 		portdb = self.options.get('portdb', None)
 
 		msg = ">>> Starting git pull in %s..." % self.repo.location
@@ -133,7 +93,7 @@ class GitSync(object):
 		writemsg_level(msg + "\n")
 		exitcode = portage.process.spawn_bash("cd %s ; git pull" % \
 			(portage._shell_quote(self.repo.location),),
-			**portage._native_kwargs(spawn_kwargs))
+			**portage._native_kwargs(self.spawn_kwargs))
 		if exitcode != os.EX_OK:
 			msg = "!!! git pull error in %s" % self.repo.location
 			self.logger(self.xterm_titles, msg)


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

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

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

Git Sync: fix missing %s in the success message.

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

diff --git a/pym/portage/sync/modules/git/git.py b/pym/portage/sync/modules/git/git.py
index 741daf3..6806ef3 100644
--- a/pym/portage/sync/modules/git/git.py
+++ b/pym/portage/sync/modules/git/git.py
@@ -139,7 +139,7 @@ class GitSync(object):
 			self.logger(self.xterm_titles, msg)
 			writemsg_level(msg + "\n", level=logging.ERROR, noiselevel=-1)
 			return (exitcode, False)
-		msg = ">>> Git pull successful" % self.repo.location
+		msg = ">>> Git pull successful: %s" % self.repo.location
 		self.logger(self.xterm_titles, msg)
 		writemsg_level(msg + "\n")
 		return self.post_sync(portdb, self.repo.location, emerge_config)


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

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

commit:     3f95400ea090c4f915eedbfaa4052cbcbf78e275
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Fri Mar 14 15:55:07 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Wed Sep  3 23:34:52 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=3f95400e

portage/sync/modules/git: Use SyncBase class.

Use self.bin_command for the binary call.

---
 pym/portage/sync/modules/git/git.py | 56 ++++++-------------------------------
 1 file changed, 8 insertions(+), 48 deletions(-)

diff --git a/pym/portage/sync/modules/git/git.py b/pym/portage/sync/modules/git/git.py
index 6806ef3..5e0e5df 100644
--- a/pym/portage/sync/modules/git/git.py
+++ b/pym/portage/sync/modules/git/git.py
@@ -11,9 +11,10 @@ good = create_color_func("GOOD")
 bad = create_color_func("BAD")
 warn = create_color_func("WARN")
 from .timestamps import git_sync_timestamps
+from portage.sync.syncbase import SyncBase
 
 
-class GitSync(object):
+class GitSync(SyncBase):
 	'''Git sync class'''
 
 	short_desc = "Perform sync operations on git based repositories"
@@ -23,34 +24,8 @@ class GitSync(object):
 		return "GitSync"
 
 
-	def can_progressbar(self, func):
-		return False
-
-
 	def __init__(self):
-		self.options = None
-		self.settings = None
-		self.logger = None
-		self.repo = None
-		self.xterm_titles = None
-
-		self.has_git = True
-		if portage.process.find_binary("git") is None:
-			msg = ["Command not found: git",
-			"Type \"emerge %s\" to enable git support." % portage.const.GIT_PACKAGE_ATOM]
-			for l in msg:
-				writemsg_level("!!! %s\n" % l,
-					level=logging.ERROR, noiselevel=-1)
-			self.has_git = 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)
+		SyncBase.__init__(self, "git", portage.const.GIT_PACKAGE_ATOM)
 
 
 	def exists(self, **kwargs):
@@ -59,37 +34,22 @@ class GitSync(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
 		exitcode = portage.process.spawn_bash("cd %s ; git rev-parse" %\
 			(portage._shell_quote(self.repo.location),),
-			**portage._native_kwargs(spawn_kwargs))
+			**portage._native_kwargs(self.spawn_kwargs))
 		if exitcode == 128:
 			return False
 		return True
 
 
-	def sync(self, **kwargs):
-		'''Sync/Clone the repository'''
-		if kwargs:
-			self._kwargs(kwargs)
-
-		if not self.has_git:
-			return (1, False)
-
-		if not self.exists():
-			return self.new()
-		return self._sync()
-
-
 	def new(self, **kwargs):
 		'''Do the initial clone of the repository'''
 		if kwargs:
 			self._kwargs(kwargs)
 		emerge_config = self.options.get('emerge_config', None)
-		spawn_kwargs = self.options.get('spawn_kwargs', None)
 		portdb = self.options.get('portdb', None)
 		try:
 			if not os.path.exists(self.repo.location):
@@ -101,10 +61,11 @@ class GitSync(object):
 		msg = ">>> Cloning git repository from upstream into %s..." % self.repo.location
 		self.logger(self.xterm_titles, msg)
 		writemsg_level(msg + "\n")
-		exitcode = portage.process.spawn_bash("cd %s ; git clone %s ." % \
+		exitcode = portage.process.spawn_bash("cd %s ; %s clone %s ." % \
 			(portage._shell_quote(self.repo.location),
+			self.bin_command,
 			portage._shell_quote(self.repo.sync_uri)),
-			**portage._native_kwargs(spawn_kwargs))
+			**portage._native_kwargs(self.spawn_kwargs))
 		if exitcode != os.EX_OK:
 			msg = "!!! git clone error in %s" % self.repo.location
 			self.logger(self.xterm_titles, msg)
@@ -125,7 +86,6 @@ class GitSync(object):
 		# No kwargs call here; this is internal, so it should have been
 		# called by something which set the internal variables
 		emerge_config = self.options.get('emerge_config', None)
-		spawn_kwargs = self.options.get('spawn_kwargs', None)
 		portdb = self.options.get('portdb', None)
 
 		msg = ">>> Starting git pull in %s..." % self.repo.location
@@ -133,7 +93,7 @@ class GitSync(object):
 		writemsg_level(msg + "\n")
 		exitcode = portage.process.spawn_bash("cd %s ; git pull" % \
 			(portage._shell_quote(self.repo.location),),
-			**portage._native_kwargs(spawn_kwargs))
+			**portage._native_kwargs(self.spawn_kwargs))
 		if exitcode != os.EX_OK:
 			msg = "!!! git pull error in %s" % self.repo.location
 			self.logger(self.xterm_titles, msg)


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

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

commit:     af729048d35d3c7bde879c9d04d96cbd786798e2
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue Oct 21 01:13:45 2014 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Oct 21 01:13:45 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=af729048

Remove obsolete git_sync_timestamps function.

This function is no longer needed since we switched to the md5-cache
format which does not use timestamps.

---
 pym/portage/sync/modules/git/git.py        |   8 +-
 pym/portage/sync/modules/git/timestamps.py | 154 -----------------------------
 2 files changed, 1 insertion(+), 161 deletions(-)

diff --git a/pym/portage/sync/modules/git/git.py b/pym/portage/sync/modules/git/git.py
index 5e0e5df..d8c5a32 100644
--- a/pym/portage/sync/modules/git/git.py
+++ b/pym/portage/sync/modules/git/git.py
@@ -10,7 +10,6 @@ from portage.output import create_color_func
 good = create_color_func("GOOD")
 bad = create_color_func("BAD")
 warn = create_color_func("WARN")
-from .timestamps import git_sync_timestamps
 from portage.sync.syncbase import SyncBase
 
 
@@ -116,9 +115,4 @@ class GitSync(SyncBase):
 		# Reload the whole config from scratch.
 		settings, trees, mtimedb = load_emerge_config(emerge_config=emerge_config)
 		adjust_configs(emerge_config.opts, emerge_config.trees)
-		portdb = trees[settings['EROOT']]['porttree'].dbapi
-		updatecache_flg = False
-		exitcode = git_sync_timestamps(portdb, location)
-		if exitcode == os.EX_OK:
-			updatecache_flg = True
-		return (exitcode, updatecache_flg)
+		return (os.EX_OK, True)

diff --git a/pym/portage/sync/modules/git/timestamps.py b/pym/portage/sync/modules/git/timestamps.py
deleted file mode 100644
index 5e44845..0000000
--- a/pym/portage/sync/modules/git/timestamps.py
+++ /dev/null
@@ -1,154 +0,0 @@
-# Copyright 1999-2014 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-import logging
-import stat
-import subprocess
-
-
-import portage
-from portage import os
-from portage import _unicode_decode
-from portage.util import writemsg_level
-from portage.cache.cache_errors import CacheError
-
-
-def git_sync_timestamps(portdb, portdir):
-	"""
-	Since git doesn't preserve timestamps, synchronize timestamps between
-	entries and ebuilds/eclasses. Assume the cache has the correct timestamp
-	for a given file as long as the file in the working tree is not modified
-	(relative to HEAD).
-	"""
-
-	cache_db = portdb._pregen_auxdb.get(portdir)
-
-	try:
-		if cache_db is None:
-			# portdbapi does not populate _pregen_auxdb
-			# when FEATURES=metadata-transfer is enabled
-			cache_db = portdb._create_pregen_cache(portdir)
-	except CacheError as e:
-		writemsg_level("!!! Unable to instantiate cache: %s\n" % (e,),
-			level=logging.ERROR, noiselevel=-1)
-		return 1
-
-	if cache_db is None:
-		return os.EX_OK
-
-	if cache_db.validation_chf != 'mtime':
-		# newer formats like md5-dict do not require mtime sync
-		return os.EX_OK
-
-	writemsg_level(">>> Synchronizing timestamps...\n")
-
-	ec_dir = os.path.join(portdir, "eclass")
-	try:
-		ec_names = set(f[:-7] for f in os.listdir(ec_dir) \
-			if f.endswith(".eclass"))
-	except OSError as e:
-		writemsg_level("!!! Unable to list eclasses: %s\n" % (e,),
-			level=logging.ERROR, noiselevel=-1)
-		return 1
-
-	args = [portage.const.BASH_BINARY, "-c",
-		"cd %s && git diff-index --name-only --diff-filter=M HEAD" % \
-		portage._shell_quote(portdir)]
-	proc = subprocess.Popen(args, stdout=subprocess.PIPE)
-	modified_files = set(_unicode_decode(l).rstrip("\n") for l in proc.stdout)
-	rval = proc.wait()
-	proc.stdout.close()
-	if rval != os.EX_OK:
-		return rval
-
-	modified_eclasses = set(ec for ec in ec_names \
-		if os.path.join("eclass", ec + ".eclass") in modified_files)
-
-	updated_ec_mtimes = {}
-
-	for cpv in cache_db:
-		cpv_split = portage.catpkgsplit(cpv)
-		if cpv_split is None:
-			writemsg_level("!!! Invalid cache entry: %s\n" % (cpv,),
-				level=logging.ERROR, noiselevel=-1)
-			continue
-
-		cat, pn, ver, rev = cpv_split
-		cat, pf = portage.catsplit(cpv)
-		relative_eb_path = os.path.join(cat, pn, pf + ".ebuild")
-		if relative_eb_path in modified_files:
-			continue
-
-		try:
-			cache_entry = cache_db[cpv]
-			eb_mtime = cache_entry.get("_mtime_")
-			ec_mtimes = cache_entry.get("_eclasses_")
-		except KeyError:
-			writemsg_level("!!! Missing cache entry: %s\n" % (cpv,),
-				level=logging.ERROR, noiselevel=-1)
-			continue
-		except CacheError as e:
-			writemsg_level("!!! Unable to access cache entry: %s %s\n" % \
-				(cpv, e), level=logging.ERROR, noiselevel=-1)
-			continue
-
-		if eb_mtime is None:
-			writemsg_level("!!! Missing ebuild mtime: %s\n" % (cpv,),
-				level=logging.ERROR, noiselevel=-1)
-			continue
-
-		try:
-			eb_mtime = long(eb_mtime)
-		except ValueError:
-			writemsg_level("!!! Invalid ebuild mtime: %s %s\n" % \
-				(cpv, eb_mtime), level=logging.ERROR, noiselevel=-1)
-			continue
-
-		if ec_mtimes is None:
-			writemsg_level("!!! Missing eclass mtimes: %s\n" % (cpv,),
-				level=logging.ERROR, noiselevel=-1)
-			continue
-
-		if modified_eclasses.intersection(ec_mtimes):
-			continue
-
-		missing_eclasses = set(ec_mtimes).difference(ec_names)
-		if missing_eclasses:
-			writemsg_level("!!! Non-existent eclass(es): %s %s\n" % \
-				(cpv, sorted(missing_eclasses)), level=logging.ERROR,
-				noiselevel=-1)
-			continue
-
-		eb_path = os.path.join(portdir, relative_eb_path)
-		try:
-			current_eb_mtime = os.stat(eb_path)
-		except OSError:
-			writemsg_level("!!! Missing ebuild: %s\n" % \
-				(cpv,), level=logging.ERROR, noiselevel=-1)
-			continue
-
-		inconsistent = False
-		for ec, (ec_path, ec_mtime) in ec_mtimes.items():
-			updated_mtime = updated_ec_mtimes.get(ec)
-			if updated_mtime is not None and updated_mtime != ec_mtime:
-				writemsg_level("!!! Inconsistent eclass mtime: %s %s\n" % \
-					(cpv, ec), level=logging.ERROR, noiselevel=-1)
-				inconsistent = True
-				break
-
-		if inconsistent:
-			continue
-
-		if current_eb_mtime != eb_mtime:
-			os.utime(eb_path, (eb_mtime, eb_mtime))
-
-		for ec, (ec_path, ec_mtime) in ec_mtimes.items():
-			if ec in updated_ec_mtimes:
-				continue
-			ec_path = os.path.join(ec_dir, ec + ".eclass")
-			current_mtime = os.stat(ec_path)[stat.ST_MTIME]
-			if current_mtime != ec_mtime:
-				os.utime(ec_path, (ec_mtime, ec_mtime))
-			updated_ec_mtimes[ec] = ec_mtime
-
-	return os.EX_OK


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

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

commit:     6bb883c7ef60f2ff6c036becd796dd86dc025b72
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue Oct 21 01:49:35 2014 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Oct 21 01:49:35 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=6bb883c7

git sync: remove unneeded post_sync

None of the remaining post_sync code is really needed. Also, fix
indent of return near the end of the _sync method.

---
 pym/portage/sync/modules/git/git.py | 18 ++----------------
 1 file changed, 2 insertions(+), 16 deletions(-)

diff --git a/pym/portage/sync/modules/git/git.py b/pym/portage/sync/modules/git/git.py
index d8c5a32..7c28139 100644
--- a/pym/portage/sync/modules/git/git.py
+++ b/pym/portage/sync/modules/git/git.py
@@ -69,11 +69,11 @@ class GitSync(SyncBase):
 			msg = "!!! git clone error in %s" % self.repo.location
 			self.logger(self.xterm_titles, msg)
 			writemsg_level(msg + "\n", level=logging.ERROR, noiselevel=-1)
-		return (exitcode, False)
+			return (exitcode, False)
 		msg = ">>> Git clone successful"
 		self.logger(self.xterm_titles, msg)
 		writemsg_level(msg + "\n")
-		return self.post_sync(portdb, self.repo.location, emerge_config)
+		return (os.EX_OK, True)
 
 
 	def _sync(self):
@@ -101,18 +101,4 @@ class GitSync(SyncBase):
 		msg = ">>> Git pull successful: %s" % self.repo.location
 		self.logger(self.xterm_titles, msg)
 		writemsg_level(msg + "\n")
-		return self.post_sync(portdb, self.repo.location, emerge_config)
-
-
-	def post_sync(self, portdb, location, emerge_config):
-		'''repo.sync_type == "git":
-		# 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.
-		'''
-		# avoid circular import for now
-		from _emerge.actions import load_emerge_config, adjust_configs
-		# Reload the whole config from scratch.
-		settings, trees, mtimedb = load_emerge_config(emerge_config=emerge_config)
-		adjust_configs(emerge_config.opts, emerge_config.trees)
 		return (os.EX_OK, True)


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

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

commit:     8902ca15d7b443a6fdfdc011eb968f2d10d2edbb
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue Oct 21 01:49:35 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=8902ca15

git sync: remove unneeded post_sync

None of the remaining post_sync code is really needed. Also, fix
indent of return near the end of the _sync method.

---
 pym/portage/sync/modules/git/git.py | 18 ++----------------
 1 file changed, 2 insertions(+), 16 deletions(-)

diff --git a/pym/portage/sync/modules/git/git.py b/pym/portage/sync/modules/git/git.py
index d8c5a32..7c28139 100644
--- a/pym/portage/sync/modules/git/git.py
+++ b/pym/portage/sync/modules/git/git.py
@@ -69,11 +69,11 @@ class GitSync(SyncBase):
 			msg = "!!! git clone error in %s" % self.repo.location
 			self.logger(self.xterm_titles, msg)
 			writemsg_level(msg + "\n", level=logging.ERROR, noiselevel=-1)
-		return (exitcode, False)
+			return (exitcode, False)
 		msg = ">>> Git clone successful"
 		self.logger(self.xterm_titles, msg)
 		writemsg_level(msg + "\n")
-		return self.post_sync(portdb, self.repo.location, emerge_config)
+		return (os.EX_OK, True)
 
 
 	def _sync(self):
@@ -101,18 +101,4 @@ class GitSync(SyncBase):
 		msg = ">>> Git pull successful: %s" % self.repo.location
 		self.logger(self.xterm_titles, msg)
 		writemsg_level(msg + "\n")
-		return self.post_sync(portdb, self.repo.location, emerge_config)
-
-
-	def post_sync(self, portdb, location, emerge_config):
-		'''repo.sync_type == "git":
-		# 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.
-		'''
-		# avoid circular import for now
-		from _emerge.actions import load_emerge_config, adjust_configs
-		# Reload the whole config from scratch.
-		settings, trees, mtimedb = load_emerge_config(emerge_config=emerge_config)
-		adjust_configs(emerge_config.opts, emerge_config.trees)
 		return (os.EX_OK, True)


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

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

commit:     416a5e46c7ab108d24c65d8a89fcec31dcdf55f9
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue Oct 21 01:13:45 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=416a5e46

Remove obsolete git_sync_timestamps function.

This function is no longer needed since we switched to the md5-cache
format which does not use timestamps.

---
 pym/portage/sync/modules/git/git.py        |   8 +-
 pym/portage/sync/modules/git/timestamps.py | 154 -----------------------------
 2 files changed, 1 insertion(+), 161 deletions(-)

diff --git a/pym/portage/sync/modules/git/git.py b/pym/portage/sync/modules/git/git.py
index 5e0e5df..d8c5a32 100644
--- a/pym/portage/sync/modules/git/git.py
+++ b/pym/portage/sync/modules/git/git.py
@@ -10,7 +10,6 @@ from portage.output import create_color_func
 good = create_color_func("GOOD")
 bad = create_color_func("BAD")
 warn = create_color_func("WARN")
-from .timestamps import git_sync_timestamps
 from portage.sync.syncbase import SyncBase
 
 
@@ -116,9 +115,4 @@ class GitSync(SyncBase):
 		# Reload the whole config from scratch.
 		settings, trees, mtimedb = load_emerge_config(emerge_config=emerge_config)
 		adjust_configs(emerge_config.opts, emerge_config.trees)
-		portdb = trees[settings['EROOT']]['porttree'].dbapi
-		updatecache_flg = False
-		exitcode = git_sync_timestamps(portdb, location)
-		if exitcode == os.EX_OK:
-			updatecache_flg = True
-		return (exitcode, updatecache_flg)
+		return (os.EX_OK, True)

diff --git a/pym/portage/sync/modules/git/timestamps.py b/pym/portage/sync/modules/git/timestamps.py
deleted file mode 100644
index 5e44845..0000000
--- a/pym/portage/sync/modules/git/timestamps.py
+++ /dev/null
@@ -1,154 +0,0 @@
-# Copyright 1999-2014 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-import logging
-import stat
-import subprocess
-
-
-import portage
-from portage import os
-from portage import _unicode_decode
-from portage.util import writemsg_level
-from portage.cache.cache_errors import CacheError
-
-
-def git_sync_timestamps(portdb, portdir):
-	"""
-	Since git doesn't preserve timestamps, synchronize timestamps between
-	entries and ebuilds/eclasses. Assume the cache has the correct timestamp
-	for a given file as long as the file in the working tree is not modified
-	(relative to HEAD).
-	"""
-
-	cache_db = portdb._pregen_auxdb.get(portdir)
-
-	try:
-		if cache_db is None:
-			# portdbapi does not populate _pregen_auxdb
-			# when FEATURES=metadata-transfer is enabled
-			cache_db = portdb._create_pregen_cache(portdir)
-	except CacheError as e:
-		writemsg_level("!!! Unable to instantiate cache: %s\n" % (e,),
-			level=logging.ERROR, noiselevel=-1)
-		return 1
-
-	if cache_db is None:
-		return os.EX_OK
-
-	if cache_db.validation_chf != 'mtime':
-		# newer formats like md5-dict do not require mtime sync
-		return os.EX_OK
-
-	writemsg_level(">>> Synchronizing timestamps...\n")
-
-	ec_dir = os.path.join(portdir, "eclass")
-	try:
-		ec_names = set(f[:-7] for f in os.listdir(ec_dir) \
-			if f.endswith(".eclass"))
-	except OSError as e:
-		writemsg_level("!!! Unable to list eclasses: %s\n" % (e,),
-			level=logging.ERROR, noiselevel=-1)
-		return 1
-
-	args = [portage.const.BASH_BINARY, "-c",
-		"cd %s && git diff-index --name-only --diff-filter=M HEAD" % \
-		portage._shell_quote(portdir)]
-	proc = subprocess.Popen(args, stdout=subprocess.PIPE)
-	modified_files = set(_unicode_decode(l).rstrip("\n") for l in proc.stdout)
-	rval = proc.wait()
-	proc.stdout.close()
-	if rval != os.EX_OK:
-		return rval
-
-	modified_eclasses = set(ec for ec in ec_names \
-		if os.path.join("eclass", ec + ".eclass") in modified_files)
-
-	updated_ec_mtimes = {}
-
-	for cpv in cache_db:
-		cpv_split = portage.catpkgsplit(cpv)
-		if cpv_split is None:
-			writemsg_level("!!! Invalid cache entry: %s\n" % (cpv,),
-				level=logging.ERROR, noiselevel=-1)
-			continue
-
-		cat, pn, ver, rev = cpv_split
-		cat, pf = portage.catsplit(cpv)
-		relative_eb_path = os.path.join(cat, pn, pf + ".ebuild")
-		if relative_eb_path in modified_files:
-			continue
-
-		try:
-			cache_entry = cache_db[cpv]
-			eb_mtime = cache_entry.get("_mtime_")
-			ec_mtimes = cache_entry.get("_eclasses_")
-		except KeyError:
-			writemsg_level("!!! Missing cache entry: %s\n" % (cpv,),
-				level=logging.ERROR, noiselevel=-1)
-			continue
-		except CacheError as e:
-			writemsg_level("!!! Unable to access cache entry: %s %s\n" % \
-				(cpv, e), level=logging.ERROR, noiselevel=-1)
-			continue
-
-		if eb_mtime is None:
-			writemsg_level("!!! Missing ebuild mtime: %s\n" % (cpv,),
-				level=logging.ERROR, noiselevel=-1)
-			continue
-
-		try:
-			eb_mtime = long(eb_mtime)
-		except ValueError:
-			writemsg_level("!!! Invalid ebuild mtime: %s %s\n" % \
-				(cpv, eb_mtime), level=logging.ERROR, noiselevel=-1)
-			continue
-
-		if ec_mtimes is None:
-			writemsg_level("!!! Missing eclass mtimes: %s\n" % (cpv,),
-				level=logging.ERROR, noiselevel=-1)
-			continue
-
-		if modified_eclasses.intersection(ec_mtimes):
-			continue
-
-		missing_eclasses = set(ec_mtimes).difference(ec_names)
-		if missing_eclasses:
-			writemsg_level("!!! Non-existent eclass(es): %s %s\n" % \
-				(cpv, sorted(missing_eclasses)), level=logging.ERROR,
-				noiselevel=-1)
-			continue
-
-		eb_path = os.path.join(portdir, relative_eb_path)
-		try:
-			current_eb_mtime = os.stat(eb_path)
-		except OSError:
-			writemsg_level("!!! Missing ebuild: %s\n" % \
-				(cpv,), level=logging.ERROR, noiselevel=-1)
-			continue
-
-		inconsistent = False
-		for ec, (ec_path, ec_mtime) in ec_mtimes.items():
-			updated_mtime = updated_ec_mtimes.get(ec)
-			if updated_mtime is not None and updated_mtime != ec_mtime:
-				writemsg_level("!!! Inconsistent eclass mtime: %s %s\n" % \
-					(cpv, ec), level=logging.ERROR, noiselevel=-1)
-				inconsistent = True
-				break
-
-		if inconsistent:
-			continue
-
-		if current_eb_mtime != eb_mtime:
-			os.utime(eb_path, (eb_mtime, eb_mtime))
-
-		for ec, (ec_path, ec_mtime) in ec_mtimes.items():
-			if ec in updated_ec_mtimes:
-				continue
-			ec_path = os.path.join(ec_dir, ec + ".eclass")
-			current_mtime = os.stat(ec_path)[stat.ST_MTIME]
-			if current_mtime != ec_mtime:
-				os.utime(ec_path, (ec_mtime, ec_mtime))
-			updated_ec_mtimes[ec] = ec_mtime
-
-	return os.EX_OK


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

* [gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/git/
@ 2014-10-22 11:02 Zac Medico
  0 siblings, 0 replies; 28+ messages in thread
From: Zac Medico @ 2014-10-22 11:02 UTC (permalink / raw
  To: gentoo-commits

commit:     b1d34a76a90edeb9839e3004ee2871b716e8965a
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Wed Oct 22 11:01:03 2014 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Wed Oct 22 11:01:03 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=b1d34a76

GitSync: support file:// sync-uri

This will be useful for unit tests that will sync from a local
file:// sync-uri.

---
 pym/portage/sync/modules/git/git.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/pym/portage/sync/modules/git/git.py b/pym/portage/sync/modules/git/git.py
index 7c28139..35943dd 100644
--- a/pym/portage/sync/modules/git/git.py
+++ b/pym/portage/sync/modules/git/git.py
@@ -60,10 +60,13 @@ class GitSync(SyncBase):
 		msg = ">>> Cloning git repository from upstream into %s..." % self.repo.location
 		self.logger(self.xterm_titles, msg)
 		writemsg_level(msg + "\n")
+		sync_uri = self.repo.sync_uri
+		if sync_uri.startswith("file://"):
+			sync_uri = sync_uri[6:]
 		exitcode = portage.process.spawn_bash("cd %s ; %s clone %s ." % \
 			(portage._shell_quote(self.repo.location),
 			self.bin_command,
-			portage._shell_quote(self.repo.sync_uri)),
+			portage._shell_quote(sync_uri)),
 			**portage._native_kwargs(self.spawn_kwargs))
 		if exitcode != os.EX_OK:
 			msg = "!!! git clone error in %s" % self.repo.location


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

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

commit:     bd30c829d20bb50bfcab3faa99261154281f3953
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue Oct 21 01:13:45 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=bd30c829

Remove obsolete git_sync_timestamps function.

This function is no longer needed since we switched to the md5-cache
format which does not use timestamps.

---
 pym/portage/sync/modules/git/git.py        |   8 +-
 pym/portage/sync/modules/git/timestamps.py | 154 -----------------------------
 2 files changed, 1 insertion(+), 161 deletions(-)

diff --git a/pym/portage/sync/modules/git/git.py b/pym/portage/sync/modules/git/git.py
index 5e0e5df..d8c5a32 100644
--- a/pym/portage/sync/modules/git/git.py
+++ b/pym/portage/sync/modules/git/git.py
@@ -10,7 +10,6 @@ from portage.output import create_color_func
 good = create_color_func("GOOD")
 bad = create_color_func("BAD")
 warn = create_color_func("WARN")
-from .timestamps import git_sync_timestamps
 from portage.sync.syncbase import SyncBase
 
 
@@ -116,9 +115,4 @@ class GitSync(SyncBase):
 		# Reload the whole config from scratch.
 		settings, trees, mtimedb = load_emerge_config(emerge_config=emerge_config)
 		adjust_configs(emerge_config.opts, emerge_config.trees)
-		portdb = trees[settings['EROOT']]['porttree'].dbapi
-		updatecache_flg = False
-		exitcode = git_sync_timestamps(portdb, location)
-		if exitcode == os.EX_OK:
-			updatecache_flg = True
-		return (exitcode, updatecache_flg)
+		return (os.EX_OK, True)

diff --git a/pym/portage/sync/modules/git/timestamps.py b/pym/portage/sync/modules/git/timestamps.py
deleted file mode 100644
index 5e44845..0000000
--- a/pym/portage/sync/modules/git/timestamps.py
+++ /dev/null
@@ -1,154 +0,0 @@
-# Copyright 1999-2014 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-import logging
-import stat
-import subprocess
-
-
-import portage
-from portage import os
-from portage import _unicode_decode
-from portage.util import writemsg_level
-from portage.cache.cache_errors import CacheError
-
-
-def git_sync_timestamps(portdb, portdir):
-	"""
-	Since git doesn't preserve timestamps, synchronize timestamps between
-	entries and ebuilds/eclasses. Assume the cache has the correct timestamp
-	for a given file as long as the file in the working tree is not modified
-	(relative to HEAD).
-	"""
-
-	cache_db = portdb._pregen_auxdb.get(portdir)
-
-	try:
-		if cache_db is None:
-			# portdbapi does not populate _pregen_auxdb
-			# when FEATURES=metadata-transfer is enabled
-			cache_db = portdb._create_pregen_cache(portdir)
-	except CacheError as e:
-		writemsg_level("!!! Unable to instantiate cache: %s\n" % (e,),
-			level=logging.ERROR, noiselevel=-1)
-		return 1
-
-	if cache_db is None:
-		return os.EX_OK
-
-	if cache_db.validation_chf != 'mtime':
-		# newer formats like md5-dict do not require mtime sync
-		return os.EX_OK
-
-	writemsg_level(">>> Synchronizing timestamps...\n")
-
-	ec_dir = os.path.join(portdir, "eclass")
-	try:
-		ec_names = set(f[:-7] for f in os.listdir(ec_dir) \
-			if f.endswith(".eclass"))
-	except OSError as e:
-		writemsg_level("!!! Unable to list eclasses: %s\n" % (e,),
-			level=logging.ERROR, noiselevel=-1)
-		return 1
-
-	args = [portage.const.BASH_BINARY, "-c",
-		"cd %s && git diff-index --name-only --diff-filter=M HEAD" % \
-		portage._shell_quote(portdir)]
-	proc = subprocess.Popen(args, stdout=subprocess.PIPE)
-	modified_files = set(_unicode_decode(l).rstrip("\n") for l in proc.stdout)
-	rval = proc.wait()
-	proc.stdout.close()
-	if rval != os.EX_OK:
-		return rval
-
-	modified_eclasses = set(ec for ec in ec_names \
-		if os.path.join("eclass", ec + ".eclass") in modified_files)
-
-	updated_ec_mtimes = {}
-
-	for cpv in cache_db:
-		cpv_split = portage.catpkgsplit(cpv)
-		if cpv_split is None:
-			writemsg_level("!!! Invalid cache entry: %s\n" % (cpv,),
-				level=logging.ERROR, noiselevel=-1)
-			continue
-
-		cat, pn, ver, rev = cpv_split
-		cat, pf = portage.catsplit(cpv)
-		relative_eb_path = os.path.join(cat, pn, pf + ".ebuild")
-		if relative_eb_path in modified_files:
-			continue
-
-		try:
-			cache_entry = cache_db[cpv]
-			eb_mtime = cache_entry.get("_mtime_")
-			ec_mtimes = cache_entry.get("_eclasses_")
-		except KeyError:
-			writemsg_level("!!! Missing cache entry: %s\n" % (cpv,),
-				level=logging.ERROR, noiselevel=-1)
-			continue
-		except CacheError as e:
-			writemsg_level("!!! Unable to access cache entry: %s %s\n" % \
-				(cpv, e), level=logging.ERROR, noiselevel=-1)
-			continue
-
-		if eb_mtime is None:
-			writemsg_level("!!! Missing ebuild mtime: %s\n" % (cpv,),
-				level=logging.ERROR, noiselevel=-1)
-			continue
-
-		try:
-			eb_mtime = long(eb_mtime)
-		except ValueError:
-			writemsg_level("!!! Invalid ebuild mtime: %s %s\n" % \
-				(cpv, eb_mtime), level=logging.ERROR, noiselevel=-1)
-			continue
-
-		if ec_mtimes is None:
-			writemsg_level("!!! Missing eclass mtimes: %s\n" % (cpv,),
-				level=logging.ERROR, noiselevel=-1)
-			continue
-
-		if modified_eclasses.intersection(ec_mtimes):
-			continue
-
-		missing_eclasses = set(ec_mtimes).difference(ec_names)
-		if missing_eclasses:
-			writemsg_level("!!! Non-existent eclass(es): %s %s\n" % \
-				(cpv, sorted(missing_eclasses)), level=logging.ERROR,
-				noiselevel=-1)
-			continue
-
-		eb_path = os.path.join(portdir, relative_eb_path)
-		try:
-			current_eb_mtime = os.stat(eb_path)
-		except OSError:
-			writemsg_level("!!! Missing ebuild: %s\n" % \
-				(cpv,), level=logging.ERROR, noiselevel=-1)
-			continue
-
-		inconsistent = False
-		for ec, (ec_path, ec_mtime) in ec_mtimes.items():
-			updated_mtime = updated_ec_mtimes.get(ec)
-			if updated_mtime is not None and updated_mtime != ec_mtime:
-				writemsg_level("!!! Inconsistent eclass mtime: %s %s\n" % \
-					(cpv, ec), level=logging.ERROR, noiselevel=-1)
-				inconsistent = True
-				break
-
-		if inconsistent:
-			continue
-
-		if current_eb_mtime != eb_mtime:
-			os.utime(eb_path, (eb_mtime, eb_mtime))
-
-		for ec, (ec_path, ec_mtime) in ec_mtimes.items():
-			if ec in updated_ec_mtimes:
-				continue
-			ec_path = os.path.join(ec_dir, ec + ".eclass")
-			current_mtime = os.stat(ec_path)[stat.ST_MTIME]
-			if current_mtime != ec_mtime:
-				os.utime(ec_path, (ec_mtime, ec_mtime))
-			updated_ec_mtimes[ec] = ec_mtime
-
-	return os.EX_OK


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

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

commit:     3459c877af225a28658f09cb934d615d4d5ae694
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue Oct 21 01:49:35 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=3459c877

git sync: remove unneeded post_sync

None of the remaining post_sync code is really needed. Also, fix
indent of return near the end of the _sync method.

---
 pym/portage/sync/modules/git/git.py | 18 ++----------------
 1 file changed, 2 insertions(+), 16 deletions(-)

diff --git a/pym/portage/sync/modules/git/git.py b/pym/portage/sync/modules/git/git.py
index d8c5a32..7c28139 100644
--- a/pym/portage/sync/modules/git/git.py
+++ b/pym/portage/sync/modules/git/git.py
@@ -69,11 +69,11 @@ class GitSync(SyncBase):
 			msg = "!!! git clone error in %s" % self.repo.location
 			self.logger(self.xterm_titles, msg)
 			writemsg_level(msg + "\n", level=logging.ERROR, noiselevel=-1)
-		return (exitcode, False)
+			return (exitcode, False)
 		msg = ">>> Git clone successful"
 		self.logger(self.xterm_titles, msg)
 		writemsg_level(msg + "\n")
-		return self.post_sync(portdb, self.repo.location, emerge_config)
+		return (os.EX_OK, True)
 
 
 	def _sync(self):
@@ -101,18 +101,4 @@ class GitSync(SyncBase):
 		msg = ">>> Git pull successful: %s" % self.repo.location
 		self.logger(self.xterm_titles, msg)
 		writemsg_level(msg + "\n")
-		return self.post_sync(portdb, self.repo.location, emerge_config)
-
-
-	def post_sync(self, portdb, location, emerge_config):
-		'''repo.sync_type == "git":
-		# 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.
-		'''
-		# avoid circular import for now
-		from _emerge.actions import load_emerge_config, adjust_configs
-		# Reload the whole config from scratch.
-		settings, trees, mtimedb = load_emerge_config(emerge_config=emerge_config)
-		adjust_configs(emerge_config.opts, emerge_config.trees)
 		return (os.EX_OK, True)


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

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

commit:     883f7ceb8b30f75d882e94074a3a3411875f6c31
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Wed Oct 22 11:01:03 2014 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon Dec  1 21:49:42 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=883f7ceb

GitSync: support file:// sync-uri

This will be useful for unit tests that will sync from a local
file:// sync-uri.

---
 pym/portage/sync/modules/git/git.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/pym/portage/sync/modules/git/git.py b/pym/portage/sync/modules/git/git.py
index 7c28139..35943dd 100644
--- a/pym/portage/sync/modules/git/git.py
+++ b/pym/portage/sync/modules/git/git.py
@@ -60,10 +60,13 @@ class GitSync(SyncBase):
 		msg = ">>> Cloning git repository from upstream into %s..." % self.repo.location
 		self.logger(self.xterm_titles, msg)
 		writemsg_level(msg + "\n")
+		sync_uri = self.repo.sync_uri
+		if sync_uri.startswith("file://"):
+			sync_uri = sync_uri[6:]
 		exitcode = portage.process.spawn_bash("cd %s ; %s clone %s ." % \
 			(portage._shell_quote(self.repo.location),
 			self.bin_command,
-			portage._shell_quote(self.repo.sync_uri)),
+			portage._shell_quote(sync_uri)),
 			**portage._native_kwargs(self.spawn_kwargs))
 		if exitcode != os.EX_OK:
 			msg = "!!! git clone error in %s" % self.repo.location


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

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

commit:     932fa3f8295dcfb0bdbf3762161940d44d19d395
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue Oct 21 01:13:45 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Thu Dec  4 19:56:35 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=932fa3f8

Remove obsolete git_sync_timestamps function.

This function is no longer needed since we switched to the md5-cache
format which does not use timestamps.

---
 pym/portage/sync/modules/git/git.py        |   8 +-
 pym/portage/sync/modules/git/timestamps.py | 154 -----------------------------
 2 files changed, 1 insertion(+), 161 deletions(-)

diff --git a/pym/portage/sync/modules/git/git.py b/pym/portage/sync/modules/git/git.py
index 5e0e5df..d8c5a32 100644
--- a/pym/portage/sync/modules/git/git.py
+++ b/pym/portage/sync/modules/git/git.py
@@ -10,7 +10,6 @@ from portage.output import create_color_func
 good = create_color_func("GOOD")
 bad = create_color_func("BAD")
 warn = create_color_func("WARN")
-from .timestamps import git_sync_timestamps
 from portage.sync.syncbase import SyncBase
 
 
@@ -116,9 +115,4 @@ class GitSync(SyncBase):
 		# Reload the whole config from scratch.
 		settings, trees, mtimedb = load_emerge_config(emerge_config=emerge_config)
 		adjust_configs(emerge_config.opts, emerge_config.trees)
-		portdb = trees[settings['EROOT']]['porttree'].dbapi
-		updatecache_flg = False
-		exitcode = git_sync_timestamps(portdb, location)
-		if exitcode == os.EX_OK:
-			updatecache_flg = True
-		return (exitcode, updatecache_flg)
+		return (os.EX_OK, True)

diff --git a/pym/portage/sync/modules/git/timestamps.py b/pym/portage/sync/modules/git/timestamps.py
deleted file mode 100644
index 5e44845..0000000
--- a/pym/portage/sync/modules/git/timestamps.py
+++ /dev/null
@@ -1,154 +0,0 @@
-# Copyright 1999-2014 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-import logging
-import stat
-import subprocess
-
-
-import portage
-from portage import os
-from portage import _unicode_decode
-from portage.util import writemsg_level
-from portage.cache.cache_errors import CacheError
-
-
-def git_sync_timestamps(portdb, portdir):
-	"""
-	Since git doesn't preserve timestamps, synchronize timestamps between
-	entries and ebuilds/eclasses. Assume the cache has the correct timestamp
-	for a given file as long as the file in the working tree is not modified
-	(relative to HEAD).
-	"""
-
-	cache_db = portdb._pregen_auxdb.get(portdir)
-
-	try:
-		if cache_db is None:
-			# portdbapi does not populate _pregen_auxdb
-			# when FEATURES=metadata-transfer is enabled
-			cache_db = portdb._create_pregen_cache(portdir)
-	except CacheError as e:
-		writemsg_level("!!! Unable to instantiate cache: %s\n" % (e,),
-			level=logging.ERROR, noiselevel=-1)
-		return 1
-
-	if cache_db is None:
-		return os.EX_OK
-
-	if cache_db.validation_chf != 'mtime':
-		# newer formats like md5-dict do not require mtime sync
-		return os.EX_OK
-
-	writemsg_level(">>> Synchronizing timestamps...\n")
-
-	ec_dir = os.path.join(portdir, "eclass")
-	try:
-		ec_names = set(f[:-7] for f in os.listdir(ec_dir) \
-			if f.endswith(".eclass"))
-	except OSError as e:
-		writemsg_level("!!! Unable to list eclasses: %s\n" % (e,),
-			level=logging.ERROR, noiselevel=-1)
-		return 1
-
-	args = [portage.const.BASH_BINARY, "-c",
-		"cd %s && git diff-index --name-only --diff-filter=M HEAD" % \
-		portage._shell_quote(portdir)]
-	proc = subprocess.Popen(args, stdout=subprocess.PIPE)
-	modified_files = set(_unicode_decode(l).rstrip("\n") for l in proc.stdout)
-	rval = proc.wait()
-	proc.stdout.close()
-	if rval != os.EX_OK:
-		return rval
-
-	modified_eclasses = set(ec for ec in ec_names \
-		if os.path.join("eclass", ec + ".eclass") in modified_files)
-
-	updated_ec_mtimes = {}
-
-	for cpv in cache_db:
-		cpv_split = portage.catpkgsplit(cpv)
-		if cpv_split is None:
-			writemsg_level("!!! Invalid cache entry: %s\n" % (cpv,),
-				level=logging.ERROR, noiselevel=-1)
-			continue
-
-		cat, pn, ver, rev = cpv_split
-		cat, pf = portage.catsplit(cpv)
-		relative_eb_path = os.path.join(cat, pn, pf + ".ebuild")
-		if relative_eb_path in modified_files:
-			continue
-
-		try:
-			cache_entry = cache_db[cpv]
-			eb_mtime = cache_entry.get("_mtime_")
-			ec_mtimes = cache_entry.get("_eclasses_")
-		except KeyError:
-			writemsg_level("!!! Missing cache entry: %s\n" % (cpv,),
-				level=logging.ERROR, noiselevel=-1)
-			continue
-		except CacheError as e:
-			writemsg_level("!!! Unable to access cache entry: %s %s\n" % \
-				(cpv, e), level=logging.ERROR, noiselevel=-1)
-			continue
-
-		if eb_mtime is None:
-			writemsg_level("!!! Missing ebuild mtime: %s\n" % (cpv,),
-				level=logging.ERROR, noiselevel=-1)
-			continue
-
-		try:
-			eb_mtime = long(eb_mtime)
-		except ValueError:
-			writemsg_level("!!! Invalid ebuild mtime: %s %s\n" % \
-				(cpv, eb_mtime), level=logging.ERROR, noiselevel=-1)
-			continue
-
-		if ec_mtimes is None:
-			writemsg_level("!!! Missing eclass mtimes: %s\n" % (cpv,),
-				level=logging.ERROR, noiselevel=-1)
-			continue
-
-		if modified_eclasses.intersection(ec_mtimes):
-			continue
-
-		missing_eclasses = set(ec_mtimes).difference(ec_names)
-		if missing_eclasses:
-			writemsg_level("!!! Non-existent eclass(es): %s %s\n" % \
-				(cpv, sorted(missing_eclasses)), level=logging.ERROR,
-				noiselevel=-1)
-			continue
-
-		eb_path = os.path.join(portdir, relative_eb_path)
-		try:
-			current_eb_mtime = os.stat(eb_path)
-		except OSError:
-			writemsg_level("!!! Missing ebuild: %s\n" % \
-				(cpv,), level=logging.ERROR, noiselevel=-1)
-			continue
-
-		inconsistent = False
-		for ec, (ec_path, ec_mtime) in ec_mtimes.items():
-			updated_mtime = updated_ec_mtimes.get(ec)
-			if updated_mtime is not None and updated_mtime != ec_mtime:
-				writemsg_level("!!! Inconsistent eclass mtime: %s %s\n" % \
-					(cpv, ec), level=logging.ERROR, noiselevel=-1)
-				inconsistent = True
-				break
-
-		if inconsistent:
-			continue
-
-		if current_eb_mtime != eb_mtime:
-			os.utime(eb_path, (eb_mtime, eb_mtime))
-
-		for ec, (ec_path, ec_mtime) in ec_mtimes.items():
-			if ec in updated_ec_mtimes:
-				continue
-			ec_path = os.path.join(ec_dir, ec + ".eclass")
-			current_mtime = os.stat(ec_path)[stat.ST_MTIME]
-			if current_mtime != ec_mtime:
-				os.utime(ec_path, (ec_mtime, ec_mtime))
-			updated_ec_mtimes[ec] = ec_mtime
-
-	return os.EX_OK


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

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

commit:     92c612d743907c89532247298f95cc64d956548a
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Wed Oct 22 11:01:03 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Thu Dec  4 19:56:35 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=92c612d7

GitSync: support file:// sync-uri

This will be useful for unit tests that will sync from a local
file:// sync-uri.

---
 pym/portage/sync/modules/git/git.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/pym/portage/sync/modules/git/git.py b/pym/portage/sync/modules/git/git.py
index 7c28139..35943dd 100644
--- a/pym/portage/sync/modules/git/git.py
+++ b/pym/portage/sync/modules/git/git.py
@@ -60,10 +60,13 @@ class GitSync(SyncBase):
 		msg = ">>> Cloning git repository from upstream into %s..." % self.repo.location
 		self.logger(self.xterm_titles, msg)
 		writemsg_level(msg + "\n")
+		sync_uri = self.repo.sync_uri
+		if sync_uri.startswith("file://"):
+			sync_uri = sync_uri[6:]
 		exitcode = portage.process.spawn_bash("cd %s ; %s clone %s ." % \
 			(portage._shell_quote(self.repo.location),
 			self.bin_command,
-			portage._shell_quote(self.repo.sync_uri)),
+			portage._shell_quote(sync_uri)),
 			**portage._native_kwargs(self.spawn_kwargs))
 		if exitcode != os.EX_OK:
 			msg = "!!! git clone error in %s" % self.repo.location


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

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

commit:     4514e80a40525dd87d84381e8869a5cd78b3f454
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue Oct 21 01:49:35 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Thu Dec  4 19:56:35 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=4514e80a

git sync: remove unneeded post_sync

None of the remaining post_sync code is really needed. Also, fix
indent of return near the end of the _sync method.

---
 pym/portage/sync/modules/git/git.py | 18 ++----------------
 1 file changed, 2 insertions(+), 16 deletions(-)

diff --git a/pym/portage/sync/modules/git/git.py b/pym/portage/sync/modules/git/git.py
index d8c5a32..7c28139 100644
--- a/pym/portage/sync/modules/git/git.py
+++ b/pym/portage/sync/modules/git/git.py
@@ -69,11 +69,11 @@ class GitSync(SyncBase):
 			msg = "!!! git clone error in %s" % self.repo.location
 			self.logger(self.xterm_titles, msg)
 			writemsg_level(msg + "\n", level=logging.ERROR, noiselevel=-1)
-		return (exitcode, False)
+			return (exitcode, False)
 		msg = ">>> Git clone successful"
 		self.logger(self.xterm_titles, msg)
 		writemsg_level(msg + "\n")
-		return self.post_sync(portdb, self.repo.location, emerge_config)
+		return (os.EX_OK, True)
 
 
 	def _sync(self):
@@ -101,18 +101,4 @@ class GitSync(SyncBase):
 		msg = ">>> Git pull successful: %s" % self.repo.location
 		self.logger(self.xterm_titles, msg)
 		writemsg_level(msg + "\n")
-		return self.post_sync(portdb, self.repo.location, emerge_config)
-
-
-	def post_sync(self, portdb, location, emerge_config):
-		'''repo.sync_type == "git":
-		# 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.
-		'''
-		# avoid circular import for now
-		from _emerge.actions import load_emerge_config, adjust_configs
-		# Reload the whole config from scratch.
-		settings, trees, mtimedb = load_emerge_config(emerge_config=emerge_config)
-		adjust_configs(emerge_config.opts, emerge_config.trees)
 		return (os.EX_OK, True)


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

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

Thread overview: 28+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-02 23:13 [gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/git/ 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: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-10-22 11:02 Zac Medico
2014-10-21  5:05 Zac Medico
2014-10-21  5:05 Zac Medico
2014-10-21  1:49 Zac Medico
2014-10-21  1:15 Zac Medico
2014-09-03 23:36 Brian Dolbec
2014-06-16 22:45 Brian Dolbec
2014-06-16 22:45 Brian Dolbec
2014-06-16 15:46 Brian Dolbec
2014-06-16 15:46 Brian Dolbec
2014-05-02 23:13 Brian Dolbec
2014-05-02 23:13 Brian Dolbec
2014-05-02 23:13 Brian Dolbec
2014-04-22  2:36 Brian Dolbec
2014-03-14 16:23 Brian Dolbec
2014-02-19 15:37 Brian Dolbec
2014-02-10  4:07 Chris Reffett
2014-02-08 15:41 Chris Reffett
2014-02-08  4:03 Chris Reffett
2014-02-08  4:03 Chris Reffett
2014-02-08  4:03 Chris Reffett

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