зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1745092 - Remove optional XZ compression of executables during packaging. r=firefox-build-system-reviewers,nalexander
Its use was removed in bug 1486524. Differential Revision: https://phabricator.services.mozilla.com/D133305
This commit is contained in:
Родитель
9028b0458c
Коммит
17888a7d71
|
@ -816,7 +816,6 @@ AC_SUBST_LIST(SSSE3_FLAGS)
|
|||
AC_SUBST(MOZ_LINKER)
|
||||
if test -n "$MOZ_LINKER"; then
|
||||
AC_DEFINE(MOZ_LINKER)
|
||||
AC_CHECK_PROGS(XZ, xz)
|
||||
fi
|
||||
|
||||
if test -z "$COMPILE_ENVIRONMENT"; then
|
||||
|
|
|
@ -140,49 +140,3 @@ def elfhack(path):
|
|||
cmd = [os.path.join(topobjdir, "build/unix/elfhack/elfhack"), path]
|
||||
if subprocess.call(cmd) != 0:
|
||||
errors.fatal("Error executing " + " ".join(cmd))
|
||||
|
||||
|
||||
def xz_compress(path):
|
||||
"""
|
||||
Execute xz to compress the given path.
|
||||
"""
|
||||
if open(path, "rb").read(5)[1:] == "7zXZ":
|
||||
print("%s is already compressed" % path)
|
||||
return
|
||||
|
||||
from buildconfig import substs
|
||||
|
||||
xz = substs.get("XZ")
|
||||
cmd = [xz, "-zkf", path]
|
||||
|
||||
# For now, the mozglue XZStream ELF loader can only support xz files
|
||||
# with a single stream that contains a single block. In xz, there is no
|
||||
# explicit option to set the max block count. Instead, we force xz to use
|
||||
# single thread mode, which results in a single block.
|
||||
cmd.extend(["--threads=1"])
|
||||
|
||||
bcj = None
|
||||
if substs.get("MOZ_THUMB2"):
|
||||
bcj = "--armthumb"
|
||||
elif substs.get("CPU_ARCH") == "arm":
|
||||
bcj = "--arm"
|
||||
elif substs.get("CPU_ARCH") == "x86":
|
||||
bcj = "--x86"
|
||||
|
||||
if bcj:
|
||||
cmd.extend([bcj])
|
||||
|
||||
# We need to explicitly specify the LZMA filter chain to ensure consistent builds
|
||||
# across platforms. Note that the dict size must be less then 16MiB per the hardcoded
|
||||
# value in mozglue/linker/XZStream.cpp. This is the default LZMA filter chain for for
|
||||
# xz-utils version 5.0. See:
|
||||
# https://github.com/xz-mirror/xz/blob/v5.0.0/src/liblzma/lzma/lzma_encoder_presets.c
|
||||
# https://github.com/xz-mirror/xz/blob/v5.0.0/src/liblzma/api/lzma/container.h#L31
|
||||
cmd.extend(["--lzma2=dict=8MiB,lc=3,lp=0,pb=2,mode=normal,nice=64,mf=bt4,depth=0"])
|
||||
print("xz-compressing %s with %s" % (path, " ".join(cmd)))
|
||||
|
||||
if subprocess.call(cmd) != 0:
|
||||
errors.fatal("Error executing " + " ".join(cmd))
|
||||
return
|
||||
|
||||
os.rename(path + ".xz", path)
|
||||
|
|
|
@ -25,7 +25,6 @@ from mozpack.executables import (
|
|||
strip,
|
||||
may_elfhack,
|
||||
elfhack,
|
||||
xz_compress,
|
||||
)
|
||||
from mozpack.chrome.manifest import (
|
||||
ManifestEntry,
|
||||
|
@ -318,9 +317,8 @@ class ExecutableFile(File):
|
|||
(see mozpack.executables.is_executable documentation).
|
||||
"""
|
||||
|
||||
def __init__(self, path, xz_compress=False):
|
||||
def __init__(self, path):
|
||||
File.__init__(self, path)
|
||||
self.xz_compress = xz_compress
|
||||
|
||||
def copy(self, dest, skip_if_older=True):
|
||||
real_dest = dest
|
||||
|
@ -331,7 +329,7 @@ class ExecutableFile(File):
|
|||
assert isinstance(dest, six.string_types)
|
||||
# If File.copy didn't actually copy because dest is newer, check the
|
||||
# file sizes. If dest is smaller, it means it is already stripped and
|
||||
# elfhacked and xz_compressed, so we can skip.
|
||||
# elfhacked, so we can skip.
|
||||
if not File.copy(self, dest, skip_if_older) and os.path.getsize(
|
||||
self.path
|
||||
) > os.path.getsize(dest):
|
||||
|
@ -341,8 +339,6 @@ class ExecutableFile(File):
|
|||
strip(dest)
|
||||
if may_elfhack(dest):
|
||||
elfhack(dest)
|
||||
if self.xz_compress:
|
||||
xz_compress(dest)
|
||||
except ErrorMessage:
|
||||
os.remove(dest)
|
||||
raise
|
||||
|
|
|
@ -19,7 +19,6 @@ from mozpack.chrome.manifest import (
|
|||
is_manifest,
|
||||
parse_manifest,
|
||||
)
|
||||
from mozpack.files import ExecutableFile
|
||||
import mozpack.path as mozpath
|
||||
from mozbuild.preprocessor import Preprocessor
|
||||
|
||||
|
@ -29,19 +28,16 @@ class Component(object):
|
|||
Class that represents a component in a package manifest.
|
||||
"""
|
||||
|
||||
def __init__(self, name, destdir="", xz_compress=False):
|
||||
def __init__(self, name, destdir=""):
|
||||
if name.find(" ") > 0:
|
||||
errors.fatal('Malformed manifest: space in component name "%s"' % name)
|
||||
self._name = name
|
||||
self._destdir = destdir
|
||||
self._xz_compress = xz_compress
|
||||
|
||||
def __repr__(self):
|
||||
s = self.name
|
||||
if self.destdir:
|
||||
s += ' destdir="%s"' % self.destdir
|
||||
if self.xz_compress:
|
||||
s += ' xz_compress="1"'
|
||||
return s
|
||||
|
||||
@property
|
||||
|
@ -52,10 +48,6 @@ class Component(object):
|
|||
def destdir(self):
|
||||
return self._destdir
|
||||
|
||||
@property
|
||||
def xz_compress(self):
|
||||
return self._xz_compress
|
||||
|
||||
@staticmethod
|
||||
def _triples(lst):
|
||||
"""
|
||||
|
@ -130,12 +122,11 @@ class Component(object):
|
|||
errors.fatal("Malformed manifest: %s" % e)
|
||||
return
|
||||
destdir = options.pop("destdir", "")
|
||||
xz_compress = options.pop("xz_compress", "0") != "0"
|
||||
if options:
|
||||
errors.fatal(
|
||||
"Malformed manifest: options %s not recognized" % options.keys()
|
||||
)
|
||||
return Component(name, destdir=destdir, xz_compress=xz_compress)
|
||||
return Component(name, destdir=destdir)
|
||||
|
||||
|
||||
class PackageManifestParser(object):
|
||||
|
@ -428,8 +419,6 @@ class SimpleManifestSink(object):
|
|||
if is_manifest(p):
|
||||
self._manifests.add(p)
|
||||
dest = mozpath.join(component.destdir, SimpleManifestSink.normalize_path(p))
|
||||
if isinstance(f, ExecutableFile):
|
||||
f.xz_compress = component.xz_compress
|
||||
self.packager.add(dest, f)
|
||||
if not added:
|
||||
errors.error("Missing file(s): %s" % pattern)
|
||||
|
|
Загрузка…
Ссылка в новой задаче