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 17BF113877A for ; Mon, 16 Jun 2014 15:46:34 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 529B0E0DA1; Mon, 16 Jun 2014 15:46:32 +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 8C8DAE0D9C for ; Mon, 16 Jun 2014 15:46:31 +0000 (UTC) Received: from spoonbill.gentoo.org (spoonbill.gentoo.org [81.93.255.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 91F0633FE70 for ; Mon, 16 Jun 2014 15:46:30 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by spoonbill.gentoo.org (Postfix) with ESMTP id 45693187EF for ; Mon, 16 Jun 2014 15:46:28 +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: <1402933016.faa2b6eec24d01093ce97d6efc8da65f5084c3af.dol-sen@gentoo> Subject: [gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/git/ X-VCS-Repository: proj/portage X-VCS-Files: pym/portage/sync/modules/git/git.py X-VCS-Directories: pym/portage/sync/modules/git/ X-VCS-Committer: dol-sen X-VCS-Committer-Name: Brian Dolbec X-VCS-Revision: faa2b6eec24d01093ce97d6efc8da65f5084c3af X-VCS-Branch: plugin-sync Date: Mon, 16 Jun 2014 15:46:28 +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: 224bd1bc-a763-4819-bfe7-6315720a2e89 X-Archives-Hash: c0a219e730a0d6f9803ecb83c91991a1 commit: faa2b6eec24d01093ce97d6efc8da65f5084c3af Author: Brian Dolbec gentoo org> AuthorDate: Fri Mar 14 15:55:07 2014 +0000 Commit: Brian Dolbec gmail com> CommitDate: Mon Jun 16 15:36:56 2014 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=faa2b6ee portage/sync/modules/git: Use SyncBase class. Use self.bin_command for the binary call. --- pym/portage/sync/modules/git/git.py | 56 ++++++------------------------------- 1 file changed, 8 insertions(+), 48 deletions(-) diff --git a/pym/portage/sync/modules/git/git.py b/pym/portage/sync/modules/git/git.py index 6806ef3..5e0e5df 100644 --- a/pym/portage/sync/modules/git/git.py +++ b/pym/portage/sync/modules/git/git.py @@ -11,9 +11,10 @@ good = create_color_func("GOOD") bad = create_color_func("BAD") warn = create_color_func("WARN") from .timestamps import git_sync_timestamps +from portage.sync.syncbase import SyncBase -class GitSync(object): +class GitSync(SyncBase): '''Git sync class''' short_desc = "Perform sync operations on git based repositories" @@ -23,34 +24,8 @@ class GitSync(object): return "GitSync" - def can_progressbar(self, func): - return False - - def __init__(self): - self.options = None - self.settings = None - self.logger = None - self.repo = None - self.xterm_titles = None - - self.has_git = True - if portage.process.find_binary("git") is None: - msg = ["Command not found: git", - "Type \"emerge %s\" to enable git support." % portage.const.GIT_PACKAGE_ATOM] - for l in msg: - writemsg_level("!!! %s\n" % l, - level=logging.ERROR, noiselevel=-1) - self.has_git = False - - - def _kwargs(self, kwargs): - '''Sets internal variables from kwargs''' - self.options = kwargs.get('options', {}) - self.settings = self.options.get('settings', None) - self.logger = self.options.get('logger', None) - self.repo = self.options.get('repo', None) - self.xterm_titles = self.options.get('xterm_titles', False) + SyncBase.__init__(self, "git", portage.const.GIT_PACKAGE_ATOM) def exists(self, **kwargs): @@ -59,37 +34,22 @@ class GitSync(object): self._kwargs(kwargs) elif not self.repo: return False - spawn_kwargs = self.options.get('spawn_kwargs', None) if not os.path.exists(self.repo.location): return False exitcode = portage.process.spawn_bash("cd %s ; git rev-parse" %\ (portage._shell_quote(self.repo.location),), - **portage._native_kwargs(spawn_kwargs)) + **portage._native_kwargs(self.spawn_kwargs)) if exitcode == 128: return False return True - def sync(self, **kwargs): - '''Sync/Clone the repository''' - if kwargs: - self._kwargs(kwargs) - - if not self.has_git: - return (1, False) - - if not self.exists(): - return self.new() - return self._sync() - - def new(self, **kwargs): '''Do the initial clone of the repository''' if kwargs: self._kwargs(kwargs) emerge_config = self.options.get('emerge_config', None) - spawn_kwargs = self.options.get('spawn_kwargs', None) portdb = self.options.get('portdb', None) try: if not os.path.exists(self.repo.location): @@ -101,10 +61,11 @@ class GitSync(object): msg = ">>> Cloning git repository from upstream into %s..." % self.repo.location self.logger(self.xterm_titles, msg) writemsg_level(msg + "\n") - exitcode = portage.process.spawn_bash("cd %s ; git clone %s ." % \ + exitcode = portage.process.spawn_bash("cd %s ; %s clone %s ." % \ (portage._shell_quote(self.repo.location), + self.bin_command, portage._shell_quote(self.repo.sync_uri)), - **portage._native_kwargs(spawn_kwargs)) + **portage._native_kwargs(self.spawn_kwargs)) if exitcode != os.EX_OK: msg = "!!! git clone error in %s" % self.repo.location self.logger(self.xterm_titles, msg) @@ -125,7 +86,6 @@ class GitSync(object): # No kwargs call here; this is internal, so it should have been # called by something which set the internal variables emerge_config = self.options.get('emerge_config', None) - spawn_kwargs = self.options.get('spawn_kwargs', None) portdb = self.options.get('portdb', None) msg = ">>> Starting git pull in %s..." % self.repo.location @@ -133,7 +93,7 @@ class GitSync(object): writemsg_level(msg + "\n") exitcode = portage.process.spawn_bash("cd %s ; git pull" % \ (portage._shell_quote(self.repo.location),), - **portage._native_kwargs(spawn_kwargs)) + **portage._native_kwargs(self.spawn_kwargs)) if exitcode != os.EX_OK: msg = "!!! git pull error in %s" % self.repo.location self.logger(self.xterm_titles, msg)