commit: fa3fa9a9e5463ea22f90c617664963ce17298f33
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Fri May 2 22:59:23 2014 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Oct 20 03:48:34 2014 +0000
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=fa3fa9a9
sync/modules/websync: Make the bash version operational
---
pym/portage/sync/modules/websync/websync.py | 54 ++++++++++++++++++-----------
1 file changed, 34 insertions(+), 20 deletions(-)
diff --git a/pym/portage/sync/modules/websync/websync.py
b/pym/portage/sync/modules/websync/websync.py
index 7c31567..f08ae77 100644
--- a/pym/portage/sync/modules/websync/websync.py
+++ b/pym/portage/sync/modules/websync/websync.py
@@ -1,16 +1,26 @@
'''WebRsync module for portage'''
+import logging
+
+import portage
+from portage import os
+from portage.util import writemsg_level
+from portage.output import create_color_func
+good = create_color_func("GOOD")
+bad = create_color_func("BAD")
+warn = create_color_func("WARN")
from portage.sync.syncbase import SyncBase
+
class WebRsync(SyncBase):
'''WebRSync sync class'''
short_desc = "Perform sync operations on webrsync based repositories"
+ @staticmethod
def name():
return "WebRSync"
- name = staticmethod(name)
def __init__(self):
@@ -19,20 +29,31 @@ class WebRsync(SyncBase):
def new(self, **kwargs):
'''Do the initial download and install of the repository'''
- pass
+ return self._sync()
+
def _sync(self):
''' Update existing repository
'''
- pass
-
- def post_sync(self, portdb, location, emerge_config):
- '''repo.sync_type == "websync":
- # NOTE: Do this after reloading the config, in case
- # it did not exist prior to sync, so that the config
- # and portdb properly account for its existence.
- '''
- pass
+ emerge_config = self.options.get('emerge_config', None)
+ portdb = self.options.get('portdb', None)
+
+ msg = ">>> Starting emerge-webrsync for %s..." %
self.repo.location
+ self.logger(self.xterm_titles, msg)
+ writemsg_level(msg + "\n")
+ exitcode = portage.process.spawn_bash("%s" % \
+ (self.bin_command),
+ **portage._native_kwargs(self.spawn_kwargs))
+ if exitcode != os.EX_OK:
+ msg = "!!! emerge-webrsync error in %s" %
self.repo.location
+ self.logger(self.xterm_titles, msg)
+ writemsg_level(msg + "\n", level=logging.ERROR,
noiselevel=-1)
+ return (exitcode, False)
+ msg = ">>> Emerge-webrsync successful: %s" % self.repo.location
+ self.logger(self.xterm_titles, msg)
+ writemsg_level(msg + "\n")
+ #return self.post_sync(portdb, self.repo.location,
emerge_config)
+ return (exitcode, True)
class PyWebRsync(SyncBase):
@@ -40,9 +61,9 @@ class PyWebRsync(SyncBase):
short_desc = "Perform sync operations on webrsync based repositories"
+ @staticmethod
def name():
return "WebRSync"
- name = staticmethod(name)
def __init__(self):
@@ -53,15 +74,8 @@ class PyWebRsync(SyncBase):
'''Do the initial download and install of the repository'''
pass
+
def _sync(self):
''' Update existing repository
'''
pass
-
- def post_sync(self, portdb, location, emerge_config):
- '''repo.sync_type == "websync":
- # NOTE: Do this after reloading the config, in case
- # it did not exist prior to sync, so that the config
- # and portdb properly account for its existence.
- '''
- pass