Change package format to use XZ compression
Version of the new package format is 1.2. Delta support is not ready yet.
This commit is contained in:
+2
-1
@@ -463,7 +463,8 @@ class ArchiveZip(ArchiveBase):
|
||||
self.zip_obj.writestr(attr, dest)
|
||||
else:
|
||||
comp_type = zipfile.ZIP_DEFLATED
|
||||
if file_name.endswith(ctx.const.lzma_suffix):
|
||||
if file_name.endswith((ctx.const.lzma_suffix,
|
||||
ctx.const.xz_suffix)):
|
||||
comp_type = zipfile.ZIP_STORED
|
||||
self.zip_obj.write(file_name, arc_name, comp_type)
|
||||
|
||||
|
||||
@@ -53,6 +53,8 @@ class Constants:
|
||||
|
||||
# suffix for lzma
|
||||
self.__c.lzma_suffix = ".lzma"
|
||||
# suffix for xz
|
||||
self.__c.xz_suffix = ".xz"
|
||||
|
||||
self.__c.partial_suffix = ".part"
|
||||
|
||||
@@ -87,6 +89,7 @@ class Constants:
|
||||
self.__c.metadata_xml = "metadata.xml"
|
||||
self.__c.install_tar = "install.tar"
|
||||
self.__c.install_tar_lzma = "install.tar.lzma"
|
||||
self.__c.install_tar_xz = "install.tar.xz"
|
||||
self.__c.mirrors_conf = "/etc/pisi/mirrors.conf"
|
||||
self.__c.sandbox_conf = "/etc/pisi/sandbox.conf"
|
||||
self.__c.blacklist = "/etc/pisi/blacklist"
|
||||
|
||||
@@ -166,8 +166,8 @@ class Builder:
|
||||
"""Provides the package build and creation routines"""
|
||||
#FIXME: this class and every other class must use URLs as paths!
|
||||
|
||||
package_formats = ("1.0", "1.1")
|
||||
default_package_format = "1.1"
|
||||
package_formats = ("1.0", "1.1", "1.2")
|
||||
default_package_format = "1.2"
|
||||
|
||||
@staticmethod
|
||||
def from_name(name):
|
||||
@@ -1122,19 +1122,28 @@ class Builder:
|
||||
orgname = util.join_path("debug", finfo.path)
|
||||
pkg.add_to_package(orgname, arcname)
|
||||
pkg.close()
|
||||
else: # default package format is 1.1, so make it fallback.
|
||||
else:
|
||||
if self.target_package_format == "1.1":
|
||||
archive_format = "tarlzma"
|
||||
archive_suffix = ctx.const.lzma_suffix
|
||||
else:
|
||||
archive_format = "tarxz"
|
||||
archive_suffix = ctx.const.xz_suffix
|
||||
|
||||
archive_name = ctx.const.install_tar + archive_suffix
|
||||
|
||||
ctx.build_leftover = util.join_path(self.pkg_dir(),
|
||||
ctx.const.install_tar_lzma)
|
||||
tar = archive.ArchiveTar(ctx.const.install_tar_lzma, "tarlzma")
|
||||
archive_name)
|
||||
tar = archive.ArchiveTar(archive_name, archive_format)
|
||||
for finfo in files.list:
|
||||
orgname = util.join_path("install", finfo.path)
|
||||
if package.debug_package:
|
||||
orgname = util.join_path("debug", finfo.path)
|
||||
tar.add_to_archive(orgname, finfo.path)
|
||||
tar.close()
|
||||
pkg.add_to_package(ctx.const.install_tar_lzma)
|
||||
pkg.add_to_package(archive_name)
|
||||
pkg.close()
|
||||
os.unlink(ctx.const.install_tar_lzma)
|
||||
os.unlink(archive_name)
|
||||
ctx.build_leftover = None
|
||||
|
||||
os.chdir(c)
|
||||
|
||||
+14
-4
@@ -119,10 +119,20 @@ class Package:
|
||||
ctx.ui.notify(pisi.ui.desktopfile, desktopfile=tarinfo.name)
|
||||
|
||||
|
||||
if self.impl.has_file(ctx.const.install_tar_lzma):
|
||||
lzmafile = self.impl.open(ctx.const.install_tar_lzma)
|
||||
tar = archive.ArchiveTar(fileobj=lzmafile,
|
||||
arch_type="tarlzma",
|
||||
# TODO: Read metadata to get package format
|
||||
|
||||
archive_name = None
|
||||
if self.impl.has_file(ctx.const.install_tar_xz):
|
||||
archive_name = ctx.const.install_tar_xz
|
||||
archive_format = "tarxz"
|
||||
elif self.impl.has_file(ctx.const.install_tar_lzma):
|
||||
archive_name = ctx.const.install_tar_lzma
|
||||
archive_format = "tarlzma"
|
||||
|
||||
if archive_name:
|
||||
archive_file = self.impl.open(archive_name)
|
||||
tar = archive.ArchiveTar(fileobj=archive_file,
|
||||
arch_type=archive_format,
|
||||
no_same_permissions=False,
|
||||
no_same_owner=False)
|
||||
tar.unpack_dir(outdir, callback=callback)
|
||||
|
||||
Reference in New Issue
Block a user