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