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 E8E9A13877A for ; Mon, 16 Jun 2014 03:37:34 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 884E7E0B9D; Mon, 16 Jun 2014 03:37: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 731E7E0B96 for ; Mon, 16 Jun 2014 03:37: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 9A1B633FF71 for ; Mon, 16 Jun 2014 03:37:30 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by spoonbill.gentoo.org (Postfix) with ESMTP id 66249187F1 for ; Mon, 16 Jun 2014 03:37: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: <1402607509.e44f6726b5162cbc3026e9047878e2def78a562a.dol-sen@gentoo> Subject: [gentoo-commits] proj/layman:gsoc2014 commit in: layman/overlays/ X-VCS-Repository: proj/layman X-VCS-Files: layman/overlays/cvs.py X-VCS-Directories: layman/overlays/ X-VCS-Committer: dol-sen X-VCS-Committer-Name: Brian Dolbec X-VCS-Revision: e44f6726b5162cbc3026e9047878e2def78a562a X-VCS-Branch: gsoc2014 Date: Mon, 16 Jun 2014 03:37: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: 96a1da9d-c771-4258-8576-49b6f630a5aa X-Archives-Hash: 001d8e7e5fc13cd1be68f2f038ce4348 commit: e44f6726b5162cbc3026e9047878e2def78a562a Author: Devan Franchini gentoo org> AuthorDate: Fri May 30 20:54:12 2014 +0000 Commit: Brian Dolbec gmail com> CommitDate: Thu Jun 12 21:11:49 2014 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=e44f6726 cvs.py: Adds update() function --- layman/overlays/cvs.py | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/layman/overlays/cvs.py b/layman/overlays/cvs.py index b166dc8..bf54921 100644 --- a/layman/overlays/cvs.py +++ b/layman/overlays/cvs.py @@ -27,6 +27,7 @@ __version__ = "$Id$" #------------------------------------------------------------------------------- import xml.etree.ElementTree as ET # Python 2.5 +import re from layman.utils import path from layman.overlays.source import OverlaySource, require_supported @@ -90,6 +91,42 @@ class CvsOverlay(OverlaySource): env=dict(CVSROOT=self.src), cmd=self.type), cwd=target) + def update(self, base, src): + ''' + Updates overlay src-url. + + @params base: base location where all overlays are installed. + @params src: source URL. + ''' + + if not self.supported(): + return 1 + + target = path([base, self.parent.name]) + + # First echo the new repository to CVS/Root + args = [src, '>', '/CVS/Root'] + result = self.run_command('echo', args, cmd='echo', cwd=target) + + if result == 0: + location = src.split(':')[3] + old_location = self.src.split(':/')[3] + + # Check if the repository location needs to be updated too. + if not location == old_location: + location = re.sub('/', '\/', location) + old_location = re.sub('/', '\/', old_location) + + expression = 's/' + old_location + '/' + location + '/' + + # sed -i 's/// /CVS/Repository + args = ['-i', expression, '/CVS/Repository'] + + return self.run_command('sed', args, cmd='sed', cwd=target) + + return result + + def sync(self, base): '''Sync overlay.''' 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 9CEA613877A for ; Mon, 16 Jun 2014 03:40:24 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 0E1C7E0B45; Mon, 16 Jun 2014 03:40:22 +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 219FAE0B37 for ; Mon, 16 Jun 2014 03:40:21 +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 544CC33F908 for ; Mon, 16 Jun 2014 03:40:20 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by spoonbill.gentoo.org (Postfix) with ESMTP id 27839187F1 for ; Mon, 16 Jun 2014 03:40:18 +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: <1402607509.e44f6726b5162cbc3026e9047878e2def78a562a.dol-sen@gentoo> Subject: [gentoo-commits] proj/layman:master commit in: layman/overlays/ X-VCS-Repository: proj/layman X-VCS-Files: layman/overlays/cvs.py X-VCS-Directories: layman/overlays/ X-VCS-Committer: dol-sen X-VCS-Committer-Name: Brian Dolbec X-VCS-Revision: e44f6726b5162cbc3026e9047878e2def78a562a X-VCS-Branch: master Date: Mon, 16 Jun 2014 03:40:18 +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: 66a37e79-0e5e-4d9c-a954-633a6d0b4192 X-Archives-Hash: 31b1d93e0ba0eaf6b72261b01407fc27 Message-ID: <20140616034018.JSR2fGe6taBktD1fk5Jg-L8xTs8mUHdDZsV7ygrve7c@z> commit: e44f6726b5162cbc3026e9047878e2def78a562a Author: Devan Franchini gentoo org> AuthorDate: Fri May 30 20:54:12 2014 +0000 Commit: Brian Dolbec gmail com> CommitDate: Thu Jun 12 21:11:49 2014 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=e44f6726 cvs.py: Adds update() function --- layman/overlays/cvs.py | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/layman/overlays/cvs.py b/layman/overlays/cvs.py index b166dc8..bf54921 100644 --- a/layman/overlays/cvs.py +++ b/layman/overlays/cvs.py @@ -27,6 +27,7 @@ __version__ = "$Id$" #------------------------------------------------------------------------------- import xml.etree.ElementTree as ET # Python 2.5 +import re from layman.utils import path from layman.overlays.source import OverlaySource, require_supported @@ -90,6 +91,42 @@ class CvsOverlay(OverlaySource): env=dict(CVSROOT=self.src), cmd=self.type), cwd=target) + def update(self, base, src): + ''' + Updates overlay src-url. + + @params base: base location where all overlays are installed. + @params src: source URL. + ''' + + if not self.supported(): + return 1 + + target = path([base, self.parent.name]) + + # First echo the new repository to CVS/Root + args = [src, '>', '/CVS/Root'] + result = self.run_command('echo', args, cmd='echo', cwd=target) + + if result == 0: + location = src.split(':')[3] + old_location = self.src.split(':/')[3] + + # Check if the repository location needs to be updated too. + if not location == old_location: + location = re.sub('/', '\/', location) + old_location = re.sub('/', '\/', old_location) + + expression = 's/' + old_location + '/' + location + '/' + + # sed -i 's/// /CVS/Repository + args = ['-i', expression, '/CVS/Repository'] + + return self.run_command('sed', args, cmd='sed', cwd=target) + + return result + + def sync(self, base): '''Sync overlay.'''