From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 66C8B1393E9 for ; Thu, 4 Sep 2014 01:18:42 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 173CBE0932; Thu, 4 Sep 2014 01:18:41 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 65B22E0932 for ; Thu, 4 Sep 2014 01:18:40 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 435C734002E for ; Thu, 4 Sep 2014 01:18:39 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id B8C2E4A4B for ; Thu, 4 Sep 2014 01:18:37 +0000 (UTC) From: "Brian Dolbec" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Brian Dolbec" Message-ID: <1409793481.303674173125a151136c2310f48cc6db04a39e5c.dol-sen@gentoo> Subject: [gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/websync/ X-VCS-Repository: proj/portage X-VCS-Files: pym/portage/sync/modules/websync/websync.py X-VCS-Directories: pym/portage/sync/modules/websync/ X-VCS-Committer: dol-sen X-VCS-Committer-Name: Brian Dolbec X-VCS-Revision: 303674173125a151136c2310f48cc6db04a39e5c X-VCS-Branch: plugin-sync Date: Thu, 4 Sep 2014 01:18:37 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 688334ff-b8d6-455e-895e-0d4d73dc61bb X-Archives-Hash: 081d6e0336ccc809cef66515b82dd160 commit: 303674173125a151136c2310f48cc6db04a39e5c Author: Brian Dolbec gentoo org> AuthorDate: Fri May 2 22:59:23 2014 +0000 Commit: Brian Dolbec gmail com> CommitDate: Thu Sep 4 01:18:01 2014 +0000 URL: http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=30367417 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