1 |
Fix the cvs sync module since it doesn't work at all right now. More |
2 |
specifically: |
3 |
|
4 |
1. add exists() method that checks for the 'CVS' sub-directory to determine |
5 |
whether the repository was checked out already. |
6 |
|
7 |
2. Do not remove the just-created directory on initial clone, to avoid |
8 |
permission issues. Just run checkout on top of it. |
9 |
|
10 |
3. Fix the sync method to run update unconditionally to whether the URI |
11 |
starts with cvs:// or not. In fact, remove the whole check since it |
12 |
doesn't serve any purpose. |
13 |
--- |
14 |
pym/portage/sync/modules/cvs/cvs.py | 36 ++++++++++++++---------------------- |
15 |
1 file changed, 14 insertions(+), 22 deletions(-) |
16 |
|
17 |
diff --git a/pym/portage/sync/modules/cvs/cvs.py b/pym/portage/sync/modules/cvs/cvs.py |
18 |
index 2c3c6a3..919cb34 100644 |
19 |
--- a/pym/portage/sync/modules/cvs/cvs.py |
20 |
+++ b/pym/portage/sync/modules/cvs/cvs.py |
21 |
@@ -24,19 +24,15 @@ class CVSSync(SyncBase): |
22 |
SyncBase.__init__(self, "cvs", portage.const.CVS_PACKAGE_ATOM) |
23 |
|
24 |
|
25 |
+ def exists(self, **kwargs): |
26 |
+ '''Tests whether the repo is checked out''' |
27 |
+ return os.path.exists(os.path.join(self.repo.location, 'CVS')) |
28 |
+ |
29 |
+ |
30 |
def new(self, **kwargs): |
31 |
if kwargs: |
32 |
self._kwargs(kwargs) |
33 |
#initial checkout |
34 |
- try: |
35 |
- os.rmdir(self.repo.location) |
36 |
- except OSError as e: |
37 |
- if e.errno != errno.ENOENT: |
38 |
- msg = "!!! existing '%s' directory; exiting." % self.repo.location |
39 |
- self.logger(self.xterm_titles, msg) |
40 |
- writemsg_level(msg + "\n", noiselevel=-1, level=logging.ERROR) |
41 |
- return (1, False) |
42 |
- del e |
43 |
cvs_root = self.repo.sync_uri |
44 |
if portage.process.spawn_bash( |
45 |
"cd %s; exec cvs -z0 -d %s co -P -d %s %s" % |
46 |
@@ -60,17 +56,13 @@ class CVSSync(SyncBase): |
47 |
@rtype: (int, bool) |
48 |
""" |
49 |
|
50 |
- cvs_root = self.repo.sync_uri |
51 |
- |
52 |
- if cvs_root.startswith("cvs://"): |
53 |
- cvs_root = cvs_root[6:] |
54 |
- #cvs update |
55 |
- exitcode = portage.process.spawn_bash( |
56 |
- "cd %s; exec cvs -z0 -q update -dP" % \ |
57 |
- (portage._shell_quote(self.repo.location),), |
58 |
- **portage._native_kwargs(self.spawn_kwargs)) |
59 |
- if exitcode != os.EX_OK: |
60 |
- msg = "!!! cvs update error; exiting." |
61 |
- self.logger(self.xterm_titles, msg) |
62 |
- writemsg_level(msg + "\n", noiselevel=-1, level=logging.ERROR) |
63 |
+ #cvs update |
64 |
+ exitcode = portage.process.spawn_bash( |
65 |
+ "cd %s; exec cvs -z0 -q update -dP" % \ |
66 |
+ (portage._shell_quote(self.repo.location),), |
67 |
+ **portage._native_kwargs(self.spawn_kwargs)) |
68 |
+ if exitcode != os.EX_OK: |
69 |
+ msg = "!!! cvs update error; exiting." |
70 |
+ self.logger(self.xterm_titles, msg) |
71 |
+ writemsg_level(msg + "\n", noiselevel=-1, level=logging.ERROR) |
72 |
return (exitcode, False) |
73 |
-- |
74 |
2.2.1 |