switched back to whoosh with haystack
[ebuildfind.git] / commands / lib / layman / overlays / rsync.py
blob6052bd0e675f6b74e12f0ba100002eb85ab771e0
1 #!/usr/bin/python
2 # -*- coding: utf-8 -*-
3 #################################################################################
4 # LAYMAN RSYNC OVERLAY HANDLER
5 #################################################################################
6 # File: rsync.py
8 # Handles rsync 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 ''' Rsync overlay support.'''
19 __version__ = "$Id: rsync.py 236 2006-09-05 20:39:37Z wrobel $"
21 #===============================================================================
23 # Dependencies
25 #-------------------------------------------------------------------------------
27 from layman.utils import path
28 from layman.overlays.overlay import Overlay
30 #===============================================================================
32 # Class RsyncOverlay
34 #-------------------------------------------------------------------------------
36 class RsyncOverlay(Overlay):
37 ''' Handles rsync overlays.'''
39 type = 'Rsync'
41 binary = '/usr/bin/rsync'
43 base = binary + ' -rlptDvz --progress --delete --delete-after ' + \
44 '--timeout=180 --exclude="distfiles/*" --exclude="local/*" ' + \
45 '--exclude="packages/*" '
47 def add(self, base, quiet = False):
48 '''Add overlay.'''
50 self.supported()
52 Overlay.add(self, base)
54 return self.sync(base)
56 def sync(self, base, quiet = False):
57 '''Sync overlay.'''
59 self.supported()
61 if quiet:
62 quiet_option = '-q '
63 else:
64 quiet_option = ''
66 return self.cmd(self.base + quiet_option + '"' + self.src + '/" "' +
67 path([base, self.name]) + '"')
69 def supported(self):
70 '''Overlay type supported?'''
72 return Overlay.supported(self, [(self.binary, 'rsync',
73 'net-misc/rsync'),])