commit: a2a6d87d17d19d3ab9c64b829cdece7e2485f949 Author: Michał Górny <mgorny <AT> gentoo <DOT> org> AuthorDate: Sat Jan 17 17:35:17 2015 +0000 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> CommitDate: Sun Jan 18 18:04:25 2015 +0000 URL: http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=a2a6d87d
cvs sync: fix the module 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 (in pre_sync()) 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)