public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Brian Dolbec" <brian.dolbec@gmail.com>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/layman:master commit in: layman/overlays/
Date: Mon, 16 Jun 2014 03:40:18 +0000 (UTC)	[thread overview]
Message-ID: <1402607509.e44f6726b5162cbc3026e9047878e2def78a562a.dol-sen@gentoo> (raw)
Message-ID: <20140616034018.JSR2fGe6taBktD1fk5Jg-L8xTs8mUHdDZsV7ygrve7c@z> (raw)

commit:     e44f6726b5162cbc3026e9047878e2def78a562a
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Fri May 30 20:54:12 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> 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/<old_location>/<new_location>/ <target>/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.'''
 


             reply	other threads:[~2014-06-16  3:40 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-16  3:37 Brian Dolbec [this message]
2014-06-16  3:40 ` [gentoo-commits] proj/layman:master commit in: layman/overlays/ Brian Dolbec
  -- strict thread matches above, loose matches on Subject: below --
2014-08-15 22:32 [gentoo-commits] proj/layman:gsoc2014 " Devan Franchini
2014-08-15 22:32 Devan Franchini
2014-06-27  4:07 Devan Franchini
2014-06-16  3:40 [gentoo-commits] proj/layman:master " Brian Dolbec
2014-06-16  3:37 ` [gentoo-commits] proj/layman:gsoc2014 " Brian Dolbec
2014-06-16  3:40 [gentoo-commits] proj/layman:master " Brian Dolbec
2014-06-16  3:37 ` [gentoo-commits] proj/layman:gsoc2014 " Brian Dolbec
2014-06-16  3:37 Brian Dolbec
2014-06-16  3:37 Brian Dolbec
2014-06-16  3:37 Brian Dolbec
2014-06-16  3:37 Brian Dolbec
2014-06-16  3:37 Brian Dolbec
2014-06-16  3:37 Brian Dolbec
2014-05-14 23:49 Devan Franchini
2014-05-14 17:32 Devan Franchini
2014-05-14  1:14 Devan Franchini
2014-05-14  0:42 Devan Franchini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1402607509.e44f6726b5162cbc3026e9047878e2def78a562a.dol-sen@gentoo \
    --to=brian.dolbec@gmail.com \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox