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 uses 'svn info' to determine whether |
5 |
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 directory to avoid permission issues, just run checkout |
9 |
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 | 54 ++++++++++++++++++++----------------- |
16 |
1 file changed, 29 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..3ab15f5 100644 |
20 |
--- a/pym/portage/sync/modules/svn/svn.py |
21 |
+++ b/pym/portage/sync/modules/svn/svn.py |
22 |
@@ -24,23 +24,31 @@ 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 |
+ if kwargs: |
29 |
+ self._kwargs(kwargs) |
30 |
+ elif not self.repo: |
31 |
+ return False |
32 |
+ |
33 |
+ if not os.path.exists(self.repo.location): |
34 |
+ return False |
35 |
+ exitcode = portage.process.spawn_bash("cd %s ; svn info &>/dev/null" %\ |
36 |
+ (portage._shell_quote(self.repo.location),), |
37 |
+ **portage._native_kwargs(self.spawn_kwargs)) |
38 |
+ if exitcode != 0: |
39 |
+ return False |
40 |
+ return True |
41 |
+ |
42 |
+ |
43 |
def new(self, **kwargs): |
44 |
if kwargs: |
45 |
self._kwargs(kwargs) |
46 |
#initial checkout |
47 |
- try: |
48 |
- os.rmdir(self.repo.location) |
49 |
- except OSError as e: |
50 |
- if e.errno != errno.ENOENT: |
51 |
- msg = "!!! existing '%s' directory; exiting." % self.repo.location |
52 |
- self.logger(self.xterm_titles, msg) |
53 |
- writemsg_level(msg + "\n", noiselevel=-1, level=logging.ERROR) |
54 |
- return (1, False) |
55 |
- del e |
56 |
svn_root = self.repo.sync_uri |
57 |
- exitcode = portage.process.spawn_bash( |
58 |
- "cd %s; exec svn %s" % |
59 |
- (portage._shell_quote(os.path.dirname(self.repo.location)), |
60 |
+ exitcode = portage.process.spawn_bash( |
61 |
+ "cd %s; exec svn co %s ." % |
62 |
+ (portage._shell_quote(self.repo.location), |
63 |
portage._shell_quote(svn_root)), |
64 |
**portage._native_kwargs(self.spawn_kwargs)) |
65 |
if exitcode != os.EX_OK: |
66 |
@@ -63,19 +71,15 @@ class SVNSync(SyncBase): |
67 |
if exitcode != os.EX_OK: |
68 |
return (exitcode, False) |
69 |
|
70 |
- svn_root = self.repo.sync_uri |
71 |
- |
72 |
- if svn_root.startswith("svn://"): |
73 |
- svn_root = svn_root[6:] |
74 |
- #svn update |
75 |
- exitcode = portage.process.spawn_bash( |
76 |
- "cd %s; exec svn update" % \ |
77 |
- (portage._shell_quote(self.repo.location),), |
78 |
- **portage._native_kwargs(self.spawn_kwargs)) |
79 |
- if exitcode != os.EX_OK: |
80 |
- msg = "!!! svn update error; exiting." |
81 |
- self.logger(self.xterm_titles, msg) |
82 |
- writemsg_level(msg + "\n", noiselevel=-1, level=logging.ERROR) |
83 |
+ #svn update |
84 |
+ exitcode = portage.process.spawn_bash( |
85 |
+ "cd %s; exec svn update" % \ |
86 |
+ (portage._shell_quote(self.repo.location),), |
87 |
+ **portage._native_kwargs(self.spawn_kwargs)) |
88 |
+ if exitcode != os.EX_OK: |
89 |
+ msg = "!!! svn update error; exiting." |
90 |
+ self.logger(self.xterm_titles, msg) |
91 |
+ writemsg_level(msg + "\n", noiselevel=-1, level=logging.ERROR) |
92 |
return (exitcode, False) |
93 |
|
94 |
|
95 |
-- |
96 |
2.2.1 |