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)
|
self.zip_obj.writestr(attr, dest)
|
||||||
else:
|
else:
|
||||||
comp_type = zipfile.ZIP_DEFLATED
|
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
|
comp_type = zipfile.ZIP_STORED
|
||||||
self.zip_obj.write(file_name, arc_name, comp_type)
|
self.zip_obj.write(file_name, arc_name, comp_type)
|
||||||
|
|
||||||
|
|||||||
@@ -53,6 +53,8 @@ class Constants:
|
|||||||
|
|
||||||
# suffix for lzma
|
# suffix for lzma
|
||||||
self.__c.lzma_suffix = ".lzma"
|
self.__c.lzma_suffix = ".lzma"
|
||||||
|
# suffix for xz
|
||||||
|
self.__c.xz_suffix = ".xz"
|
||||||
|
|
||||||
self.__c.partial_suffix = ".part"
|
self.__c.partial_suffix = ".part"
|
||||||
|
|
||||||
@@ -87,6 +89,7 @@ class Constants:
|
|||||||
self.__c.metadata_xml = "metadata.xml"
|
self.__c.metadata_xml = "metadata.xml"
|
||||||
self.__c.install_tar = "install.tar"
|
self.__c.install_tar = "install.tar"
|
||||||
self.__c.install_tar_lzma = "install.tar.lzma"
|
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.mirrors_conf = "/etc/pisi/mirrors.conf"
|
||||||
self.__c.sandbox_conf = "/etc/pisi/sandbox.conf"
|
self.__c.sandbox_conf = "/etc/pisi/sandbox.conf"
|
||||||
self.__c.blacklist = "/etc/pisi/blacklist"
|
self.__c.blacklist = "/etc/pisi/blacklist"
|
||||||
|
|||||||
@@ -166,8 +166,8 @@ class Builder:
|
|||||||
"""Provides the package build and creation routines"""
|
"""Provides the package build and creation routines"""
|
||||||
#FIXME: this class and every other class must use URLs as paths!
|
#FIXME: this class and every other class must use URLs as paths!
|
||||||
|
|
||||||
package_formats = ("1.0", "1.1")
|
package_formats = ("1.0", "1.1", "1.2")
|
||||||
default_package_format = "1.1"
|
default_package_format = "1.2"
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def from_name(name):
|
def from_name(name):
|
||||||
@@ -1122,19 +1122,28 @@ class Builder:
|
|||||||
orgname = util.join_path("debug", finfo.path)
|
orgname = util.join_path("debug", finfo.path)
|
||||||
pkg.add_to_package(orgname, arcname)
|
pkg.add_to_package(orgname, arcname)
|
||||||
pkg.close()
|
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.build_leftover = util.join_path(self.pkg_dir(),
|
||||||
ctx.const.install_tar_lzma)
|
archive_name)
|
||||||
tar = archive.ArchiveTar(ctx.const.install_tar_lzma, "tarlzma")
|
tar = archive.ArchiveTar(archive_name, archive_format)
|
||||||
for finfo in files.list:
|
for finfo in files.list:
|
||||||
orgname = util.join_path("install", finfo.path)
|
orgname = util.join_path("install", finfo.path)
|
||||||
if package.debug_package:
|
if package.debug_package:
|
||||||
orgname = util.join_path("debug", finfo.path)
|
orgname = util.join_path("debug", finfo.path)
|
||||||
tar.add_to_archive(orgname, finfo.path)
|
tar.add_to_archive(orgname, finfo.path)
|
||||||
tar.close()
|
tar.close()
|
||||||
pkg.add_to_package(ctx.const.install_tar_lzma)
|
pkg.add_to_package(archive_name)
|
||||||
pkg.close()
|
pkg.close()
|
||||||
os.unlink(ctx.const.install_tar_lzma)
|
os.unlink(archive_name)
|
||||||
ctx.build_leftover = None
|
ctx.build_leftover = None
|
||||||
|
|
||||||
os.chdir(c)
|
os.chdir(c)
|
||||||
|
|||||||
+14
-4
@@ -119,10 +119,20 @@ class Package:
|
|||||||
ctx.ui.notify(pisi.ui.desktopfile, desktopfile=tarinfo.name)
|
ctx.ui.notify(pisi.ui.desktopfile, desktopfile=tarinfo.name)
|
||||||
|
|
||||||
|
|
||||||
if self.impl.has_file(ctx.const.install_tar_lzma):
|
# TODO: Read metadata to get package format
|
||||||
lzmafile = self.impl.open(ctx.const.install_tar_lzma)
|
|
||||||
tar = archive.ArchiveTar(fileobj=lzmafile,
|
archive_name = None
|
||||||
arch_type="tarlzma",
|
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_permissions=False,
|
||||||
no_same_owner=False)
|
no_same_owner=False)
|
||||||
tar.unpack_dir(outdir, callback=callback)
|
tar.unpack_dir(outdir, callback=callback)
|
||||||
|
|||||||
Reference in New Issue
Block a user