]> git.decadent.org.uk Git - dak.git/commitdiff
Add support for xz compression to FileWriter
authorAnsgar Burchardt <ansgar@debian.org>
Sun, 19 Feb 2012 14:02:32 +0000 (14:02 +0000)
committerAnsgar Burchardt <ansgar@debian.org>
Fri, 11 May 2012 16:30:35 +0000 (18:30 +0200)
daklib/filewriter.py

index c010fb5dc97afc0b1cc1f115bf0ec392119acac7..3b816ee9b5f53261151f7090d9f110774294274e 100755 (executable)
@@ -47,6 +47,7 @@ class BaseFileWriter(object):
         self.uncompressed = 'none' in compression
         self.gzip = 'gzip' in compression
         self.bzip2 = 'bzip2' in compression
+        self.xz = 'xz' in compression
         root_dir = Config()['Dir::Root']
         relative_dir = template % keywords
         self.path = os.path.join(root_dir, relative_dir)
@@ -81,6 +82,9 @@ class BaseFileWriter(object):
         if self.bzip2:
             check_call('bzip2 -9 <%s.new >%s.bz2.new' % (self.path, self.path), shell = True)
             self.rename('%s.bz2' % self.path)
+        if self.xz:
+            check_call('xz -c <{0}.new >{0}.xz.new'.format(self.path), shell=True)
+            self.rename('{0}.xz'.format(self.path))
         if self.uncompressed:
             self.rename(self.path)
         else: