initial commit
[ebuildfind.git] / commands / lib / layman / overlays / cvs.py
blob096dfea57ae91bb763fb523ad14ede6520f20c29
1 #!/usr/bin/python
2 # -*- coding: utf-8 -*-
3 #################################################################################
4 # LAYMAN CVS OVERLAY HANDLER
5 #################################################################################
6 # File: cvs.py
8 # Handles cvs overlays
10 # Copyright:
11 # (c) 2005 - 2008 Gunnar Wrobel
12 # Distributed under the terms of the GNU General Public License v2
14 # Author(s):
15 # Gunnar Wrobel <wrobel@gentoo.org>
17 ''' Cvs overlay support.'''
19 __version__ = "$Id$"
21 #===============================================================================
23 # Dependencies
25 #-------------------------------------------------------------------------------
27 from layman.utils import path
28 from layman.overlays.overlay import Overlay
30 #===============================================================================
32 # Class CvsOverlay
34 #-------------------------------------------------------------------------------
36 class CvsOverlay(Overlay):
37 ''' Handles cvs overlays.'''
39 type = 'cvs'
41 binary = '/usr/bin/cvs'
43 def __init__(self, xml, ignore = 0, quiet = False):
45 Overlay.__init__(self, xml, ignore, quiet)
47 if '&subpath' in self.data.keys():
48 self.subpath = self.data['&subpath']
49 else:
50 self.subpath = ''
52 def add(self, base, quiet = False):
53 '''Add overlay.'''
55 self.supported()
57 if quiet:
58 quiet_option = ' -q'
59 else:
60 quiet_option = ''
62 return self.cmd('cd "' + base + '" && CVSROOT="' + self.src + '" ' +
63 self.binary + quiet_option + ' co -d "' + self.name
64 + '" "' + self.subpath + '"' )
66 def sync(self, base, quiet = False):
67 '''Sync overlay.'''
69 self.supported()
71 if quiet:
72 quiet_option = ' -q'
73 else:
74 quiet_option = ''
76 return self.cmd('cd "' + path([base, self.name]) + '" && ' +
77 self.binary + quiet_option + ' update')
79 def supported(self):
80 '''Overlay type supported?'''
82 return Overlay.supported(self, [(self.binary, 'cvs',
83 'dev-util/cvs'),])