From: "Brian Dolbec" <brian.dolbec@gmail.com>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/svn/
Date: Sat, 27 Sep 2014 02:20:49 +0000 (UTC) [thread overview]
Message-ID: <1411782045.95e96778a2ccc3aaa441aae544371d299f1d07c8.dol-sen@gentoo> (raw)
commit: 95e96778a2ccc3aaa441aae544371d299f1d07c8
Author: David Heidelberger <david.heidelberger <AT> ixit <DOT> cz>
AuthorDate: Mon Jun 16 16:04:06 2014 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sat Sep 27 01:40:45 2014 +0000
URL: http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=95e96778
portage/sync/modules: Add svn sync module
Module submitted by: David Heidelberger
edits by Brian Dolbec <dolsen>:
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 0000000..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 0000000..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.sync_uri
+ self.logger(self.xterm_titles, msg)
+ writemsg_level(msg + "\n")
+ exitcode = portage.process.spawn_bash(
+ "cd %s; exec svn update" % \
+ (portage._shell_quote(self.repo.location),),
+ **portage._native_kwargs(self.spawn_kwargs))
+ if exitcode != os.EX_OK:
+ msg = "!!! svn update error; exiting."
+ self.logger(self.xterm_titles, msg)
+ writemsg_level(msg + "\n", noiselevel=-1, level=logging.ERROR)
+ return (exitcode, False)
next reply other threads:[~2014-09-27 2:21 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-27 2:20 Brian Dolbec [this message]
-- strict thread matches above, loose matches on Subject: below --
2014-12-04 20:16 [gentoo-commits] proj/portage:master commit in: pym/portage/sync/modules/svn/ Brian Dolbec
2014-12-04 20:04 ` [gentoo-commits] proj/portage:plugin-sync " Brian Dolbec
2014-12-01 21:50 Michał Górny
2014-12-01 21:50 Michał Górny
2014-10-21 5:05 Zac Medico
2014-10-21 5:05 Zac Medico
2014-10-20 3:54 Zac Medico
2014-10-20 3:54 Zac Medico
2014-09-30 0:46 Brian Dolbec
2014-09-30 0:46 Brian Dolbec
2014-09-29 18:29 Brian Dolbec
2014-09-29 18:29 Brian Dolbec
2014-09-27 2:20 Brian Dolbec
2014-09-05 21:15 Brian Dolbec
2014-09-05 21:15 Brian Dolbec
2014-09-05 4:38 Brian Dolbec
2014-09-05 4:38 Brian Dolbec
2014-09-04 1:18 Brian Dolbec
2014-09-04 1:18 Brian Dolbec
2014-09-03 23:36 Brian Dolbec
2014-09-03 23:36 Brian Dolbec
2014-06-16 22:45 Brian Dolbec
2014-06-16 22:45 Brian Dolbec
2014-06-16 18:09 Brian Dolbec
2014-06-16 18:09 Brian Dolbec
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1411782045.95e96778a2ccc3aaa441aae544371d299f1d07c8.dol-sen@gentoo \
--to=brian.dolbec@gmail.com \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox