public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
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/cvs/
Date: Tue, 22 Apr 2014 02:36:14 +0000 (UTC)	[thread overview]
Message-ID: <1396133180.384951033ef135cc1c2a660d400d171938fbedfe.dol-sen@gentoo> (raw)

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

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

---
 pym/portage/sync/modules/cvs/cvs.py | 58 +++++--------------------------------
 1 file changed, 7 insertions(+), 51 deletions(-)

diff --git a/pym/portage/sync/modules/cvs/cvs.py b/pym/portage/sync/modules/cvs/cvs.py
index dadbf7b..52d5d9a 100644
--- a/pym/portage/sync/modules/cvs/cvs.py
+++ b/pym/portage/sync/modules/cvs/cvs.py
@@ -1,16 +1,16 @@
 # Copyright 1999-2014 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
-import sys
 import logging
 import errno
 
 import portage
 from portage import os
 from portage.util import writemsg_level
+from portage.sync.syncbase import SyncBase
 
 
-class CVSSync(object):
+class CVSSync(SyncBase):
 	'''CVS sync module'''
 
 	short_desc = "Perform sync operations on CVS repositories"
@@ -20,53 +20,8 @@ class CVSSync(object):
 		return "CVSSync"
 
 
-	def can_progressbar(self, func):
-		return False
-
-
 	def __init__(self):
-		self.settings = None
-		self.options = None
-		self.logger = None
-		self.xterm_titles = None
-		self.has_cvs = True
-		if portage.process.find_binary("cvs") is None:
-			msg = "Command not found: cvs"
-			"Type \"emerge %s\" to enable CVS support." % portage.const.CVS_PACKAGE_ATOM
-			for l in msg:
-				writemsg_level("!!! %s\n" % l,
-					level=logging.ERROR, noiselevel=-1)
-			self.has_cvs = False
-
-	def _kwargs(self, **kwargs):
-		self.options = kwargs.get('options', {})
-		self.repo = self.options.get('repo', None)
-		self.logger = self.options.get('logger', None)
-		self.xterm_titles = self.options.get('xterm_titles', None)
-
-
-	def exists(self, **kwargs):
-		if kwargs:
-			self._kwargs(kwargs)
-		elif not self.repo:
-			return False
-		spawn_kwargs = self.options.get('spawn_kwargs', None)
-
-		if not os.path.exists(os.path.join(repo.location, "CVS")):
-			return False
-		return True
-
-
-	def sync(self, **kwargs):
-		if kwargs:
-			self._kwargs(kwargs)
-
-		if not self.has_cvs:
-			return (1, False)
-
-		if not self.exists():
-			return self.new()
-		return self.sync()
+		SyncBase.__init__(self, "cvs", portage.const.CVS_PACKAGE_ATOM)
 
 
 	def new(self, **kwargs):
@@ -85,18 +40,20 @@ class CVSSync(object):
 				writemsg_level(msg + "\n", noiselevel=-1, level=logging.ERROR)
 				return (1, False)
 			del e
+		cvs_root = self.repo.sync_uri
 		if portage.process.spawn_bash(
 			"cd %s; exec cvs -z0 -d %s co -P -d %s %s" %
 			(portage._shell_quote(os.path.dirname(self.repo.location)), portage._shell_quote(cvs_root),
 				portage._shell_quote(os.path.basename(self.repo.location)),
 				portage._shell_quote(self.repo.sync_cvs_repo)),
-				**portage._native_kwargs(spawn_kwargs)) != os.EX_OK:
+				**portage._native_kwargs(self.spawn_kwargs)) != os.EX_OK:
 			msg = "!!! cvs checkout error; exiting."
 			self.logger(self.xterm_titles, msg)
 			writemsg_level(msg + "\n", noiselevel=-1, level=logging.ERROR)
 			return (1, False)
 		return (0, False)
 
+
 	def _sync(self):
 		"""
 		Internal function to sync an existing CVS repository
@@ -106,7 +63,6 @@ class CVSSync(object):
 		@rtype: (int, bool)
 		"""
 
-		spawn_kwargs = options.get('spawn_kwargs', None)
 		cvs_root = self.repo.sync_uri
 
 		if cvs_root.startswith("cvs://"):
@@ -118,7 +74,7 @@ class CVSSync(object):
 			exitcode = portage.process.spawn_bash(
 				"cd %s; exec cvs -z0 -q update -dP" % \
 				(portage._shell_quote(self.repo.location),),
-				**portage._native_kwargs(spawn_kwargs))
+				**portage._native_kwargs(self.spawn_kwargs))
 			if exitcode != os.EX_OK:
 				msg = "!!! cvs update error; exiting."
 				self.logger(self.xterm_titles, msg)


             reply	other threads:[~2014-04-22  2:36 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-22  2:36 Brian Dolbec [this message]
  -- strict thread matches above, loose matches on Subject: below --
2014-09-03 23:36 [gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/cvs/ Brian Dolbec
2014-06-16 22:45 Brian Dolbec
2014-06-16 15:46 Brian Dolbec
2014-05-02 23:13 Brian Dolbec
2014-05-02 23:13 Brian Dolbec
2014-04-22  2:36 Brian Dolbec
2014-04-22  2:36 Brian Dolbec
2014-03-14 16:23 Brian Dolbec
2014-02-11 17:28 Chris Reffett
2014-01-29  6:32 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=1396133180.384951033ef135cc1c2a660d400d171938fbedfe.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