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 371AD138A1A for ; Sat, 17 Jan 2015 17:37:06 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id C27C8E0994; Sat, 17 Jan 2015 17:37:05 +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 5E117E0991 for ; Sat, 17 Jan 2015 17:37:05 +0000 (UTC) Received: from pomiot.lan (77-253-152-100.adsl.inetia.pl [77.253.152.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: mgorny) by smtp.gentoo.org (Postfix) with ESMTPSA id A14BD34076A; Sat, 17 Jan 2015 17:37:03 +0000 (UTC) From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= To: gentoo-portage-dev@lists.gentoo.org Cc: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Subject: [gentoo-portage-dev] [PATCH] cvs sync: fix the module Date: Sat, 17 Jan 2015 18:36:58 +0100 Message-Id: <1421516218-6706-1-git-send-email-mgorny@gentoo.org> X-Mailer: git-send-email 2.2.1 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-portage-dev@lists.gentoo.org Reply-to: gentoo-portage-dev@lists.gentoo.org X-Archives-Salt: a6d4e381-936e-4f8d-9369-fde7fa50cfba X-Archives-Hash: a995cdebc0ada5458ef9d6cff0342bc1 Fix the cvs sync module since it doesn't work at all right now. More specifically: 1. add exists() method that checks for the 'CVS' sub-directory to determine whether the repository was checked out already. 2. Do not remove the just-created directory on initial clone, to avoid permission issues. Just run checkout on top of it. 3. Fix the sync method to run update unconditionally to whether the URI starts with cvs:// or not. In fact, remove the whole check since it doesn't serve any purpose. --- pym/portage/sync/modules/cvs/cvs.py | 36 ++++++++++++++---------------------- 1 file changed, 14 insertions(+), 22 deletions(-) diff --git a/pym/portage/sync/modules/cvs/cvs.py b/pym/portage/sync/modules/cvs/cvs.py index 2c3c6a3..919cb34 100644 --- a/pym/portage/sync/modules/cvs/cvs.py +++ b/pym/portage/sync/modules/cvs/cvs.py @@ -24,19 +24,15 @@ class CVSSync(SyncBase): SyncBase.__init__(self, "cvs", portage.const.CVS_PACKAGE_ATOM) + def exists(self, **kwargs): + '''Tests whether the repo is checked out''' + return os.path.exists(os.path.join(self.repo.location, 'CVS')) + + def new(self, **kwargs): if kwargs: self._kwargs(kwargs) #initial checkout - 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 cvs_root = self.repo.sync_uri if portage.process.spawn_bash( "cd %s; exec cvs -z0 -d %s co -P -d %s %s" % @@ -60,17 +56,13 @@ class CVSSync(SyncBase): @rtype: (int, bool) """ - cvs_root = self.repo.sync_uri - - if cvs_root.startswith("cvs://"): - cvs_root = cvs_root[6:] - #cvs update - exitcode = portage.process.spawn_bash( - "cd %s; exec cvs -z0 -q update -dP" % \ - (portage._shell_quote(self.repo.location),), - **portage._native_kwargs(self.spawn_kwargs)) - if exitcode != os.EX_OK: - msg = "!!! cvs update error; exiting." - self.logger(self.xterm_titles, msg) - writemsg_level(msg + "\n", noiselevel=-1, level=logging.ERROR) + #cvs update + exitcode = portage.process.spawn_bash( + "cd %s; exec cvs -z0 -q update -dP" % \ + (portage._shell_quote(self.repo.location),), + **portage._native_kwargs(self.spawn_kwargs)) + if exitcode != os.EX_OK: + msg = "!!! cvs update error; exiting." + self.logger(self.xterm_titles, msg) + writemsg_level(msg + "\n", noiselevel=-1, level=logging.ERROR) return (exitcode, False) -- 2.2.1