1 |
commit: a91cb5d028d11e0120d943bfa235435edb650077 |
2 |
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri May 2 22:59:23 2014 +0000 |
4 |
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com> |
5 |
CommitDate: Tue Sep 30 00:42:25 2014 +0000 |
6 |
URL: http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=a91cb5d0 |
7 |
|
8 |
sync/modules/websync: Make the bash version operational |
9 |
|
10 |
--- |
11 |
pym/portage/sync/modules/websync/websync.py | 54 ++++++++++++++++++----------- |
12 |
1 file changed, 34 insertions(+), 20 deletions(-) |
13 |
|
14 |
diff --git a/pym/portage/sync/modules/websync/websync.py b/pym/portage/sync/modules/websync/websync.py |
15 |
index 7c31567..f08ae77 100644 |
16 |
--- a/pym/portage/sync/modules/websync/websync.py |
17 |
+++ b/pym/portage/sync/modules/websync/websync.py |
18 |
@@ -1,16 +1,26 @@ |
19 |
|
20 |
'''WebRsync module for portage''' |
21 |
|
22 |
+import logging |
23 |
+ |
24 |
+import portage |
25 |
+from portage import os |
26 |
+from portage.util import writemsg_level |
27 |
+from portage.output import create_color_func |
28 |
+good = create_color_func("GOOD") |
29 |
+bad = create_color_func("BAD") |
30 |
+warn = create_color_func("WARN") |
31 |
from portage.sync.syncbase import SyncBase |
32 |
|
33 |
+ |
34 |
class WebRsync(SyncBase): |
35 |
'''WebRSync sync class''' |
36 |
|
37 |
short_desc = "Perform sync operations on webrsync based repositories" |
38 |
|
39 |
+ @staticmethod |
40 |
def name(): |
41 |
return "WebRSync" |
42 |
- name = staticmethod(name) |
43 |
|
44 |
|
45 |
def __init__(self): |
46 |
@@ -19,20 +29,31 @@ class WebRsync(SyncBase): |
47 |
|
48 |
def new(self, **kwargs): |
49 |
'''Do the initial download and install of the repository''' |
50 |
- pass |
51 |
+ return self._sync() |
52 |
+ |
53 |
|
54 |
def _sync(self): |
55 |
''' Update existing repository |
56 |
''' |
57 |
- pass |
58 |
- |
59 |
- def post_sync(self, portdb, location, emerge_config): |
60 |
- '''repo.sync_type == "websync": |
61 |
- # NOTE: Do this after reloading the config, in case |
62 |
- # it did not exist prior to sync, so that the config |
63 |
- # and portdb properly account for its existence. |
64 |
- ''' |
65 |
- pass |
66 |
+ emerge_config = self.options.get('emerge_config', None) |
67 |
+ portdb = self.options.get('portdb', None) |
68 |
+ |
69 |
+ msg = ">>> Starting emerge-webrsync for %s..." % self.repo.location |
70 |
+ self.logger(self.xterm_titles, msg) |
71 |
+ writemsg_level(msg + "\n") |
72 |
+ exitcode = portage.process.spawn_bash("%s" % \ |
73 |
+ (self.bin_command), |
74 |
+ **portage._native_kwargs(self.spawn_kwargs)) |
75 |
+ if exitcode != os.EX_OK: |
76 |
+ msg = "!!! emerge-webrsync error in %s" % self.repo.location |
77 |
+ self.logger(self.xterm_titles, msg) |
78 |
+ writemsg_level(msg + "\n", level=logging.ERROR, noiselevel=-1) |
79 |
+ return (exitcode, False) |
80 |
+ msg = ">>> Emerge-webrsync successful: %s" % self.repo.location |
81 |
+ self.logger(self.xterm_titles, msg) |
82 |
+ writemsg_level(msg + "\n") |
83 |
+ #return self.post_sync(portdb, self.repo.location, emerge_config) |
84 |
+ return (exitcode, True) |
85 |
|
86 |
|
87 |
class PyWebRsync(SyncBase): |
88 |
@@ -40,9 +61,9 @@ class PyWebRsync(SyncBase): |
89 |
|
90 |
short_desc = "Perform sync operations on webrsync based repositories" |
91 |
|
92 |
+ @staticmethod |
93 |
def name(): |
94 |
return "WebRSync" |
95 |
- name = staticmethod(name) |
96 |
|
97 |
|
98 |
def __init__(self): |
99 |
@@ -53,15 +74,8 @@ class PyWebRsync(SyncBase): |
100 |
'''Do the initial download and install of the repository''' |
101 |
pass |
102 |
|
103 |
+ |
104 |
def _sync(self): |
105 |
''' Update existing repository |
106 |
''' |
107 |
pass |
108 |
- |
109 |
- def post_sync(self, portdb, location, emerge_config): |
110 |
- '''repo.sync_type == "websync": |
111 |
- # NOTE: Do this after reloading the config, in case |
112 |
- # it did not exist prior to sync, so that the config |
113 |
- # and portdb properly account for its existence. |
114 |
- ''' |
115 |
- pass |