1 |
commit: d5bb53ece2bd74c60bbeff3b2f89b086bec2fa30 |
2 |
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Feb 19 08:24:58 2014 +0000 |
4 |
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com> |
5 |
CommitDate: Fri May 2 23:05:15 2014 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=d5bb53ec |
7 |
|
8 |
Use the new SyncBase class in websync module |
9 |
|
10 |
--- |
11 |
pym/portage/sync/modules/websync/websync.py | 112 ++-------------------------- |
12 |
1 file changed, 6 insertions(+), 106 deletions(-) |
13 |
|
14 |
diff --git a/pym/portage/sync/modules/websync/websync.py b/pym/portage/sync/modules/websync/websync.py |
15 |
index 5954a31..7c31567 100644 |
16 |
--- a/pym/portage/sync/modules/websync/websync.py |
17 |
+++ b/pym/portage/sync/modules/websync/websync.py |
18 |
@@ -1,7 +1,9 @@ |
19 |
|
20 |
'''WebRsync module for portage''' |
21 |
|
22 |
-class WebRsync(object): |
23 |
+from portage.sync.syncbase import SyncBase |
24 |
+ |
25 |
+class WebRsync(SyncBase): |
26 |
'''WebRSync sync class''' |
27 |
|
28 |
short_desc = "Perform sync operations on webrsync based repositories" |
29 |
@@ -11,60 +13,8 @@ class WebRsync(object): |
30 |
name = staticmethod(name) |
31 |
|
32 |
|
33 |
- def can_progressbar(self, func): |
34 |
- return False |
35 |
- |
36 |
- |
37 |
def __init__(self): |
38 |
- self.options = None |
39 |
- self.settings = None |
40 |
- self.logger = None |
41 |
- self.repo = None |
42 |
- self.xterm_titles = None |
43 |
- |
44 |
- self.has_git = True |
45 |
- if portage.process.find_binary("emerge-webrsync") is None: |
46 |
- msg = ["Command not found: git", |
47 |
- "Type \"emerge %s\" to enable git support." % portage.const.GIT_PACKAGE_ATOM] |
48 |
- for l in msg: |
49 |
- writemsg_level("!!! %s\n" % l, |
50 |
- level=logging.ERROR, noiselevel=-1) |
51 |
- self.has_git = False |
52 |
- |
53 |
- |
54 |
- def _kwargs(self, kwargs): |
55 |
- '''Sets internal variables from kwargs''' |
56 |
- self.options = kwargs.get('options', {}) |
57 |
- self.settings = self.options.get('settings', None) |
58 |
- self.logger = self.options.get('logger', None) |
59 |
- self.repo = self.options.get('repo', None) |
60 |
- self.xterm_titles = self.options.get('xterm_titles', False) |
61 |
- |
62 |
- |
63 |
- def exists(self, **kwargs): |
64 |
- '''Tests whether the repo actually exists''' |
65 |
- if kwargs: |
66 |
- self._kwargs(kwargs) |
67 |
- elif not self.repo: |
68 |
- return False |
69 |
- spawn_kwargs = self.options.get('spawn_kwargs', None) |
70 |
- |
71 |
- if not os.path.exists(self.repo.location): |
72 |
- return False |
73 |
- return True |
74 |
- |
75 |
- |
76 |
- def sync(self, **kwargs): |
77 |
- '''Sync the repository''' |
78 |
- if kwargs: |
79 |
- self._kwargs(kwargs) |
80 |
- |
81 |
- if not self.has_git: |
82 |
- return (1, False) |
83 |
- |
84 |
- if not self.exists(): |
85 |
- return self.new() |
86 |
- return self._sync() |
87 |
+ SyncBase.__init__(self, 'emerge-webrsync', '>=sys-apps/portage-2.3') |
88 |
|
89 |
|
90 |
def new(self, **kwargs): |
91 |
@@ -85,7 +35,7 @@ class WebRsync(object): |
92 |
pass |
93 |
|
94 |
|
95 |
-class PyWebRsync(object): |
96 |
+class PyWebRsync(SyncBase): |
97 |
'''WebRSync sync class''' |
98 |
|
99 |
short_desc = "Perform sync operations on webrsync based repositories" |
100 |
@@ -95,58 +45,8 @@ class PyWebRsync(object): |
101 |
name = staticmethod(name) |
102 |
|
103 |
|
104 |
- def can_progressbar(self, func): |
105 |
- return False |
106 |
- |
107 |
- |
108 |
def __init__(self): |
109 |
- self.options = None |
110 |
- self.settings = None |
111 |
- self.logger = None |
112 |
- self.repo = None |
113 |
- self.xterm_titles = None |
114 |
- |
115 |
- #if portage.process.find_binary("gpg") is None: |
116 |
- #msg = ["Command not found: gpg", |
117 |
- #"Type \"emerge %s\" to enable blah support." % 'emerge-webrsync'] |
118 |
- #for l in msg: |
119 |
- #writemsg_level("!!! %s\n" % l, |
120 |
- # level=logging.ERROR, noiselevel=-1) |
121 |
- |
122 |
- |
123 |
- def _kwargs(self, kwargs): |
124 |
- '''Sets internal variables from kwargs''' |
125 |
- self.options = kwargs.get('options', {}) |
126 |
- self.settings = self.options.get('settings', None) |
127 |
- self.logger = self.options.get('logger', None) |
128 |
- self.repo = self.options.get('repo', None) |
129 |
- self.xterm_titles = self.options.get('xterm_titles', False) |
130 |
- |
131 |
- |
132 |
- def exists(self, **kwargs): |
133 |
- '''Tests whether the repo actually exists''' |
134 |
- if kwargs: |
135 |
- self._kwargs(kwargs) |
136 |
- elif not self.repo: |
137 |
- return False |
138 |
- spawn_kwargs = self.options.get('spawn_kwargs', None) |
139 |
- |
140 |
- if not os.path.exists(self.repo.location): |
141 |
- return False |
142 |
- return True |
143 |
- |
144 |
- |
145 |
- def sync(self, **kwargs): |
146 |
- '''Sync/Clone the repository''' |
147 |
- if kwargs: |
148 |
- self._kwargs(kwargs) |
149 |
- |
150 |
- if not self.has_git: |
151 |
- return (1, False) |
152 |
- |
153 |
- if not self.exists(): |
154 |
- return self.new() |
155 |
- return self._sync() |
156 |
+ SyncBase.__init__(self, None, '>=sys-apps/portage-2.3') |
157 |
|
158 |
|
159 |
def new(self, **kwargs): |