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 F1F4E138A1A for ; Sat, 17 Jan 2015 17:35:48 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id EB325E08E1; Sat, 17 Jan 2015 17:35:47 +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 6DEA2E0887 for ; Sat, 17 Jan 2015 17:35:47 +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 8B17334075D; Sat, 17 Jan 2015 17:35:45 +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] svn sync: fix the module Date: Sat, 17 Jan 2015 18:35:39 +0100 Message-Id: <1421516139-6662-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: f4e940bc-f643-42ec-a3a1-f14adc940824 X-Archives-Hash: 9ea14b94e0578b4ce2a9ac82d7488d04 Fix the svn sync module since it doesn't work at all right now. More specifically: 1. add exists() method that uses 'svn info' 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 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 | 54 ++++++++++++++++++++----------------- 1 file changed, 29 insertions(+), 25 deletions(-) diff --git a/pym/portage/sync/modules/svn/svn.py b/pym/portage/sync/modules/svn/svn.py index 73c4b83..3ab15f5 100644 --- a/pym/portage/sync/modules/svn/svn.py +++ b/pym/portage/sync/modules/svn/svn.py @@ -24,23 +24,31 @@ class SVNSync(SyncBase): SyncBase.__init__(self, "svn", "dev-vcs/subversion") + def exists(self, **kwargs): + '''Tests whether the repo actually exists''' + if kwargs: + self._kwargs(kwargs) + elif not self.repo: + return False + + if not os.path.exists(self.repo.location): + return False + exitcode = portage.process.spawn_bash("cd %s ; svn info &>/dev/null" %\ + (portage._shell_quote(self.repo.location),), + **portage._native_kwargs(self.spawn_kwargs)) + if exitcode != 0: + return False + return True + + 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 +71,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