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 42741138A1A for ; Sun, 18 Jan 2015 18:04:39 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id AC697E0909; Sun, 18 Jan 2015 18:04:37 +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 02B11E0908 for ; Sun, 18 Jan 2015 18:04:37 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 246353406A1 for ; Sun, 18 Jan 2015 18:04:36 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 95014FDC0 for ; Sun, 18 Jan 2015 18:04:33 +0000 (UTC) From: "Michał Górny" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Michał Górny" Message-ID: <1421604265.7ca0672d4c95d2e07885460eee9ed41e882faf9f.mgorny@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/sync/modules/svn/ X-VCS-Repository: proj/portage X-VCS-Files: pym/portage/sync/modules/svn/svn.py X-VCS-Directories: pym/portage/sync/modules/svn/ X-VCS-Committer: mgorny X-VCS-Committer-Name: Michał Górny X-VCS-Revision: 7ca0672d4c95d2e07885460eee9ed41e882faf9f X-VCS-Branch: master Date: Sun, 18 Jan 2015 18:04:33 +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: cce2e3e9-2bbf-4d73-9838-04b331623b3d X-Archives-Hash: 48389cacb3d4eec7590107d6f2adcbf0 commit: 7ca0672d4c95d2e07885460eee9ed41e882faf9f Author: Michał Górny gentoo org> AuthorDate: Sat Jan 17 17:13:09 2015 +0000 Commit: Michał Górny gentoo org> CommitDate: Sun Jan 18 18:04:25 2015 +0000 URL: http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=7ca0672d svn sync: fix the module 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)