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 8EB72138A1A for ; Sun, 18 Jan 2015 10:35:26 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 869F6E0912; Sun, 18 Jan 2015 10:35:25 +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 1EF05E08FA for ; Sun, 18 Jan 2015 10:35:25 +0000 (UTC) Received: from pomiot.lan (mgorny-1-pt.tunnel.tserv28.waw1.ipv6.he.net [IPv6:2001:470:70:353::2]) (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 34D0A3405BB; Sun, 18 Jan 2015 10:35:23 +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 v2] svn sync: fix the module Date: Sun, 18 Jan 2015 11:35:18 +0100 Message-Id: <1421577318-4960-1-git-send-email-mgorny@gentoo.org> X-Mailer: git-send-email 2.2.1 In-Reply-To: <54BAFA8C.7030100@gentoo.org> References: <54BAFA8C.7030100@gentoo.org> 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: d6384051-4f2a-4af0-b625-3dc3af2d515c X-Archives-Hash: 38486d84c773a108230adb5d593dd0f1 Fix the svn sync module since it doesn't work at all right now. More specifically: 1. add exists() method that checks for the '.svn' directory to determine whether the repository was checked out already. 2. Fix the initial clone to use valid svn commands. Do not remove the just-created (in pre_sync()) directory 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 svn:// or not. In fact, remove the whole check since it doesn't serve any purpose. --- pym/portage/sync/modules/svn/svn.py | 42 +++++++++++++++---------------------- 1 file changed, 17 insertions(+), 25 deletions(-) diff --git a/pym/portage/sync/modules/svn/svn.py b/pym/portage/sync/modules/svn/svn.py index 73c4b83..60ead4b 100644 --- a/pym/portage/sync/modules/svn/svn.py +++ b/pym/portage/sync/modules/svn/svn.py @@ -24,23 +24,19 @@ class SVNSync(SyncBase): SyncBase.__init__(self, "svn", "dev-vcs/subversion") + def exists(self, **kwargs): + '''Tests whether the repo actually exists''' + return os.path.exists(os.path.join(self.repo.location, '.svn')) + + 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 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)), + exitcode = portage.process.spawn_bash( + "cd %s; exec svn co %s ." % + (portage._shell_quote(self.repo.location), portage._shell_quote(svn_root)), **portage._native_kwargs(self.spawn_kwargs)) if exitcode != os.EX_OK: @@ -63,19 +59,15 @@ class SVNSync(SyncBase): if exitcode != os.EX_OK: return (exitcode, False) - svn_root = self.repo.sync_uri - - if svn_root.startswith("svn://"): - svn_root = svn_root[6:] - #svn update - 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) + #svn update + 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) -- 2.2.1