p7zip -> lzmautils conversion

This commit is contained in:
Faik Uygur
2006-05-23 08:07:17 +00:00
parent 98226d048b
commit 6ad14d2732
3 changed files with 11 additions and 11 deletions
+7 -7
View File
@@ -84,10 +84,10 @@ class ArchiveTar(ArchiveBase):
rmode = 'r:gz' rmode = 'r:gz'
elif self.type == 'tarbz2': elif self.type == 'tarbz2':
rmode = 'r:bz2' rmode = 'r:bz2'
elif self.type == 'tar7z': elif self.type == 'tarlzma':
rmode = 'r:' rmode = 'r:'
os.system("7z e -y -o%s %s" % (ctx.config.tmp_dir(), self.file_path)) self.file_path = self.file_path.rstrip('.lzma')
self.file_path = self.file_path.rstrip('.7z') util.run_batch("lzma d %s %s" % (self.file_path + '.lzma', self.file_path))
else: else:
raise ArchiveError(_("Archive type not recognized")) raise ArchiveError(_("Archive type not recognized"))
@@ -108,9 +108,9 @@ class ArchiveTar(ArchiveBase):
wmode = 'w:gz' wmode = 'w:gz'
elif self.type == 'tarbz2': elif self.type == 'tarbz2':
wmode = 'w:bz2' wmode = 'w:bz2'
elif self.type == 'tar7z': elif self.type == 'tarlzma':
wmode = 'w:' wmode = 'w:'
self.file_path = self.file_path.rstrip('.7z') self.file_path = self.file_path.rstrip('.lzma')
else: else:
raise ArchiveError(_("Archive type not recognized")) raise ArchiveError(_("Archive type not recognized"))
self.tar = tarfile.open(self.file_path, wmode) self.tar = tarfile.open(self.file_path, wmode)
@@ -118,8 +118,8 @@ class ArchiveTar(ArchiveBase):
self.tar.add(file_name, arc_name) self.tar.add(file_name, arc_name)
def close(self): def close(self):
if self.tar.mode == 'wb' and self.type == 'tar7z': if self.tar.mode == 'wb' and self.type == 'tarlzma':
os.system("7z a -mx=9 %s %s" % (self.file_path + '.7z', self.file_path)) util.run_batch("lzma e -a2 -d26 -fb64 %s %s" % (self.file_path, self.file_path + '.lzma'))
self.tar.close() self.tar.close()
+2 -2
View File
@@ -801,14 +801,14 @@ class Builder:
# created files.xml # created files.xml
files = Files() files = Files()
files.read(ctx.const.files_xml) files.read(ctx.const.files_xml)
tar = archive.ArchiveTar("install.tar.7z", "tar7z") tar = archive.ArchiveTar("install.tar.lzma", "tarlzma")
for finfo in files.list: for finfo in files.list:
orgname = arcname = join("install", finfo.path) orgname = arcname = join("install", finfo.path)
if package.debug_package: if package.debug_package:
orgname = join("debug", finfo.path) orgname = join("debug", finfo.path)
tar.add_to_archive(orgname, arcname.lstrip("install")) tar.add_to_archive(orgname, arcname.lstrip("install"))
tar.close() tar.close()
pkg.add_to_package("install.tar.7z") pkg.add_to_package("install.tar.lzma")
pkg.close() pkg.close()
os.chdir(c) os.chdir(c)
+2 -2
View File
@@ -118,8 +118,8 @@ class Package:
self.impl.unpack_dir(dir, outdir) self.impl.unpack_dir(dir, outdir)
def extract_install(self, outdir): def extract_install(self, outdir):
self.extract_file('install.tar.7z', ctx.config.tmp_dir()) self.extract_file('install.tar.lzma', ctx.config.tmp_dir())
tar = archive.ArchiveTar(join(ctx.config.tmp_dir(), 'install.tar.7z'), 'tar7z') tar = archive.ArchiveTar(join(ctx.config.tmp_dir(), 'install.tar.lzma'), 'tarlzma')
tar.unpack(outdir) tar.unpack(outdir)
def extract_dir_flat(self, dir, outdir): def extract_dir_flat(self, dir, outdir):