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 8E4A3138010 for ; Mon, 8 Oct 2012 04:37:00 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id DEC67E04BA; Mon, 8 Oct 2012 04:36:49 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 571A6E04BA for ; Mon, 8 Oct 2012 04:36:48 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 41C2833D7CF for ; Mon, 8 Oct 2012 04:36:48 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id CA226E5436 for ; Mon, 8 Oct 2012 04:36:45 +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: <1349670831.fc3cd9942ac71e118796d823fe3303a8c7cecdc2.dol-sen@gentoo> Subject: [gentoo-commits] proj/layman:master commit in: layman/overlays/ X-VCS-Repository: proj/layman X-VCS-Files: layman/overlays/svn.py X-VCS-Directories: layman/overlays/ X-VCS-Committer: dol-sen X-VCS-Committer-Name: Brian Dolbec X-VCS-Revision: fc3cd9942ac71e118796d823fe3303a8c7cecdc2 X-VCS-Branch: master Date: Mon, 8 Oct 2012 04:36:45 +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: c8b293ed-76ff-4bc9-901e-3719cfc36c97 X-Archives-Hash: 1fdf018ca9ae45fe6848a6cf84c03728 commit: fc3cd9942ac71e118796d823fe3303a8c7cecdc2 Author: Brian Dolbec gentoo org> AuthorDate: Mon Oct 8 04:33:51 2012 +0000 Commit: Brian Dolbec gmail com> CommitDate: Mon Oct 8 04:33:51 2012 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=fc3cd994 An an automatic 'svn upgrade' capability for svn type repos. Bug 408039. --- layman/overlays/svn.py | 39 +++++++++++++++++++++++++++++++++++++-- 1 files changed, 37 insertions(+), 2 deletions(-) diff --git a/layman/overlays/svn.py b/layman/overlays/svn.py index 3e5497c..9785025 100644 --- a/layman/overlays/svn.py +++ b/layman/overlays/svn.py @@ -18,14 +18,19 @@ __version__ = "$Id: svn.py 236 2006-09-05 20:39:37Z wrobel $" + +import os +from subprocess import PIPE, Popen + #============================================================================== # # Dependencies # #------------------------------------------------------------------------------ -from layman.utils import path -from layman.overlays.source import OverlaySource, require_supported +from layman.utils import path +from layman.overlays.source import (OverlaySource, require_supported, + _resolve_command) #============================================================================== # @@ -86,6 +91,10 @@ class SvnOverlay(OverlaySource): cfg_opts = self.config["svn_syncopts"] self.target = checkout_location() + # first check if an svn upgrade is needed. + self.output.debug("SVN: check_upgrade() call", 4) + self.check_upgrade(path([base, self.parent.name])) + # svn up [-q] TARGET args = ['up'] if self.config['quiet']: @@ -114,3 +123,29 @@ class SvnOverlay(OverlaySource): args.append(self.target) cleanup = self.run_command(self.command(), args, cmd="svn cleanup") return + + def check_upgrade(self, target): + '''Code to check the installed svn version and + run "svn upgrade" if needed.''' + file_to_run = _resolve_command(self.command(), self.output.error)[1] + args = file_to_run + ' -q --version' + pipe = Popen(args, shell=True, stdout=PIPE) + if pipe: + self.output.debug("SVN: check_upgrade()... have a valid pipe", 4) + version = pipe.stdout.readline().strip('\n') + self.output.debug("SVN: check_upgrade()... svn version found: %s" + % version, 4) + pipe.terminate() + if version >= '1.7.0': + self.output.debug("SVN: check_upgrade()... svn upgrade maybe", + 4) + _path = path([target,'.svn/wc.db']) + if not os.path.exists(_path): + self.output.info("An svn upgrade needs to be run...", + 2) + args = ["upgrade"] + return self.run_command(self.command(), args, + cwd=target, cmd="svn upgrade") + return + else: + return