From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 355491392EF for ; Fri, 14 Mar 2014 16:24:01 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 4FCFBE0B9B; Fri, 14 Mar 2014 16:23:59 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id C7B15E0B9B for ; Fri, 14 Mar 2014 16:23:58 +0000 (UTC) Received: from spoonbill.gentoo.org (spoonbill.gentoo.org [81.93.255.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id D65AB33FB73 for ; Fri, 14 Mar 2014 16:23:57 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by spoonbill.gentoo.org (Postfix) with ESMTP id 47BC8188EF for ; Fri, 14 Mar 2014 16:23:55 +0000 (UTC) From: "Brian Dolbec" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Brian Dolbec" Message-ID: <1394813919.ec7f025e6b9139bbbbbe67dbdd1c721112310d84.dol-sen@gentoo> Subject: [gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/cvs/ X-VCS-Repository: proj/portage X-VCS-Files: pym/portage/sync/modules/cvs/cvs.py X-VCS-Directories: pym/portage/sync/modules/cvs/ X-VCS-Committer: dol-sen X-VCS-Committer-Name: Brian Dolbec X-VCS-Revision: ec7f025e6b9139bbbbbe67dbdd1c721112310d84 X-VCS-Branch: plugin-sync Date: Fri, 14 Mar 2014 16:23:55 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 9ae49e59-a540-42fb-9b5c-fb9c880c3e24 X-Archives-Hash: 05660c4138393d31c14b892b88e3be91 commit: ec7f025e6b9139bbbbbe67dbdd1c721112310d84 Author: Brian Dolbec gentoo org> AuthorDate: Fri Mar 14 15:56:00 2014 +0000 Commit: Brian Dolbec gmail com> CommitDate: Fri Mar 14 16:18:39 2014 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=ec7f025e 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 e169dbb..9cc4d6a 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_self.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)