public inbox for gentoo-portage-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-portage-dev] [PATCH] cvs sync: fix the module
@ 2015-01-17 17:36 Michał Górny
  2015-01-18  1:10 ` Zac Medico
  2015-01-18 17:01 ` Brian Dolbec
  0 siblings, 2 replies; 3+ messages in thread
From: Michał Górny @ 2015-01-17 17:36 UTC (permalink / raw
  To: gentoo-portage-dev; +Cc: Michał Górny

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



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [gentoo-portage-dev] [PATCH] cvs sync: fix the module
  2015-01-17 17:36 [gentoo-portage-dev] [PATCH] cvs sync: fix the module Michał Górny
@ 2015-01-18  1:10 ` Zac Medico
  2015-01-18 17:01 ` Brian Dolbec
  1 sibling, 0 replies; 3+ messages in thread
From: Zac Medico @ 2015-01-18  1:10 UTC (permalink / raw
  To: gentoo-portage-dev; +Cc: Michał Górny

On 01/17/2015 09:36 AM, Michał Górny wrote:
> 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(-)

LGTM.
-- 
Thanks,
Zac


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [gentoo-portage-dev] [PATCH] cvs sync: fix the module
  2015-01-17 17:36 [gentoo-portage-dev] [PATCH] cvs sync: fix the module Michał Górny
  2015-01-18  1:10 ` Zac Medico
@ 2015-01-18 17:01 ` Brian Dolbec
  1 sibling, 0 replies; 3+ messages in thread
From: Brian Dolbec @ 2015-01-18 17:01 UTC (permalink / raw
  To: gentoo-portage-dev

On Sat, 17 Jan 2015 18:36:58 +0100
Michał Górny <mgorny@gentoo.org> wrote:

> 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(-)
> 

Looks good, merge please
-- 
Brian Dolbec <dolsen>



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-01-18 17:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-17 17:36 [gentoo-portage-dev] [PATCH] cvs sync: fix the module Michał Górny
2015-01-18  1:10 ` Zac Medico
2015-01-18 17:01 ` Brian Dolbec

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox