Compression level for lzma. (#2832)

This commit is contained in:
Faik Uygur
2006-05-30 13:37:14 +00:00
parent c1f5c8769d
commit 7267bdee22
2 changed files with 18 additions and 2 deletions
+7 -1
View File
@@ -143,7 +143,13 @@ class ArchiveTar(ArchiveBase):
self.tar.close() self.tar.close()
if self.tar.mode == 'wb' and self.type == 'tarlzma': if self.tar.mode == 'wb' and self.type == 'tarlzma':
ret, out, err = util.run_batch("lzma e -a2 -d26 -fb64 %s %s" % (self.file_path, self.file_path + '.lzma')) batch = None
if ctx.get_option('compression_level'):
batch = "lzmash -k -%s %s" % (ctx.get_option('compression_level'), self.file_path)
else:
batch = "lzmash -k %s" % self.file_path
ret, out, err = util.run_batch(batch)
if ret != 0: if ret != 0:
raise LZMAError(err) raise LZMAError(err)
+11 -1
View File
@@ -401,7 +401,17 @@ unpack, setup, build, install, package
self.init() self.init()
if ctx.get_option('package_format') not in Build.package_formats: if ctx.get_option('package_format') not in Build.package_formats:
raise Error(_('package_format must be one of %s ') % pisi.util.strlist(Build.package_formats)) raise Error(_('package_format must be one of %s ') % pisi.util.strlist(Build.package_formats))
if ctx.get_option('compression_level'):
if ctx.get_option('package_format') != "1.1":
raise Error(_('compression level is for lzma compression'))
try:
if int(ctx.get_option('compression_level')) not in range(1, 10):
raise Error(_('compression level must be between 1 and 9'))
except ValueError:
raise Error(_('compression level must be an integer'))
if ctx.get_option('output_dir'): if ctx.get_option('output_dir'):
ctx.ui.info(_('Output directory: %s') % ctx.config.options.output_dir) ctx.ui.info(_('Output directory: %s') % ctx.config.options.output_dir)