[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-06-16 Thread Brian Dolbec
commit: d894d8c13f62dc7e40e78ae942c98d7d43e02bcd
Author: David Heidelberger  ixit  cz>
AuthorDate: Mon Jun 16 16:04:06 2014 +
Commit: Brian Dolbec  gmail  com>
CommitDate: Mon Jun 16 17:59:05 2014 +
URL:
http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=d894d8c1

portage/sync/modules: Add svn sync module

Module submitted by: David Heidelberger
edits by Brian Dolbec :
Remove CheckSVNConfig class.
Use the default CheckSyncConfig class instead.
Copying the sync-cvs-repo option from the cvs module was incorrect and not 
needed.
Fixed the new()'s spawn_bash(...) call.

---
 pym/portage/sync/modules/svn/__init__.py | 32 +
 pym/portage/sync/modules/svn/svn.py  | 81 
 2 files changed, 113 insertions(+)

diff --git a/pym/portage/sync/modules/svn/__init__.py 
b/pym/portage/sync/modules/svn/__init__.py
new file mode 100644
index 000..1fda55a
--- /dev/null
+++ b/pym/portage/sync/modules/svn/__init__.py
@@ -0,0 +1,32 @@
+# Copyright 2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+"""SVN plug-in module for portage.
+Performs a svn up on repositories
+"""
+
+
+from portage.localization import _
+from portage.sync.config_checks import CheckSyncConfig
+from portage.util import writemsg_level
+
+
+module_spec = {
+   'name': 'svn',
+   'description': __doc__,
+   'provides':{
+   'svn-module': {
+   'name': "svn",
+   'class': "SVNSync",
+   'description': __doc__,
+   'functions': ['sync', 'new', 'exists'],
+   'func_desc': {
+   'sync': 'Performs a svn up 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 SVN repository',
+   },
+   'validate_config': CheckSyncConfig,
+   }
+   }
+}

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
new file mode 100644
index 000..182a7ac
--- /dev/null
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -0,0 +1,81 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+import logging
+import errno
+
+import portage
+from portage import os
+from portage.util import writemsg_level
+from portage.sync.syncbase import SyncBase
+
+
+class SVNSync(SyncBase):
+   '''SVN sync module'''
+
+   short_desc = "Perform sync operations on SVN repositories"
+
+   @staticmethod
+   def name():
+   return "SVNSync"
+
+
+   def __init__(self):
+   SyncBase.__init__(self, "svn", "dev-vcs/subversion")
+
+
+   def new(self, **kwargs):
+   if kwargs:
+   self._kwargs(kwargs)
+   #initial checkout
+   msg = ">>> Starting initial svn checkout with %s..." % 
self.repo.sync_uri
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n")
+   try:
+   os.rmdir(self.repo.location)
+   except OSError as e:
+   if e.errno != errno.ENOENT:
+   msg = "!!! existing '%s' directory; exiting." % 
self.repo.location
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (1, False)
+   del e
+   svn_root = self.repo.sync_uri
+   exitcode =  portage.process.spawn_bash(
+   "cd %s; exec svn %s" %
+   
(portage._shell_quote(os.path.dirname(self.repo.location)),
+   portage._shell_quote(svn_root)),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn checkout error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)
+
+
+   def _sync(self):
+   """
+   Internal function to sync an existing SVN repository
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+
+   svn_root = self.repo.sync_uri
+
+   if svn_root.startswith("svn://"):
+   svn_root = svn_root[6:]
+   #svn update
+   msg = ">>> Starting svn update with %s..." % 
self.

[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-06-16 Thread Brian Dolbec
commit: e304a607772e052227a771219579e4112544a022
Author: Brian Dolbec  gentoo  org>
AuthorDate: Mon Jun 16 17:58:09 2014 +
Commit: Brian Dolbec  gmail  com>
CommitDate: Mon Jun 16 18:08:54 2014 +
URL:
http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=e304a607

sync/modules/svn: Add snv upgrade to sync operation

This prevents errors when a newer svn has been installed that requires a db 
upgrade.

---
 pym/portage/sync/modules/svn/svn.py | 23 +++
 1 file changed, 23 insertions(+)

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
index 182a7ac..0365e90 100644
--- a/pym/portage/sync/modules/svn/svn.py
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -62,6 +62,10 @@ class SVNSync(SyncBase):
@rtype: (int, bool)
"""
 
+   exitcode, d = self._svn_upgrade()
+   if exitcode != os.EX_OK:
+   return (exitcode, False)
+
svn_root = self.repo.sync_uri
 
if svn_root.startswith("svn://"):
@@ -79,3 +83,22 @@ class SVNSync(SyncBase):
self.logger(self.xterm_titles, msg)
writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
return (exitcode, False)
+
+
+   def _svn_upgrade(self):
+   """
+   Internal function which performs an svn upgrade on the repo
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+   exitcode = portage.process.spawn_bash(
+   "cd %s; exec svn upgrade" %
+   (portage._shell_quote(self.repo.location),),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn upgrade error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)



[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-06-16 Thread Brian Dolbec
commit: 90cef042302e0c347e9361a145132942d17e8823
Author: David Heidelberger  ixit  cz>
AuthorDate: Mon Jun 16 16:04:06 2014 +
Commit: Brian Dolbec  gmail  com>
CommitDate: Mon Jun 16 22:44:15 2014 +
URL:
http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=90cef042

portage/sync/modules: Add svn sync module

Module submitted by: David Heidelberger
edits by Brian Dolbec :
Remove CheckSVNConfig class.
Use the default CheckSyncConfig class instead.
Copying the sync-cvs-repo option from the cvs module was incorrect and not 
needed.
Fixed the new()'s spawn_bash(...) call.

---
 pym/portage/sync/modules/svn/__init__.py | 32 +
 pym/portage/sync/modules/svn/svn.py  | 81 
 2 files changed, 113 insertions(+)

diff --git a/pym/portage/sync/modules/svn/__init__.py 
b/pym/portage/sync/modules/svn/__init__.py
new file mode 100644
index 000..1fda55a
--- /dev/null
+++ b/pym/portage/sync/modules/svn/__init__.py
@@ -0,0 +1,32 @@
+# Copyright 2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+"""SVN plug-in module for portage.
+Performs a svn up on repositories
+"""
+
+
+from portage.localization import _
+from portage.sync.config_checks import CheckSyncConfig
+from portage.util import writemsg_level
+
+
+module_spec = {
+   'name': 'svn',
+   'description': __doc__,
+   'provides':{
+   'svn-module': {
+   'name': "svn",
+   'class': "SVNSync",
+   'description': __doc__,
+   'functions': ['sync', 'new', 'exists'],
+   'func_desc': {
+   'sync': 'Performs a svn up 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 SVN repository',
+   },
+   'validate_config': CheckSyncConfig,
+   }
+   }
+}

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
new file mode 100644
index 000..182a7ac
--- /dev/null
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -0,0 +1,81 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+import logging
+import errno
+
+import portage
+from portage import os
+from portage.util import writemsg_level
+from portage.sync.syncbase import SyncBase
+
+
+class SVNSync(SyncBase):
+   '''SVN sync module'''
+
+   short_desc = "Perform sync operations on SVN repositories"
+
+   @staticmethod
+   def name():
+   return "SVNSync"
+
+
+   def __init__(self):
+   SyncBase.__init__(self, "svn", "dev-vcs/subversion")
+
+
+   def new(self, **kwargs):
+   if kwargs:
+   self._kwargs(kwargs)
+   #initial checkout
+   msg = ">>> Starting initial svn checkout with %s..." % 
self.repo.sync_uri
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n")
+   try:
+   os.rmdir(self.repo.location)
+   except OSError as e:
+   if e.errno != errno.ENOENT:
+   msg = "!!! existing '%s' directory; exiting." % 
self.repo.location
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (1, False)
+   del e
+   svn_root = self.repo.sync_uri
+   exitcode =  portage.process.spawn_bash(
+   "cd %s; exec svn %s" %
+   
(portage._shell_quote(os.path.dirname(self.repo.location)),
+   portage._shell_quote(svn_root)),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn checkout error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)
+
+
+   def _sync(self):
+   """
+   Internal function to sync an existing SVN repository
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+
+   svn_root = self.repo.sync_uri
+
+   if svn_root.startswith("svn://"):
+   svn_root = svn_root[6:]
+   #svn update
+   msg = ">>> Starting svn update with %s..." % 
self.

[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-06-16 Thread Brian Dolbec
commit: b96eaefa633548405a0389eaac66388ae2c1f870
Author: Brian Dolbec  gentoo  org>
AuthorDate: Mon Jun 16 17:58:09 2014 +
Commit: Brian Dolbec  gmail  com>
CommitDate: Mon Jun 16 22:44:15 2014 +
URL:
http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=b96eaefa

sync/modules/svn: Add snv upgrade to sync operation

This prevents errors when a newer svn has been installed that requires a db 
upgrade.

---
 pym/portage/sync/modules/svn/svn.py | 23 +++
 1 file changed, 23 insertions(+)

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
index 182a7ac..0365e90 100644
--- a/pym/portage/sync/modules/svn/svn.py
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -62,6 +62,10 @@ class SVNSync(SyncBase):
@rtype: (int, bool)
"""
 
+   exitcode, d = self._svn_upgrade()
+   if exitcode != os.EX_OK:
+   return (exitcode, False)
+
svn_root = self.repo.sync_uri
 
if svn_root.startswith("svn://"):
@@ -79,3 +83,22 @@ class SVNSync(SyncBase):
self.logger(self.xterm_titles, msg)
writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
return (exitcode, False)
+
+
+   def _svn_upgrade(self):
+   """
+   Internal function which performs an svn upgrade on the repo
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+   exitcode = portage.process.spawn_bash(
+   "cd %s; exec svn upgrade" %
+   (portage._shell_quote(self.repo.location),),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn upgrade error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)



[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-10-19 Thread Zac Medico
commit: 3e03d6b00b90d45a570cca06289e74603d76ca3d
Author: David Heidelberger  ixit  cz>
AuthorDate: Mon Jun 16 16:04:06 2014 +
Commit: Zac Medico  gentoo  org>
CommitDate: Mon Oct 20 03:48:34 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=3e03d6b0

portage/sync/modules: Add svn sync module

Module submitted by: David Heidelberger
edits by Brian Dolbec :
Remove CheckSVNConfig class.
Use the default CheckSyncConfig class instead.
Copying the sync-cvs-repo option from the cvs module was incorrect and not 
needed.
Fixed the new()'s spawn_bash(...) call.

---
 pym/portage/sync/modules/svn/__init__.py | 32 +
 pym/portage/sync/modules/svn/svn.py  | 81 
 2 files changed, 113 insertions(+)

diff --git a/pym/portage/sync/modules/svn/__init__.py 
b/pym/portage/sync/modules/svn/__init__.py
new file mode 100644
index 000..1fda55a
--- /dev/null
+++ b/pym/portage/sync/modules/svn/__init__.py
@@ -0,0 +1,32 @@
+# Copyright 2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+"""SVN plug-in module for portage.
+Performs a svn up on repositories
+"""
+
+
+from portage.localization import _
+from portage.sync.config_checks import CheckSyncConfig
+from portage.util import writemsg_level
+
+
+module_spec = {
+   'name': 'svn',
+   'description': __doc__,
+   'provides':{
+   'svn-module': {
+   'name': "svn",
+   'class': "SVNSync",
+   'description': __doc__,
+   'functions': ['sync', 'new', 'exists'],
+   'func_desc': {
+   'sync': 'Performs a svn up 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 SVN repository',
+   },
+   'validate_config': CheckSyncConfig,
+   }
+   }
+}

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
new file mode 100644
index 000..182a7ac
--- /dev/null
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -0,0 +1,81 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+import logging
+import errno
+
+import portage
+from portage import os
+from portage.util import writemsg_level
+from portage.sync.syncbase import SyncBase
+
+
+class SVNSync(SyncBase):
+   '''SVN sync module'''
+
+   short_desc = "Perform sync operations on SVN repositories"
+
+   @staticmethod
+   def name():
+   return "SVNSync"
+
+
+   def __init__(self):
+   SyncBase.__init__(self, "svn", "dev-vcs/subversion")
+
+
+   def new(self, **kwargs):
+   if kwargs:
+   self._kwargs(kwargs)
+   #initial checkout
+   msg = ">>> Starting initial svn checkout with %s..." % 
self.repo.sync_uri
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n")
+   try:
+   os.rmdir(self.repo.location)
+   except OSError as e:
+   if e.errno != errno.ENOENT:
+   msg = "!!! existing '%s' directory; exiting." % 
self.repo.location
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (1, False)
+   del e
+   svn_root = self.repo.sync_uri
+   exitcode =  portage.process.spawn_bash(
+   "cd %s; exec svn %s" %
+   
(portage._shell_quote(os.path.dirname(self.repo.location)),
+   portage._shell_quote(svn_root)),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn checkout error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)
+
+
+   def _sync(self):
+   """
+   Internal function to sync an existing SVN repository
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+
+   svn_root = self.repo.sync_uri
+
+   if svn_root.startswith("svn://"):
+   svn_root = svn_root[6:]
+   #svn update
+   msg = ">>> Starting svn update with %s..." % 
self.repo.s

[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-10-19 Thread Zac Medico
commit: 9132fdaedfcb8aac0cebdc4154120fbf45b04a42
Author: Brian Dolbec  gentoo  org>
AuthorDate: Mon Jun 16 17:58:09 2014 +
Commit: Zac Medico  gentoo  org>
CommitDate: Mon Oct 20 03:48:34 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=9132fdae

sync/modules/svn: Add snv upgrade to sync operation

This prevents errors when a newer svn has been installed that requires a db 
upgrade.

---
 pym/portage/sync/modules/svn/svn.py | 23 +++
 1 file changed, 23 insertions(+)

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
index 182a7ac..0365e90 100644
--- a/pym/portage/sync/modules/svn/svn.py
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -62,6 +62,10 @@ class SVNSync(SyncBase):
@rtype: (int, bool)
"""
 
+   exitcode, d = self._svn_upgrade()
+   if exitcode != os.EX_OK:
+   return (exitcode, False)
+
svn_root = self.repo.sync_uri
 
if svn_root.startswith("svn://"):
@@ -79,3 +83,22 @@ class SVNSync(SyncBase):
self.logger(self.xterm_titles, msg)
writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
return (exitcode, False)
+
+
+   def _svn_upgrade(self):
+   """
+   Internal function which performs an svn upgrade on the repo
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+   exitcode = portage.process.spawn_bash(
+   "cd %s; exec svn upgrade" %
+   (portage._shell_quote(self.repo.location),),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn upgrade error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)



[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-10-20 Thread Zac Medico
commit: a56ee8b456ea059f92e5e4fd142cde85be249a23
Author: David Heidelberger  ixit  cz>
AuthorDate: Mon Jun 16 16:04:06 2014 +
Commit: Zac Medico  gentoo  org>
CommitDate: Tue Oct 21 05:04:07 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=a56ee8b4

portage/sync/modules: Add svn sync module

Module submitted by: David Heidelberger
edits by Brian Dolbec :
Remove CheckSVNConfig class.
Use the default CheckSyncConfig class instead.
Copying the sync-cvs-repo option from the cvs module was incorrect and not 
needed.
Fixed the new()'s spawn_bash(...) call.

---
 pym/portage/sync/modules/svn/__init__.py | 32 +
 pym/portage/sync/modules/svn/svn.py  | 81 
 2 files changed, 113 insertions(+)

diff --git a/pym/portage/sync/modules/svn/__init__.py 
b/pym/portage/sync/modules/svn/__init__.py
new file mode 100644
index 000..1fda55a
--- /dev/null
+++ b/pym/portage/sync/modules/svn/__init__.py
@@ -0,0 +1,32 @@
+# Copyright 2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+"""SVN plug-in module for portage.
+Performs a svn up on repositories
+"""
+
+
+from portage.localization import _
+from portage.sync.config_checks import CheckSyncConfig
+from portage.util import writemsg_level
+
+
+module_spec = {
+   'name': 'svn',
+   'description': __doc__,
+   'provides':{
+   'svn-module': {
+   'name': "svn",
+   'class': "SVNSync",
+   'description': __doc__,
+   'functions': ['sync', 'new', 'exists'],
+   'func_desc': {
+   'sync': 'Performs a svn up 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 SVN repository',
+   },
+   'validate_config': CheckSyncConfig,
+   }
+   }
+}

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
new file mode 100644
index 000..182a7ac
--- /dev/null
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -0,0 +1,81 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+import logging
+import errno
+
+import portage
+from portage import os
+from portage.util import writemsg_level
+from portage.sync.syncbase import SyncBase
+
+
+class SVNSync(SyncBase):
+   '''SVN sync module'''
+
+   short_desc = "Perform sync operations on SVN repositories"
+
+   @staticmethod
+   def name():
+   return "SVNSync"
+
+
+   def __init__(self):
+   SyncBase.__init__(self, "svn", "dev-vcs/subversion")
+
+
+   def new(self, **kwargs):
+   if kwargs:
+   self._kwargs(kwargs)
+   #initial checkout
+   msg = ">>> Starting initial svn checkout with %s..." % 
self.repo.sync_uri
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n")
+   try:
+   os.rmdir(self.repo.location)
+   except OSError as e:
+   if e.errno != errno.ENOENT:
+   msg = "!!! existing '%s' directory; exiting." % 
self.repo.location
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (1, False)
+   del e
+   svn_root = self.repo.sync_uri
+   exitcode =  portage.process.spawn_bash(
+   "cd %s; exec svn %s" %
+   
(portage._shell_quote(os.path.dirname(self.repo.location)),
+   portage._shell_quote(svn_root)),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn checkout error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)
+
+
+   def _sync(self):
+   """
+   Internal function to sync an existing SVN repository
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+
+   svn_root = self.repo.sync_uri
+
+   if svn_root.startswith("svn://"):
+   svn_root = svn_root[6:]
+   #svn update
+   msg = ">>> Starting svn update with %s..." % 
self.repo.s

[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-10-20 Thread Zac Medico
commit: 8ba80d4cf6d4af4e6c1d59c3c0bf732ea224aea4
Author: Brian Dolbec  gentoo  org>
AuthorDate: Mon Jun 16 17:58:09 2014 +
Commit: Zac Medico  gentoo  org>
CommitDate: Tue Oct 21 05:04:07 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=8ba80d4c

sync/modules/svn: Add snv upgrade to sync operation

This prevents errors when a newer svn has been installed that requires a db 
upgrade.

---
 pym/portage/sync/modules/svn/svn.py | 23 +++
 1 file changed, 23 insertions(+)

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
index 182a7ac..0365e90 100644
--- a/pym/portage/sync/modules/svn/svn.py
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -62,6 +62,10 @@ class SVNSync(SyncBase):
@rtype: (int, bool)
"""
 
+   exitcode, d = self._svn_upgrade()
+   if exitcode != os.EX_OK:
+   return (exitcode, False)
+
svn_root = self.repo.sync_uri
 
if svn_root.startswith("svn://"):
@@ -79,3 +83,22 @@ class SVNSync(SyncBase):
self.logger(self.xterm_titles, msg)
writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
return (exitcode, False)
+
+
+   def _svn_upgrade(self):
+   """
+   Internal function which performs an svn upgrade on the repo
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+   exitcode = portage.process.spawn_bash(
+   "cd %s; exec svn upgrade" %
+   (portage._shell_quote(self.repo.location),),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn upgrade error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)



[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-09-03 Thread Brian Dolbec
commit: 9bc13ae7c9a6892c9fe0f998b0473c9a1dfca656
Author: Brian Dolbec  gentoo  org>
AuthorDate: Mon Jun 16 17:58:09 2014 +
Commit: Brian Dolbec  gmail  com>
CommitDate: Wed Sep  3 23:34:54 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=9bc13ae7

sync/modules/svn: Add snv upgrade to sync operation

This prevents errors when a newer svn has been installed that requires a db 
upgrade.

---
 pym/portage/sync/modules/svn/svn.py | 23 +++
 1 file changed, 23 insertions(+)

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
index 182a7ac..0365e90 100644
--- a/pym/portage/sync/modules/svn/svn.py
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -62,6 +62,10 @@ class SVNSync(SyncBase):
@rtype: (int, bool)
"""
 
+   exitcode, d = self._svn_upgrade()
+   if exitcode != os.EX_OK:
+   return (exitcode, False)
+
svn_root = self.repo.sync_uri
 
if svn_root.startswith("svn://"):
@@ -79,3 +83,22 @@ class SVNSync(SyncBase):
self.logger(self.xterm_titles, msg)
writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
return (exitcode, False)
+
+
+   def _svn_upgrade(self):
+   """
+   Internal function which performs an svn upgrade on the repo
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+   exitcode = portage.process.spawn_bash(
+   "cd %s; exec svn upgrade" %
+   (portage._shell_quote(self.repo.location),),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn upgrade error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)



[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-09-03 Thread Brian Dolbec
commit: 2aa70957a16dad2a5f66ac11e88c4c81d45833fa
Author: David Heidelberger  ixit  cz>
AuthorDate: Mon Jun 16 16:04:06 2014 +
Commit: Brian Dolbec  gmail  com>
CommitDate: Wed Sep  3 23:34:54 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=2aa70957

portage/sync/modules: Add svn sync module

Module submitted by: David Heidelberger
edits by Brian Dolbec :
Remove CheckSVNConfig class.
Use the default CheckSyncConfig class instead.
Copying the sync-cvs-repo option from the cvs module was incorrect and not 
needed.
Fixed the new()'s spawn_bash(...) call.

---
 pym/portage/sync/modules/svn/__init__.py | 32 +
 pym/portage/sync/modules/svn/svn.py  | 81 
 2 files changed, 113 insertions(+)

diff --git a/pym/portage/sync/modules/svn/__init__.py 
b/pym/portage/sync/modules/svn/__init__.py
new file mode 100644
index 000..1fda55a
--- /dev/null
+++ b/pym/portage/sync/modules/svn/__init__.py
@@ -0,0 +1,32 @@
+# Copyright 2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+"""SVN plug-in module for portage.
+Performs a svn up on repositories
+"""
+
+
+from portage.localization import _
+from portage.sync.config_checks import CheckSyncConfig
+from portage.util import writemsg_level
+
+
+module_spec = {
+   'name': 'svn',
+   'description': __doc__,
+   'provides':{
+   'svn-module': {
+   'name': "svn",
+   'class': "SVNSync",
+   'description': __doc__,
+   'functions': ['sync', 'new', 'exists'],
+   'func_desc': {
+   'sync': 'Performs a svn up 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 SVN repository',
+   },
+   'validate_config': CheckSyncConfig,
+   }
+   }
+}

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
new file mode 100644
index 000..182a7ac
--- /dev/null
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -0,0 +1,81 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+import logging
+import errno
+
+import portage
+from portage import os
+from portage.util import writemsg_level
+from portage.sync.syncbase import SyncBase
+
+
+class SVNSync(SyncBase):
+   '''SVN sync module'''
+
+   short_desc = "Perform sync operations on SVN repositories"
+
+   @staticmethod
+   def name():
+   return "SVNSync"
+
+
+   def __init__(self):
+   SyncBase.__init__(self, "svn", "dev-vcs/subversion")
+
+
+   def new(self, **kwargs):
+   if kwargs:
+   self._kwargs(kwargs)
+   #initial checkout
+   msg = ">>> Starting initial svn checkout with %s..." % 
self.repo.sync_uri
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n")
+   try:
+   os.rmdir(self.repo.location)
+   except OSError as e:
+   if e.errno != errno.ENOENT:
+   msg = "!!! existing '%s' directory; exiting." % 
self.repo.location
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (1, False)
+   del e
+   svn_root = self.repo.sync_uri
+   exitcode =  portage.process.spawn_bash(
+   "cd %s; exec svn %s" %
+   
(portage._shell_quote(os.path.dirname(self.repo.location)),
+   portage._shell_quote(svn_root)),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn checkout error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)
+
+
+   def _sync(self):
+   """
+   Internal function to sync an existing SVN repository
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+
+   svn_root = self.repo.sync_uri
+
+   if svn_root.startswith("svn://"):
+   svn_root = svn_root[6:]
+   #svn update
+   msg = ">>> Starting svn update with %s..." % 
self.repo.

[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-09-03 Thread Brian Dolbec
commit: 2cb2c8b506a36dabeba3e1aaa6c1ecb9405a5e40
Author: David Heidelberger  ixit  cz>
AuthorDate: Mon Jun 16 16:04:06 2014 +
Commit: Brian Dolbec  gmail  com>
CommitDate: Thu Sep  4 01:18:02 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=2cb2c8b5

portage/sync/modules: Add svn sync module

Module submitted by: David Heidelberger
edits by Brian Dolbec :
Remove CheckSVNConfig class.
Use the default CheckSyncConfig class instead.
Copying the sync-cvs-repo option from the cvs module was incorrect and not 
needed.
Fixed the new()'s spawn_bash(...) call.

---
 pym/portage/sync/modules/svn/__init__.py | 32 +
 pym/portage/sync/modules/svn/svn.py  | 81 
 2 files changed, 113 insertions(+)

diff --git a/pym/portage/sync/modules/svn/__init__.py 
b/pym/portage/sync/modules/svn/__init__.py
new file mode 100644
index 000..1fda55a
--- /dev/null
+++ b/pym/portage/sync/modules/svn/__init__.py
@@ -0,0 +1,32 @@
+# Copyright 2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+"""SVN plug-in module for portage.
+Performs a svn up on repositories
+"""
+
+
+from portage.localization import _
+from portage.sync.config_checks import CheckSyncConfig
+from portage.util import writemsg_level
+
+
+module_spec = {
+   'name': 'svn',
+   'description': __doc__,
+   'provides':{
+   'svn-module': {
+   'name': "svn",
+   'class': "SVNSync",
+   'description': __doc__,
+   'functions': ['sync', 'new', 'exists'],
+   'func_desc': {
+   'sync': 'Performs a svn up 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 SVN repository',
+   },
+   'validate_config': CheckSyncConfig,
+   }
+   }
+}

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
new file mode 100644
index 000..182a7ac
--- /dev/null
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -0,0 +1,81 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+import logging
+import errno
+
+import portage
+from portage import os
+from portage.util import writemsg_level
+from portage.sync.syncbase import SyncBase
+
+
+class SVNSync(SyncBase):
+   '''SVN sync module'''
+
+   short_desc = "Perform sync operations on SVN repositories"
+
+   @staticmethod
+   def name():
+   return "SVNSync"
+
+
+   def __init__(self):
+   SyncBase.__init__(self, "svn", "dev-vcs/subversion")
+
+
+   def new(self, **kwargs):
+   if kwargs:
+   self._kwargs(kwargs)
+   #initial checkout
+   msg = ">>> Starting initial svn checkout with %s..." % 
self.repo.sync_uri
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n")
+   try:
+   os.rmdir(self.repo.location)
+   except OSError as e:
+   if e.errno != errno.ENOENT:
+   msg = "!!! existing '%s' directory; exiting." % 
self.repo.location
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (1, False)
+   del e
+   svn_root = self.repo.sync_uri
+   exitcode =  portage.process.spawn_bash(
+   "cd %s; exec svn %s" %
+   
(portage._shell_quote(os.path.dirname(self.repo.location)),
+   portage._shell_quote(svn_root)),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn checkout error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)
+
+
+   def _sync(self):
+   """
+   Internal function to sync an existing SVN repository
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+
+   svn_root = self.repo.sync_uri
+
+   if svn_root.startswith("svn://"):
+   svn_root = svn_root[6:]
+   #svn update
+   msg = ">>> Starting svn update with %s..." % 
self.repo.

[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-09-03 Thread Brian Dolbec
commit: 30909ce1a92a067fbbe3058275818a3aab9f4daf
Author: Brian Dolbec  gentoo  org>
AuthorDate: Mon Jun 16 17:58:09 2014 +
Commit: Brian Dolbec  gmail  com>
CommitDate: Thu Sep  4 01:18:02 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=30909ce1

sync/modules/svn: Add snv upgrade to sync operation

This prevents errors when a newer svn has been installed that requires a db 
upgrade.

---
 pym/portage/sync/modules/svn/svn.py | 23 +++
 1 file changed, 23 insertions(+)

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
index 182a7ac..0365e90 100644
--- a/pym/portage/sync/modules/svn/svn.py
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -62,6 +62,10 @@ class SVNSync(SyncBase):
@rtype: (int, bool)
"""
 
+   exitcode, d = self._svn_upgrade()
+   if exitcode != os.EX_OK:
+   return (exitcode, False)
+
svn_root = self.repo.sync_uri
 
if svn_root.startswith("svn://"):
@@ -79,3 +83,22 @@ class SVNSync(SyncBase):
self.logger(self.xterm_titles, msg)
writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
return (exitcode, False)
+
+
+   def _svn_upgrade(self):
+   """
+   Internal function which performs an svn upgrade on the repo
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+   exitcode = portage.process.spawn_bash(
+   "cd %s; exec svn upgrade" %
+   (portage._shell_quote(self.repo.location),),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn upgrade error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)



[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-09-04 Thread Brian Dolbec
commit: 2e6ccc31c3ce3ce86ce80c24e2a407fc5554f706
Author: David Heidelberger  ixit  cz>
AuthorDate: Mon Jun 16 16:04:06 2014 +
Commit: Brian Dolbec  gmail  com>
CommitDate: Thu Sep  4 07:20:42 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=2e6ccc31

portage/sync/modules: Add svn sync module

Module submitted by: David Heidelberger
edits by Brian Dolbec :
Remove CheckSVNConfig class.
Use the default CheckSyncConfig class instead.
Copying the sync-cvs-repo option from the cvs module was incorrect and not 
needed.
Fixed the new()'s spawn_bash(...) call.

---
 pym/portage/sync/modules/svn/__init__.py | 32 +
 pym/portage/sync/modules/svn/svn.py  | 81 
 2 files changed, 113 insertions(+)

diff --git a/pym/portage/sync/modules/svn/__init__.py 
b/pym/portage/sync/modules/svn/__init__.py
new file mode 100644
index 000..1fda55a
--- /dev/null
+++ b/pym/portage/sync/modules/svn/__init__.py
@@ -0,0 +1,32 @@
+# Copyright 2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+"""SVN plug-in module for portage.
+Performs a svn up on repositories
+"""
+
+
+from portage.localization import _
+from portage.sync.config_checks import CheckSyncConfig
+from portage.util import writemsg_level
+
+
+module_spec = {
+   'name': 'svn',
+   'description': __doc__,
+   'provides':{
+   'svn-module': {
+   'name': "svn",
+   'class': "SVNSync",
+   'description': __doc__,
+   'functions': ['sync', 'new', 'exists'],
+   'func_desc': {
+   'sync': 'Performs a svn up 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 SVN repository',
+   },
+   'validate_config': CheckSyncConfig,
+   }
+   }
+}

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
new file mode 100644
index 000..182a7ac
--- /dev/null
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -0,0 +1,81 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+import logging
+import errno
+
+import portage
+from portage import os
+from portage.util import writemsg_level
+from portage.sync.syncbase import SyncBase
+
+
+class SVNSync(SyncBase):
+   '''SVN sync module'''
+
+   short_desc = "Perform sync operations on SVN repositories"
+
+   @staticmethod
+   def name():
+   return "SVNSync"
+
+
+   def __init__(self):
+   SyncBase.__init__(self, "svn", "dev-vcs/subversion")
+
+
+   def new(self, **kwargs):
+   if kwargs:
+   self._kwargs(kwargs)
+   #initial checkout
+   msg = ">>> Starting initial svn checkout with %s..." % 
self.repo.sync_uri
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n")
+   try:
+   os.rmdir(self.repo.location)
+   except OSError as e:
+   if e.errno != errno.ENOENT:
+   msg = "!!! existing '%s' directory; exiting." % 
self.repo.location
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (1, False)
+   del e
+   svn_root = self.repo.sync_uri
+   exitcode =  portage.process.spawn_bash(
+   "cd %s; exec svn %s" %
+   
(portage._shell_quote(os.path.dirname(self.repo.location)),
+   portage._shell_quote(svn_root)),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn checkout error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)
+
+
+   def _sync(self):
+   """
+   Internal function to sync an existing SVN repository
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+
+   svn_root = self.repo.sync_uri
+
+   if svn_root.startswith("svn://"):
+   svn_root = svn_root[6:]
+   #svn update
+   msg = ">>> Starting svn update with %s..." % 
self.repo.

[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-09-04 Thread Brian Dolbec
commit: d2a6895c1ecabb94b5e19df12d1ee3570cf56bce
Author: Brian Dolbec  gentoo  org>
AuthorDate: Mon Jun 16 17:58:09 2014 +
Commit: Brian Dolbec  gmail  com>
CommitDate: Thu Sep  4 07:20:42 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=d2a6895c

sync/modules/svn: Add snv upgrade to sync operation

This prevents errors when a newer svn has been installed that requires a db 
upgrade.

---
 pym/portage/sync/modules/svn/svn.py | 23 +++
 1 file changed, 23 insertions(+)

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
index 182a7ac..0365e90 100644
--- a/pym/portage/sync/modules/svn/svn.py
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -62,6 +62,10 @@ class SVNSync(SyncBase):
@rtype: (int, bool)
"""
 
+   exitcode, d = self._svn_upgrade()
+   if exitcode != os.EX_OK:
+   return (exitcode, False)
+
svn_root = self.repo.sync_uri
 
if svn_root.startswith("svn://"):
@@ -79,3 +83,22 @@ class SVNSync(SyncBase):
self.logger(self.xterm_titles, msg)
writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
return (exitcode, False)
+
+
+   def _svn_upgrade(self):
+   """
+   Internal function which performs an svn upgrade on the repo
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+   exitcode = portage.process.spawn_bash(
+   "cd %s; exec svn upgrade" %
+   (portage._shell_quote(self.repo.location),),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn upgrade error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)



[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-09-05 Thread Brian Dolbec
commit: a89954dc492727902aceefad9eeac6064c3a5d42
Author: Brian Dolbec  gentoo  org>
AuthorDate: Mon Jun 16 17:58:09 2014 +
Commit: Brian Dolbec  gmail  com>
CommitDate: Fri Sep  5 20:26:14 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=a89954dc

sync/modules/svn: Add snv upgrade to sync operation

This prevents errors when a newer svn has been installed that requires a db 
upgrade.

---
 pym/portage/sync/modules/svn/svn.py | 23 +++
 1 file changed, 23 insertions(+)

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
index 182a7ac..0365e90 100644
--- a/pym/portage/sync/modules/svn/svn.py
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -62,6 +62,10 @@ class SVNSync(SyncBase):
@rtype: (int, bool)
"""
 
+   exitcode, d = self._svn_upgrade()
+   if exitcode != os.EX_OK:
+   return (exitcode, False)
+
svn_root = self.repo.sync_uri
 
if svn_root.startswith("svn://"):
@@ -79,3 +83,22 @@ class SVNSync(SyncBase):
self.logger(self.xterm_titles, msg)
writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
return (exitcode, False)
+
+
+   def _svn_upgrade(self):
+   """
+   Internal function which performs an svn upgrade on the repo
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+   exitcode = portage.process.spawn_bash(
+   "cd %s; exec svn upgrade" %
+   (portage._shell_quote(self.repo.location),),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn upgrade error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)



[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-09-05 Thread Brian Dolbec
commit: d2b019e8b9e7f3e8924a5f38c9fff991aeda223f
Author: David Heidelberger  ixit  cz>
AuthorDate: Mon Jun 16 16:04:06 2014 +
Commit: Brian Dolbec  gmail  com>
CommitDate: Fri Sep  5 20:26:14 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=d2b019e8

portage/sync/modules: Add svn sync module

Module submitted by: David Heidelberger
edits by Brian Dolbec :
Remove CheckSVNConfig class.
Use the default CheckSyncConfig class instead.
Copying the sync-cvs-repo option from the cvs module was incorrect and not 
needed.
Fixed the new()'s spawn_bash(...) call.

---
 pym/portage/sync/modules/svn/__init__.py | 32 +
 pym/portage/sync/modules/svn/svn.py  | 81 
 2 files changed, 113 insertions(+)

diff --git a/pym/portage/sync/modules/svn/__init__.py 
b/pym/portage/sync/modules/svn/__init__.py
new file mode 100644
index 000..1fda55a
--- /dev/null
+++ b/pym/portage/sync/modules/svn/__init__.py
@@ -0,0 +1,32 @@
+# Copyright 2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+"""SVN plug-in module for portage.
+Performs a svn up on repositories
+"""
+
+
+from portage.localization import _
+from portage.sync.config_checks import CheckSyncConfig
+from portage.util import writemsg_level
+
+
+module_spec = {
+   'name': 'svn',
+   'description': __doc__,
+   'provides':{
+   'svn-module': {
+   'name': "svn",
+   'class': "SVNSync",
+   'description': __doc__,
+   'functions': ['sync', 'new', 'exists'],
+   'func_desc': {
+   'sync': 'Performs a svn up 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 SVN repository',
+   },
+   'validate_config': CheckSyncConfig,
+   }
+   }
+}

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
new file mode 100644
index 000..182a7ac
--- /dev/null
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -0,0 +1,81 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+import logging
+import errno
+
+import portage
+from portage import os
+from portage.util import writemsg_level
+from portage.sync.syncbase import SyncBase
+
+
+class SVNSync(SyncBase):
+   '''SVN sync module'''
+
+   short_desc = "Perform sync operations on SVN repositories"
+
+   @staticmethod
+   def name():
+   return "SVNSync"
+
+
+   def __init__(self):
+   SyncBase.__init__(self, "svn", "dev-vcs/subversion")
+
+
+   def new(self, **kwargs):
+   if kwargs:
+   self._kwargs(kwargs)
+   #initial checkout
+   msg = ">>> Starting initial svn checkout with %s..." % 
self.repo.sync_uri
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n")
+   try:
+   os.rmdir(self.repo.location)
+   except OSError as e:
+   if e.errno != errno.ENOENT:
+   msg = "!!! existing '%s' directory; exiting." % 
self.repo.location
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (1, False)
+   del e
+   svn_root = self.repo.sync_uri
+   exitcode =  portage.process.spawn_bash(
+   "cd %s; exec svn %s" %
+   
(portage._shell_quote(os.path.dirname(self.repo.location)),
+   portage._shell_quote(svn_root)),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn checkout error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)
+
+
+   def _sync(self):
+   """
+   Internal function to sync an existing SVN repository
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+
+   svn_root = self.repo.sync_uri
+
+   if svn_root.startswith("svn://"):
+   svn_root = svn_root[6:]
+   #svn update
+   msg = ">>> Starting svn update with %s..." % 
self.repo.

[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-12-01 Thread Michał Górny
commit: 461159f48621bb8e7e0d20fa1937885956d979d0
Author: David Heidelberger  ixit  cz>
AuthorDate: Mon Jun 16 16:04:06 2014 +
Commit: Michał Górny  gentoo  org>
CommitDate: Mon Dec  1 21:49:40 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=461159f4

portage/sync/modules: Add svn sync module

Module submitted by: David Heidelberger
edits by Brian Dolbec :
Remove CheckSVNConfig class.
Use the default CheckSyncConfig class instead.
Copying the sync-cvs-repo option from the cvs module was incorrect and not 
needed.
Fixed the new()'s spawn_bash(...) call.

---
 pym/portage/sync/modules/svn/__init__.py | 32 +
 pym/portage/sync/modules/svn/svn.py  | 81 
 2 files changed, 113 insertions(+)

diff --git a/pym/portage/sync/modules/svn/__init__.py 
b/pym/portage/sync/modules/svn/__init__.py
new file mode 100644
index 000..1fda55a
--- /dev/null
+++ b/pym/portage/sync/modules/svn/__init__.py
@@ -0,0 +1,32 @@
+# Copyright 2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+"""SVN plug-in module for portage.
+Performs a svn up on repositories
+"""
+
+
+from portage.localization import _
+from portage.sync.config_checks import CheckSyncConfig
+from portage.util import writemsg_level
+
+
+module_spec = {
+   'name': 'svn',
+   'description': __doc__,
+   'provides':{
+   'svn-module': {
+   'name': "svn",
+   'class': "SVNSync",
+   'description': __doc__,
+   'functions': ['sync', 'new', 'exists'],
+   'func_desc': {
+   'sync': 'Performs a svn up 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 SVN repository',
+   },
+   'validate_config': CheckSyncConfig,
+   }
+   }
+}

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
new file mode 100644
index 000..182a7ac
--- /dev/null
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -0,0 +1,81 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+import logging
+import errno
+
+import portage
+from portage import os
+from portage.util import writemsg_level
+from portage.sync.syncbase import SyncBase
+
+
+class SVNSync(SyncBase):
+   '''SVN sync module'''
+
+   short_desc = "Perform sync operations on SVN repositories"
+
+   @staticmethod
+   def name():
+   return "SVNSync"
+
+
+   def __init__(self):
+   SyncBase.__init__(self, "svn", "dev-vcs/subversion")
+
+
+   def new(self, **kwargs):
+   if kwargs:
+   self._kwargs(kwargs)
+   #initial checkout
+   msg = ">>> Starting initial svn checkout with %s..." % 
self.repo.sync_uri
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n")
+   try:
+   os.rmdir(self.repo.location)
+   except OSError as e:
+   if e.errno != errno.ENOENT:
+   msg = "!!! existing '%s' directory; exiting." % 
self.repo.location
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (1, False)
+   del e
+   svn_root = self.repo.sync_uri
+   exitcode =  portage.process.spawn_bash(
+   "cd %s; exec svn %s" %
+   
(portage._shell_quote(os.path.dirname(self.repo.location)),
+   portage._shell_quote(svn_root)),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn checkout error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)
+
+
+   def _sync(self):
+   """
+   Internal function to sync an existing SVN repository
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+
+   svn_root = self.repo.sync_uri
+
+   if svn_root.startswith("svn://"):
+   svn_root = svn_root[6:]
+   #svn update
+   msg = ">>> Starting svn update with %s..." % 
self.repo

[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-12-01 Thread Michał Górny
commit: 94be45b625a8ddb7bd6c3472c1ca012f3461317e
Author: Brian Dolbec  gentoo  org>
AuthorDate: Mon Jun 16 17:58:09 2014 +
Commit: Michał Górny  gentoo  org>
CommitDate: Mon Dec  1 21:49:40 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=94be45b6

sync/modules/svn: Add snv upgrade to sync operation

This prevents errors when a newer svn has been installed that requires a db 
upgrade.

---
 pym/portage/sync/modules/svn/svn.py | 23 +++
 1 file changed, 23 insertions(+)

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
index 182a7ac..0365e90 100644
--- a/pym/portage/sync/modules/svn/svn.py
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -62,6 +62,10 @@ class SVNSync(SyncBase):
@rtype: (int, bool)
"""
 
+   exitcode, d = self._svn_upgrade()
+   if exitcode != os.EX_OK:
+   return (exitcode, False)
+
svn_root = self.repo.sync_uri
 
if svn_root.startswith("svn://"):
@@ -79,3 +83,22 @@ class SVNSync(SyncBase):
self.logger(self.xterm_titles, msg)
writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
return (exitcode, False)
+
+
+   def _svn_upgrade(self):
+   """
+   Internal function which performs an svn upgrade on the repo
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+   exitcode = portage.process.spawn_bash(
+   "cd %s; exec svn upgrade" %
+   (portage._shell_quote(self.repo.location),),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn upgrade error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)



[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-12-04 Thread Brian Dolbec
commit: 9831dd2fbd8889ee4c1738813b6a9c4c78c36e8c
Author: Brian Dolbec  gentoo  org>
AuthorDate: Mon Jun 16 17:58:09 2014 +
Commit: Brian Dolbec  gmail  com>
CommitDate: Thu Dec  4 19:56:33 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=9831dd2f

sync/modules/svn: Add snv upgrade to sync operation

This prevents errors when a newer svn has been installed that requires a db 
upgrade.

---
 pym/portage/sync/modules/svn/svn.py | 23 +++
 1 file changed, 23 insertions(+)

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
index 182a7ac..0365e90 100644
--- a/pym/portage/sync/modules/svn/svn.py
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -62,6 +62,10 @@ class SVNSync(SyncBase):
@rtype: (int, bool)
"""
 
+   exitcode, d = self._svn_upgrade()
+   if exitcode != os.EX_OK:
+   return (exitcode, False)
+
svn_root = self.repo.sync_uri
 
if svn_root.startswith("svn://"):
@@ -79,3 +83,22 @@ class SVNSync(SyncBase):
self.logger(self.xterm_titles, msg)
writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
return (exitcode, False)
+
+
+   def _svn_upgrade(self):
+   """
+   Internal function which performs an svn upgrade on the repo
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+   exitcode = portage.process.spawn_bash(
+   "cd %s; exec svn upgrade" %
+   (portage._shell_quote(self.repo.location),),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn upgrade error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)



[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-09-26 Thread Brian Dolbec
commit: b16889acdf7754ce5c0d0151beafde8dcb44de99
Author: Brian Dolbec  gentoo  org>
AuthorDate: Mon Jun 16 17:58:09 2014 +
Commit: Brian Dolbec  gmail  com>
CommitDate: Sat Sep 27 01:40:45 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=b16889ac

sync/modules/svn: Add snv upgrade to sync operation

This prevents errors when a newer svn has been installed that requires a db 
upgrade.

---
 pym/portage/sync/modules/svn/svn.py | 23 +++
 1 file changed, 23 insertions(+)

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
index 182a7ac..0365e90 100644
--- a/pym/portage/sync/modules/svn/svn.py
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -62,6 +62,10 @@ class SVNSync(SyncBase):
@rtype: (int, bool)
"""
 
+   exitcode, d = self._svn_upgrade()
+   if exitcode != os.EX_OK:
+   return (exitcode, False)
+
svn_root = self.repo.sync_uri
 
if svn_root.startswith("svn://"):
@@ -79,3 +83,22 @@ class SVNSync(SyncBase):
self.logger(self.xterm_titles, msg)
writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
return (exitcode, False)
+
+
+   def _svn_upgrade(self):
+   """
+   Internal function which performs an svn upgrade on the repo
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+   exitcode = portage.process.spawn_bash(
+   "cd %s; exec svn upgrade" %
+   (portage._shell_quote(self.repo.location),),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn upgrade error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)



[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-09-26 Thread Brian Dolbec
commit: 95e96778a2ccc3aaa441aae544371d299f1d07c8
Author: David Heidelberger  ixit  cz>
AuthorDate: Mon Jun 16 16:04:06 2014 +
Commit: Brian Dolbec  gmail  com>
CommitDate: Sat Sep 27 01:40:45 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=95e96778

portage/sync/modules: Add svn sync module

Module submitted by: David Heidelberger
edits by Brian Dolbec :
Remove CheckSVNConfig class.
Use the default CheckSyncConfig class instead.
Copying the sync-cvs-repo option from the cvs module was incorrect and not 
needed.
Fixed the new()'s spawn_bash(...) call.

---
 pym/portage/sync/modules/svn/__init__.py | 32 +
 pym/portage/sync/modules/svn/svn.py  | 81 
 2 files changed, 113 insertions(+)

diff --git a/pym/portage/sync/modules/svn/__init__.py 
b/pym/portage/sync/modules/svn/__init__.py
new file mode 100644
index 000..1fda55a
--- /dev/null
+++ b/pym/portage/sync/modules/svn/__init__.py
@@ -0,0 +1,32 @@
+# Copyright 2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+"""SVN plug-in module for portage.
+Performs a svn up on repositories
+"""
+
+
+from portage.localization import _
+from portage.sync.config_checks import CheckSyncConfig
+from portage.util import writemsg_level
+
+
+module_spec = {
+   'name': 'svn',
+   'description': __doc__,
+   'provides':{
+   'svn-module': {
+   'name': "svn",
+   'class': "SVNSync",
+   'description': __doc__,
+   'functions': ['sync', 'new', 'exists'],
+   'func_desc': {
+   'sync': 'Performs a svn up 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 SVN repository',
+   },
+   'validate_config': CheckSyncConfig,
+   }
+   }
+}

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
new file mode 100644
index 000..182a7ac
--- /dev/null
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -0,0 +1,81 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+import logging
+import errno
+
+import portage
+from portage import os
+from portage.util import writemsg_level
+from portage.sync.syncbase import SyncBase
+
+
+class SVNSync(SyncBase):
+   '''SVN sync module'''
+
+   short_desc = "Perform sync operations on SVN repositories"
+
+   @staticmethod
+   def name():
+   return "SVNSync"
+
+
+   def __init__(self):
+   SyncBase.__init__(self, "svn", "dev-vcs/subversion")
+
+
+   def new(self, **kwargs):
+   if kwargs:
+   self._kwargs(kwargs)
+   #initial checkout
+   msg = ">>> Starting initial svn checkout with %s..." % 
self.repo.sync_uri
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n")
+   try:
+   os.rmdir(self.repo.location)
+   except OSError as e:
+   if e.errno != errno.ENOENT:
+   msg = "!!! existing '%s' directory; exiting." % 
self.repo.location
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (1, False)
+   del e
+   svn_root = self.repo.sync_uri
+   exitcode =  portage.process.spawn_bash(
+   "cd %s; exec svn %s" %
+   
(portage._shell_quote(os.path.dirname(self.repo.location)),
+   portage._shell_quote(svn_root)),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn checkout error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)
+
+
+   def _sync(self):
+   """
+   Internal function to sync an existing SVN repository
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+
+   svn_root = self.repo.sync_uri
+
+   if svn_root.startswith("svn://"):
+   svn_root = svn_root[6:]
+   #svn update
+   msg = ">>> Starting svn update with %s..." % 
self.repo.

[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-09-29 Thread Brian Dolbec
commit: 53430a1d9a1452d152f590672b0e073011cf3552
Author: David Heidelberger  ixit  cz>
AuthorDate: Mon Jun 16 16:04:06 2014 +
Commit: Brian Dolbec  gmail  com>
CommitDate: Mon Sep 29 17:20:21 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=53430a1d

portage/sync/modules: Add svn sync module

Module submitted by: David Heidelberger
edits by Brian Dolbec :
Remove CheckSVNConfig class.
Use the default CheckSyncConfig class instead.
Copying the sync-cvs-repo option from the cvs module was incorrect and not 
needed.
Fixed the new()'s spawn_bash(...) call.

---
 pym/portage/sync/modules/svn/__init__.py | 32 +
 pym/portage/sync/modules/svn/svn.py  | 81 
 2 files changed, 113 insertions(+)

diff --git a/pym/portage/sync/modules/svn/__init__.py 
b/pym/portage/sync/modules/svn/__init__.py
new file mode 100644
index 000..1fda55a
--- /dev/null
+++ b/pym/portage/sync/modules/svn/__init__.py
@@ -0,0 +1,32 @@
+# Copyright 2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+"""SVN plug-in module for portage.
+Performs a svn up on repositories
+"""
+
+
+from portage.localization import _
+from portage.sync.config_checks import CheckSyncConfig
+from portage.util import writemsg_level
+
+
+module_spec = {
+   'name': 'svn',
+   'description': __doc__,
+   'provides':{
+   'svn-module': {
+   'name': "svn",
+   'class': "SVNSync",
+   'description': __doc__,
+   'functions': ['sync', 'new', 'exists'],
+   'func_desc': {
+   'sync': 'Performs a svn up 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 SVN repository',
+   },
+   'validate_config': CheckSyncConfig,
+   }
+   }
+}

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
new file mode 100644
index 000..182a7ac
--- /dev/null
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -0,0 +1,81 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+import logging
+import errno
+
+import portage
+from portage import os
+from portage.util import writemsg_level
+from portage.sync.syncbase import SyncBase
+
+
+class SVNSync(SyncBase):
+   '''SVN sync module'''
+
+   short_desc = "Perform sync operations on SVN repositories"
+
+   @staticmethod
+   def name():
+   return "SVNSync"
+
+
+   def __init__(self):
+   SyncBase.__init__(self, "svn", "dev-vcs/subversion")
+
+
+   def new(self, **kwargs):
+   if kwargs:
+   self._kwargs(kwargs)
+   #initial checkout
+   msg = ">>> Starting initial svn checkout with %s..." % 
self.repo.sync_uri
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n")
+   try:
+   os.rmdir(self.repo.location)
+   except OSError as e:
+   if e.errno != errno.ENOENT:
+   msg = "!!! existing '%s' directory; exiting." % 
self.repo.location
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (1, False)
+   del e
+   svn_root = self.repo.sync_uri
+   exitcode =  portage.process.spawn_bash(
+   "cd %s; exec svn %s" %
+   
(portage._shell_quote(os.path.dirname(self.repo.location)),
+   portage._shell_quote(svn_root)),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn checkout error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)
+
+
+   def _sync(self):
+   """
+   Internal function to sync an existing SVN repository
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+
+   svn_root = self.repo.sync_uri
+
+   if svn_root.startswith("svn://"):
+   svn_root = svn_root[6:]
+   #svn update
+   msg = ">>> Starting svn update with %s..." % 
self.repo.

[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-09-29 Thread Brian Dolbec
commit: 55ab0b8c43533defa8f676df699c7b2471fccb6f
Author: Brian Dolbec  gentoo  org>
AuthorDate: Mon Jun 16 17:58:09 2014 +
Commit: Brian Dolbec  gmail  com>
CommitDate: Mon Sep 29 17:20:21 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=55ab0b8c

sync/modules/svn: Add snv upgrade to sync operation

This prevents errors when a newer svn has been installed that requires a db 
upgrade.

---
 pym/portage/sync/modules/svn/svn.py | 23 +++
 1 file changed, 23 insertions(+)

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
index 182a7ac..0365e90 100644
--- a/pym/portage/sync/modules/svn/svn.py
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -62,6 +62,10 @@ class SVNSync(SyncBase):
@rtype: (int, bool)
"""
 
+   exitcode, d = self._svn_upgrade()
+   if exitcode != os.EX_OK:
+   return (exitcode, False)
+
svn_root = self.repo.sync_uri
 
if svn_root.startswith("svn://"):
@@ -79,3 +83,22 @@ class SVNSync(SyncBase):
self.logger(self.xterm_titles, msg)
writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
return (exitcode, False)
+
+
+   def _svn_upgrade(self):
+   """
+   Internal function which performs an svn upgrade on the repo
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+   exitcode = portage.process.spawn_bash(
+   "cd %s; exec svn upgrade" %
+   (portage._shell_quote(self.repo.location),),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn upgrade error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)



[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-09-29 Thread Brian Dolbec
commit: 0f80a9bce939874c51a83a9fea63905bbfd47675
Author: Brian Dolbec  gentoo  org>
AuthorDate: Mon Jun 16 17:58:09 2014 +
Commit: Brian Dolbec  gmail  com>
CommitDate: Tue Sep 30 00:42:26 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=0f80a9bc

sync/modules/svn: Add snv upgrade to sync operation

This prevents errors when a newer svn has been installed that requires a db 
upgrade.

---
 pym/portage/sync/modules/svn/svn.py | 23 +++
 1 file changed, 23 insertions(+)

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
index 182a7ac..0365e90 100644
--- a/pym/portage/sync/modules/svn/svn.py
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -62,6 +62,10 @@ class SVNSync(SyncBase):
@rtype: (int, bool)
"""
 
+   exitcode, d = self._svn_upgrade()
+   if exitcode != os.EX_OK:
+   return (exitcode, False)
+
svn_root = self.repo.sync_uri
 
if svn_root.startswith("svn://"):
@@ -79,3 +83,22 @@ class SVNSync(SyncBase):
self.logger(self.xterm_titles, msg)
writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
return (exitcode, False)
+
+
+   def _svn_upgrade(self):
+   """
+   Internal function which performs an svn upgrade on the repo
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+   exitcode = portage.process.spawn_bash(
+   "cd %s; exec svn upgrade" %
+   (portage._shell_quote(self.repo.location),),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn upgrade error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)



[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-09-29 Thread Brian Dolbec
commit: d524b7285c973385c90e272829bda8b727cd5f54
Author: David Heidelberger  ixit  cz>
AuthorDate: Mon Jun 16 16:04:06 2014 +
Commit: Brian Dolbec  gmail  com>
CommitDate: Tue Sep 30 00:42:26 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=d524b728

portage/sync/modules: Add svn sync module

Module submitted by: David Heidelberger
edits by Brian Dolbec :
Remove CheckSVNConfig class.
Use the default CheckSyncConfig class instead.
Copying the sync-cvs-repo option from the cvs module was incorrect and not 
needed.
Fixed the new()'s spawn_bash(...) call.

---
 pym/portage/sync/modules/svn/__init__.py | 32 +
 pym/portage/sync/modules/svn/svn.py  | 81 
 2 files changed, 113 insertions(+)

diff --git a/pym/portage/sync/modules/svn/__init__.py 
b/pym/portage/sync/modules/svn/__init__.py
new file mode 100644
index 000..1fda55a
--- /dev/null
+++ b/pym/portage/sync/modules/svn/__init__.py
@@ -0,0 +1,32 @@
+# Copyright 2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+"""SVN plug-in module for portage.
+Performs a svn up on repositories
+"""
+
+
+from portage.localization import _
+from portage.sync.config_checks import CheckSyncConfig
+from portage.util import writemsg_level
+
+
+module_spec = {
+   'name': 'svn',
+   'description': __doc__,
+   'provides':{
+   'svn-module': {
+   'name': "svn",
+   'class': "SVNSync",
+   'description': __doc__,
+   'functions': ['sync', 'new', 'exists'],
+   'func_desc': {
+   'sync': 'Performs a svn up 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 SVN repository',
+   },
+   'validate_config': CheckSyncConfig,
+   }
+   }
+}

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
new file mode 100644
index 000..182a7ac
--- /dev/null
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -0,0 +1,81 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+import logging
+import errno
+
+import portage
+from portage import os
+from portage.util import writemsg_level
+from portage.sync.syncbase import SyncBase
+
+
+class SVNSync(SyncBase):
+   '''SVN sync module'''
+
+   short_desc = "Perform sync operations on SVN repositories"
+
+   @staticmethod
+   def name():
+   return "SVNSync"
+
+
+   def __init__(self):
+   SyncBase.__init__(self, "svn", "dev-vcs/subversion")
+
+
+   def new(self, **kwargs):
+   if kwargs:
+   self._kwargs(kwargs)
+   #initial checkout
+   msg = ">>> Starting initial svn checkout with %s..." % 
self.repo.sync_uri
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n")
+   try:
+   os.rmdir(self.repo.location)
+   except OSError as e:
+   if e.errno != errno.ENOENT:
+   msg = "!!! existing '%s' directory; exiting." % 
self.repo.location
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (1, False)
+   del e
+   svn_root = self.repo.sync_uri
+   exitcode =  portage.process.spawn_bash(
+   "cd %s; exec svn %s" %
+   
(portage._shell_quote(os.path.dirname(self.repo.location)),
+   portage._shell_quote(svn_root)),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn checkout error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)
+
+
+   def _sync(self):
+   """
+   Internal function to sync an existing SVN repository
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+
+   svn_root = self.repo.sync_uri
+
+   if svn_root.startswith("svn://"):
+   svn_root = svn_root[6:]
+   #svn update
+   msg = ">>> Starting svn update with %s..." % 
self.repo.

[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-10-19 Thread Zac Medico
commit: 3e03d6b00b90d45a570cca06289e74603d76ca3d
Author: David Heidelberger  ixit  cz>
AuthorDate: Mon Jun 16 16:04:06 2014 +
Commit: Zac Medico  gentoo  org>
CommitDate: Mon Oct 20 03:48:34 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=3e03d6b0

portage/sync/modules: Add svn sync module

Module submitted by: David Heidelberger
edits by Brian Dolbec :
Remove CheckSVNConfig class.
Use the default CheckSyncConfig class instead.
Copying the sync-cvs-repo option from the cvs module was incorrect and not 
needed.
Fixed the new()'s spawn_bash(...) call.

---
 pym/portage/sync/modules/svn/__init__.py | 32 +
 pym/portage/sync/modules/svn/svn.py  | 81 
 2 files changed, 113 insertions(+)

diff --git a/pym/portage/sync/modules/svn/__init__.py 
b/pym/portage/sync/modules/svn/__init__.py
new file mode 100644
index 000..1fda55a
--- /dev/null
+++ b/pym/portage/sync/modules/svn/__init__.py
@@ -0,0 +1,32 @@
+# Copyright 2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+"""SVN plug-in module for portage.
+Performs a svn up on repositories
+"""
+
+
+from portage.localization import _
+from portage.sync.config_checks import CheckSyncConfig
+from portage.util import writemsg_level
+
+
+module_spec = {
+   'name': 'svn',
+   'description': __doc__,
+   'provides':{
+   'svn-module': {
+   'name': "svn",
+   'class': "SVNSync",
+   'description': __doc__,
+   'functions': ['sync', 'new', 'exists'],
+   'func_desc': {
+   'sync': 'Performs a svn up 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 SVN repository',
+   },
+   'validate_config': CheckSyncConfig,
+   }
+   }
+}

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
new file mode 100644
index 000..182a7ac
--- /dev/null
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -0,0 +1,81 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+import logging
+import errno
+
+import portage
+from portage import os
+from portage.util import writemsg_level
+from portage.sync.syncbase import SyncBase
+
+
+class SVNSync(SyncBase):
+   '''SVN sync module'''
+
+   short_desc = "Perform sync operations on SVN repositories"
+
+   @staticmethod
+   def name():
+   return "SVNSync"
+
+
+   def __init__(self):
+   SyncBase.__init__(self, "svn", "dev-vcs/subversion")
+
+
+   def new(self, **kwargs):
+   if kwargs:
+   self._kwargs(kwargs)
+   #initial checkout
+   msg = ">>> Starting initial svn checkout with %s..." % 
self.repo.sync_uri
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n")
+   try:
+   os.rmdir(self.repo.location)
+   except OSError as e:
+   if e.errno != errno.ENOENT:
+   msg = "!!! existing '%s' directory; exiting." % 
self.repo.location
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (1, False)
+   del e
+   svn_root = self.repo.sync_uri
+   exitcode =  portage.process.spawn_bash(
+   "cd %s; exec svn %s" %
+   
(portage._shell_quote(os.path.dirname(self.repo.location)),
+   portage._shell_quote(svn_root)),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn checkout error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)
+
+
+   def _sync(self):
+   """
+   Internal function to sync an existing SVN repository
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+
+   svn_root = self.repo.sync_uri
+
+   if svn_root.startswith("svn://"):
+   svn_root = svn_root[6:]
+   #svn update
+   msg = ">>> Starting svn update with %s..." % 
self.repo.s

[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-10-19 Thread Zac Medico
commit: 9132fdaedfcb8aac0cebdc4154120fbf45b04a42
Author: Brian Dolbec  gentoo  org>
AuthorDate: Mon Jun 16 17:58:09 2014 +
Commit: Zac Medico  gentoo  org>
CommitDate: Mon Oct 20 03:48:34 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=9132fdae

sync/modules/svn: Add snv upgrade to sync operation

This prevents errors when a newer svn has been installed that requires a db 
upgrade.

---
 pym/portage/sync/modules/svn/svn.py | 23 +++
 1 file changed, 23 insertions(+)

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
index 182a7ac..0365e90 100644
--- a/pym/portage/sync/modules/svn/svn.py
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -62,6 +62,10 @@ class SVNSync(SyncBase):
@rtype: (int, bool)
"""
 
+   exitcode, d = self._svn_upgrade()
+   if exitcode != os.EX_OK:
+   return (exitcode, False)
+
svn_root = self.repo.sync_uri
 
if svn_root.startswith("svn://"):
@@ -79,3 +83,22 @@ class SVNSync(SyncBase):
self.logger(self.xterm_titles, msg)
writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
return (exitcode, False)
+
+
+   def _svn_upgrade(self):
+   """
+   Internal function which performs an svn upgrade on the repo
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+   exitcode = portage.process.spawn_bash(
+   "cd %s; exec svn upgrade" %
+   (portage._shell_quote(self.repo.location),),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn upgrade error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)



[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-10-20 Thread Zac Medico
commit: a56ee8b456ea059f92e5e4fd142cde85be249a23
Author: David Heidelberger  ixit  cz>
AuthorDate: Mon Jun 16 16:04:06 2014 +
Commit: Zac Medico  gentoo  org>
CommitDate: Tue Oct 21 05:04:07 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=a56ee8b4

portage/sync/modules: Add svn sync module

Module submitted by: David Heidelberger
edits by Brian Dolbec :
Remove CheckSVNConfig class.
Use the default CheckSyncConfig class instead.
Copying the sync-cvs-repo option from the cvs module was incorrect and not 
needed.
Fixed the new()'s spawn_bash(...) call.

---
 pym/portage/sync/modules/svn/__init__.py | 32 +
 pym/portage/sync/modules/svn/svn.py  | 81 
 2 files changed, 113 insertions(+)

diff --git a/pym/portage/sync/modules/svn/__init__.py 
b/pym/portage/sync/modules/svn/__init__.py
new file mode 100644
index 000..1fda55a
--- /dev/null
+++ b/pym/portage/sync/modules/svn/__init__.py
@@ -0,0 +1,32 @@
+# Copyright 2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+"""SVN plug-in module for portage.
+Performs a svn up on repositories
+"""
+
+
+from portage.localization import _
+from portage.sync.config_checks import CheckSyncConfig
+from portage.util import writemsg_level
+
+
+module_spec = {
+   'name': 'svn',
+   'description': __doc__,
+   'provides':{
+   'svn-module': {
+   'name': "svn",
+   'class': "SVNSync",
+   'description': __doc__,
+   'functions': ['sync', 'new', 'exists'],
+   'func_desc': {
+   'sync': 'Performs a svn up 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 SVN repository',
+   },
+   'validate_config': CheckSyncConfig,
+   }
+   }
+}

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
new file mode 100644
index 000..182a7ac
--- /dev/null
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -0,0 +1,81 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+import logging
+import errno
+
+import portage
+from portage import os
+from portage.util import writemsg_level
+from portage.sync.syncbase import SyncBase
+
+
+class SVNSync(SyncBase):
+   '''SVN sync module'''
+
+   short_desc = "Perform sync operations on SVN repositories"
+
+   @staticmethod
+   def name():
+   return "SVNSync"
+
+
+   def __init__(self):
+   SyncBase.__init__(self, "svn", "dev-vcs/subversion")
+
+
+   def new(self, **kwargs):
+   if kwargs:
+   self._kwargs(kwargs)
+   #initial checkout
+   msg = ">>> Starting initial svn checkout with %s..." % 
self.repo.sync_uri
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n")
+   try:
+   os.rmdir(self.repo.location)
+   except OSError as e:
+   if e.errno != errno.ENOENT:
+   msg = "!!! existing '%s' directory; exiting." % 
self.repo.location
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (1, False)
+   del e
+   svn_root = self.repo.sync_uri
+   exitcode =  portage.process.spawn_bash(
+   "cd %s; exec svn %s" %
+   
(portage._shell_quote(os.path.dirname(self.repo.location)),
+   portage._shell_quote(svn_root)),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn checkout error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)
+
+
+   def _sync(self):
+   """
+   Internal function to sync an existing SVN repository
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+
+   svn_root = self.repo.sync_uri
+
+   if svn_root.startswith("svn://"):
+   svn_root = svn_root[6:]
+   #svn update
+   msg = ">>> Starting svn update with %s..." % 
self.repo.s

[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-10-20 Thread Zac Medico
commit: 8ba80d4cf6d4af4e6c1d59c3c0bf732ea224aea4
Author: Brian Dolbec  gentoo  org>
AuthorDate: Mon Jun 16 17:58:09 2014 +
Commit: Zac Medico  gentoo  org>
CommitDate: Tue Oct 21 05:04:07 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=8ba80d4c

sync/modules/svn: Add snv upgrade to sync operation

This prevents errors when a newer svn has been installed that requires a db 
upgrade.

---
 pym/portage/sync/modules/svn/svn.py | 23 +++
 1 file changed, 23 insertions(+)

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
index 182a7ac..0365e90 100644
--- a/pym/portage/sync/modules/svn/svn.py
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -62,6 +62,10 @@ class SVNSync(SyncBase):
@rtype: (int, bool)
"""
 
+   exitcode, d = self._svn_upgrade()
+   if exitcode != os.EX_OK:
+   return (exitcode, False)
+
svn_root = self.repo.sync_uri
 
if svn_root.startswith("svn://"):
@@ -79,3 +83,22 @@ class SVNSync(SyncBase):
self.logger(self.xterm_titles, msg)
writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
return (exitcode, False)
+
+
+   def _svn_upgrade(self):
+   """
+   Internal function which performs an svn upgrade on the repo
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+   exitcode = portage.process.spawn_bash(
+   "cd %s; exec svn upgrade" %
+   (portage._shell_quote(self.repo.location),),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn upgrade error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)



[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-12-01 Thread Michał Górny
commit: 461159f48621bb8e7e0d20fa1937885956d979d0
Author: David Heidelberger  ixit  cz>
AuthorDate: Mon Jun 16 16:04:06 2014 +
Commit: Michał Górny  gentoo  org>
CommitDate: Mon Dec  1 21:49:40 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=461159f4

portage/sync/modules: Add svn sync module

Module submitted by: David Heidelberger
edits by Brian Dolbec :
Remove CheckSVNConfig class.
Use the default CheckSyncConfig class instead.
Copying the sync-cvs-repo option from the cvs module was incorrect and not 
needed.
Fixed the new()'s spawn_bash(...) call.

---
 pym/portage/sync/modules/svn/__init__.py | 32 +
 pym/portage/sync/modules/svn/svn.py  | 81 
 2 files changed, 113 insertions(+)

diff --git a/pym/portage/sync/modules/svn/__init__.py 
b/pym/portage/sync/modules/svn/__init__.py
new file mode 100644
index 000..1fda55a
--- /dev/null
+++ b/pym/portage/sync/modules/svn/__init__.py
@@ -0,0 +1,32 @@
+# Copyright 2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+"""SVN plug-in module for portage.
+Performs a svn up on repositories
+"""
+
+
+from portage.localization import _
+from portage.sync.config_checks import CheckSyncConfig
+from portage.util import writemsg_level
+
+
+module_spec = {
+   'name': 'svn',
+   'description': __doc__,
+   'provides':{
+   'svn-module': {
+   'name': "svn",
+   'class': "SVNSync",
+   'description': __doc__,
+   'functions': ['sync', 'new', 'exists'],
+   'func_desc': {
+   'sync': 'Performs a svn up 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 SVN repository',
+   },
+   'validate_config': CheckSyncConfig,
+   }
+   }
+}

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
new file mode 100644
index 000..182a7ac
--- /dev/null
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -0,0 +1,81 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+import logging
+import errno
+
+import portage
+from portage import os
+from portage.util import writemsg_level
+from portage.sync.syncbase import SyncBase
+
+
+class SVNSync(SyncBase):
+   '''SVN sync module'''
+
+   short_desc = "Perform sync operations on SVN repositories"
+
+   @staticmethod
+   def name():
+   return "SVNSync"
+
+
+   def __init__(self):
+   SyncBase.__init__(self, "svn", "dev-vcs/subversion")
+
+
+   def new(self, **kwargs):
+   if kwargs:
+   self._kwargs(kwargs)
+   #initial checkout
+   msg = ">>> Starting initial svn checkout with %s..." % 
self.repo.sync_uri
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n")
+   try:
+   os.rmdir(self.repo.location)
+   except OSError as e:
+   if e.errno != errno.ENOENT:
+   msg = "!!! existing '%s' directory; exiting." % 
self.repo.location
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (1, False)
+   del e
+   svn_root = self.repo.sync_uri
+   exitcode =  portage.process.spawn_bash(
+   "cd %s; exec svn %s" %
+   
(portage._shell_quote(os.path.dirname(self.repo.location)),
+   portage._shell_quote(svn_root)),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn checkout error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)
+
+
+   def _sync(self):
+   """
+   Internal function to sync an existing SVN repository
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+
+   svn_root = self.repo.sync_uri
+
+   if svn_root.startswith("svn://"):
+   svn_root = svn_root[6:]
+   #svn update
+   msg = ">>> Starting svn update with %s..." % 
self.repo

[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-12-01 Thread Michał Górny
commit: 94be45b625a8ddb7bd6c3472c1ca012f3461317e
Author: Brian Dolbec  gentoo  org>
AuthorDate: Mon Jun 16 17:58:09 2014 +
Commit: Michał Górny  gentoo  org>
CommitDate: Mon Dec  1 21:49:40 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=94be45b6

sync/modules/svn: Add snv upgrade to sync operation

This prevents errors when a newer svn has been installed that requires a db 
upgrade.

---
 pym/portage/sync/modules/svn/svn.py | 23 +++
 1 file changed, 23 insertions(+)

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
index 182a7ac..0365e90 100644
--- a/pym/portage/sync/modules/svn/svn.py
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -62,6 +62,10 @@ class SVNSync(SyncBase):
@rtype: (int, bool)
"""
 
+   exitcode, d = self._svn_upgrade()
+   if exitcode != os.EX_OK:
+   return (exitcode, False)
+
svn_root = self.repo.sync_uri
 
if svn_root.startswith("svn://"):
@@ -79,3 +83,22 @@ class SVNSync(SyncBase):
self.logger(self.xterm_titles, msg)
writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
return (exitcode, False)
+
+
+   def _svn_upgrade(self):
+   """
+   Internal function which performs an svn upgrade on the repo
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+   exitcode = portage.process.spawn_bash(
+   "cd %s; exec svn upgrade" %
+   (portage._shell_quote(self.repo.location),),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn upgrade error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)



[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-12-04 Thread Brian Dolbec
commit: 9831dd2fbd8889ee4c1738813b6a9c4c78c36e8c
Author: Brian Dolbec  gentoo  org>
AuthorDate: Mon Jun 16 17:58:09 2014 +
Commit: Brian Dolbec  gmail  com>
CommitDate: Thu Dec  4 19:56:33 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=9831dd2f

sync/modules/svn: Add snv upgrade to sync operation

This prevents errors when a newer svn has been installed that requires a db 
upgrade.

---
 pym/portage/sync/modules/svn/svn.py | 23 +++
 1 file changed, 23 insertions(+)

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
index 182a7ac..0365e90 100644
--- a/pym/portage/sync/modules/svn/svn.py
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -62,6 +62,10 @@ class SVNSync(SyncBase):
@rtype: (int, bool)
"""
 
+   exitcode, d = self._svn_upgrade()
+   if exitcode != os.EX_OK:
+   return (exitcode, False)
+
svn_root = self.repo.sync_uri
 
if svn_root.startswith("svn://"):
@@ -79,3 +83,22 @@ class SVNSync(SyncBase):
self.logger(self.xterm_titles, msg)
writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
return (exitcode, False)
+
+
+   def _svn_upgrade(self):
+   """
+   Internal function which performs an svn upgrade on the repo
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+   exitcode = portage.process.spawn_bash(
+   "cd %s; exec svn upgrade" %
+   (portage._shell_quote(self.repo.location),),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn upgrade error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)



[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-09-03 Thread Brian Dolbec
commit: 9bc13ae7c9a6892c9fe0f998b0473c9a1dfca656
Author: Brian Dolbec  gentoo  org>
AuthorDate: Mon Jun 16 17:58:09 2014 +
Commit: Brian Dolbec  gmail  com>
CommitDate: Wed Sep  3 23:34:54 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=9bc13ae7

sync/modules/svn: Add snv upgrade to sync operation

This prevents errors when a newer svn has been installed that requires a db 
upgrade.

---
 pym/portage/sync/modules/svn/svn.py | 23 +++
 1 file changed, 23 insertions(+)

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
index 182a7ac..0365e90 100644
--- a/pym/portage/sync/modules/svn/svn.py
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -62,6 +62,10 @@ class SVNSync(SyncBase):
@rtype: (int, bool)
"""
 
+   exitcode, d = self._svn_upgrade()
+   if exitcode != os.EX_OK:
+   return (exitcode, False)
+
svn_root = self.repo.sync_uri
 
if svn_root.startswith("svn://"):
@@ -79,3 +83,22 @@ class SVNSync(SyncBase):
self.logger(self.xterm_titles, msg)
writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
return (exitcode, False)
+
+
+   def _svn_upgrade(self):
+   """
+   Internal function which performs an svn upgrade on the repo
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+   exitcode = portage.process.spawn_bash(
+   "cd %s; exec svn upgrade" %
+   (portage._shell_quote(self.repo.location),),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn upgrade error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)



[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-09-03 Thread Brian Dolbec
commit: 2aa70957a16dad2a5f66ac11e88c4c81d45833fa
Author: David Heidelberger  ixit  cz>
AuthorDate: Mon Jun 16 16:04:06 2014 +
Commit: Brian Dolbec  gmail  com>
CommitDate: Wed Sep  3 23:34:54 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=2aa70957

portage/sync/modules: Add svn sync module

Module submitted by: David Heidelberger
edits by Brian Dolbec :
Remove CheckSVNConfig class.
Use the default CheckSyncConfig class instead.
Copying the sync-cvs-repo option from the cvs module was incorrect and not 
needed.
Fixed the new()'s spawn_bash(...) call.

---
 pym/portage/sync/modules/svn/__init__.py | 32 +
 pym/portage/sync/modules/svn/svn.py  | 81 
 2 files changed, 113 insertions(+)

diff --git a/pym/portage/sync/modules/svn/__init__.py 
b/pym/portage/sync/modules/svn/__init__.py
new file mode 100644
index 000..1fda55a
--- /dev/null
+++ b/pym/portage/sync/modules/svn/__init__.py
@@ -0,0 +1,32 @@
+# Copyright 2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+"""SVN plug-in module for portage.
+Performs a svn up on repositories
+"""
+
+
+from portage.localization import _
+from portage.sync.config_checks import CheckSyncConfig
+from portage.util import writemsg_level
+
+
+module_spec = {
+   'name': 'svn',
+   'description': __doc__,
+   'provides':{
+   'svn-module': {
+   'name': "svn",
+   'class': "SVNSync",
+   'description': __doc__,
+   'functions': ['sync', 'new', 'exists'],
+   'func_desc': {
+   'sync': 'Performs a svn up 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 SVN repository',
+   },
+   'validate_config': CheckSyncConfig,
+   }
+   }
+}

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
new file mode 100644
index 000..182a7ac
--- /dev/null
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -0,0 +1,81 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+import logging
+import errno
+
+import portage
+from portage import os
+from portage.util import writemsg_level
+from portage.sync.syncbase import SyncBase
+
+
+class SVNSync(SyncBase):
+   '''SVN sync module'''
+
+   short_desc = "Perform sync operations on SVN repositories"
+
+   @staticmethod
+   def name():
+   return "SVNSync"
+
+
+   def __init__(self):
+   SyncBase.__init__(self, "svn", "dev-vcs/subversion")
+
+
+   def new(self, **kwargs):
+   if kwargs:
+   self._kwargs(kwargs)
+   #initial checkout
+   msg = ">>> Starting initial svn checkout with %s..." % 
self.repo.sync_uri
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n")
+   try:
+   os.rmdir(self.repo.location)
+   except OSError as e:
+   if e.errno != errno.ENOENT:
+   msg = "!!! existing '%s' directory; exiting." % 
self.repo.location
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (1, False)
+   del e
+   svn_root = self.repo.sync_uri
+   exitcode =  portage.process.spawn_bash(
+   "cd %s; exec svn %s" %
+   
(portage._shell_quote(os.path.dirname(self.repo.location)),
+   portage._shell_quote(svn_root)),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn checkout error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)
+
+
+   def _sync(self):
+   """
+   Internal function to sync an existing SVN repository
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+
+   svn_root = self.repo.sync_uri
+
+   if svn_root.startswith("svn://"):
+   svn_root = svn_root[6:]
+   #svn update
+   msg = ">>> Starting svn update with %s..." % 
self.repo.

[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-09-03 Thread Brian Dolbec
commit: 2cb2c8b506a36dabeba3e1aaa6c1ecb9405a5e40
Author: David Heidelberger  ixit  cz>
AuthorDate: Mon Jun 16 16:04:06 2014 +
Commit: Brian Dolbec  gmail  com>
CommitDate: Thu Sep  4 01:18:02 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=2cb2c8b5

portage/sync/modules: Add svn sync module

Module submitted by: David Heidelberger
edits by Brian Dolbec :
Remove CheckSVNConfig class.
Use the default CheckSyncConfig class instead.
Copying the sync-cvs-repo option from the cvs module was incorrect and not 
needed.
Fixed the new()'s spawn_bash(...) call.

---
 pym/portage/sync/modules/svn/__init__.py | 32 +
 pym/portage/sync/modules/svn/svn.py  | 81 
 2 files changed, 113 insertions(+)

diff --git a/pym/portage/sync/modules/svn/__init__.py 
b/pym/portage/sync/modules/svn/__init__.py
new file mode 100644
index 000..1fda55a
--- /dev/null
+++ b/pym/portage/sync/modules/svn/__init__.py
@@ -0,0 +1,32 @@
+# Copyright 2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+"""SVN plug-in module for portage.
+Performs a svn up on repositories
+"""
+
+
+from portage.localization import _
+from portage.sync.config_checks import CheckSyncConfig
+from portage.util import writemsg_level
+
+
+module_spec = {
+   'name': 'svn',
+   'description': __doc__,
+   'provides':{
+   'svn-module': {
+   'name': "svn",
+   'class': "SVNSync",
+   'description': __doc__,
+   'functions': ['sync', 'new', 'exists'],
+   'func_desc': {
+   'sync': 'Performs a svn up 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 SVN repository',
+   },
+   'validate_config': CheckSyncConfig,
+   }
+   }
+}

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
new file mode 100644
index 000..182a7ac
--- /dev/null
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -0,0 +1,81 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+import logging
+import errno
+
+import portage
+from portage import os
+from portage.util import writemsg_level
+from portage.sync.syncbase import SyncBase
+
+
+class SVNSync(SyncBase):
+   '''SVN sync module'''
+
+   short_desc = "Perform sync operations on SVN repositories"
+
+   @staticmethod
+   def name():
+   return "SVNSync"
+
+
+   def __init__(self):
+   SyncBase.__init__(self, "svn", "dev-vcs/subversion")
+
+
+   def new(self, **kwargs):
+   if kwargs:
+   self._kwargs(kwargs)
+   #initial checkout
+   msg = ">>> Starting initial svn checkout with %s..." % 
self.repo.sync_uri
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n")
+   try:
+   os.rmdir(self.repo.location)
+   except OSError as e:
+   if e.errno != errno.ENOENT:
+   msg = "!!! existing '%s' directory; exiting." % 
self.repo.location
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (1, False)
+   del e
+   svn_root = self.repo.sync_uri
+   exitcode =  portage.process.spawn_bash(
+   "cd %s; exec svn %s" %
+   
(portage._shell_quote(os.path.dirname(self.repo.location)),
+   portage._shell_quote(svn_root)),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn checkout error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)
+
+
+   def _sync(self):
+   """
+   Internal function to sync an existing SVN repository
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+
+   svn_root = self.repo.sync_uri
+
+   if svn_root.startswith("svn://"):
+   svn_root = svn_root[6:]
+   #svn update
+   msg = ">>> Starting svn update with %s..." % 
self.repo.

[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-09-03 Thread Brian Dolbec
commit: 30909ce1a92a067fbbe3058275818a3aab9f4daf
Author: Brian Dolbec  gentoo  org>
AuthorDate: Mon Jun 16 17:58:09 2014 +
Commit: Brian Dolbec  gmail  com>
CommitDate: Thu Sep  4 01:18:02 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=30909ce1

sync/modules/svn: Add snv upgrade to sync operation

This prevents errors when a newer svn has been installed that requires a db 
upgrade.

---
 pym/portage/sync/modules/svn/svn.py | 23 +++
 1 file changed, 23 insertions(+)

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
index 182a7ac..0365e90 100644
--- a/pym/portage/sync/modules/svn/svn.py
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -62,6 +62,10 @@ class SVNSync(SyncBase):
@rtype: (int, bool)
"""
 
+   exitcode, d = self._svn_upgrade()
+   if exitcode != os.EX_OK:
+   return (exitcode, False)
+
svn_root = self.repo.sync_uri
 
if svn_root.startswith("svn://"):
@@ -79,3 +83,22 @@ class SVNSync(SyncBase):
self.logger(self.xterm_titles, msg)
writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
return (exitcode, False)
+
+
+   def _svn_upgrade(self):
+   """
+   Internal function which performs an svn upgrade on the repo
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+   exitcode = portage.process.spawn_bash(
+   "cd %s; exec svn upgrade" %
+   (portage._shell_quote(self.repo.location),),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn upgrade error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)



[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-09-04 Thread Brian Dolbec
commit: 2e6ccc31c3ce3ce86ce80c24e2a407fc5554f706
Author: David Heidelberger  ixit  cz>
AuthorDate: Mon Jun 16 16:04:06 2014 +
Commit: Brian Dolbec  gmail  com>
CommitDate: Thu Sep  4 07:20:42 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=2e6ccc31

portage/sync/modules: Add svn sync module

Module submitted by: David Heidelberger
edits by Brian Dolbec :
Remove CheckSVNConfig class.
Use the default CheckSyncConfig class instead.
Copying the sync-cvs-repo option from the cvs module was incorrect and not 
needed.
Fixed the new()'s spawn_bash(...) call.

---
 pym/portage/sync/modules/svn/__init__.py | 32 +
 pym/portage/sync/modules/svn/svn.py  | 81 
 2 files changed, 113 insertions(+)

diff --git a/pym/portage/sync/modules/svn/__init__.py 
b/pym/portage/sync/modules/svn/__init__.py
new file mode 100644
index 000..1fda55a
--- /dev/null
+++ b/pym/portage/sync/modules/svn/__init__.py
@@ -0,0 +1,32 @@
+# Copyright 2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+"""SVN plug-in module for portage.
+Performs a svn up on repositories
+"""
+
+
+from portage.localization import _
+from portage.sync.config_checks import CheckSyncConfig
+from portage.util import writemsg_level
+
+
+module_spec = {
+   'name': 'svn',
+   'description': __doc__,
+   'provides':{
+   'svn-module': {
+   'name': "svn",
+   'class': "SVNSync",
+   'description': __doc__,
+   'functions': ['sync', 'new', 'exists'],
+   'func_desc': {
+   'sync': 'Performs a svn up 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 SVN repository',
+   },
+   'validate_config': CheckSyncConfig,
+   }
+   }
+}

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
new file mode 100644
index 000..182a7ac
--- /dev/null
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -0,0 +1,81 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+import logging
+import errno
+
+import portage
+from portage import os
+from portage.util import writemsg_level
+from portage.sync.syncbase import SyncBase
+
+
+class SVNSync(SyncBase):
+   '''SVN sync module'''
+
+   short_desc = "Perform sync operations on SVN repositories"
+
+   @staticmethod
+   def name():
+   return "SVNSync"
+
+
+   def __init__(self):
+   SyncBase.__init__(self, "svn", "dev-vcs/subversion")
+
+
+   def new(self, **kwargs):
+   if kwargs:
+   self._kwargs(kwargs)
+   #initial checkout
+   msg = ">>> Starting initial svn checkout with %s..." % 
self.repo.sync_uri
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n")
+   try:
+   os.rmdir(self.repo.location)
+   except OSError as e:
+   if e.errno != errno.ENOENT:
+   msg = "!!! existing '%s' directory; exiting." % 
self.repo.location
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (1, False)
+   del e
+   svn_root = self.repo.sync_uri
+   exitcode =  portage.process.spawn_bash(
+   "cd %s; exec svn %s" %
+   
(portage._shell_quote(os.path.dirname(self.repo.location)),
+   portage._shell_quote(svn_root)),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn checkout error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)
+
+
+   def _sync(self):
+   """
+   Internal function to sync an existing SVN repository
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+
+   svn_root = self.repo.sync_uri
+
+   if svn_root.startswith("svn://"):
+   svn_root = svn_root[6:]
+   #svn update
+   msg = ">>> Starting svn update with %s..." % 
self.repo.

[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-09-04 Thread Brian Dolbec
commit: d2a6895c1ecabb94b5e19df12d1ee3570cf56bce
Author: Brian Dolbec  gentoo  org>
AuthorDate: Mon Jun 16 17:58:09 2014 +
Commit: Brian Dolbec  gmail  com>
CommitDate: Thu Sep  4 07:20:42 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=d2a6895c

sync/modules/svn: Add snv upgrade to sync operation

This prevents errors when a newer svn has been installed that requires a db 
upgrade.

---
 pym/portage/sync/modules/svn/svn.py | 23 +++
 1 file changed, 23 insertions(+)

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
index 182a7ac..0365e90 100644
--- a/pym/portage/sync/modules/svn/svn.py
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -62,6 +62,10 @@ class SVNSync(SyncBase):
@rtype: (int, bool)
"""
 
+   exitcode, d = self._svn_upgrade()
+   if exitcode != os.EX_OK:
+   return (exitcode, False)
+
svn_root = self.repo.sync_uri
 
if svn_root.startswith("svn://"):
@@ -79,3 +83,22 @@ class SVNSync(SyncBase):
self.logger(self.xterm_titles, msg)
writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
return (exitcode, False)
+
+
+   def _svn_upgrade(self):
+   """
+   Internal function which performs an svn upgrade on the repo
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+   exitcode = portage.process.spawn_bash(
+   "cd %s; exec svn upgrade" %
+   (portage._shell_quote(self.repo.location),),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn upgrade error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)



[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-09-05 Thread Brian Dolbec
commit: a89954dc492727902aceefad9eeac6064c3a5d42
Author: Brian Dolbec  gentoo  org>
AuthorDate: Mon Jun 16 17:58:09 2014 +
Commit: Brian Dolbec  gmail  com>
CommitDate: Fri Sep  5 20:26:14 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=a89954dc

sync/modules/svn: Add snv upgrade to sync operation

This prevents errors when a newer svn has been installed that requires a db 
upgrade.

---
 pym/portage/sync/modules/svn/svn.py | 23 +++
 1 file changed, 23 insertions(+)

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
index 182a7ac..0365e90 100644
--- a/pym/portage/sync/modules/svn/svn.py
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -62,6 +62,10 @@ class SVNSync(SyncBase):
@rtype: (int, bool)
"""
 
+   exitcode, d = self._svn_upgrade()
+   if exitcode != os.EX_OK:
+   return (exitcode, False)
+
svn_root = self.repo.sync_uri
 
if svn_root.startswith("svn://"):
@@ -79,3 +83,22 @@ class SVNSync(SyncBase):
self.logger(self.xterm_titles, msg)
writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
return (exitcode, False)
+
+
+   def _svn_upgrade(self):
+   """
+   Internal function which performs an svn upgrade on the repo
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+   exitcode = portage.process.spawn_bash(
+   "cd %s; exec svn upgrade" %
+   (portage._shell_quote(self.repo.location),),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn upgrade error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)



[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-09-05 Thread Brian Dolbec
commit: d2b019e8b9e7f3e8924a5f38c9fff991aeda223f
Author: David Heidelberger  ixit  cz>
AuthorDate: Mon Jun 16 16:04:06 2014 +
Commit: Brian Dolbec  gmail  com>
CommitDate: Fri Sep  5 20:26:14 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=d2b019e8

portage/sync/modules: Add svn sync module

Module submitted by: David Heidelberger
edits by Brian Dolbec :
Remove CheckSVNConfig class.
Use the default CheckSyncConfig class instead.
Copying the sync-cvs-repo option from the cvs module was incorrect and not 
needed.
Fixed the new()'s spawn_bash(...) call.

---
 pym/portage/sync/modules/svn/__init__.py | 32 +
 pym/portage/sync/modules/svn/svn.py  | 81 
 2 files changed, 113 insertions(+)

diff --git a/pym/portage/sync/modules/svn/__init__.py 
b/pym/portage/sync/modules/svn/__init__.py
new file mode 100644
index 000..1fda55a
--- /dev/null
+++ b/pym/portage/sync/modules/svn/__init__.py
@@ -0,0 +1,32 @@
+# Copyright 2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+"""SVN plug-in module for portage.
+Performs a svn up on repositories
+"""
+
+
+from portage.localization import _
+from portage.sync.config_checks import CheckSyncConfig
+from portage.util import writemsg_level
+
+
+module_spec = {
+   'name': 'svn',
+   'description': __doc__,
+   'provides':{
+   'svn-module': {
+   'name': "svn",
+   'class': "SVNSync",
+   'description': __doc__,
+   'functions': ['sync', 'new', 'exists'],
+   'func_desc': {
+   'sync': 'Performs a svn up 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 SVN repository',
+   },
+   'validate_config': CheckSyncConfig,
+   }
+   }
+}

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
new file mode 100644
index 000..182a7ac
--- /dev/null
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -0,0 +1,81 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+import logging
+import errno
+
+import portage
+from portage import os
+from portage.util import writemsg_level
+from portage.sync.syncbase import SyncBase
+
+
+class SVNSync(SyncBase):
+   '''SVN sync module'''
+
+   short_desc = "Perform sync operations on SVN repositories"
+
+   @staticmethod
+   def name():
+   return "SVNSync"
+
+
+   def __init__(self):
+   SyncBase.__init__(self, "svn", "dev-vcs/subversion")
+
+
+   def new(self, **kwargs):
+   if kwargs:
+   self._kwargs(kwargs)
+   #initial checkout
+   msg = ">>> Starting initial svn checkout with %s..." % 
self.repo.sync_uri
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n")
+   try:
+   os.rmdir(self.repo.location)
+   except OSError as e:
+   if e.errno != errno.ENOENT:
+   msg = "!!! existing '%s' directory; exiting." % 
self.repo.location
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (1, False)
+   del e
+   svn_root = self.repo.sync_uri
+   exitcode =  portage.process.spawn_bash(
+   "cd %s; exec svn %s" %
+   
(portage._shell_quote(os.path.dirname(self.repo.location)),
+   portage._shell_quote(svn_root)),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn checkout error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)
+
+
+   def _sync(self):
+   """
+   Internal function to sync an existing SVN repository
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+
+   svn_root = self.repo.sync_uri
+
+   if svn_root.startswith("svn://"):
+   svn_root = svn_root[6:]
+   #svn update
+   msg = ">>> Starting svn update with %s..." % 
self.repo.

[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-09-26 Thread Brian Dolbec
commit: b16889acdf7754ce5c0d0151beafde8dcb44de99
Author: Brian Dolbec  gentoo  org>
AuthorDate: Mon Jun 16 17:58:09 2014 +
Commit: Brian Dolbec  gmail  com>
CommitDate: Sat Sep 27 01:40:45 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=b16889ac

sync/modules/svn: Add snv upgrade to sync operation

This prevents errors when a newer svn has been installed that requires a db 
upgrade.

---
 pym/portage/sync/modules/svn/svn.py | 23 +++
 1 file changed, 23 insertions(+)

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
index 182a7ac..0365e90 100644
--- a/pym/portage/sync/modules/svn/svn.py
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -62,6 +62,10 @@ class SVNSync(SyncBase):
@rtype: (int, bool)
"""
 
+   exitcode, d = self._svn_upgrade()
+   if exitcode != os.EX_OK:
+   return (exitcode, False)
+
svn_root = self.repo.sync_uri
 
if svn_root.startswith("svn://"):
@@ -79,3 +83,22 @@ class SVNSync(SyncBase):
self.logger(self.xterm_titles, msg)
writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
return (exitcode, False)
+
+
+   def _svn_upgrade(self):
+   """
+   Internal function which performs an svn upgrade on the repo
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+   exitcode = portage.process.spawn_bash(
+   "cd %s; exec svn upgrade" %
+   (portage._shell_quote(self.repo.location),),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn upgrade error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)



[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-09-26 Thread Brian Dolbec
commit: 95e96778a2ccc3aaa441aae544371d299f1d07c8
Author: David Heidelberger  ixit  cz>
AuthorDate: Mon Jun 16 16:04:06 2014 +
Commit: Brian Dolbec  gmail  com>
CommitDate: Sat Sep 27 01:40:45 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=95e96778

portage/sync/modules: Add svn sync module

Module submitted by: David Heidelberger
edits by Brian Dolbec :
Remove CheckSVNConfig class.
Use the default CheckSyncConfig class instead.
Copying the sync-cvs-repo option from the cvs module was incorrect and not 
needed.
Fixed the new()'s spawn_bash(...) call.

---
 pym/portage/sync/modules/svn/__init__.py | 32 +
 pym/portage/sync/modules/svn/svn.py  | 81 
 2 files changed, 113 insertions(+)

diff --git a/pym/portage/sync/modules/svn/__init__.py 
b/pym/portage/sync/modules/svn/__init__.py
new file mode 100644
index 000..1fda55a
--- /dev/null
+++ b/pym/portage/sync/modules/svn/__init__.py
@@ -0,0 +1,32 @@
+# Copyright 2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+"""SVN plug-in module for portage.
+Performs a svn up on repositories
+"""
+
+
+from portage.localization import _
+from portage.sync.config_checks import CheckSyncConfig
+from portage.util import writemsg_level
+
+
+module_spec = {
+   'name': 'svn',
+   'description': __doc__,
+   'provides':{
+   'svn-module': {
+   'name': "svn",
+   'class': "SVNSync",
+   'description': __doc__,
+   'functions': ['sync', 'new', 'exists'],
+   'func_desc': {
+   'sync': 'Performs a svn up 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 SVN repository',
+   },
+   'validate_config': CheckSyncConfig,
+   }
+   }
+}

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
new file mode 100644
index 000..182a7ac
--- /dev/null
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -0,0 +1,81 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+import logging
+import errno
+
+import portage
+from portage import os
+from portage.util import writemsg_level
+from portage.sync.syncbase import SyncBase
+
+
+class SVNSync(SyncBase):
+   '''SVN sync module'''
+
+   short_desc = "Perform sync operations on SVN repositories"
+
+   @staticmethod
+   def name():
+   return "SVNSync"
+
+
+   def __init__(self):
+   SyncBase.__init__(self, "svn", "dev-vcs/subversion")
+
+
+   def new(self, **kwargs):
+   if kwargs:
+   self._kwargs(kwargs)
+   #initial checkout
+   msg = ">>> Starting initial svn checkout with %s..." % 
self.repo.sync_uri
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n")
+   try:
+   os.rmdir(self.repo.location)
+   except OSError as e:
+   if e.errno != errno.ENOENT:
+   msg = "!!! existing '%s' directory; exiting." % 
self.repo.location
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (1, False)
+   del e
+   svn_root = self.repo.sync_uri
+   exitcode =  portage.process.spawn_bash(
+   "cd %s; exec svn %s" %
+   
(portage._shell_quote(os.path.dirname(self.repo.location)),
+   portage._shell_quote(svn_root)),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn checkout error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)
+
+
+   def _sync(self):
+   """
+   Internal function to sync an existing SVN repository
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+
+   svn_root = self.repo.sync_uri
+
+   if svn_root.startswith("svn://"):
+   svn_root = svn_root[6:]
+   #svn update
+   msg = ">>> Starting svn update with %s..." % 
self.repo.

[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-09-29 Thread Brian Dolbec
commit: 53430a1d9a1452d152f590672b0e073011cf3552
Author: David Heidelberger  ixit  cz>
AuthorDate: Mon Jun 16 16:04:06 2014 +
Commit: Brian Dolbec  gmail  com>
CommitDate: Mon Sep 29 17:20:21 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=53430a1d

portage/sync/modules: Add svn sync module

Module submitted by: David Heidelberger
edits by Brian Dolbec :
Remove CheckSVNConfig class.
Use the default CheckSyncConfig class instead.
Copying the sync-cvs-repo option from the cvs module was incorrect and not 
needed.
Fixed the new()'s spawn_bash(...) call.

---
 pym/portage/sync/modules/svn/__init__.py | 32 +
 pym/portage/sync/modules/svn/svn.py  | 81 
 2 files changed, 113 insertions(+)

diff --git a/pym/portage/sync/modules/svn/__init__.py 
b/pym/portage/sync/modules/svn/__init__.py
new file mode 100644
index 000..1fda55a
--- /dev/null
+++ b/pym/portage/sync/modules/svn/__init__.py
@@ -0,0 +1,32 @@
+# Copyright 2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+"""SVN plug-in module for portage.
+Performs a svn up on repositories
+"""
+
+
+from portage.localization import _
+from portage.sync.config_checks import CheckSyncConfig
+from portage.util import writemsg_level
+
+
+module_spec = {
+   'name': 'svn',
+   'description': __doc__,
+   'provides':{
+   'svn-module': {
+   'name': "svn",
+   'class': "SVNSync",
+   'description': __doc__,
+   'functions': ['sync', 'new', 'exists'],
+   'func_desc': {
+   'sync': 'Performs a svn up 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 SVN repository',
+   },
+   'validate_config': CheckSyncConfig,
+   }
+   }
+}

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
new file mode 100644
index 000..182a7ac
--- /dev/null
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -0,0 +1,81 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+import logging
+import errno
+
+import portage
+from portage import os
+from portage.util import writemsg_level
+from portage.sync.syncbase import SyncBase
+
+
+class SVNSync(SyncBase):
+   '''SVN sync module'''
+
+   short_desc = "Perform sync operations on SVN repositories"
+
+   @staticmethod
+   def name():
+   return "SVNSync"
+
+
+   def __init__(self):
+   SyncBase.__init__(self, "svn", "dev-vcs/subversion")
+
+
+   def new(self, **kwargs):
+   if kwargs:
+   self._kwargs(kwargs)
+   #initial checkout
+   msg = ">>> Starting initial svn checkout with %s..." % 
self.repo.sync_uri
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n")
+   try:
+   os.rmdir(self.repo.location)
+   except OSError as e:
+   if e.errno != errno.ENOENT:
+   msg = "!!! existing '%s' directory; exiting." % 
self.repo.location
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (1, False)
+   del e
+   svn_root = self.repo.sync_uri
+   exitcode =  portage.process.spawn_bash(
+   "cd %s; exec svn %s" %
+   
(portage._shell_quote(os.path.dirname(self.repo.location)),
+   portage._shell_quote(svn_root)),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn checkout error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)
+
+
+   def _sync(self):
+   """
+   Internal function to sync an existing SVN repository
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+
+   svn_root = self.repo.sync_uri
+
+   if svn_root.startswith("svn://"):
+   svn_root = svn_root[6:]
+   #svn update
+   msg = ">>> Starting svn update with %s..." % 
self.repo.

[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-09-29 Thread Brian Dolbec
commit: 55ab0b8c43533defa8f676df699c7b2471fccb6f
Author: Brian Dolbec  gentoo  org>
AuthorDate: Mon Jun 16 17:58:09 2014 +
Commit: Brian Dolbec  gmail  com>
CommitDate: Mon Sep 29 17:20:21 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=55ab0b8c

sync/modules/svn: Add snv upgrade to sync operation

This prevents errors when a newer svn has been installed that requires a db 
upgrade.

---
 pym/portage/sync/modules/svn/svn.py | 23 +++
 1 file changed, 23 insertions(+)

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
index 182a7ac..0365e90 100644
--- a/pym/portage/sync/modules/svn/svn.py
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -62,6 +62,10 @@ class SVNSync(SyncBase):
@rtype: (int, bool)
"""
 
+   exitcode, d = self._svn_upgrade()
+   if exitcode != os.EX_OK:
+   return (exitcode, False)
+
svn_root = self.repo.sync_uri
 
if svn_root.startswith("svn://"):
@@ -79,3 +83,22 @@ class SVNSync(SyncBase):
self.logger(self.xterm_titles, msg)
writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
return (exitcode, False)
+
+
+   def _svn_upgrade(self):
+   """
+   Internal function which performs an svn upgrade on the repo
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+   exitcode = portage.process.spawn_bash(
+   "cd %s; exec svn upgrade" %
+   (portage._shell_quote(self.repo.location),),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn upgrade error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)



[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-09-29 Thread Brian Dolbec
commit: 0f80a9bce939874c51a83a9fea63905bbfd47675
Author: Brian Dolbec  gentoo  org>
AuthorDate: Mon Jun 16 17:58:09 2014 +
Commit: Brian Dolbec  gmail  com>
CommitDate: Tue Sep 30 00:42:26 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=0f80a9bc

sync/modules/svn: Add snv upgrade to sync operation

This prevents errors when a newer svn has been installed that requires a db 
upgrade.

---
 pym/portage/sync/modules/svn/svn.py | 23 +++
 1 file changed, 23 insertions(+)

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
index 182a7ac..0365e90 100644
--- a/pym/portage/sync/modules/svn/svn.py
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -62,6 +62,10 @@ class SVNSync(SyncBase):
@rtype: (int, bool)
"""
 
+   exitcode, d = self._svn_upgrade()
+   if exitcode != os.EX_OK:
+   return (exitcode, False)
+
svn_root = self.repo.sync_uri
 
if svn_root.startswith("svn://"):
@@ -79,3 +83,22 @@ class SVNSync(SyncBase):
self.logger(self.xterm_titles, msg)
writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
return (exitcode, False)
+
+
+   def _svn_upgrade(self):
+   """
+   Internal function which performs an svn upgrade on the repo
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+   exitcode = portage.process.spawn_bash(
+   "cd %s; exec svn upgrade" %
+   (portage._shell_quote(self.repo.location),),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn upgrade error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)



[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-09-29 Thread Brian Dolbec
commit: d524b7285c973385c90e272829bda8b727cd5f54
Author: David Heidelberger  ixit  cz>
AuthorDate: Mon Jun 16 16:04:06 2014 +
Commit: Brian Dolbec  gmail  com>
CommitDate: Tue Sep 30 00:42:26 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=d524b728

portage/sync/modules: Add svn sync module

Module submitted by: David Heidelberger
edits by Brian Dolbec :
Remove CheckSVNConfig class.
Use the default CheckSyncConfig class instead.
Copying the sync-cvs-repo option from the cvs module was incorrect and not 
needed.
Fixed the new()'s spawn_bash(...) call.

---
 pym/portage/sync/modules/svn/__init__.py | 32 +
 pym/portage/sync/modules/svn/svn.py  | 81 
 2 files changed, 113 insertions(+)

diff --git a/pym/portage/sync/modules/svn/__init__.py 
b/pym/portage/sync/modules/svn/__init__.py
new file mode 100644
index 000..1fda55a
--- /dev/null
+++ b/pym/portage/sync/modules/svn/__init__.py
@@ -0,0 +1,32 @@
+# Copyright 2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+"""SVN plug-in module for portage.
+Performs a svn up on repositories
+"""
+
+
+from portage.localization import _
+from portage.sync.config_checks import CheckSyncConfig
+from portage.util import writemsg_level
+
+
+module_spec = {
+   'name': 'svn',
+   'description': __doc__,
+   'provides':{
+   'svn-module': {
+   'name': "svn",
+   'class': "SVNSync",
+   'description': __doc__,
+   'functions': ['sync', 'new', 'exists'],
+   'func_desc': {
+   'sync': 'Performs a svn up 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 SVN repository',
+   },
+   'validate_config': CheckSyncConfig,
+   }
+   }
+}

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
new file mode 100644
index 000..182a7ac
--- /dev/null
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -0,0 +1,81 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+import logging
+import errno
+
+import portage
+from portage import os
+from portage.util import writemsg_level
+from portage.sync.syncbase import SyncBase
+
+
+class SVNSync(SyncBase):
+   '''SVN sync module'''
+
+   short_desc = "Perform sync operations on SVN repositories"
+
+   @staticmethod
+   def name():
+   return "SVNSync"
+
+
+   def __init__(self):
+   SyncBase.__init__(self, "svn", "dev-vcs/subversion")
+
+
+   def new(self, **kwargs):
+   if kwargs:
+   self._kwargs(kwargs)
+   #initial checkout
+   msg = ">>> Starting initial svn checkout with %s..." % 
self.repo.sync_uri
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n")
+   try:
+   os.rmdir(self.repo.location)
+   except OSError as e:
+   if e.errno != errno.ENOENT:
+   msg = "!!! existing '%s' directory; exiting." % 
self.repo.location
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (1, False)
+   del e
+   svn_root = self.repo.sync_uri
+   exitcode =  portage.process.spawn_bash(
+   "cd %s; exec svn %s" %
+   
(portage._shell_quote(os.path.dirname(self.repo.location)),
+   portage._shell_quote(svn_root)),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn checkout error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)
+
+
+   def _sync(self):
+   """
+   Internal function to sync an existing SVN repository
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+
+   svn_root = self.repo.sync_uri
+
+   if svn_root.startswith("svn://"):
+   svn_root = svn_root[6:]
+   #svn update
+   msg = ">>> Starting svn update with %s..." % 
self.repo.

[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-06-16 Thread Brian Dolbec
commit: d894d8c13f62dc7e40e78ae942c98d7d43e02bcd
Author: David Heidelberger  ixit  cz>
AuthorDate: Mon Jun 16 16:04:06 2014 +
Commit: Brian Dolbec  gmail  com>
CommitDate: Mon Jun 16 17:59:05 2014 +
URL:
http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=d894d8c1

portage/sync/modules: Add svn sync module

Module submitted by: David Heidelberger
edits by Brian Dolbec :
Remove CheckSVNConfig class.
Use the default CheckSyncConfig class instead.
Copying the sync-cvs-repo option from the cvs module was incorrect and not 
needed.
Fixed the new()'s spawn_bash(...) call.

---
 pym/portage/sync/modules/svn/__init__.py | 32 +
 pym/portage/sync/modules/svn/svn.py  | 81 
 2 files changed, 113 insertions(+)

diff --git a/pym/portage/sync/modules/svn/__init__.py 
b/pym/portage/sync/modules/svn/__init__.py
new file mode 100644
index 000..1fda55a
--- /dev/null
+++ b/pym/portage/sync/modules/svn/__init__.py
@@ -0,0 +1,32 @@
+# Copyright 2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+"""SVN plug-in module for portage.
+Performs a svn up on repositories
+"""
+
+
+from portage.localization import _
+from portage.sync.config_checks import CheckSyncConfig
+from portage.util import writemsg_level
+
+
+module_spec = {
+   'name': 'svn',
+   'description': __doc__,
+   'provides':{
+   'svn-module': {
+   'name': "svn",
+   'class': "SVNSync",
+   'description': __doc__,
+   'functions': ['sync', 'new', 'exists'],
+   'func_desc': {
+   'sync': 'Performs a svn up 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 SVN repository',
+   },
+   'validate_config': CheckSyncConfig,
+   }
+   }
+}

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
new file mode 100644
index 000..182a7ac
--- /dev/null
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -0,0 +1,81 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+import logging
+import errno
+
+import portage
+from portage import os
+from portage.util import writemsg_level
+from portage.sync.syncbase import SyncBase
+
+
+class SVNSync(SyncBase):
+   '''SVN sync module'''
+
+   short_desc = "Perform sync operations on SVN repositories"
+
+   @staticmethod
+   def name():
+   return "SVNSync"
+
+
+   def __init__(self):
+   SyncBase.__init__(self, "svn", "dev-vcs/subversion")
+
+
+   def new(self, **kwargs):
+   if kwargs:
+   self._kwargs(kwargs)
+   #initial checkout
+   msg = ">>> Starting initial svn checkout with %s..." % 
self.repo.sync_uri
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n")
+   try:
+   os.rmdir(self.repo.location)
+   except OSError as e:
+   if e.errno != errno.ENOENT:
+   msg = "!!! existing '%s' directory; exiting." % 
self.repo.location
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (1, False)
+   del e
+   svn_root = self.repo.sync_uri
+   exitcode =  portage.process.spawn_bash(
+   "cd %s; exec svn %s" %
+   
(portage._shell_quote(os.path.dirname(self.repo.location)),
+   portage._shell_quote(svn_root)),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn checkout error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)
+
+
+   def _sync(self):
+   """
+   Internal function to sync an existing SVN repository
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+
+   svn_root = self.repo.sync_uri
+
+   if svn_root.startswith("svn://"):
+   svn_root = svn_root[6:]
+   #svn update
+   msg = ">>> Starting svn update with %s..." % 
self.

[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-06-16 Thread Brian Dolbec
commit: e304a607772e052227a771219579e4112544a022
Author: Brian Dolbec  gentoo  org>
AuthorDate: Mon Jun 16 17:58:09 2014 +
Commit: Brian Dolbec  gmail  com>
CommitDate: Mon Jun 16 18:08:54 2014 +
URL:
http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=e304a607

sync/modules/svn: Add snv upgrade to sync operation

This prevents errors when a newer svn has been installed that requires a db 
upgrade.

---
 pym/portage/sync/modules/svn/svn.py | 23 +++
 1 file changed, 23 insertions(+)

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
index 182a7ac..0365e90 100644
--- a/pym/portage/sync/modules/svn/svn.py
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -62,6 +62,10 @@ class SVNSync(SyncBase):
@rtype: (int, bool)
"""
 
+   exitcode, d = self._svn_upgrade()
+   if exitcode != os.EX_OK:
+   return (exitcode, False)
+
svn_root = self.repo.sync_uri
 
if svn_root.startswith("svn://"):
@@ -79,3 +83,22 @@ class SVNSync(SyncBase):
self.logger(self.xterm_titles, msg)
writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
return (exitcode, False)
+
+
+   def _svn_upgrade(self):
+   """
+   Internal function which performs an svn upgrade on the repo
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+   exitcode = portage.process.spawn_bash(
+   "cd %s; exec svn upgrade" %
+   (portage._shell_quote(self.repo.location),),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn upgrade error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)



[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-06-16 Thread Brian Dolbec
commit: 90cef042302e0c347e9361a145132942d17e8823
Author: David Heidelberger  ixit  cz>
AuthorDate: Mon Jun 16 16:04:06 2014 +
Commit: Brian Dolbec  gmail  com>
CommitDate: Mon Jun 16 22:44:15 2014 +
URL:
http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=90cef042

portage/sync/modules: Add svn sync module

Module submitted by: David Heidelberger
edits by Brian Dolbec :
Remove CheckSVNConfig class.
Use the default CheckSyncConfig class instead.
Copying the sync-cvs-repo option from the cvs module was incorrect and not 
needed.
Fixed the new()'s spawn_bash(...) call.

---
 pym/portage/sync/modules/svn/__init__.py | 32 +
 pym/portage/sync/modules/svn/svn.py  | 81 
 2 files changed, 113 insertions(+)

diff --git a/pym/portage/sync/modules/svn/__init__.py 
b/pym/portage/sync/modules/svn/__init__.py
new file mode 100644
index 000..1fda55a
--- /dev/null
+++ b/pym/portage/sync/modules/svn/__init__.py
@@ -0,0 +1,32 @@
+# Copyright 2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+"""SVN plug-in module for portage.
+Performs a svn up on repositories
+"""
+
+
+from portage.localization import _
+from portage.sync.config_checks import CheckSyncConfig
+from portage.util import writemsg_level
+
+
+module_spec = {
+   'name': 'svn',
+   'description': __doc__,
+   'provides':{
+   'svn-module': {
+   'name': "svn",
+   'class': "SVNSync",
+   'description': __doc__,
+   'functions': ['sync', 'new', 'exists'],
+   'func_desc': {
+   'sync': 'Performs a svn up 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 SVN repository',
+   },
+   'validate_config': CheckSyncConfig,
+   }
+   }
+}

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
new file mode 100644
index 000..182a7ac
--- /dev/null
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -0,0 +1,81 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+import logging
+import errno
+
+import portage
+from portage import os
+from portage.util import writemsg_level
+from portage.sync.syncbase import SyncBase
+
+
+class SVNSync(SyncBase):
+   '''SVN sync module'''
+
+   short_desc = "Perform sync operations on SVN repositories"
+
+   @staticmethod
+   def name():
+   return "SVNSync"
+
+
+   def __init__(self):
+   SyncBase.__init__(self, "svn", "dev-vcs/subversion")
+
+
+   def new(self, **kwargs):
+   if kwargs:
+   self._kwargs(kwargs)
+   #initial checkout
+   msg = ">>> Starting initial svn checkout with %s..." % 
self.repo.sync_uri
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n")
+   try:
+   os.rmdir(self.repo.location)
+   except OSError as e:
+   if e.errno != errno.ENOENT:
+   msg = "!!! existing '%s' directory; exiting." % 
self.repo.location
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (1, False)
+   del e
+   svn_root = self.repo.sync_uri
+   exitcode =  portage.process.spawn_bash(
+   "cd %s; exec svn %s" %
+   
(portage._shell_quote(os.path.dirname(self.repo.location)),
+   portage._shell_quote(svn_root)),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn checkout error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)
+
+
+   def _sync(self):
+   """
+   Internal function to sync an existing SVN repository
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+
+   svn_root = self.repo.sync_uri
+
+   if svn_root.startswith("svn://"):
+   svn_root = svn_root[6:]
+   #svn update
+   msg = ">>> Starting svn update with %s..." % 
self.

[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-06-16 Thread Brian Dolbec
commit: b96eaefa633548405a0389eaac66388ae2c1f870
Author: Brian Dolbec  gentoo  org>
AuthorDate: Mon Jun 16 17:58:09 2014 +
Commit: Brian Dolbec  gmail  com>
CommitDate: Mon Jun 16 22:44:15 2014 +
URL:
http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=b96eaefa

sync/modules/svn: Add snv upgrade to sync operation

This prevents errors when a newer svn has been installed that requires a db 
upgrade.

---
 pym/portage/sync/modules/svn/svn.py | 23 +++
 1 file changed, 23 insertions(+)

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
index 182a7ac..0365e90 100644
--- a/pym/portage/sync/modules/svn/svn.py
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -62,6 +62,10 @@ class SVNSync(SyncBase):
@rtype: (int, bool)
"""
 
+   exitcode, d = self._svn_upgrade()
+   if exitcode != os.EX_OK:
+   return (exitcode, False)
+
svn_root = self.repo.sync_uri
 
if svn_root.startswith("svn://"):
@@ -79,3 +83,22 @@ class SVNSync(SyncBase):
self.logger(self.xterm_titles, msg)
writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
return (exitcode, False)
+
+
+   def _svn_upgrade(self):
+   """
+   Internal function which performs an svn upgrade on the repo
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+   exitcode = portage.process.spawn_bash(
+   "cd %s; exec svn upgrade" %
+   (portage._shell_quote(self.repo.location),),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn upgrade error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)



[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-06-16 Thread Brian Dolbec
commit: d894d8c13f62dc7e40e78ae942c98d7d43e02bcd
Author: David Heidelberger  ixit  cz>
AuthorDate: Mon Jun 16 16:04:06 2014 +
Commit: Brian Dolbec  gmail  com>
CommitDate: Mon Jun 16 17:59:05 2014 +
URL:
http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=d894d8c1

portage/sync/modules: Add svn sync module

Module submitted by: David Heidelberger
edits by Brian Dolbec :
Remove CheckSVNConfig class.
Use the default CheckSyncConfig class instead.
Copying the sync-cvs-repo option from the cvs module was incorrect and not 
needed.
Fixed the new()'s spawn_bash(...) call.

---
 pym/portage/sync/modules/svn/__init__.py | 32 +
 pym/portage/sync/modules/svn/svn.py  | 81 
 2 files changed, 113 insertions(+)

diff --git a/pym/portage/sync/modules/svn/__init__.py 
b/pym/portage/sync/modules/svn/__init__.py
new file mode 100644
index 000..1fda55a
--- /dev/null
+++ b/pym/portage/sync/modules/svn/__init__.py
@@ -0,0 +1,32 @@
+# Copyright 2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+"""SVN plug-in module for portage.
+Performs a svn up on repositories
+"""
+
+
+from portage.localization import _
+from portage.sync.config_checks import CheckSyncConfig
+from portage.util import writemsg_level
+
+
+module_spec = {
+   'name': 'svn',
+   'description': __doc__,
+   'provides':{
+   'svn-module': {
+   'name': "svn",
+   'class': "SVNSync",
+   'description': __doc__,
+   'functions': ['sync', 'new', 'exists'],
+   'func_desc': {
+   'sync': 'Performs a svn up 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 SVN repository',
+   },
+   'validate_config': CheckSyncConfig,
+   }
+   }
+}

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
new file mode 100644
index 000..182a7ac
--- /dev/null
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -0,0 +1,81 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+import logging
+import errno
+
+import portage
+from portage import os
+from portage.util import writemsg_level
+from portage.sync.syncbase import SyncBase
+
+
+class SVNSync(SyncBase):
+   '''SVN sync module'''
+
+   short_desc = "Perform sync operations on SVN repositories"
+
+   @staticmethod
+   def name():
+   return "SVNSync"
+
+
+   def __init__(self):
+   SyncBase.__init__(self, "svn", "dev-vcs/subversion")
+
+
+   def new(self, **kwargs):
+   if kwargs:
+   self._kwargs(kwargs)
+   #initial checkout
+   msg = ">>> Starting initial svn checkout with %s..." % 
self.repo.sync_uri
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n")
+   try:
+   os.rmdir(self.repo.location)
+   except OSError as e:
+   if e.errno != errno.ENOENT:
+   msg = "!!! existing '%s' directory; exiting." % 
self.repo.location
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (1, False)
+   del e
+   svn_root = self.repo.sync_uri
+   exitcode =  portage.process.spawn_bash(
+   "cd %s; exec svn %s" %
+   
(portage._shell_quote(os.path.dirname(self.repo.location)),
+   portage._shell_quote(svn_root)),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn checkout error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)
+
+
+   def _sync(self):
+   """
+   Internal function to sync an existing SVN repository
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+
+   svn_root = self.repo.sync_uri
+
+   if svn_root.startswith("svn://"):
+   svn_root = svn_root[6:]
+   #svn update
+   msg = ">>> Starting svn update with %s..." % 
self.

[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-06-16 Thread Brian Dolbec
commit: e304a607772e052227a771219579e4112544a022
Author: Brian Dolbec  gentoo  org>
AuthorDate: Mon Jun 16 17:58:09 2014 +
Commit: Brian Dolbec  gmail  com>
CommitDate: Mon Jun 16 18:08:54 2014 +
URL:
http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=e304a607

sync/modules/svn: Add snv upgrade to sync operation

This prevents errors when a newer svn has been installed that requires a db 
upgrade.

---
 pym/portage/sync/modules/svn/svn.py | 23 +++
 1 file changed, 23 insertions(+)

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
index 182a7ac..0365e90 100644
--- a/pym/portage/sync/modules/svn/svn.py
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -62,6 +62,10 @@ class SVNSync(SyncBase):
@rtype: (int, bool)
"""
 
+   exitcode, d = self._svn_upgrade()
+   if exitcode != os.EX_OK:
+   return (exitcode, False)
+
svn_root = self.repo.sync_uri
 
if svn_root.startswith("svn://"):
@@ -79,3 +83,22 @@ class SVNSync(SyncBase):
self.logger(self.xterm_titles, msg)
writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
return (exitcode, False)
+
+
+   def _svn_upgrade(self):
+   """
+   Internal function which performs an svn upgrade on the repo
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+   exitcode = portage.process.spawn_bash(
+   "cd %s; exec svn upgrade" %
+   (portage._shell_quote(self.repo.location),),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn upgrade error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)



[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-06-16 Thread Brian Dolbec
commit: 90cef042302e0c347e9361a145132942d17e8823
Author: David Heidelberger  ixit  cz>
AuthorDate: Mon Jun 16 16:04:06 2014 +
Commit: Brian Dolbec  gmail  com>
CommitDate: Mon Jun 16 22:44:15 2014 +
URL:
http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=90cef042

portage/sync/modules: Add svn sync module

Module submitted by: David Heidelberger
edits by Brian Dolbec :
Remove CheckSVNConfig class.
Use the default CheckSyncConfig class instead.
Copying the sync-cvs-repo option from the cvs module was incorrect and not 
needed.
Fixed the new()'s spawn_bash(...) call.

---
 pym/portage/sync/modules/svn/__init__.py | 32 +
 pym/portage/sync/modules/svn/svn.py  | 81 
 2 files changed, 113 insertions(+)

diff --git a/pym/portage/sync/modules/svn/__init__.py 
b/pym/portage/sync/modules/svn/__init__.py
new file mode 100644
index 000..1fda55a
--- /dev/null
+++ b/pym/portage/sync/modules/svn/__init__.py
@@ -0,0 +1,32 @@
+# Copyright 2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+"""SVN plug-in module for portage.
+Performs a svn up on repositories
+"""
+
+
+from portage.localization import _
+from portage.sync.config_checks import CheckSyncConfig
+from portage.util import writemsg_level
+
+
+module_spec = {
+   'name': 'svn',
+   'description': __doc__,
+   'provides':{
+   'svn-module': {
+   'name': "svn",
+   'class': "SVNSync",
+   'description': __doc__,
+   'functions': ['sync', 'new', 'exists'],
+   'func_desc': {
+   'sync': 'Performs a svn up 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 SVN repository',
+   },
+   'validate_config': CheckSyncConfig,
+   }
+   }
+}

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
new file mode 100644
index 000..182a7ac
--- /dev/null
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -0,0 +1,81 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+import logging
+import errno
+
+import portage
+from portage import os
+from portage.util import writemsg_level
+from portage.sync.syncbase import SyncBase
+
+
+class SVNSync(SyncBase):
+   '''SVN sync module'''
+
+   short_desc = "Perform sync operations on SVN repositories"
+
+   @staticmethod
+   def name():
+   return "SVNSync"
+
+
+   def __init__(self):
+   SyncBase.__init__(self, "svn", "dev-vcs/subversion")
+
+
+   def new(self, **kwargs):
+   if kwargs:
+   self._kwargs(kwargs)
+   #initial checkout
+   msg = ">>> Starting initial svn checkout with %s..." % 
self.repo.sync_uri
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n")
+   try:
+   os.rmdir(self.repo.location)
+   except OSError as e:
+   if e.errno != errno.ENOENT:
+   msg = "!!! existing '%s' directory; exiting." % 
self.repo.location
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (1, False)
+   del e
+   svn_root = self.repo.sync_uri
+   exitcode =  portage.process.spawn_bash(
+   "cd %s; exec svn %s" %
+   
(portage._shell_quote(os.path.dirname(self.repo.location)),
+   portage._shell_quote(svn_root)),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn checkout error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)
+
+
+   def _sync(self):
+   """
+   Internal function to sync an existing SVN repository
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+
+   svn_root = self.repo.sync_uri
+
+   if svn_root.startswith("svn://"):
+   svn_root = svn_root[6:]
+   #svn update
+   msg = ">>> Starting svn update with %s..." % 
self.

[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-06-16 Thread Brian Dolbec
commit: b96eaefa633548405a0389eaac66388ae2c1f870
Author: Brian Dolbec  gentoo  org>
AuthorDate: Mon Jun 16 17:58:09 2014 +
Commit: Brian Dolbec  gmail  com>
CommitDate: Mon Jun 16 22:44:15 2014 +
URL:
http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=b96eaefa

sync/modules/svn: Add snv upgrade to sync operation

This prevents errors when a newer svn has been installed that requires a db 
upgrade.

---
 pym/portage/sync/modules/svn/svn.py | 23 +++
 1 file changed, 23 insertions(+)

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
index 182a7ac..0365e90 100644
--- a/pym/portage/sync/modules/svn/svn.py
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -62,6 +62,10 @@ class SVNSync(SyncBase):
@rtype: (int, bool)
"""
 
+   exitcode, d = self._svn_upgrade()
+   if exitcode != os.EX_OK:
+   return (exitcode, False)
+
svn_root = self.repo.sync_uri
 
if svn_root.startswith("svn://"):
@@ -79,3 +83,22 @@ class SVNSync(SyncBase):
self.logger(self.xterm_titles, msg)
writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
return (exitcode, False)
+
+
+   def _svn_upgrade(self):
+   """
+   Internal function which performs an svn upgrade on the repo
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+   exitcode = portage.process.spawn_bash(
+   "cd %s; exec svn upgrade" %
+   (portage._shell_quote(self.repo.location),),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn upgrade error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)



[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-12-01 Thread Michał Górny
commit: 461159f48621bb8e7e0d20fa1937885956d979d0
Author: David Heidelberger  ixit  cz>
AuthorDate: Mon Jun 16 16:04:06 2014 +
Commit: Michał Górny  gentoo  org>
CommitDate: Mon Dec  1 21:49:40 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=461159f4

portage/sync/modules: Add svn sync module

Module submitted by: David Heidelberger
edits by Brian Dolbec :
Remove CheckSVNConfig class.
Use the default CheckSyncConfig class instead.
Copying the sync-cvs-repo option from the cvs module was incorrect and not 
needed.
Fixed the new()'s spawn_bash(...) call.

---
 pym/portage/sync/modules/svn/__init__.py | 32 +
 pym/portage/sync/modules/svn/svn.py  | 81 
 2 files changed, 113 insertions(+)

diff --git a/pym/portage/sync/modules/svn/__init__.py 
b/pym/portage/sync/modules/svn/__init__.py
new file mode 100644
index 000..1fda55a
--- /dev/null
+++ b/pym/portage/sync/modules/svn/__init__.py
@@ -0,0 +1,32 @@
+# Copyright 2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+"""SVN plug-in module for portage.
+Performs a svn up on repositories
+"""
+
+
+from portage.localization import _
+from portage.sync.config_checks import CheckSyncConfig
+from portage.util import writemsg_level
+
+
+module_spec = {
+   'name': 'svn',
+   'description': __doc__,
+   'provides':{
+   'svn-module': {
+   'name': "svn",
+   'class': "SVNSync",
+   'description': __doc__,
+   'functions': ['sync', 'new', 'exists'],
+   'func_desc': {
+   'sync': 'Performs a svn up 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 SVN repository',
+   },
+   'validate_config': CheckSyncConfig,
+   }
+   }
+}

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
new file mode 100644
index 000..182a7ac
--- /dev/null
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -0,0 +1,81 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+import logging
+import errno
+
+import portage
+from portage import os
+from portage.util import writemsg_level
+from portage.sync.syncbase import SyncBase
+
+
+class SVNSync(SyncBase):
+   '''SVN sync module'''
+
+   short_desc = "Perform sync operations on SVN repositories"
+
+   @staticmethod
+   def name():
+   return "SVNSync"
+
+
+   def __init__(self):
+   SyncBase.__init__(self, "svn", "dev-vcs/subversion")
+
+
+   def new(self, **kwargs):
+   if kwargs:
+   self._kwargs(kwargs)
+   #initial checkout
+   msg = ">>> Starting initial svn checkout with %s..." % 
self.repo.sync_uri
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n")
+   try:
+   os.rmdir(self.repo.location)
+   except OSError as e:
+   if e.errno != errno.ENOENT:
+   msg = "!!! existing '%s' directory; exiting." % 
self.repo.location
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (1, False)
+   del e
+   svn_root = self.repo.sync_uri
+   exitcode =  portage.process.spawn_bash(
+   "cd %s; exec svn %s" %
+   
(portage._shell_quote(os.path.dirname(self.repo.location)),
+   portage._shell_quote(svn_root)),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn checkout error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)
+
+
+   def _sync(self):
+   """
+   Internal function to sync an existing SVN repository
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+
+   svn_root = self.repo.sync_uri
+
+   if svn_root.startswith("svn://"):
+   svn_root = svn_root[6:]
+   #svn update
+   msg = ">>> Starting svn update with %s..." % 
self.repo

[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-12-01 Thread Michał Górny
commit: 94be45b625a8ddb7bd6c3472c1ca012f3461317e
Author: Brian Dolbec  gentoo  org>
AuthorDate: Mon Jun 16 17:58:09 2014 +
Commit: Michał Górny  gentoo  org>
CommitDate: Mon Dec  1 21:49:40 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=94be45b6

sync/modules/svn: Add snv upgrade to sync operation

This prevents errors when a newer svn has been installed that requires a db 
upgrade.

---
 pym/portage/sync/modules/svn/svn.py | 23 +++
 1 file changed, 23 insertions(+)

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
index 182a7ac..0365e90 100644
--- a/pym/portage/sync/modules/svn/svn.py
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -62,6 +62,10 @@ class SVNSync(SyncBase):
@rtype: (int, bool)
"""
 
+   exitcode, d = self._svn_upgrade()
+   if exitcode != os.EX_OK:
+   return (exitcode, False)
+
svn_root = self.repo.sync_uri
 
if svn_root.startswith("svn://"):
@@ -79,3 +83,22 @@ class SVNSync(SyncBase):
self.logger(self.xterm_titles, msg)
writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
return (exitcode, False)
+
+
+   def _svn_upgrade(self):
+   """
+   Internal function which performs an svn upgrade on the repo
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+   exitcode = portage.process.spawn_bash(
+   "cd %s; exec svn upgrade" %
+   (portage._shell_quote(self.repo.location),),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn upgrade error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)



[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-12-04 Thread Brian Dolbec
commit: 9831dd2fbd8889ee4c1738813b6a9c4c78c36e8c
Author: Brian Dolbec  gentoo  org>
AuthorDate: Mon Jun 16 17:58:09 2014 +
Commit: Brian Dolbec  gmail  com>
CommitDate: Thu Dec  4 19:56:33 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=9831dd2f

sync/modules/svn: Add snv upgrade to sync operation

This prevents errors when a newer svn has been installed that requires a db 
upgrade.

---
 pym/portage/sync/modules/svn/svn.py | 23 +++
 1 file changed, 23 insertions(+)

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
index 182a7ac..0365e90 100644
--- a/pym/portage/sync/modules/svn/svn.py
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -62,6 +62,10 @@ class SVNSync(SyncBase):
@rtype: (int, bool)
"""
 
+   exitcode, d = self._svn_upgrade()
+   if exitcode != os.EX_OK:
+   return (exitcode, False)
+
svn_root = self.repo.sync_uri
 
if svn_root.startswith("svn://"):
@@ -79,3 +83,22 @@ class SVNSync(SyncBase):
self.logger(self.xterm_titles, msg)
writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
return (exitcode, False)
+
+
+   def _svn_upgrade(self):
+   """
+   Internal function which performs an svn upgrade on the repo
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+   exitcode = portage.process.spawn_bash(
+   "cd %s; exec svn upgrade" %
+   (portage._shell_quote(self.repo.location),),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn upgrade error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)



[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-10-19 Thread Zac Medico
commit: 3e03d6b00b90d45a570cca06289e74603d76ca3d
Author: David Heidelberger  ixit  cz>
AuthorDate: Mon Jun 16 16:04:06 2014 +
Commit: Zac Medico  gentoo  org>
CommitDate: Mon Oct 20 03:48:34 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=3e03d6b0

portage/sync/modules: Add svn sync module

Module submitted by: David Heidelberger
edits by Brian Dolbec :
Remove CheckSVNConfig class.
Use the default CheckSyncConfig class instead.
Copying the sync-cvs-repo option from the cvs module was incorrect and not 
needed.
Fixed the new()'s spawn_bash(...) call.

---
 pym/portage/sync/modules/svn/__init__.py | 32 +
 pym/portage/sync/modules/svn/svn.py  | 81 
 2 files changed, 113 insertions(+)

diff --git a/pym/portage/sync/modules/svn/__init__.py 
b/pym/portage/sync/modules/svn/__init__.py
new file mode 100644
index 000..1fda55a
--- /dev/null
+++ b/pym/portage/sync/modules/svn/__init__.py
@@ -0,0 +1,32 @@
+# Copyright 2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+"""SVN plug-in module for portage.
+Performs a svn up on repositories
+"""
+
+
+from portage.localization import _
+from portage.sync.config_checks import CheckSyncConfig
+from portage.util import writemsg_level
+
+
+module_spec = {
+   'name': 'svn',
+   'description': __doc__,
+   'provides':{
+   'svn-module': {
+   'name': "svn",
+   'class': "SVNSync",
+   'description': __doc__,
+   'functions': ['sync', 'new', 'exists'],
+   'func_desc': {
+   'sync': 'Performs a svn up 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 SVN repository',
+   },
+   'validate_config': CheckSyncConfig,
+   }
+   }
+}

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
new file mode 100644
index 000..182a7ac
--- /dev/null
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -0,0 +1,81 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+import logging
+import errno
+
+import portage
+from portage import os
+from portage.util import writemsg_level
+from portage.sync.syncbase import SyncBase
+
+
+class SVNSync(SyncBase):
+   '''SVN sync module'''
+
+   short_desc = "Perform sync operations on SVN repositories"
+
+   @staticmethod
+   def name():
+   return "SVNSync"
+
+
+   def __init__(self):
+   SyncBase.__init__(self, "svn", "dev-vcs/subversion")
+
+
+   def new(self, **kwargs):
+   if kwargs:
+   self._kwargs(kwargs)
+   #initial checkout
+   msg = ">>> Starting initial svn checkout with %s..." % 
self.repo.sync_uri
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n")
+   try:
+   os.rmdir(self.repo.location)
+   except OSError as e:
+   if e.errno != errno.ENOENT:
+   msg = "!!! existing '%s' directory; exiting." % 
self.repo.location
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (1, False)
+   del e
+   svn_root = self.repo.sync_uri
+   exitcode =  portage.process.spawn_bash(
+   "cd %s; exec svn %s" %
+   
(portage._shell_quote(os.path.dirname(self.repo.location)),
+   portage._shell_quote(svn_root)),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn checkout error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)
+
+
+   def _sync(self):
+   """
+   Internal function to sync an existing SVN repository
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+
+   svn_root = self.repo.sync_uri
+
+   if svn_root.startswith("svn://"):
+   svn_root = svn_root[6:]
+   #svn update
+   msg = ">>> Starting svn update with %s..." % 
self.repo.s

[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-10-19 Thread Zac Medico
commit: 9132fdaedfcb8aac0cebdc4154120fbf45b04a42
Author: Brian Dolbec  gentoo  org>
AuthorDate: Mon Jun 16 17:58:09 2014 +
Commit: Zac Medico  gentoo  org>
CommitDate: Mon Oct 20 03:48:34 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=9132fdae

sync/modules/svn: Add snv upgrade to sync operation

This prevents errors when a newer svn has been installed that requires a db 
upgrade.

---
 pym/portage/sync/modules/svn/svn.py | 23 +++
 1 file changed, 23 insertions(+)

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
index 182a7ac..0365e90 100644
--- a/pym/portage/sync/modules/svn/svn.py
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -62,6 +62,10 @@ class SVNSync(SyncBase):
@rtype: (int, bool)
"""
 
+   exitcode, d = self._svn_upgrade()
+   if exitcode != os.EX_OK:
+   return (exitcode, False)
+
svn_root = self.repo.sync_uri
 
if svn_root.startswith("svn://"):
@@ -79,3 +83,22 @@ class SVNSync(SyncBase):
self.logger(self.xterm_titles, msg)
writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
return (exitcode, False)
+
+
+   def _svn_upgrade(self):
+   """
+   Internal function which performs an svn upgrade on the repo
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+   exitcode = portage.process.spawn_bash(
+   "cd %s; exec svn upgrade" %
+   (portage._shell_quote(self.repo.location),),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn upgrade error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)



[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-10-20 Thread Zac Medico
commit: a56ee8b456ea059f92e5e4fd142cde85be249a23
Author: David Heidelberger  ixit  cz>
AuthorDate: Mon Jun 16 16:04:06 2014 +
Commit: Zac Medico  gentoo  org>
CommitDate: Tue Oct 21 05:04:07 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=a56ee8b4

portage/sync/modules: Add svn sync module

Module submitted by: David Heidelberger
edits by Brian Dolbec :
Remove CheckSVNConfig class.
Use the default CheckSyncConfig class instead.
Copying the sync-cvs-repo option from the cvs module was incorrect and not 
needed.
Fixed the new()'s spawn_bash(...) call.

---
 pym/portage/sync/modules/svn/__init__.py | 32 +
 pym/portage/sync/modules/svn/svn.py  | 81 
 2 files changed, 113 insertions(+)

diff --git a/pym/portage/sync/modules/svn/__init__.py 
b/pym/portage/sync/modules/svn/__init__.py
new file mode 100644
index 000..1fda55a
--- /dev/null
+++ b/pym/portage/sync/modules/svn/__init__.py
@@ -0,0 +1,32 @@
+# Copyright 2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+"""SVN plug-in module for portage.
+Performs a svn up on repositories
+"""
+
+
+from portage.localization import _
+from portage.sync.config_checks import CheckSyncConfig
+from portage.util import writemsg_level
+
+
+module_spec = {
+   'name': 'svn',
+   'description': __doc__,
+   'provides':{
+   'svn-module': {
+   'name': "svn",
+   'class': "SVNSync",
+   'description': __doc__,
+   'functions': ['sync', 'new', 'exists'],
+   'func_desc': {
+   'sync': 'Performs a svn up 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 SVN repository',
+   },
+   'validate_config': CheckSyncConfig,
+   }
+   }
+}

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
new file mode 100644
index 000..182a7ac
--- /dev/null
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -0,0 +1,81 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+import logging
+import errno
+
+import portage
+from portage import os
+from portage.util import writemsg_level
+from portage.sync.syncbase import SyncBase
+
+
+class SVNSync(SyncBase):
+   '''SVN sync module'''
+
+   short_desc = "Perform sync operations on SVN repositories"
+
+   @staticmethod
+   def name():
+   return "SVNSync"
+
+
+   def __init__(self):
+   SyncBase.__init__(self, "svn", "dev-vcs/subversion")
+
+
+   def new(self, **kwargs):
+   if kwargs:
+   self._kwargs(kwargs)
+   #initial checkout
+   msg = ">>> Starting initial svn checkout with %s..." % 
self.repo.sync_uri
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n")
+   try:
+   os.rmdir(self.repo.location)
+   except OSError as e:
+   if e.errno != errno.ENOENT:
+   msg = "!!! existing '%s' directory; exiting." % 
self.repo.location
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (1, False)
+   del e
+   svn_root = self.repo.sync_uri
+   exitcode =  portage.process.spawn_bash(
+   "cd %s; exec svn %s" %
+   
(portage._shell_quote(os.path.dirname(self.repo.location)),
+   portage._shell_quote(svn_root)),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn checkout error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)
+
+
+   def _sync(self):
+   """
+   Internal function to sync an existing SVN repository
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+
+   svn_root = self.repo.sync_uri
+
+   if svn_root.startswith("svn://"):
+   svn_root = svn_root[6:]
+   #svn update
+   msg = ">>> Starting svn update with %s..." % 
self.repo.s

[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-10-20 Thread Zac Medico
commit: 8ba80d4cf6d4af4e6c1d59c3c0bf732ea224aea4
Author: Brian Dolbec  gentoo  org>
AuthorDate: Mon Jun 16 17:58:09 2014 +
Commit: Zac Medico  gentoo  org>
CommitDate: Tue Oct 21 05:04:07 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=8ba80d4c

sync/modules/svn: Add snv upgrade to sync operation

This prevents errors when a newer svn has been installed that requires a db 
upgrade.

---
 pym/portage/sync/modules/svn/svn.py | 23 +++
 1 file changed, 23 insertions(+)

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
index 182a7ac..0365e90 100644
--- a/pym/portage/sync/modules/svn/svn.py
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -62,6 +62,10 @@ class SVNSync(SyncBase):
@rtype: (int, bool)
"""
 
+   exitcode, d = self._svn_upgrade()
+   if exitcode != os.EX_OK:
+   return (exitcode, False)
+
svn_root = self.repo.sync_uri
 
if svn_root.startswith("svn://"):
@@ -79,3 +83,22 @@ class SVNSync(SyncBase):
self.logger(self.xterm_titles, msg)
writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
return (exitcode, False)
+
+
+   def _svn_upgrade(self):
+   """
+   Internal function which performs an svn upgrade on the repo
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+   exitcode = portage.process.spawn_bash(
+   "cd %s; exec svn upgrade" %
+   (portage._shell_quote(self.repo.location),),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn upgrade error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)



[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-09-03 Thread Brian Dolbec
commit: 9bc13ae7c9a6892c9fe0f998b0473c9a1dfca656
Author: Brian Dolbec  gentoo  org>
AuthorDate: Mon Jun 16 17:58:09 2014 +
Commit: Brian Dolbec  gmail  com>
CommitDate: Wed Sep  3 23:34:54 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=9bc13ae7

sync/modules/svn: Add snv upgrade to sync operation

This prevents errors when a newer svn has been installed that requires a db 
upgrade.

---
 pym/portage/sync/modules/svn/svn.py | 23 +++
 1 file changed, 23 insertions(+)

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
index 182a7ac..0365e90 100644
--- a/pym/portage/sync/modules/svn/svn.py
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -62,6 +62,10 @@ class SVNSync(SyncBase):
@rtype: (int, bool)
"""
 
+   exitcode, d = self._svn_upgrade()
+   if exitcode != os.EX_OK:
+   return (exitcode, False)
+
svn_root = self.repo.sync_uri
 
if svn_root.startswith("svn://"):
@@ -79,3 +83,22 @@ class SVNSync(SyncBase):
self.logger(self.xterm_titles, msg)
writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
return (exitcode, False)
+
+
+   def _svn_upgrade(self):
+   """
+   Internal function which performs an svn upgrade on the repo
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+   exitcode = portage.process.spawn_bash(
+   "cd %s; exec svn upgrade" %
+   (portage._shell_quote(self.repo.location),),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn upgrade error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)



[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-09-03 Thread Brian Dolbec
commit: 2aa70957a16dad2a5f66ac11e88c4c81d45833fa
Author: David Heidelberger  ixit  cz>
AuthorDate: Mon Jun 16 16:04:06 2014 +
Commit: Brian Dolbec  gmail  com>
CommitDate: Wed Sep  3 23:34:54 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=2aa70957

portage/sync/modules: Add svn sync module

Module submitted by: David Heidelberger
edits by Brian Dolbec :
Remove CheckSVNConfig class.
Use the default CheckSyncConfig class instead.
Copying the sync-cvs-repo option from the cvs module was incorrect and not 
needed.
Fixed the new()'s spawn_bash(...) call.

---
 pym/portage/sync/modules/svn/__init__.py | 32 +
 pym/portage/sync/modules/svn/svn.py  | 81 
 2 files changed, 113 insertions(+)

diff --git a/pym/portage/sync/modules/svn/__init__.py 
b/pym/portage/sync/modules/svn/__init__.py
new file mode 100644
index 000..1fda55a
--- /dev/null
+++ b/pym/portage/sync/modules/svn/__init__.py
@@ -0,0 +1,32 @@
+# Copyright 2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+"""SVN plug-in module for portage.
+Performs a svn up on repositories
+"""
+
+
+from portage.localization import _
+from portage.sync.config_checks import CheckSyncConfig
+from portage.util import writemsg_level
+
+
+module_spec = {
+   'name': 'svn',
+   'description': __doc__,
+   'provides':{
+   'svn-module': {
+   'name': "svn",
+   'class': "SVNSync",
+   'description': __doc__,
+   'functions': ['sync', 'new', 'exists'],
+   'func_desc': {
+   'sync': 'Performs a svn up 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 SVN repository',
+   },
+   'validate_config': CheckSyncConfig,
+   }
+   }
+}

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
new file mode 100644
index 000..182a7ac
--- /dev/null
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -0,0 +1,81 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+import logging
+import errno
+
+import portage
+from portage import os
+from portage.util import writemsg_level
+from portage.sync.syncbase import SyncBase
+
+
+class SVNSync(SyncBase):
+   '''SVN sync module'''
+
+   short_desc = "Perform sync operations on SVN repositories"
+
+   @staticmethod
+   def name():
+   return "SVNSync"
+
+
+   def __init__(self):
+   SyncBase.__init__(self, "svn", "dev-vcs/subversion")
+
+
+   def new(self, **kwargs):
+   if kwargs:
+   self._kwargs(kwargs)
+   #initial checkout
+   msg = ">>> Starting initial svn checkout with %s..." % 
self.repo.sync_uri
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n")
+   try:
+   os.rmdir(self.repo.location)
+   except OSError as e:
+   if e.errno != errno.ENOENT:
+   msg = "!!! existing '%s' directory; exiting." % 
self.repo.location
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (1, False)
+   del e
+   svn_root = self.repo.sync_uri
+   exitcode =  portage.process.spawn_bash(
+   "cd %s; exec svn %s" %
+   
(portage._shell_quote(os.path.dirname(self.repo.location)),
+   portage._shell_quote(svn_root)),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn checkout error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)
+
+
+   def _sync(self):
+   """
+   Internal function to sync an existing SVN repository
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+
+   svn_root = self.repo.sync_uri
+
+   if svn_root.startswith("svn://"):
+   svn_root = svn_root[6:]
+   #svn update
+   msg = ">>> Starting svn update with %s..." % 
self.repo.

[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-09-03 Thread Brian Dolbec
commit: 2cb2c8b506a36dabeba3e1aaa6c1ecb9405a5e40
Author: David Heidelberger  ixit  cz>
AuthorDate: Mon Jun 16 16:04:06 2014 +
Commit: Brian Dolbec  gmail  com>
CommitDate: Thu Sep  4 01:18:02 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=2cb2c8b5

portage/sync/modules: Add svn sync module

Module submitted by: David Heidelberger
edits by Brian Dolbec :
Remove CheckSVNConfig class.
Use the default CheckSyncConfig class instead.
Copying the sync-cvs-repo option from the cvs module was incorrect and not 
needed.
Fixed the new()'s spawn_bash(...) call.

---
 pym/portage/sync/modules/svn/__init__.py | 32 +
 pym/portage/sync/modules/svn/svn.py  | 81 
 2 files changed, 113 insertions(+)

diff --git a/pym/portage/sync/modules/svn/__init__.py 
b/pym/portage/sync/modules/svn/__init__.py
new file mode 100644
index 000..1fda55a
--- /dev/null
+++ b/pym/portage/sync/modules/svn/__init__.py
@@ -0,0 +1,32 @@
+# Copyright 2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+"""SVN plug-in module for portage.
+Performs a svn up on repositories
+"""
+
+
+from portage.localization import _
+from portage.sync.config_checks import CheckSyncConfig
+from portage.util import writemsg_level
+
+
+module_spec = {
+   'name': 'svn',
+   'description': __doc__,
+   'provides':{
+   'svn-module': {
+   'name': "svn",
+   'class': "SVNSync",
+   'description': __doc__,
+   'functions': ['sync', 'new', 'exists'],
+   'func_desc': {
+   'sync': 'Performs a svn up 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 SVN repository',
+   },
+   'validate_config': CheckSyncConfig,
+   }
+   }
+}

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
new file mode 100644
index 000..182a7ac
--- /dev/null
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -0,0 +1,81 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+import logging
+import errno
+
+import portage
+from portage import os
+from portage.util import writemsg_level
+from portage.sync.syncbase import SyncBase
+
+
+class SVNSync(SyncBase):
+   '''SVN sync module'''
+
+   short_desc = "Perform sync operations on SVN repositories"
+
+   @staticmethod
+   def name():
+   return "SVNSync"
+
+
+   def __init__(self):
+   SyncBase.__init__(self, "svn", "dev-vcs/subversion")
+
+
+   def new(self, **kwargs):
+   if kwargs:
+   self._kwargs(kwargs)
+   #initial checkout
+   msg = ">>> Starting initial svn checkout with %s..." % 
self.repo.sync_uri
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n")
+   try:
+   os.rmdir(self.repo.location)
+   except OSError as e:
+   if e.errno != errno.ENOENT:
+   msg = "!!! existing '%s' directory; exiting." % 
self.repo.location
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (1, False)
+   del e
+   svn_root = self.repo.sync_uri
+   exitcode =  portage.process.spawn_bash(
+   "cd %s; exec svn %s" %
+   
(portage._shell_quote(os.path.dirname(self.repo.location)),
+   portage._shell_quote(svn_root)),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn checkout error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)
+
+
+   def _sync(self):
+   """
+   Internal function to sync an existing SVN repository
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+
+   svn_root = self.repo.sync_uri
+
+   if svn_root.startswith("svn://"):
+   svn_root = svn_root[6:]
+   #svn update
+   msg = ">>> Starting svn update with %s..." % 
self.repo.

[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-09-03 Thread Brian Dolbec
commit: 30909ce1a92a067fbbe3058275818a3aab9f4daf
Author: Brian Dolbec  gentoo  org>
AuthorDate: Mon Jun 16 17:58:09 2014 +
Commit: Brian Dolbec  gmail  com>
CommitDate: Thu Sep  4 01:18:02 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=30909ce1

sync/modules/svn: Add snv upgrade to sync operation

This prevents errors when a newer svn has been installed that requires a db 
upgrade.

---
 pym/portage/sync/modules/svn/svn.py | 23 +++
 1 file changed, 23 insertions(+)

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
index 182a7ac..0365e90 100644
--- a/pym/portage/sync/modules/svn/svn.py
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -62,6 +62,10 @@ class SVNSync(SyncBase):
@rtype: (int, bool)
"""
 
+   exitcode, d = self._svn_upgrade()
+   if exitcode != os.EX_OK:
+   return (exitcode, False)
+
svn_root = self.repo.sync_uri
 
if svn_root.startswith("svn://"):
@@ -79,3 +83,22 @@ class SVNSync(SyncBase):
self.logger(self.xterm_titles, msg)
writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
return (exitcode, False)
+
+
+   def _svn_upgrade(self):
+   """
+   Internal function which performs an svn upgrade on the repo
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+   exitcode = portage.process.spawn_bash(
+   "cd %s; exec svn upgrade" %
+   (portage._shell_quote(self.repo.location),),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn upgrade error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)



[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-09-04 Thread Brian Dolbec
commit: 2e6ccc31c3ce3ce86ce80c24e2a407fc5554f706
Author: David Heidelberger  ixit  cz>
AuthorDate: Mon Jun 16 16:04:06 2014 +
Commit: Brian Dolbec  gmail  com>
CommitDate: Thu Sep  4 07:20:42 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=2e6ccc31

portage/sync/modules: Add svn sync module

Module submitted by: David Heidelberger
edits by Brian Dolbec :
Remove CheckSVNConfig class.
Use the default CheckSyncConfig class instead.
Copying the sync-cvs-repo option from the cvs module was incorrect and not 
needed.
Fixed the new()'s spawn_bash(...) call.

---
 pym/portage/sync/modules/svn/__init__.py | 32 +
 pym/portage/sync/modules/svn/svn.py  | 81 
 2 files changed, 113 insertions(+)

diff --git a/pym/portage/sync/modules/svn/__init__.py 
b/pym/portage/sync/modules/svn/__init__.py
new file mode 100644
index 000..1fda55a
--- /dev/null
+++ b/pym/portage/sync/modules/svn/__init__.py
@@ -0,0 +1,32 @@
+# Copyright 2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+"""SVN plug-in module for portage.
+Performs a svn up on repositories
+"""
+
+
+from portage.localization import _
+from portage.sync.config_checks import CheckSyncConfig
+from portage.util import writemsg_level
+
+
+module_spec = {
+   'name': 'svn',
+   'description': __doc__,
+   'provides':{
+   'svn-module': {
+   'name': "svn",
+   'class': "SVNSync",
+   'description': __doc__,
+   'functions': ['sync', 'new', 'exists'],
+   'func_desc': {
+   'sync': 'Performs a svn up 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 SVN repository',
+   },
+   'validate_config': CheckSyncConfig,
+   }
+   }
+}

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
new file mode 100644
index 000..182a7ac
--- /dev/null
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -0,0 +1,81 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+import logging
+import errno
+
+import portage
+from portage import os
+from portage.util import writemsg_level
+from portage.sync.syncbase import SyncBase
+
+
+class SVNSync(SyncBase):
+   '''SVN sync module'''
+
+   short_desc = "Perform sync operations on SVN repositories"
+
+   @staticmethod
+   def name():
+   return "SVNSync"
+
+
+   def __init__(self):
+   SyncBase.__init__(self, "svn", "dev-vcs/subversion")
+
+
+   def new(self, **kwargs):
+   if kwargs:
+   self._kwargs(kwargs)
+   #initial checkout
+   msg = ">>> Starting initial svn checkout with %s..." % 
self.repo.sync_uri
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n")
+   try:
+   os.rmdir(self.repo.location)
+   except OSError as e:
+   if e.errno != errno.ENOENT:
+   msg = "!!! existing '%s' directory; exiting." % 
self.repo.location
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (1, False)
+   del e
+   svn_root = self.repo.sync_uri
+   exitcode =  portage.process.spawn_bash(
+   "cd %s; exec svn %s" %
+   
(portage._shell_quote(os.path.dirname(self.repo.location)),
+   portage._shell_quote(svn_root)),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn checkout error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)
+
+
+   def _sync(self):
+   """
+   Internal function to sync an existing SVN repository
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+
+   svn_root = self.repo.sync_uri
+
+   if svn_root.startswith("svn://"):
+   svn_root = svn_root[6:]
+   #svn update
+   msg = ">>> Starting svn update with %s..." % 
self.repo.

[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-09-04 Thread Brian Dolbec
commit: d2a6895c1ecabb94b5e19df12d1ee3570cf56bce
Author: Brian Dolbec  gentoo  org>
AuthorDate: Mon Jun 16 17:58:09 2014 +
Commit: Brian Dolbec  gmail  com>
CommitDate: Thu Sep  4 07:20:42 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=d2a6895c

sync/modules/svn: Add snv upgrade to sync operation

This prevents errors when a newer svn has been installed that requires a db 
upgrade.

---
 pym/portage/sync/modules/svn/svn.py | 23 +++
 1 file changed, 23 insertions(+)

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
index 182a7ac..0365e90 100644
--- a/pym/portage/sync/modules/svn/svn.py
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -62,6 +62,10 @@ class SVNSync(SyncBase):
@rtype: (int, bool)
"""
 
+   exitcode, d = self._svn_upgrade()
+   if exitcode != os.EX_OK:
+   return (exitcode, False)
+
svn_root = self.repo.sync_uri
 
if svn_root.startswith("svn://"):
@@ -79,3 +83,22 @@ class SVNSync(SyncBase):
self.logger(self.xterm_titles, msg)
writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
return (exitcode, False)
+
+
+   def _svn_upgrade(self):
+   """
+   Internal function which performs an svn upgrade on the repo
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+   exitcode = portage.process.spawn_bash(
+   "cd %s; exec svn upgrade" %
+   (portage._shell_quote(self.repo.location),),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn upgrade error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)



[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-09-05 Thread Brian Dolbec
commit: a89954dc492727902aceefad9eeac6064c3a5d42
Author: Brian Dolbec  gentoo  org>
AuthorDate: Mon Jun 16 17:58:09 2014 +
Commit: Brian Dolbec  gmail  com>
CommitDate: Fri Sep  5 20:26:14 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=a89954dc

sync/modules/svn: Add snv upgrade to sync operation

This prevents errors when a newer svn has been installed that requires a db 
upgrade.

---
 pym/portage/sync/modules/svn/svn.py | 23 +++
 1 file changed, 23 insertions(+)

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
index 182a7ac..0365e90 100644
--- a/pym/portage/sync/modules/svn/svn.py
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -62,6 +62,10 @@ class SVNSync(SyncBase):
@rtype: (int, bool)
"""
 
+   exitcode, d = self._svn_upgrade()
+   if exitcode != os.EX_OK:
+   return (exitcode, False)
+
svn_root = self.repo.sync_uri
 
if svn_root.startswith("svn://"):
@@ -79,3 +83,22 @@ class SVNSync(SyncBase):
self.logger(self.xterm_titles, msg)
writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
return (exitcode, False)
+
+
+   def _svn_upgrade(self):
+   """
+   Internal function which performs an svn upgrade on the repo
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+   exitcode = portage.process.spawn_bash(
+   "cd %s; exec svn upgrade" %
+   (portage._shell_quote(self.repo.location),),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn upgrade error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)



[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-09-05 Thread Brian Dolbec
commit: d2b019e8b9e7f3e8924a5f38c9fff991aeda223f
Author: David Heidelberger  ixit  cz>
AuthorDate: Mon Jun 16 16:04:06 2014 +
Commit: Brian Dolbec  gmail  com>
CommitDate: Fri Sep  5 20:26:14 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=d2b019e8

portage/sync/modules: Add svn sync module

Module submitted by: David Heidelberger
edits by Brian Dolbec :
Remove CheckSVNConfig class.
Use the default CheckSyncConfig class instead.
Copying the sync-cvs-repo option from the cvs module was incorrect and not 
needed.
Fixed the new()'s spawn_bash(...) call.

---
 pym/portage/sync/modules/svn/__init__.py | 32 +
 pym/portage/sync/modules/svn/svn.py  | 81 
 2 files changed, 113 insertions(+)

diff --git a/pym/portage/sync/modules/svn/__init__.py 
b/pym/portage/sync/modules/svn/__init__.py
new file mode 100644
index 000..1fda55a
--- /dev/null
+++ b/pym/portage/sync/modules/svn/__init__.py
@@ -0,0 +1,32 @@
+# Copyright 2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+"""SVN plug-in module for portage.
+Performs a svn up on repositories
+"""
+
+
+from portage.localization import _
+from portage.sync.config_checks import CheckSyncConfig
+from portage.util import writemsg_level
+
+
+module_spec = {
+   'name': 'svn',
+   'description': __doc__,
+   'provides':{
+   'svn-module': {
+   'name': "svn",
+   'class': "SVNSync",
+   'description': __doc__,
+   'functions': ['sync', 'new', 'exists'],
+   'func_desc': {
+   'sync': 'Performs a svn up 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 SVN repository',
+   },
+   'validate_config': CheckSyncConfig,
+   }
+   }
+}

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
new file mode 100644
index 000..182a7ac
--- /dev/null
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -0,0 +1,81 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+import logging
+import errno
+
+import portage
+from portage import os
+from portage.util import writemsg_level
+from portage.sync.syncbase import SyncBase
+
+
+class SVNSync(SyncBase):
+   '''SVN sync module'''
+
+   short_desc = "Perform sync operations on SVN repositories"
+
+   @staticmethod
+   def name():
+   return "SVNSync"
+
+
+   def __init__(self):
+   SyncBase.__init__(self, "svn", "dev-vcs/subversion")
+
+
+   def new(self, **kwargs):
+   if kwargs:
+   self._kwargs(kwargs)
+   #initial checkout
+   msg = ">>> Starting initial svn checkout with %s..." % 
self.repo.sync_uri
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n")
+   try:
+   os.rmdir(self.repo.location)
+   except OSError as e:
+   if e.errno != errno.ENOENT:
+   msg = "!!! existing '%s' directory; exiting." % 
self.repo.location
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (1, False)
+   del e
+   svn_root = self.repo.sync_uri
+   exitcode =  portage.process.spawn_bash(
+   "cd %s; exec svn %s" %
+   
(portage._shell_quote(os.path.dirname(self.repo.location)),
+   portage._shell_quote(svn_root)),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn checkout error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)
+
+
+   def _sync(self):
+   """
+   Internal function to sync an existing SVN repository
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+
+   svn_root = self.repo.sync_uri
+
+   if svn_root.startswith("svn://"):
+   svn_root = svn_root[6:]
+   #svn update
+   msg = ">>> Starting svn update with %s..." % 
self.repo.

[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-09-26 Thread Brian Dolbec
commit: b16889acdf7754ce5c0d0151beafde8dcb44de99
Author: Brian Dolbec  gentoo  org>
AuthorDate: Mon Jun 16 17:58:09 2014 +
Commit: Brian Dolbec  gmail  com>
CommitDate: Sat Sep 27 01:40:45 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=b16889ac

sync/modules/svn: Add snv upgrade to sync operation

This prevents errors when a newer svn has been installed that requires a db 
upgrade.

---
 pym/portage/sync/modules/svn/svn.py | 23 +++
 1 file changed, 23 insertions(+)

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
index 182a7ac..0365e90 100644
--- a/pym/portage/sync/modules/svn/svn.py
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -62,6 +62,10 @@ class SVNSync(SyncBase):
@rtype: (int, bool)
"""
 
+   exitcode, d = self._svn_upgrade()
+   if exitcode != os.EX_OK:
+   return (exitcode, False)
+
svn_root = self.repo.sync_uri
 
if svn_root.startswith("svn://"):
@@ -79,3 +83,22 @@ class SVNSync(SyncBase):
self.logger(self.xterm_titles, msg)
writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
return (exitcode, False)
+
+
+   def _svn_upgrade(self):
+   """
+   Internal function which performs an svn upgrade on the repo
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+   exitcode = portage.process.spawn_bash(
+   "cd %s; exec svn upgrade" %
+   (portage._shell_quote(self.repo.location),),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn upgrade error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)



[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-09-26 Thread Brian Dolbec
commit: 95e96778a2ccc3aaa441aae544371d299f1d07c8
Author: David Heidelberger  ixit  cz>
AuthorDate: Mon Jun 16 16:04:06 2014 +
Commit: Brian Dolbec  gmail  com>
CommitDate: Sat Sep 27 01:40:45 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=95e96778

portage/sync/modules: Add svn sync module

Module submitted by: David Heidelberger
edits by Brian Dolbec :
Remove CheckSVNConfig class.
Use the default CheckSyncConfig class instead.
Copying the sync-cvs-repo option from the cvs module was incorrect and not 
needed.
Fixed the new()'s spawn_bash(...) call.

---
 pym/portage/sync/modules/svn/__init__.py | 32 +
 pym/portage/sync/modules/svn/svn.py  | 81 
 2 files changed, 113 insertions(+)

diff --git a/pym/portage/sync/modules/svn/__init__.py 
b/pym/portage/sync/modules/svn/__init__.py
new file mode 100644
index 000..1fda55a
--- /dev/null
+++ b/pym/portage/sync/modules/svn/__init__.py
@@ -0,0 +1,32 @@
+# Copyright 2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+"""SVN plug-in module for portage.
+Performs a svn up on repositories
+"""
+
+
+from portage.localization import _
+from portage.sync.config_checks import CheckSyncConfig
+from portage.util import writemsg_level
+
+
+module_spec = {
+   'name': 'svn',
+   'description': __doc__,
+   'provides':{
+   'svn-module': {
+   'name': "svn",
+   'class': "SVNSync",
+   'description': __doc__,
+   'functions': ['sync', 'new', 'exists'],
+   'func_desc': {
+   'sync': 'Performs a svn up 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 SVN repository',
+   },
+   'validate_config': CheckSyncConfig,
+   }
+   }
+}

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
new file mode 100644
index 000..182a7ac
--- /dev/null
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -0,0 +1,81 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+import logging
+import errno
+
+import portage
+from portage import os
+from portage.util import writemsg_level
+from portage.sync.syncbase import SyncBase
+
+
+class SVNSync(SyncBase):
+   '''SVN sync module'''
+
+   short_desc = "Perform sync operations on SVN repositories"
+
+   @staticmethod
+   def name():
+   return "SVNSync"
+
+
+   def __init__(self):
+   SyncBase.__init__(self, "svn", "dev-vcs/subversion")
+
+
+   def new(self, **kwargs):
+   if kwargs:
+   self._kwargs(kwargs)
+   #initial checkout
+   msg = ">>> Starting initial svn checkout with %s..." % 
self.repo.sync_uri
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n")
+   try:
+   os.rmdir(self.repo.location)
+   except OSError as e:
+   if e.errno != errno.ENOENT:
+   msg = "!!! existing '%s' directory; exiting." % 
self.repo.location
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (1, False)
+   del e
+   svn_root = self.repo.sync_uri
+   exitcode =  portage.process.spawn_bash(
+   "cd %s; exec svn %s" %
+   
(portage._shell_quote(os.path.dirname(self.repo.location)),
+   portage._shell_quote(svn_root)),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn checkout error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)
+
+
+   def _sync(self):
+   """
+   Internal function to sync an existing SVN repository
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+
+   svn_root = self.repo.sync_uri
+
+   if svn_root.startswith("svn://"):
+   svn_root = svn_root[6:]
+   #svn update
+   msg = ">>> Starting svn update with %s..." % 
self.repo.

[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-09-29 Thread Brian Dolbec
commit: 53430a1d9a1452d152f590672b0e073011cf3552
Author: David Heidelberger  ixit  cz>
AuthorDate: Mon Jun 16 16:04:06 2014 +
Commit: Brian Dolbec  gmail  com>
CommitDate: Mon Sep 29 17:20:21 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=53430a1d

portage/sync/modules: Add svn sync module

Module submitted by: David Heidelberger
edits by Brian Dolbec :
Remove CheckSVNConfig class.
Use the default CheckSyncConfig class instead.
Copying the sync-cvs-repo option from the cvs module was incorrect and not 
needed.
Fixed the new()'s spawn_bash(...) call.

---
 pym/portage/sync/modules/svn/__init__.py | 32 +
 pym/portage/sync/modules/svn/svn.py  | 81 
 2 files changed, 113 insertions(+)

diff --git a/pym/portage/sync/modules/svn/__init__.py 
b/pym/portage/sync/modules/svn/__init__.py
new file mode 100644
index 000..1fda55a
--- /dev/null
+++ b/pym/portage/sync/modules/svn/__init__.py
@@ -0,0 +1,32 @@
+# Copyright 2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+"""SVN plug-in module for portage.
+Performs a svn up on repositories
+"""
+
+
+from portage.localization import _
+from portage.sync.config_checks import CheckSyncConfig
+from portage.util import writemsg_level
+
+
+module_spec = {
+   'name': 'svn',
+   'description': __doc__,
+   'provides':{
+   'svn-module': {
+   'name': "svn",
+   'class': "SVNSync",
+   'description': __doc__,
+   'functions': ['sync', 'new', 'exists'],
+   'func_desc': {
+   'sync': 'Performs a svn up 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 SVN repository',
+   },
+   'validate_config': CheckSyncConfig,
+   }
+   }
+}

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
new file mode 100644
index 000..182a7ac
--- /dev/null
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -0,0 +1,81 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+import logging
+import errno
+
+import portage
+from portage import os
+from portage.util import writemsg_level
+from portage.sync.syncbase import SyncBase
+
+
+class SVNSync(SyncBase):
+   '''SVN sync module'''
+
+   short_desc = "Perform sync operations on SVN repositories"
+
+   @staticmethod
+   def name():
+   return "SVNSync"
+
+
+   def __init__(self):
+   SyncBase.__init__(self, "svn", "dev-vcs/subversion")
+
+
+   def new(self, **kwargs):
+   if kwargs:
+   self._kwargs(kwargs)
+   #initial checkout
+   msg = ">>> Starting initial svn checkout with %s..." % 
self.repo.sync_uri
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n")
+   try:
+   os.rmdir(self.repo.location)
+   except OSError as e:
+   if e.errno != errno.ENOENT:
+   msg = "!!! existing '%s' directory; exiting." % 
self.repo.location
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (1, False)
+   del e
+   svn_root = self.repo.sync_uri
+   exitcode =  portage.process.spawn_bash(
+   "cd %s; exec svn %s" %
+   
(portage._shell_quote(os.path.dirname(self.repo.location)),
+   portage._shell_quote(svn_root)),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn checkout error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)
+
+
+   def _sync(self):
+   """
+   Internal function to sync an existing SVN repository
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+
+   svn_root = self.repo.sync_uri
+
+   if svn_root.startswith("svn://"):
+   svn_root = svn_root[6:]
+   #svn update
+   msg = ">>> Starting svn update with %s..." % 
self.repo.

[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-09-29 Thread Brian Dolbec
commit: 55ab0b8c43533defa8f676df699c7b2471fccb6f
Author: Brian Dolbec  gentoo  org>
AuthorDate: Mon Jun 16 17:58:09 2014 +
Commit: Brian Dolbec  gmail  com>
CommitDate: Mon Sep 29 17:20:21 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=55ab0b8c

sync/modules/svn: Add snv upgrade to sync operation

This prevents errors when a newer svn has been installed that requires a db 
upgrade.

---
 pym/portage/sync/modules/svn/svn.py | 23 +++
 1 file changed, 23 insertions(+)

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
index 182a7ac..0365e90 100644
--- a/pym/portage/sync/modules/svn/svn.py
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -62,6 +62,10 @@ class SVNSync(SyncBase):
@rtype: (int, bool)
"""
 
+   exitcode, d = self._svn_upgrade()
+   if exitcode != os.EX_OK:
+   return (exitcode, False)
+
svn_root = self.repo.sync_uri
 
if svn_root.startswith("svn://"):
@@ -79,3 +83,22 @@ class SVNSync(SyncBase):
self.logger(self.xterm_titles, msg)
writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
return (exitcode, False)
+
+
+   def _svn_upgrade(self):
+   """
+   Internal function which performs an svn upgrade on the repo
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+   exitcode = portage.process.spawn_bash(
+   "cd %s; exec svn upgrade" %
+   (portage._shell_quote(self.repo.location),),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn upgrade error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)



[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-09-29 Thread Brian Dolbec
commit: 0f80a9bce939874c51a83a9fea63905bbfd47675
Author: Brian Dolbec  gentoo  org>
AuthorDate: Mon Jun 16 17:58:09 2014 +
Commit: Brian Dolbec  gmail  com>
CommitDate: Tue Sep 30 00:42:26 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=0f80a9bc

sync/modules/svn: Add snv upgrade to sync operation

This prevents errors when a newer svn has been installed that requires a db 
upgrade.

---
 pym/portage/sync/modules/svn/svn.py | 23 +++
 1 file changed, 23 insertions(+)

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
index 182a7ac..0365e90 100644
--- a/pym/portage/sync/modules/svn/svn.py
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -62,6 +62,10 @@ class SVNSync(SyncBase):
@rtype: (int, bool)
"""
 
+   exitcode, d = self._svn_upgrade()
+   if exitcode != os.EX_OK:
+   return (exitcode, False)
+
svn_root = self.repo.sync_uri
 
if svn_root.startswith("svn://"):
@@ -79,3 +83,22 @@ class SVNSync(SyncBase):
self.logger(self.xterm_titles, msg)
writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
return (exitcode, False)
+
+
+   def _svn_upgrade(self):
+   """
+   Internal function which performs an svn upgrade on the repo
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+   exitcode = portage.process.spawn_bash(
+   "cd %s; exec svn upgrade" %
+   (portage._shell_quote(self.repo.location),),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn upgrade error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)



[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-09-29 Thread Brian Dolbec
commit: d524b7285c973385c90e272829bda8b727cd5f54
Author: David Heidelberger  ixit  cz>
AuthorDate: Mon Jun 16 16:04:06 2014 +
Commit: Brian Dolbec  gmail  com>
CommitDate: Tue Sep 30 00:42:26 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=d524b728

portage/sync/modules: Add svn sync module

Module submitted by: David Heidelberger
edits by Brian Dolbec :
Remove CheckSVNConfig class.
Use the default CheckSyncConfig class instead.
Copying the sync-cvs-repo option from the cvs module was incorrect and not 
needed.
Fixed the new()'s spawn_bash(...) call.

---
 pym/portage/sync/modules/svn/__init__.py | 32 +
 pym/portage/sync/modules/svn/svn.py  | 81 
 2 files changed, 113 insertions(+)

diff --git a/pym/portage/sync/modules/svn/__init__.py 
b/pym/portage/sync/modules/svn/__init__.py
new file mode 100644
index 000..1fda55a
--- /dev/null
+++ b/pym/portage/sync/modules/svn/__init__.py
@@ -0,0 +1,32 @@
+# Copyright 2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+"""SVN plug-in module for portage.
+Performs a svn up on repositories
+"""
+
+
+from portage.localization import _
+from portage.sync.config_checks import CheckSyncConfig
+from portage.util import writemsg_level
+
+
+module_spec = {
+   'name': 'svn',
+   'description': __doc__,
+   'provides':{
+   'svn-module': {
+   'name': "svn",
+   'class': "SVNSync",
+   'description': __doc__,
+   'functions': ['sync', 'new', 'exists'],
+   'func_desc': {
+   'sync': 'Performs a svn up 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 SVN repository',
+   },
+   'validate_config': CheckSyncConfig,
+   }
+   }
+}

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
new file mode 100644
index 000..182a7ac
--- /dev/null
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -0,0 +1,81 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+import logging
+import errno
+
+import portage
+from portage import os
+from portage.util import writemsg_level
+from portage.sync.syncbase import SyncBase
+
+
+class SVNSync(SyncBase):
+   '''SVN sync module'''
+
+   short_desc = "Perform sync operations on SVN repositories"
+
+   @staticmethod
+   def name():
+   return "SVNSync"
+
+
+   def __init__(self):
+   SyncBase.__init__(self, "svn", "dev-vcs/subversion")
+
+
+   def new(self, **kwargs):
+   if kwargs:
+   self._kwargs(kwargs)
+   #initial checkout
+   msg = ">>> Starting initial svn checkout with %s..." % 
self.repo.sync_uri
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n")
+   try:
+   os.rmdir(self.repo.location)
+   except OSError as e:
+   if e.errno != errno.ENOENT:
+   msg = "!!! existing '%s' directory; exiting." % 
self.repo.location
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (1, False)
+   del e
+   svn_root = self.repo.sync_uri
+   exitcode =  portage.process.spawn_bash(
+   "cd %s; exec svn %s" %
+   
(portage._shell_quote(os.path.dirname(self.repo.location)),
+   portage._shell_quote(svn_root)),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn checkout error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)
+
+
+   def _sync(self):
+   """
+   Internal function to sync an existing SVN repository
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+
+   svn_root = self.repo.sync_uri
+
+   if svn_root.startswith("svn://"):
+   svn_root = svn_root[6:]
+   #svn update
+   msg = ">>> Starting svn update with %s..." % 
self.repo.

[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-06-16 Thread Brian Dolbec
commit: d894d8c13f62dc7e40e78ae942c98d7d43e02bcd
Author: David Heidelberger  ixit  cz>
AuthorDate: Mon Jun 16 16:04:06 2014 +
Commit: Brian Dolbec  gmail  com>
CommitDate: Mon Jun 16 17:59:05 2014 +
URL:
http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=d894d8c1

portage/sync/modules: Add svn sync module

Module submitted by: David Heidelberger
edits by Brian Dolbec :
Remove CheckSVNConfig class.
Use the default CheckSyncConfig class instead.
Copying the sync-cvs-repo option from the cvs module was incorrect and not 
needed.
Fixed the new()'s spawn_bash(...) call.

---
 pym/portage/sync/modules/svn/__init__.py | 32 +
 pym/portage/sync/modules/svn/svn.py  | 81 
 2 files changed, 113 insertions(+)

diff --git a/pym/portage/sync/modules/svn/__init__.py 
b/pym/portage/sync/modules/svn/__init__.py
new file mode 100644
index 000..1fda55a
--- /dev/null
+++ b/pym/portage/sync/modules/svn/__init__.py
@@ -0,0 +1,32 @@
+# Copyright 2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+"""SVN plug-in module for portage.
+Performs a svn up on repositories
+"""
+
+
+from portage.localization import _
+from portage.sync.config_checks import CheckSyncConfig
+from portage.util import writemsg_level
+
+
+module_spec = {
+   'name': 'svn',
+   'description': __doc__,
+   'provides':{
+   'svn-module': {
+   'name': "svn",
+   'class': "SVNSync",
+   'description': __doc__,
+   'functions': ['sync', 'new', 'exists'],
+   'func_desc': {
+   'sync': 'Performs a svn up 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 SVN repository',
+   },
+   'validate_config': CheckSyncConfig,
+   }
+   }
+}

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
new file mode 100644
index 000..182a7ac
--- /dev/null
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -0,0 +1,81 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+import logging
+import errno
+
+import portage
+from portage import os
+from portage.util import writemsg_level
+from portage.sync.syncbase import SyncBase
+
+
+class SVNSync(SyncBase):
+   '''SVN sync module'''
+
+   short_desc = "Perform sync operations on SVN repositories"
+
+   @staticmethod
+   def name():
+   return "SVNSync"
+
+
+   def __init__(self):
+   SyncBase.__init__(self, "svn", "dev-vcs/subversion")
+
+
+   def new(self, **kwargs):
+   if kwargs:
+   self._kwargs(kwargs)
+   #initial checkout
+   msg = ">>> Starting initial svn checkout with %s..." % 
self.repo.sync_uri
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n")
+   try:
+   os.rmdir(self.repo.location)
+   except OSError as e:
+   if e.errno != errno.ENOENT:
+   msg = "!!! existing '%s' directory; exiting." % 
self.repo.location
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (1, False)
+   del e
+   svn_root = self.repo.sync_uri
+   exitcode =  portage.process.spawn_bash(
+   "cd %s; exec svn %s" %
+   
(portage._shell_quote(os.path.dirname(self.repo.location)),
+   portage._shell_quote(svn_root)),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn checkout error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)
+
+
+   def _sync(self):
+   """
+   Internal function to sync an existing SVN repository
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+
+   svn_root = self.repo.sync_uri
+
+   if svn_root.startswith("svn://"):
+   svn_root = svn_root[6:]
+   #svn update
+   msg = ">>> Starting svn update with %s..." % 
self.

[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-06-16 Thread Brian Dolbec
commit: e304a607772e052227a771219579e4112544a022
Author: Brian Dolbec  gentoo  org>
AuthorDate: Mon Jun 16 17:58:09 2014 +
Commit: Brian Dolbec  gmail  com>
CommitDate: Mon Jun 16 18:08:54 2014 +
URL:
http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=e304a607

sync/modules/svn: Add snv upgrade to sync operation

This prevents errors when a newer svn has been installed that requires a db 
upgrade.

---
 pym/portage/sync/modules/svn/svn.py | 23 +++
 1 file changed, 23 insertions(+)

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
index 182a7ac..0365e90 100644
--- a/pym/portage/sync/modules/svn/svn.py
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -62,6 +62,10 @@ class SVNSync(SyncBase):
@rtype: (int, bool)
"""
 
+   exitcode, d = self._svn_upgrade()
+   if exitcode != os.EX_OK:
+   return (exitcode, False)
+
svn_root = self.repo.sync_uri
 
if svn_root.startswith("svn://"):
@@ -79,3 +83,22 @@ class SVNSync(SyncBase):
self.logger(self.xterm_titles, msg)
writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
return (exitcode, False)
+
+
+   def _svn_upgrade(self):
+   """
+   Internal function which performs an svn upgrade on the repo
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+   exitcode = portage.process.spawn_bash(
+   "cd %s; exec svn upgrade" %
+   (portage._shell_quote(self.repo.location),),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn upgrade error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)



[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-06-16 Thread Brian Dolbec
commit: 90cef042302e0c347e9361a145132942d17e8823
Author: David Heidelberger  ixit  cz>
AuthorDate: Mon Jun 16 16:04:06 2014 +
Commit: Brian Dolbec  gmail  com>
CommitDate: Mon Jun 16 22:44:15 2014 +
URL:
http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=90cef042

portage/sync/modules: Add svn sync module

Module submitted by: David Heidelberger
edits by Brian Dolbec :
Remove CheckSVNConfig class.
Use the default CheckSyncConfig class instead.
Copying the sync-cvs-repo option from the cvs module was incorrect and not 
needed.
Fixed the new()'s spawn_bash(...) call.

---
 pym/portage/sync/modules/svn/__init__.py | 32 +
 pym/portage/sync/modules/svn/svn.py  | 81 
 2 files changed, 113 insertions(+)

diff --git a/pym/portage/sync/modules/svn/__init__.py 
b/pym/portage/sync/modules/svn/__init__.py
new file mode 100644
index 000..1fda55a
--- /dev/null
+++ b/pym/portage/sync/modules/svn/__init__.py
@@ -0,0 +1,32 @@
+# Copyright 2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+"""SVN plug-in module for portage.
+Performs a svn up on repositories
+"""
+
+
+from portage.localization import _
+from portage.sync.config_checks import CheckSyncConfig
+from portage.util import writemsg_level
+
+
+module_spec = {
+   'name': 'svn',
+   'description': __doc__,
+   'provides':{
+   'svn-module': {
+   'name': "svn",
+   'class': "SVNSync",
+   'description': __doc__,
+   'functions': ['sync', 'new', 'exists'],
+   'func_desc': {
+   'sync': 'Performs a svn up 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 SVN repository',
+   },
+   'validate_config': CheckSyncConfig,
+   }
+   }
+}

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
new file mode 100644
index 000..182a7ac
--- /dev/null
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -0,0 +1,81 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+import logging
+import errno
+
+import portage
+from portage import os
+from portage.util import writemsg_level
+from portage.sync.syncbase import SyncBase
+
+
+class SVNSync(SyncBase):
+   '''SVN sync module'''
+
+   short_desc = "Perform sync operations on SVN repositories"
+
+   @staticmethod
+   def name():
+   return "SVNSync"
+
+
+   def __init__(self):
+   SyncBase.__init__(self, "svn", "dev-vcs/subversion")
+
+
+   def new(self, **kwargs):
+   if kwargs:
+   self._kwargs(kwargs)
+   #initial checkout
+   msg = ">>> Starting initial svn checkout with %s..." % 
self.repo.sync_uri
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n")
+   try:
+   os.rmdir(self.repo.location)
+   except OSError as e:
+   if e.errno != errno.ENOENT:
+   msg = "!!! existing '%s' directory; exiting." % 
self.repo.location
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (1, False)
+   del e
+   svn_root = self.repo.sync_uri
+   exitcode =  portage.process.spawn_bash(
+   "cd %s; exec svn %s" %
+   
(portage._shell_quote(os.path.dirname(self.repo.location)),
+   portage._shell_quote(svn_root)),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn checkout error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)
+
+
+   def _sync(self):
+   """
+   Internal function to sync an existing SVN repository
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+
+   svn_root = self.repo.sync_uri
+
+   if svn_root.startswith("svn://"):
+   svn_root = svn_root[6:]
+   #svn update
+   msg = ">>> Starting svn update with %s..." % 
self.

[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-06-16 Thread Brian Dolbec
commit: b96eaefa633548405a0389eaac66388ae2c1f870
Author: Brian Dolbec  gentoo  org>
AuthorDate: Mon Jun 16 17:58:09 2014 +
Commit: Brian Dolbec  gmail  com>
CommitDate: Mon Jun 16 22:44:15 2014 +
URL:
http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=b96eaefa

sync/modules/svn: Add snv upgrade to sync operation

This prevents errors when a newer svn has been installed that requires a db 
upgrade.

---
 pym/portage/sync/modules/svn/svn.py | 23 +++
 1 file changed, 23 insertions(+)

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
index 182a7ac..0365e90 100644
--- a/pym/portage/sync/modules/svn/svn.py
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -62,6 +62,10 @@ class SVNSync(SyncBase):
@rtype: (int, bool)
"""
 
+   exitcode, d = self._svn_upgrade()
+   if exitcode != os.EX_OK:
+   return (exitcode, False)
+
svn_root = self.repo.sync_uri
 
if svn_root.startswith("svn://"):
@@ -79,3 +83,22 @@ class SVNSync(SyncBase):
self.logger(self.xterm_titles, msg)
writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
return (exitcode, False)
+
+
+   def _svn_upgrade(self):
+   """
+   Internal function which performs an svn upgrade on the repo
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+   exitcode = portage.process.spawn_bash(
+   "cd %s; exec svn upgrade" %
+   (portage._shell_quote(self.repo.location),),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn upgrade error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)



[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-10-19 Thread Zac Medico
commit: 3e03d6b00b90d45a570cca06289e74603d76ca3d
Author: David Heidelberger  ixit  cz>
AuthorDate: Mon Jun 16 16:04:06 2014 +
Commit: Zac Medico  gentoo  org>
CommitDate: Mon Oct 20 03:48:34 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=3e03d6b0

portage/sync/modules: Add svn sync module

Module submitted by: David Heidelberger
edits by Brian Dolbec :
Remove CheckSVNConfig class.
Use the default CheckSyncConfig class instead.
Copying the sync-cvs-repo option from the cvs module was incorrect and not 
needed.
Fixed the new()'s spawn_bash(...) call.

---
 pym/portage/sync/modules/svn/__init__.py | 32 +
 pym/portage/sync/modules/svn/svn.py  | 81 
 2 files changed, 113 insertions(+)

diff --git a/pym/portage/sync/modules/svn/__init__.py 
b/pym/portage/sync/modules/svn/__init__.py
new file mode 100644
index 000..1fda55a
--- /dev/null
+++ b/pym/portage/sync/modules/svn/__init__.py
@@ -0,0 +1,32 @@
+# Copyright 2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+"""SVN plug-in module for portage.
+Performs a svn up on repositories
+"""
+
+
+from portage.localization import _
+from portage.sync.config_checks import CheckSyncConfig
+from portage.util import writemsg_level
+
+
+module_spec = {
+   'name': 'svn',
+   'description': __doc__,
+   'provides':{
+   'svn-module': {
+   'name': "svn",
+   'class': "SVNSync",
+   'description': __doc__,
+   'functions': ['sync', 'new', 'exists'],
+   'func_desc': {
+   'sync': 'Performs a svn up 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 SVN repository',
+   },
+   'validate_config': CheckSyncConfig,
+   }
+   }
+}

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
new file mode 100644
index 000..182a7ac
--- /dev/null
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -0,0 +1,81 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+import logging
+import errno
+
+import portage
+from portage import os
+from portage.util import writemsg_level
+from portage.sync.syncbase import SyncBase
+
+
+class SVNSync(SyncBase):
+   '''SVN sync module'''
+
+   short_desc = "Perform sync operations on SVN repositories"
+
+   @staticmethod
+   def name():
+   return "SVNSync"
+
+
+   def __init__(self):
+   SyncBase.__init__(self, "svn", "dev-vcs/subversion")
+
+
+   def new(self, **kwargs):
+   if kwargs:
+   self._kwargs(kwargs)
+   #initial checkout
+   msg = ">>> Starting initial svn checkout with %s..." % 
self.repo.sync_uri
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n")
+   try:
+   os.rmdir(self.repo.location)
+   except OSError as e:
+   if e.errno != errno.ENOENT:
+   msg = "!!! existing '%s' directory; exiting." % 
self.repo.location
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (1, False)
+   del e
+   svn_root = self.repo.sync_uri
+   exitcode =  portage.process.spawn_bash(
+   "cd %s; exec svn %s" %
+   
(portage._shell_quote(os.path.dirname(self.repo.location)),
+   portage._shell_quote(svn_root)),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn checkout error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)
+
+
+   def _sync(self):
+   """
+   Internal function to sync an existing SVN repository
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+
+   svn_root = self.repo.sync_uri
+
+   if svn_root.startswith("svn://"):
+   svn_root = svn_root[6:]
+   #svn update
+   msg = ">>> Starting svn update with %s..." % 
self.repo.s

[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-10-19 Thread Zac Medico
commit: 9132fdaedfcb8aac0cebdc4154120fbf45b04a42
Author: Brian Dolbec  gentoo  org>
AuthorDate: Mon Jun 16 17:58:09 2014 +
Commit: Zac Medico  gentoo  org>
CommitDate: Mon Oct 20 03:48:34 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=9132fdae

sync/modules/svn: Add snv upgrade to sync operation

This prevents errors when a newer svn has been installed that requires a db 
upgrade.

---
 pym/portage/sync/modules/svn/svn.py | 23 +++
 1 file changed, 23 insertions(+)

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
index 182a7ac..0365e90 100644
--- a/pym/portage/sync/modules/svn/svn.py
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -62,6 +62,10 @@ class SVNSync(SyncBase):
@rtype: (int, bool)
"""
 
+   exitcode, d = self._svn_upgrade()
+   if exitcode != os.EX_OK:
+   return (exitcode, False)
+
svn_root = self.repo.sync_uri
 
if svn_root.startswith("svn://"):
@@ -79,3 +83,22 @@ class SVNSync(SyncBase):
self.logger(self.xterm_titles, msg)
writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
return (exitcode, False)
+
+
+   def _svn_upgrade(self):
+   """
+   Internal function which performs an svn upgrade on the repo
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+   exitcode = portage.process.spawn_bash(
+   "cd %s; exec svn upgrade" %
+   (portage._shell_quote(self.repo.location),),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn upgrade error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)



[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-10-20 Thread Zac Medico
commit: a56ee8b456ea059f92e5e4fd142cde85be249a23
Author: David Heidelberger  ixit  cz>
AuthorDate: Mon Jun 16 16:04:06 2014 +
Commit: Zac Medico  gentoo  org>
CommitDate: Tue Oct 21 05:04:07 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=a56ee8b4

portage/sync/modules: Add svn sync module

Module submitted by: David Heidelberger
edits by Brian Dolbec :
Remove CheckSVNConfig class.
Use the default CheckSyncConfig class instead.
Copying the sync-cvs-repo option from the cvs module was incorrect and not 
needed.
Fixed the new()'s spawn_bash(...) call.

---
 pym/portage/sync/modules/svn/__init__.py | 32 +
 pym/portage/sync/modules/svn/svn.py  | 81 
 2 files changed, 113 insertions(+)

diff --git a/pym/portage/sync/modules/svn/__init__.py 
b/pym/portage/sync/modules/svn/__init__.py
new file mode 100644
index 000..1fda55a
--- /dev/null
+++ b/pym/portage/sync/modules/svn/__init__.py
@@ -0,0 +1,32 @@
+# Copyright 2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+"""SVN plug-in module for portage.
+Performs a svn up on repositories
+"""
+
+
+from portage.localization import _
+from portage.sync.config_checks import CheckSyncConfig
+from portage.util import writemsg_level
+
+
+module_spec = {
+   'name': 'svn',
+   'description': __doc__,
+   'provides':{
+   'svn-module': {
+   'name': "svn",
+   'class': "SVNSync",
+   'description': __doc__,
+   'functions': ['sync', 'new', 'exists'],
+   'func_desc': {
+   'sync': 'Performs a svn up 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 SVN repository',
+   },
+   'validate_config': CheckSyncConfig,
+   }
+   }
+}

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
new file mode 100644
index 000..182a7ac
--- /dev/null
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -0,0 +1,81 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+import logging
+import errno
+
+import portage
+from portage import os
+from portage.util import writemsg_level
+from portage.sync.syncbase import SyncBase
+
+
+class SVNSync(SyncBase):
+   '''SVN sync module'''
+
+   short_desc = "Perform sync operations on SVN repositories"
+
+   @staticmethod
+   def name():
+   return "SVNSync"
+
+
+   def __init__(self):
+   SyncBase.__init__(self, "svn", "dev-vcs/subversion")
+
+
+   def new(self, **kwargs):
+   if kwargs:
+   self._kwargs(kwargs)
+   #initial checkout
+   msg = ">>> Starting initial svn checkout with %s..." % 
self.repo.sync_uri
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n")
+   try:
+   os.rmdir(self.repo.location)
+   except OSError as e:
+   if e.errno != errno.ENOENT:
+   msg = "!!! existing '%s' directory; exiting." % 
self.repo.location
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (1, False)
+   del e
+   svn_root = self.repo.sync_uri
+   exitcode =  portage.process.spawn_bash(
+   "cd %s; exec svn %s" %
+   
(portage._shell_quote(os.path.dirname(self.repo.location)),
+   portage._shell_quote(svn_root)),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn checkout error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)
+
+
+   def _sync(self):
+   """
+   Internal function to sync an existing SVN repository
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+
+   svn_root = self.repo.sync_uri
+
+   if svn_root.startswith("svn://"):
+   svn_root = svn_root[6:]
+   #svn update
+   msg = ">>> Starting svn update with %s..." % 
self.repo.s

[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-10-20 Thread Zac Medico
commit: 8ba80d4cf6d4af4e6c1d59c3c0bf732ea224aea4
Author: Brian Dolbec  gentoo  org>
AuthorDate: Mon Jun 16 17:58:09 2014 +
Commit: Zac Medico  gentoo  org>
CommitDate: Tue Oct 21 05:04:07 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=8ba80d4c

sync/modules/svn: Add snv upgrade to sync operation

This prevents errors when a newer svn has been installed that requires a db 
upgrade.

---
 pym/portage/sync/modules/svn/svn.py | 23 +++
 1 file changed, 23 insertions(+)

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
index 182a7ac..0365e90 100644
--- a/pym/portage/sync/modules/svn/svn.py
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -62,6 +62,10 @@ class SVNSync(SyncBase):
@rtype: (int, bool)
"""
 
+   exitcode, d = self._svn_upgrade()
+   if exitcode != os.EX_OK:
+   return (exitcode, False)
+
svn_root = self.repo.sync_uri
 
if svn_root.startswith("svn://"):
@@ -79,3 +83,22 @@ class SVNSync(SyncBase):
self.logger(self.xterm_titles, msg)
writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
return (exitcode, False)
+
+
+   def _svn_upgrade(self):
+   """
+   Internal function which performs an svn upgrade on the repo
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+   exitcode = portage.process.spawn_bash(
+   "cd %s; exec svn upgrade" %
+   (portage._shell_quote(self.repo.location),),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn upgrade error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)



[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-09-03 Thread Brian Dolbec
commit: 9bc13ae7c9a6892c9fe0f998b0473c9a1dfca656
Author: Brian Dolbec  gentoo  org>
AuthorDate: Mon Jun 16 17:58:09 2014 +
Commit: Brian Dolbec  gmail  com>
CommitDate: Wed Sep  3 23:34:54 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=9bc13ae7

sync/modules/svn: Add snv upgrade to sync operation

This prevents errors when a newer svn has been installed that requires a db 
upgrade.

---
 pym/portage/sync/modules/svn/svn.py | 23 +++
 1 file changed, 23 insertions(+)

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
index 182a7ac..0365e90 100644
--- a/pym/portage/sync/modules/svn/svn.py
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -62,6 +62,10 @@ class SVNSync(SyncBase):
@rtype: (int, bool)
"""
 
+   exitcode, d = self._svn_upgrade()
+   if exitcode != os.EX_OK:
+   return (exitcode, False)
+
svn_root = self.repo.sync_uri
 
if svn_root.startswith("svn://"):
@@ -79,3 +83,22 @@ class SVNSync(SyncBase):
self.logger(self.xterm_titles, msg)
writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
return (exitcode, False)
+
+
+   def _svn_upgrade(self):
+   """
+   Internal function which performs an svn upgrade on the repo
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+   exitcode = portage.process.spawn_bash(
+   "cd %s; exec svn upgrade" %
+   (portage._shell_quote(self.repo.location),),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn upgrade error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)



[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-09-03 Thread Brian Dolbec
commit: 2aa70957a16dad2a5f66ac11e88c4c81d45833fa
Author: David Heidelberger  ixit  cz>
AuthorDate: Mon Jun 16 16:04:06 2014 +
Commit: Brian Dolbec  gmail  com>
CommitDate: Wed Sep  3 23:34:54 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=2aa70957

portage/sync/modules: Add svn sync module

Module submitted by: David Heidelberger
edits by Brian Dolbec :
Remove CheckSVNConfig class.
Use the default CheckSyncConfig class instead.
Copying the sync-cvs-repo option from the cvs module was incorrect and not 
needed.
Fixed the new()'s spawn_bash(...) call.

---
 pym/portage/sync/modules/svn/__init__.py | 32 +
 pym/portage/sync/modules/svn/svn.py  | 81 
 2 files changed, 113 insertions(+)

diff --git a/pym/portage/sync/modules/svn/__init__.py 
b/pym/portage/sync/modules/svn/__init__.py
new file mode 100644
index 000..1fda55a
--- /dev/null
+++ b/pym/portage/sync/modules/svn/__init__.py
@@ -0,0 +1,32 @@
+# Copyright 2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+"""SVN plug-in module for portage.
+Performs a svn up on repositories
+"""
+
+
+from portage.localization import _
+from portage.sync.config_checks import CheckSyncConfig
+from portage.util import writemsg_level
+
+
+module_spec = {
+   'name': 'svn',
+   'description': __doc__,
+   'provides':{
+   'svn-module': {
+   'name': "svn",
+   'class': "SVNSync",
+   'description': __doc__,
+   'functions': ['sync', 'new', 'exists'],
+   'func_desc': {
+   'sync': 'Performs a svn up 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 SVN repository',
+   },
+   'validate_config': CheckSyncConfig,
+   }
+   }
+}

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
new file mode 100644
index 000..182a7ac
--- /dev/null
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -0,0 +1,81 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+import logging
+import errno
+
+import portage
+from portage import os
+from portage.util import writemsg_level
+from portage.sync.syncbase import SyncBase
+
+
+class SVNSync(SyncBase):
+   '''SVN sync module'''
+
+   short_desc = "Perform sync operations on SVN repositories"
+
+   @staticmethod
+   def name():
+   return "SVNSync"
+
+
+   def __init__(self):
+   SyncBase.__init__(self, "svn", "dev-vcs/subversion")
+
+
+   def new(self, **kwargs):
+   if kwargs:
+   self._kwargs(kwargs)
+   #initial checkout
+   msg = ">>> Starting initial svn checkout with %s..." % 
self.repo.sync_uri
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n")
+   try:
+   os.rmdir(self.repo.location)
+   except OSError as e:
+   if e.errno != errno.ENOENT:
+   msg = "!!! existing '%s' directory; exiting." % 
self.repo.location
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (1, False)
+   del e
+   svn_root = self.repo.sync_uri
+   exitcode =  portage.process.spawn_bash(
+   "cd %s; exec svn %s" %
+   
(portage._shell_quote(os.path.dirname(self.repo.location)),
+   portage._shell_quote(svn_root)),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn checkout error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)
+
+
+   def _sync(self):
+   """
+   Internal function to sync an existing SVN repository
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+
+   svn_root = self.repo.sync_uri
+
+   if svn_root.startswith("svn://"):
+   svn_root = svn_root[6:]
+   #svn update
+   msg = ">>> Starting svn update with %s..." % 
self.repo.

[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-09-03 Thread Brian Dolbec
commit: 2cb2c8b506a36dabeba3e1aaa6c1ecb9405a5e40
Author: David Heidelberger  ixit  cz>
AuthorDate: Mon Jun 16 16:04:06 2014 +
Commit: Brian Dolbec  gmail  com>
CommitDate: Thu Sep  4 01:18:02 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=2cb2c8b5

portage/sync/modules: Add svn sync module

Module submitted by: David Heidelberger
edits by Brian Dolbec :
Remove CheckSVNConfig class.
Use the default CheckSyncConfig class instead.
Copying the sync-cvs-repo option from the cvs module was incorrect and not 
needed.
Fixed the new()'s spawn_bash(...) call.

---
 pym/portage/sync/modules/svn/__init__.py | 32 +
 pym/portage/sync/modules/svn/svn.py  | 81 
 2 files changed, 113 insertions(+)

diff --git a/pym/portage/sync/modules/svn/__init__.py 
b/pym/portage/sync/modules/svn/__init__.py
new file mode 100644
index 000..1fda55a
--- /dev/null
+++ b/pym/portage/sync/modules/svn/__init__.py
@@ -0,0 +1,32 @@
+# Copyright 2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+"""SVN plug-in module for portage.
+Performs a svn up on repositories
+"""
+
+
+from portage.localization import _
+from portage.sync.config_checks import CheckSyncConfig
+from portage.util import writemsg_level
+
+
+module_spec = {
+   'name': 'svn',
+   'description': __doc__,
+   'provides':{
+   'svn-module': {
+   'name': "svn",
+   'class': "SVNSync",
+   'description': __doc__,
+   'functions': ['sync', 'new', 'exists'],
+   'func_desc': {
+   'sync': 'Performs a svn up 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 SVN repository',
+   },
+   'validate_config': CheckSyncConfig,
+   }
+   }
+}

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
new file mode 100644
index 000..182a7ac
--- /dev/null
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -0,0 +1,81 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+import logging
+import errno
+
+import portage
+from portage import os
+from portage.util import writemsg_level
+from portage.sync.syncbase import SyncBase
+
+
+class SVNSync(SyncBase):
+   '''SVN sync module'''
+
+   short_desc = "Perform sync operations on SVN repositories"
+
+   @staticmethod
+   def name():
+   return "SVNSync"
+
+
+   def __init__(self):
+   SyncBase.__init__(self, "svn", "dev-vcs/subversion")
+
+
+   def new(self, **kwargs):
+   if kwargs:
+   self._kwargs(kwargs)
+   #initial checkout
+   msg = ">>> Starting initial svn checkout with %s..." % 
self.repo.sync_uri
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n")
+   try:
+   os.rmdir(self.repo.location)
+   except OSError as e:
+   if e.errno != errno.ENOENT:
+   msg = "!!! existing '%s' directory; exiting." % 
self.repo.location
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (1, False)
+   del e
+   svn_root = self.repo.sync_uri
+   exitcode =  portage.process.spawn_bash(
+   "cd %s; exec svn %s" %
+   
(portage._shell_quote(os.path.dirname(self.repo.location)),
+   portage._shell_quote(svn_root)),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn checkout error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)
+
+
+   def _sync(self):
+   """
+   Internal function to sync an existing SVN repository
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+
+   svn_root = self.repo.sync_uri
+
+   if svn_root.startswith("svn://"):
+   svn_root = svn_root[6:]
+   #svn update
+   msg = ">>> Starting svn update with %s..." % 
self.repo.

[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-09-03 Thread Brian Dolbec
commit: 30909ce1a92a067fbbe3058275818a3aab9f4daf
Author: Brian Dolbec  gentoo  org>
AuthorDate: Mon Jun 16 17:58:09 2014 +
Commit: Brian Dolbec  gmail  com>
CommitDate: Thu Sep  4 01:18:02 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=30909ce1

sync/modules/svn: Add snv upgrade to sync operation

This prevents errors when a newer svn has been installed that requires a db 
upgrade.

---
 pym/portage/sync/modules/svn/svn.py | 23 +++
 1 file changed, 23 insertions(+)

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
index 182a7ac..0365e90 100644
--- a/pym/portage/sync/modules/svn/svn.py
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -62,6 +62,10 @@ class SVNSync(SyncBase):
@rtype: (int, bool)
"""
 
+   exitcode, d = self._svn_upgrade()
+   if exitcode != os.EX_OK:
+   return (exitcode, False)
+
svn_root = self.repo.sync_uri
 
if svn_root.startswith("svn://"):
@@ -79,3 +83,22 @@ class SVNSync(SyncBase):
self.logger(self.xterm_titles, msg)
writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
return (exitcode, False)
+
+
+   def _svn_upgrade(self):
+   """
+   Internal function which performs an svn upgrade on the repo
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+   exitcode = portage.process.spawn_bash(
+   "cd %s; exec svn upgrade" %
+   (portage._shell_quote(self.repo.location),),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn upgrade error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)



[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-09-04 Thread Brian Dolbec
commit: 2e6ccc31c3ce3ce86ce80c24e2a407fc5554f706
Author: David Heidelberger  ixit  cz>
AuthorDate: Mon Jun 16 16:04:06 2014 +
Commit: Brian Dolbec  gmail  com>
CommitDate: Thu Sep  4 07:20:42 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=2e6ccc31

portage/sync/modules: Add svn sync module

Module submitted by: David Heidelberger
edits by Brian Dolbec :
Remove CheckSVNConfig class.
Use the default CheckSyncConfig class instead.
Copying the sync-cvs-repo option from the cvs module was incorrect and not 
needed.
Fixed the new()'s spawn_bash(...) call.

---
 pym/portage/sync/modules/svn/__init__.py | 32 +
 pym/portage/sync/modules/svn/svn.py  | 81 
 2 files changed, 113 insertions(+)

diff --git a/pym/portage/sync/modules/svn/__init__.py 
b/pym/portage/sync/modules/svn/__init__.py
new file mode 100644
index 000..1fda55a
--- /dev/null
+++ b/pym/portage/sync/modules/svn/__init__.py
@@ -0,0 +1,32 @@
+# Copyright 2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+"""SVN plug-in module for portage.
+Performs a svn up on repositories
+"""
+
+
+from portage.localization import _
+from portage.sync.config_checks import CheckSyncConfig
+from portage.util import writemsg_level
+
+
+module_spec = {
+   'name': 'svn',
+   'description': __doc__,
+   'provides':{
+   'svn-module': {
+   'name': "svn",
+   'class': "SVNSync",
+   'description': __doc__,
+   'functions': ['sync', 'new', 'exists'],
+   'func_desc': {
+   'sync': 'Performs a svn up 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 SVN repository',
+   },
+   'validate_config': CheckSyncConfig,
+   }
+   }
+}

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
new file mode 100644
index 000..182a7ac
--- /dev/null
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -0,0 +1,81 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+import logging
+import errno
+
+import portage
+from portage import os
+from portage.util import writemsg_level
+from portage.sync.syncbase import SyncBase
+
+
+class SVNSync(SyncBase):
+   '''SVN sync module'''
+
+   short_desc = "Perform sync operations on SVN repositories"
+
+   @staticmethod
+   def name():
+   return "SVNSync"
+
+
+   def __init__(self):
+   SyncBase.__init__(self, "svn", "dev-vcs/subversion")
+
+
+   def new(self, **kwargs):
+   if kwargs:
+   self._kwargs(kwargs)
+   #initial checkout
+   msg = ">>> Starting initial svn checkout with %s..." % 
self.repo.sync_uri
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n")
+   try:
+   os.rmdir(self.repo.location)
+   except OSError as e:
+   if e.errno != errno.ENOENT:
+   msg = "!!! existing '%s' directory; exiting." % 
self.repo.location
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (1, False)
+   del e
+   svn_root = self.repo.sync_uri
+   exitcode =  portage.process.spawn_bash(
+   "cd %s; exec svn %s" %
+   
(portage._shell_quote(os.path.dirname(self.repo.location)),
+   portage._shell_quote(svn_root)),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn checkout error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)
+
+
+   def _sync(self):
+   """
+   Internal function to sync an existing SVN repository
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+
+   svn_root = self.repo.sync_uri
+
+   if svn_root.startswith("svn://"):
+   svn_root = svn_root[6:]
+   #svn update
+   msg = ">>> Starting svn update with %s..." % 
self.repo.

[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-09-04 Thread Brian Dolbec
commit: d2a6895c1ecabb94b5e19df12d1ee3570cf56bce
Author: Brian Dolbec  gentoo  org>
AuthorDate: Mon Jun 16 17:58:09 2014 +
Commit: Brian Dolbec  gmail  com>
CommitDate: Thu Sep  4 07:20:42 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=d2a6895c

sync/modules/svn: Add snv upgrade to sync operation

This prevents errors when a newer svn has been installed that requires a db 
upgrade.

---
 pym/portage/sync/modules/svn/svn.py | 23 +++
 1 file changed, 23 insertions(+)

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
index 182a7ac..0365e90 100644
--- a/pym/portage/sync/modules/svn/svn.py
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -62,6 +62,10 @@ class SVNSync(SyncBase):
@rtype: (int, bool)
"""
 
+   exitcode, d = self._svn_upgrade()
+   if exitcode != os.EX_OK:
+   return (exitcode, False)
+
svn_root = self.repo.sync_uri
 
if svn_root.startswith("svn://"):
@@ -79,3 +83,22 @@ class SVNSync(SyncBase):
self.logger(self.xterm_titles, msg)
writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
return (exitcode, False)
+
+
+   def _svn_upgrade(self):
+   """
+   Internal function which performs an svn upgrade on the repo
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+   exitcode = portage.process.spawn_bash(
+   "cd %s; exec svn upgrade" %
+   (portage._shell_quote(self.repo.location),),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn upgrade error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)



[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-09-05 Thread Brian Dolbec
commit: a89954dc492727902aceefad9eeac6064c3a5d42
Author: Brian Dolbec  gentoo  org>
AuthorDate: Mon Jun 16 17:58:09 2014 +
Commit: Brian Dolbec  gmail  com>
CommitDate: Fri Sep  5 20:26:14 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=a89954dc

sync/modules/svn: Add snv upgrade to sync operation

This prevents errors when a newer svn has been installed that requires a db 
upgrade.

---
 pym/portage/sync/modules/svn/svn.py | 23 +++
 1 file changed, 23 insertions(+)

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
index 182a7ac..0365e90 100644
--- a/pym/portage/sync/modules/svn/svn.py
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -62,6 +62,10 @@ class SVNSync(SyncBase):
@rtype: (int, bool)
"""
 
+   exitcode, d = self._svn_upgrade()
+   if exitcode != os.EX_OK:
+   return (exitcode, False)
+
svn_root = self.repo.sync_uri
 
if svn_root.startswith("svn://"):
@@ -79,3 +83,22 @@ class SVNSync(SyncBase):
self.logger(self.xterm_titles, msg)
writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
return (exitcode, False)
+
+
+   def _svn_upgrade(self):
+   """
+   Internal function which performs an svn upgrade on the repo
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+   exitcode = portage.process.spawn_bash(
+   "cd %s; exec svn upgrade" %
+   (portage._shell_quote(self.repo.location),),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn upgrade error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)



[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-09-05 Thread Brian Dolbec
commit: d2b019e8b9e7f3e8924a5f38c9fff991aeda223f
Author: David Heidelberger  ixit  cz>
AuthorDate: Mon Jun 16 16:04:06 2014 +
Commit: Brian Dolbec  gmail  com>
CommitDate: Fri Sep  5 20:26:14 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=d2b019e8

portage/sync/modules: Add svn sync module

Module submitted by: David Heidelberger
edits by Brian Dolbec :
Remove CheckSVNConfig class.
Use the default CheckSyncConfig class instead.
Copying the sync-cvs-repo option from the cvs module was incorrect and not 
needed.
Fixed the new()'s spawn_bash(...) call.

---
 pym/portage/sync/modules/svn/__init__.py | 32 +
 pym/portage/sync/modules/svn/svn.py  | 81 
 2 files changed, 113 insertions(+)

diff --git a/pym/portage/sync/modules/svn/__init__.py 
b/pym/portage/sync/modules/svn/__init__.py
new file mode 100644
index 000..1fda55a
--- /dev/null
+++ b/pym/portage/sync/modules/svn/__init__.py
@@ -0,0 +1,32 @@
+# Copyright 2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+"""SVN plug-in module for portage.
+Performs a svn up on repositories
+"""
+
+
+from portage.localization import _
+from portage.sync.config_checks import CheckSyncConfig
+from portage.util import writemsg_level
+
+
+module_spec = {
+   'name': 'svn',
+   'description': __doc__,
+   'provides':{
+   'svn-module': {
+   'name': "svn",
+   'class': "SVNSync",
+   'description': __doc__,
+   'functions': ['sync', 'new', 'exists'],
+   'func_desc': {
+   'sync': 'Performs a svn up 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 SVN repository',
+   },
+   'validate_config': CheckSyncConfig,
+   }
+   }
+}

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
new file mode 100644
index 000..182a7ac
--- /dev/null
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -0,0 +1,81 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+import logging
+import errno
+
+import portage
+from portage import os
+from portage.util import writemsg_level
+from portage.sync.syncbase import SyncBase
+
+
+class SVNSync(SyncBase):
+   '''SVN sync module'''
+
+   short_desc = "Perform sync operations on SVN repositories"
+
+   @staticmethod
+   def name():
+   return "SVNSync"
+
+
+   def __init__(self):
+   SyncBase.__init__(self, "svn", "dev-vcs/subversion")
+
+
+   def new(self, **kwargs):
+   if kwargs:
+   self._kwargs(kwargs)
+   #initial checkout
+   msg = ">>> Starting initial svn checkout with %s..." % 
self.repo.sync_uri
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n")
+   try:
+   os.rmdir(self.repo.location)
+   except OSError as e:
+   if e.errno != errno.ENOENT:
+   msg = "!!! existing '%s' directory; exiting." % 
self.repo.location
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (1, False)
+   del e
+   svn_root = self.repo.sync_uri
+   exitcode =  portage.process.spawn_bash(
+   "cd %s; exec svn %s" %
+   
(portage._shell_quote(os.path.dirname(self.repo.location)),
+   portage._shell_quote(svn_root)),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn checkout error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)
+
+
+   def _sync(self):
+   """
+   Internal function to sync an existing SVN repository
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+
+   svn_root = self.repo.sync_uri
+
+   if svn_root.startswith("svn://"):
+   svn_root = svn_root[6:]
+   #svn update
+   msg = ">>> Starting svn update with %s..." % 
self.repo.

[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-12-01 Thread Michał Górny
commit: 461159f48621bb8e7e0d20fa1937885956d979d0
Author: David Heidelberger  ixit  cz>
AuthorDate: Mon Jun 16 16:04:06 2014 +
Commit: Michał Górny  gentoo  org>
CommitDate: Mon Dec  1 21:49:40 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=461159f4

portage/sync/modules: Add svn sync module

Module submitted by: David Heidelberger
edits by Brian Dolbec :
Remove CheckSVNConfig class.
Use the default CheckSyncConfig class instead.
Copying the sync-cvs-repo option from the cvs module was incorrect and not 
needed.
Fixed the new()'s spawn_bash(...) call.

---
 pym/portage/sync/modules/svn/__init__.py | 32 +
 pym/portage/sync/modules/svn/svn.py  | 81 
 2 files changed, 113 insertions(+)

diff --git a/pym/portage/sync/modules/svn/__init__.py 
b/pym/portage/sync/modules/svn/__init__.py
new file mode 100644
index 000..1fda55a
--- /dev/null
+++ b/pym/portage/sync/modules/svn/__init__.py
@@ -0,0 +1,32 @@
+# Copyright 2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+"""SVN plug-in module for portage.
+Performs a svn up on repositories
+"""
+
+
+from portage.localization import _
+from portage.sync.config_checks import CheckSyncConfig
+from portage.util import writemsg_level
+
+
+module_spec = {
+   'name': 'svn',
+   'description': __doc__,
+   'provides':{
+   'svn-module': {
+   'name': "svn",
+   'class': "SVNSync",
+   'description': __doc__,
+   'functions': ['sync', 'new', 'exists'],
+   'func_desc': {
+   'sync': 'Performs a svn up 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 SVN repository',
+   },
+   'validate_config': CheckSyncConfig,
+   }
+   }
+}

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
new file mode 100644
index 000..182a7ac
--- /dev/null
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -0,0 +1,81 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+import logging
+import errno
+
+import portage
+from portage import os
+from portage.util import writemsg_level
+from portage.sync.syncbase import SyncBase
+
+
+class SVNSync(SyncBase):
+   '''SVN sync module'''
+
+   short_desc = "Perform sync operations on SVN repositories"
+
+   @staticmethod
+   def name():
+   return "SVNSync"
+
+
+   def __init__(self):
+   SyncBase.__init__(self, "svn", "dev-vcs/subversion")
+
+
+   def new(self, **kwargs):
+   if kwargs:
+   self._kwargs(kwargs)
+   #initial checkout
+   msg = ">>> Starting initial svn checkout with %s..." % 
self.repo.sync_uri
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n")
+   try:
+   os.rmdir(self.repo.location)
+   except OSError as e:
+   if e.errno != errno.ENOENT:
+   msg = "!!! existing '%s' directory; exiting." % 
self.repo.location
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (1, False)
+   del e
+   svn_root = self.repo.sync_uri
+   exitcode =  portage.process.spawn_bash(
+   "cd %s; exec svn %s" %
+   
(portage._shell_quote(os.path.dirname(self.repo.location)),
+   portage._shell_quote(svn_root)),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn checkout error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)
+
+
+   def _sync(self):
+   """
+   Internal function to sync an existing SVN repository
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+
+   svn_root = self.repo.sync_uri
+
+   if svn_root.startswith("svn://"):
+   svn_root = svn_root[6:]
+   #svn update
+   msg = ">>> Starting svn update with %s..." % 
self.repo

[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-12-01 Thread Michał Górny
commit: 94be45b625a8ddb7bd6c3472c1ca012f3461317e
Author: Brian Dolbec  gentoo  org>
AuthorDate: Mon Jun 16 17:58:09 2014 +
Commit: Michał Górny  gentoo  org>
CommitDate: Mon Dec  1 21:49:40 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=94be45b6

sync/modules/svn: Add snv upgrade to sync operation

This prevents errors when a newer svn has been installed that requires a db 
upgrade.

---
 pym/portage/sync/modules/svn/svn.py | 23 +++
 1 file changed, 23 insertions(+)

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
index 182a7ac..0365e90 100644
--- a/pym/portage/sync/modules/svn/svn.py
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -62,6 +62,10 @@ class SVNSync(SyncBase):
@rtype: (int, bool)
"""
 
+   exitcode, d = self._svn_upgrade()
+   if exitcode != os.EX_OK:
+   return (exitcode, False)
+
svn_root = self.repo.sync_uri
 
if svn_root.startswith("svn://"):
@@ -79,3 +83,22 @@ class SVNSync(SyncBase):
self.logger(self.xterm_titles, msg)
writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
return (exitcode, False)
+
+
+   def _svn_upgrade(self):
+   """
+   Internal function which performs an svn upgrade on the repo
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+   exitcode = portage.process.spawn_bash(
+   "cd %s; exec svn upgrade" %
+   (portage._shell_quote(self.repo.location),),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn upgrade error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)



[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-12-04 Thread Brian Dolbec
commit: 9831dd2fbd8889ee4c1738813b6a9c4c78c36e8c
Author: Brian Dolbec  gentoo  org>
AuthorDate: Mon Jun 16 17:58:09 2014 +
Commit: Brian Dolbec  gmail  com>
CommitDate: Thu Dec  4 19:56:33 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=9831dd2f

sync/modules/svn: Add snv upgrade to sync operation

This prevents errors when a newer svn has been installed that requires a db 
upgrade.

---
 pym/portage/sync/modules/svn/svn.py | 23 +++
 1 file changed, 23 insertions(+)

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
index 182a7ac..0365e90 100644
--- a/pym/portage/sync/modules/svn/svn.py
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -62,6 +62,10 @@ class SVNSync(SyncBase):
@rtype: (int, bool)
"""
 
+   exitcode, d = self._svn_upgrade()
+   if exitcode != os.EX_OK:
+   return (exitcode, False)
+
svn_root = self.repo.sync_uri
 
if svn_root.startswith("svn://"):
@@ -79,3 +83,22 @@ class SVNSync(SyncBase):
self.logger(self.xterm_titles, msg)
writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
return (exitcode, False)
+
+
+   def _svn_upgrade(self):
+   """
+   Internal function which performs an svn upgrade on the repo
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+   exitcode = portage.process.spawn_bash(
+   "cd %s; exec svn upgrade" %
+   (portage._shell_quote(self.repo.location),),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn upgrade error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)



[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-09-26 Thread Brian Dolbec
commit: b16889acdf7754ce5c0d0151beafde8dcb44de99
Author: Brian Dolbec  gentoo  org>
AuthorDate: Mon Jun 16 17:58:09 2014 +
Commit: Brian Dolbec  gmail  com>
CommitDate: Sat Sep 27 01:40:45 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=b16889ac

sync/modules/svn: Add snv upgrade to sync operation

This prevents errors when a newer svn has been installed that requires a db 
upgrade.

---
 pym/portage/sync/modules/svn/svn.py | 23 +++
 1 file changed, 23 insertions(+)

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
index 182a7ac..0365e90 100644
--- a/pym/portage/sync/modules/svn/svn.py
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -62,6 +62,10 @@ class SVNSync(SyncBase):
@rtype: (int, bool)
"""
 
+   exitcode, d = self._svn_upgrade()
+   if exitcode != os.EX_OK:
+   return (exitcode, False)
+
svn_root = self.repo.sync_uri
 
if svn_root.startswith("svn://"):
@@ -79,3 +83,22 @@ class SVNSync(SyncBase):
self.logger(self.xterm_titles, msg)
writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
return (exitcode, False)
+
+
+   def _svn_upgrade(self):
+   """
+   Internal function which performs an svn upgrade on the repo
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+   exitcode = portage.process.spawn_bash(
+   "cd %s; exec svn upgrade" %
+   (portage._shell_quote(self.repo.location),),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn upgrade error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)



[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-09-26 Thread Brian Dolbec
commit: 95e96778a2ccc3aaa441aae544371d299f1d07c8
Author: David Heidelberger  ixit  cz>
AuthorDate: Mon Jun 16 16:04:06 2014 +
Commit: Brian Dolbec  gmail  com>
CommitDate: Sat Sep 27 01:40:45 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=95e96778

portage/sync/modules: Add svn sync module

Module submitted by: David Heidelberger
edits by Brian Dolbec :
Remove CheckSVNConfig class.
Use the default CheckSyncConfig class instead.
Copying the sync-cvs-repo option from the cvs module was incorrect and not 
needed.
Fixed the new()'s spawn_bash(...) call.

---
 pym/portage/sync/modules/svn/__init__.py | 32 +
 pym/portage/sync/modules/svn/svn.py  | 81 
 2 files changed, 113 insertions(+)

diff --git a/pym/portage/sync/modules/svn/__init__.py 
b/pym/portage/sync/modules/svn/__init__.py
new file mode 100644
index 000..1fda55a
--- /dev/null
+++ b/pym/portage/sync/modules/svn/__init__.py
@@ -0,0 +1,32 @@
+# Copyright 2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+"""SVN plug-in module for portage.
+Performs a svn up on repositories
+"""
+
+
+from portage.localization import _
+from portage.sync.config_checks import CheckSyncConfig
+from portage.util import writemsg_level
+
+
+module_spec = {
+   'name': 'svn',
+   'description': __doc__,
+   'provides':{
+   'svn-module': {
+   'name': "svn",
+   'class': "SVNSync",
+   'description': __doc__,
+   'functions': ['sync', 'new', 'exists'],
+   'func_desc': {
+   'sync': 'Performs a svn up 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 SVN repository',
+   },
+   'validate_config': CheckSyncConfig,
+   }
+   }
+}

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
new file mode 100644
index 000..182a7ac
--- /dev/null
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -0,0 +1,81 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+import logging
+import errno
+
+import portage
+from portage import os
+from portage.util import writemsg_level
+from portage.sync.syncbase import SyncBase
+
+
+class SVNSync(SyncBase):
+   '''SVN sync module'''
+
+   short_desc = "Perform sync operations on SVN repositories"
+
+   @staticmethod
+   def name():
+   return "SVNSync"
+
+
+   def __init__(self):
+   SyncBase.__init__(self, "svn", "dev-vcs/subversion")
+
+
+   def new(self, **kwargs):
+   if kwargs:
+   self._kwargs(kwargs)
+   #initial checkout
+   msg = ">>> Starting initial svn checkout with %s..." % 
self.repo.sync_uri
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n")
+   try:
+   os.rmdir(self.repo.location)
+   except OSError as e:
+   if e.errno != errno.ENOENT:
+   msg = "!!! existing '%s' directory; exiting." % 
self.repo.location
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (1, False)
+   del e
+   svn_root = self.repo.sync_uri
+   exitcode =  portage.process.spawn_bash(
+   "cd %s; exec svn %s" %
+   
(portage._shell_quote(os.path.dirname(self.repo.location)),
+   portage._shell_quote(svn_root)),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn checkout error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)
+
+
+   def _sync(self):
+   """
+   Internal function to sync an existing SVN repository
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+
+   svn_root = self.repo.sync_uri
+
+   if svn_root.startswith("svn://"):
+   svn_root = svn_root[6:]
+   #svn update
+   msg = ">>> Starting svn update with %s..." % 
self.repo.

[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-09-29 Thread Brian Dolbec
commit: 53430a1d9a1452d152f590672b0e073011cf3552
Author: David Heidelberger  ixit  cz>
AuthorDate: Mon Jun 16 16:04:06 2014 +
Commit: Brian Dolbec  gmail  com>
CommitDate: Mon Sep 29 17:20:21 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=53430a1d

portage/sync/modules: Add svn sync module

Module submitted by: David Heidelberger
edits by Brian Dolbec :
Remove CheckSVNConfig class.
Use the default CheckSyncConfig class instead.
Copying the sync-cvs-repo option from the cvs module was incorrect and not 
needed.
Fixed the new()'s spawn_bash(...) call.

---
 pym/portage/sync/modules/svn/__init__.py | 32 +
 pym/portage/sync/modules/svn/svn.py  | 81 
 2 files changed, 113 insertions(+)

diff --git a/pym/portage/sync/modules/svn/__init__.py 
b/pym/portage/sync/modules/svn/__init__.py
new file mode 100644
index 000..1fda55a
--- /dev/null
+++ b/pym/portage/sync/modules/svn/__init__.py
@@ -0,0 +1,32 @@
+# Copyright 2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+"""SVN plug-in module for portage.
+Performs a svn up on repositories
+"""
+
+
+from portage.localization import _
+from portage.sync.config_checks import CheckSyncConfig
+from portage.util import writemsg_level
+
+
+module_spec = {
+   'name': 'svn',
+   'description': __doc__,
+   'provides':{
+   'svn-module': {
+   'name': "svn",
+   'class': "SVNSync",
+   'description': __doc__,
+   'functions': ['sync', 'new', 'exists'],
+   'func_desc': {
+   'sync': 'Performs a svn up 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 SVN repository',
+   },
+   'validate_config': CheckSyncConfig,
+   }
+   }
+}

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
new file mode 100644
index 000..182a7ac
--- /dev/null
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -0,0 +1,81 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+import logging
+import errno
+
+import portage
+from portage import os
+from portage.util import writemsg_level
+from portage.sync.syncbase import SyncBase
+
+
+class SVNSync(SyncBase):
+   '''SVN sync module'''
+
+   short_desc = "Perform sync operations on SVN repositories"
+
+   @staticmethod
+   def name():
+   return "SVNSync"
+
+
+   def __init__(self):
+   SyncBase.__init__(self, "svn", "dev-vcs/subversion")
+
+
+   def new(self, **kwargs):
+   if kwargs:
+   self._kwargs(kwargs)
+   #initial checkout
+   msg = ">>> Starting initial svn checkout with %s..." % 
self.repo.sync_uri
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n")
+   try:
+   os.rmdir(self.repo.location)
+   except OSError as e:
+   if e.errno != errno.ENOENT:
+   msg = "!!! existing '%s' directory; exiting." % 
self.repo.location
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (1, False)
+   del e
+   svn_root = self.repo.sync_uri
+   exitcode =  portage.process.spawn_bash(
+   "cd %s; exec svn %s" %
+   
(portage._shell_quote(os.path.dirname(self.repo.location)),
+   portage._shell_quote(svn_root)),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn checkout error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)
+
+
+   def _sync(self):
+   """
+   Internal function to sync an existing SVN repository
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+
+   svn_root = self.repo.sync_uri
+
+   if svn_root.startswith("svn://"):
+   svn_root = svn_root[6:]
+   #svn update
+   msg = ">>> Starting svn update with %s..." % 
self.repo.

[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-09-29 Thread Brian Dolbec
commit: 55ab0b8c43533defa8f676df699c7b2471fccb6f
Author: Brian Dolbec  gentoo  org>
AuthorDate: Mon Jun 16 17:58:09 2014 +
Commit: Brian Dolbec  gmail  com>
CommitDate: Mon Sep 29 17:20:21 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=55ab0b8c

sync/modules/svn: Add snv upgrade to sync operation

This prevents errors when a newer svn has been installed that requires a db 
upgrade.

---
 pym/portage/sync/modules/svn/svn.py | 23 +++
 1 file changed, 23 insertions(+)

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
index 182a7ac..0365e90 100644
--- a/pym/portage/sync/modules/svn/svn.py
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -62,6 +62,10 @@ class SVNSync(SyncBase):
@rtype: (int, bool)
"""
 
+   exitcode, d = self._svn_upgrade()
+   if exitcode != os.EX_OK:
+   return (exitcode, False)
+
svn_root = self.repo.sync_uri
 
if svn_root.startswith("svn://"):
@@ -79,3 +83,22 @@ class SVNSync(SyncBase):
self.logger(self.xterm_titles, msg)
writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
return (exitcode, False)
+
+
+   def _svn_upgrade(self):
+   """
+   Internal function which performs an svn upgrade on the repo
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+   exitcode = portage.process.spawn_bash(
+   "cd %s; exec svn upgrade" %
+   (portage._shell_quote(self.repo.location),),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn upgrade error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)



[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-09-29 Thread Brian Dolbec
commit: 0f80a9bce939874c51a83a9fea63905bbfd47675
Author: Brian Dolbec  gentoo  org>
AuthorDate: Mon Jun 16 17:58:09 2014 +
Commit: Brian Dolbec  gmail  com>
CommitDate: Tue Sep 30 00:42:26 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=0f80a9bc

sync/modules/svn: Add snv upgrade to sync operation

This prevents errors when a newer svn has been installed that requires a db 
upgrade.

---
 pym/portage/sync/modules/svn/svn.py | 23 +++
 1 file changed, 23 insertions(+)

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
index 182a7ac..0365e90 100644
--- a/pym/portage/sync/modules/svn/svn.py
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -62,6 +62,10 @@ class SVNSync(SyncBase):
@rtype: (int, bool)
"""
 
+   exitcode, d = self._svn_upgrade()
+   if exitcode != os.EX_OK:
+   return (exitcode, False)
+
svn_root = self.repo.sync_uri
 
if svn_root.startswith("svn://"):
@@ -79,3 +83,22 @@ class SVNSync(SyncBase):
self.logger(self.xterm_titles, msg)
writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
return (exitcode, False)
+
+
+   def _svn_upgrade(self):
+   """
+   Internal function which performs an svn upgrade on the repo
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+   exitcode = portage.process.spawn_bash(
+   "cd %s; exec svn upgrade" %
+   (portage._shell_quote(self.repo.location),),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn upgrade error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)



[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/

2014-09-29 Thread Brian Dolbec
commit: d524b7285c973385c90e272829bda8b727cd5f54
Author: David Heidelberger  ixit  cz>
AuthorDate: Mon Jun 16 16:04:06 2014 +
Commit: Brian Dolbec  gmail  com>
CommitDate: Tue Sep 30 00:42:26 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=d524b728

portage/sync/modules: Add svn sync module

Module submitted by: David Heidelberger
edits by Brian Dolbec :
Remove CheckSVNConfig class.
Use the default CheckSyncConfig class instead.
Copying the sync-cvs-repo option from the cvs module was incorrect and not 
needed.
Fixed the new()'s spawn_bash(...) call.

---
 pym/portage/sync/modules/svn/__init__.py | 32 +
 pym/portage/sync/modules/svn/svn.py  | 81 
 2 files changed, 113 insertions(+)

diff --git a/pym/portage/sync/modules/svn/__init__.py 
b/pym/portage/sync/modules/svn/__init__.py
new file mode 100644
index 000..1fda55a
--- /dev/null
+++ b/pym/portage/sync/modules/svn/__init__.py
@@ -0,0 +1,32 @@
+# Copyright 2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+"""SVN plug-in module for portage.
+Performs a svn up on repositories
+"""
+
+
+from portage.localization import _
+from portage.sync.config_checks import CheckSyncConfig
+from portage.util import writemsg_level
+
+
+module_spec = {
+   'name': 'svn',
+   'description': __doc__,
+   'provides':{
+   'svn-module': {
+   'name': "svn",
+   'class': "SVNSync",
+   'description': __doc__,
+   'functions': ['sync', 'new', 'exists'],
+   'func_desc': {
+   'sync': 'Performs a svn up 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 SVN repository',
+   },
+   'validate_config': CheckSyncConfig,
+   }
+   }
+}

diff --git a/pym/portage/sync/modules/svn/svn.py 
b/pym/portage/sync/modules/svn/svn.py
new file mode 100644
index 000..182a7ac
--- /dev/null
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -0,0 +1,81 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+import logging
+import errno
+
+import portage
+from portage import os
+from portage.util import writemsg_level
+from portage.sync.syncbase import SyncBase
+
+
+class SVNSync(SyncBase):
+   '''SVN sync module'''
+
+   short_desc = "Perform sync operations on SVN repositories"
+
+   @staticmethod
+   def name():
+   return "SVNSync"
+
+
+   def __init__(self):
+   SyncBase.__init__(self, "svn", "dev-vcs/subversion")
+
+
+   def new(self, **kwargs):
+   if kwargs:
+   self._kwargs(kwargs)
+   #initial checkout
+   msg = ">>> Starting initial svn checkout with %s..." % 
self.repo.sync_uri
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n")
+   try:
+   os.rmdir(self.repo.location)
+   except OSError as e:
+   if e.errno != errno.ENOENT:
+   msg = "!!! existing '%s' directory; exiting." % 
self.repo.location
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (1, False)
+   del e
+   svn_root = self.repo.sync_uri
+   exitcode =  portage.process.spawn_bash(
+   "cd %s; exec svn %s" %
+   
(portage._shell_quote(os.path.dirname(self.repo.location)),
+   portage._shell_quote(svn_root)),
+   **portage._native_kwargs(self.spawn_kwargs))
+   if exitcode != os.EX_OK:
+   msg = "!!! svn checkout error; exiting."
+   self.logger(self.xterm_titles, msg)
+   writemsg_level(msg + "\n", noiselevel=-1, 
level=logging.ERROR)
+   return (exitcode, False)
+
+
+   def _sync(self):
+   """
+   Internal function to sync an existing SVN repository
+
+   @return: tuple of return code (0=success), whether the cache
+   needs to be updated
+   @rtype: (int, bool)
+   """
+
+   svn_root = self.repo.sync_uri
+
+   if svn_root.startswith("svn://"):
+   svn_root = svn_root[6:]
+   #svn update
+   msg = ">>> Starting svn update with %s..." % 
self.repo.

  1   2   >