diff options
Diffstat (limited to 'overlays')
-rw-r--r-- | overlays/overlay.py | 44 | ||||
-rw-r--r-- | overlays/rsync.py | 2 | ||||
-rw-r--r-- | overlays/tar.py | 6 |
3 files changed, 31 insertions, 21 deletions
diff --git a/overlays/overlay.py b/overlays/overlay.py index b7a006f..14aaa94 100644 --- a/overlays/overlay.py +++ b/overlays/overlay.py @@ -24,7 +24,7 @@ __version__ = "$Id: overlay.py 273 2006-12-30 15:54:50Z wrobel $" # #------------------------------------------------------------------------------- -import re, os, os.path, shutil, popen2 +import sys, types, re, os, os.path, shutil, popen2 from layman.utils import node_to_dict, dict_to_node, path @@ -112,6 +112,12 @@ class Overlay: else: self.priority = 50 + def set_priority(self, priority): + '''Set the priority of this overlay.''' + + self.data['&priority'] = str(priority) + self.priority = int(priority) + def to_minidom(self, document): '''Convert to xml.''' @@ -147,6 +153,10 @@ class Overlay: OUT.info('Running command "' + command + '"...', 2) + if hasattr(sys.stdout,'encoding'): + command = command.encode(sys.stdout.encoding or + sys.getfilesystemencoding()) + if not self.quiet: return os.system(command) else: @@ -178,29 +188,29 @@ class Overlay: <BLANKLINE> ''' - result = '' + result = u'' - result += self.name + '\n' + (len(self.name) * '~') + result += self.name + u'\n' + (len(self.name) * u'~') - result += '\nSource : ' + self.src - result += '\nContact : ' + self.contact - result += '\nType : ' + self.type - result += '; Priority: ' + str(self.priority) + '\n' + result += u'\nSource : ' + self.src + result += u'\nContact : ' + self.contact + result += u'\nType : ' + self.type + result += u'; Priority: ' + str(self.priority) + u'\n' description = self.description - description = re.compile(' +').sub(' ', description) - description = re.compile('\n ').sub('\n', description) - result += '\nDescription:' - result += '\n '.join(('\n' + description).split('\n')) - result += '\n' + description = re.compile(u' +').sub(u' ', description) + description = re.compile(u'\n ').sub(u'\n', description) + result += u'\nDescription:' + result += u'\n '.join((u'\n' + description).split(u'\n')) + result += u'\n' if '<link>1' in self.data.keys(): link = self.data['<link>1']['@'].strip() - link = re.compile(' +').sub(' ', link) - link = re.compile('\n ').sub('\n', link) - result += '\nLink:\n' - result += '\n '.join(('\n' + link).split('\n')) - result += '\n' + link = re.compile(u' +').sub(u' ', link) + link = re.compile(u'\n ').sub(u'\n', link) + result += u'\nLink:\n' + result += u'\n '.join((u'\n' + link).split(u'\n')) + result += u'\n' return result diff --git a/overlays/rsync.py b/overlays/rsync.py index e2483ad..18d563f 100644 --- a/overlays/rsync.py +++ b/overlays/rsync.py @@ -58,7 +58,7 @@ class RsyncOverlay(Overlay): self.supported() - return self.cmd(self.base + '"' + self.src + '/*" "' + + return self.cmd(self.base + '"' + self.src + '/" "' + path([base, self.name]) + '"') def supported(self): diff --git a/overlays/tar.py b/overlays/tar.py index 24a9b91..ce89450 100644 --- a/overlays/tar.py +++ b/overlays/tar.py @@ -63,7 +63,7 @@ class TarOverlay(Overlay): type = 'Tar' - binary = '/bin/tar' + binary = u'/bin/tar' def __init__(self, xml, ignore = 0, quiet = False): @@ -138,8 +138,8 @@ class TarOverlay(Overlay): os.makedirs(target) - result = self.cmd(self.binary + ' -v -x ' + opt + ' -f "' + pkg - + '" -C "' + target + '"') + result = self.cmd(self.binary + u' -v -x ' + opt + u' -f "' + pkg + + u'" -C "' + target + u'"') if self.subpath: source = target + '/' + self.subpath |