mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 13:21:05 +00:00
Backed out changeset 9a33551de4cc (bug 1798589) for causing python failures CLOSED TREE
This commit is contained in:
parent
90792dfcb0
commit
4b9873e3ca
@ -2106,7 +2106,7 @@ def repackage(command_context):
|
||||
scriptworkers in order to bundle things up into shippable formats, such as a
|
||||
.dmg on OSX or an installer exe on Windows.
|
||||
"""
|
||||
print("Usage: ./mach repackage [dmg|pkg|installer|mar] [args...]")
|
||||
print("Usage: ./mach repackage [dmg|installer|mar] [args...]")
|
||||
|
||||
|
||||
@SubCommand("repackage", "dmg", description="Repackage a tar file into a .dmg for OSX")
|
||||
@ -2129,19 +2129,6 @@ def repackage_dmg(command_context, input, output):
|
||||
repackage_dmg(input, output)
|
||||
|
||||
|
||||
@SubCommand("repackage", "pkg", description="Repackage a tar file into a .pkg for OSX")
|
||||
@CommandArgument("--input", "-i", type=str, required=True, help="Input filename")
|
||||
@CommandArgument("--output", "-o", type=str, required=True, help="Output filename")
|
||||
def repackage_pkg(command_context, input, output):
|
||||
if not os.path.exists(input):
|
||||
print("Input file does not exist: %s" % input)
|
||||
return 1
|
||||
|
||||
from mozbuild.repackaging.pkg import repackage_pkg
|
||||
|
||||
repackage_pkg(input, output)
|
||||
|
||||
|
||||
@SubCommand(
|
||||
"repackage", "installer", description="Repackage into a Windows installer exe"
|
||||
)
|
||||
|
@ -1,46 +0,0 @@
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
# You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
import shutil
|
||||
import tarfile
|
||||
from pathlib import Path
|
||||
|
||||
import mozfile
|
||||
from mozbuild.bootstrap import bootstrap_toolchain
|
||||
from mozpack.pkg import create_pkg
|
||||
|
||||
|
||||
def repackage_pkg(infile, output):
|
||||
|
||||
if not tarfile.is_tarfile(infile):
|
||||
raise Exception("Input file %s is not a valid tarfile." % infile)
|
||||
|
||||
xar_tool = bootstrap_toolchain("xar/xar")
|
||||
if not xar_tool:
|
||||
raise Exception("Could not find xar tool.")
|
||||
mkbom_tool = bootstrap_toolchain("mkbom/mkbom")
|
||||
if not mkbom_tool:
|
||||
raise Exception("Could not find mkbom tool.")
|
||||
# Note: CPIO isn't standard on all OS's
|
||||
cpio_tool = shutil.which("cpio")
|
||||
if not cpio_tool:
|
||||
raise Exception("Could not find cpio.")
|
||||
|
||||
with mozfile.TemporaryDirectory() as tmpdir:
|
||||
with tarfile.open(infile) as tar:
|
||||
tar.extractall(path=tmpdir)
|
||||
|
||||
app_list = list(Path(tmpdir).glob("*.app"))
|
||||
if len(app_list) != 1:
|
||||
raise Exception(
|
||||
"Input file should contain a single .app file. %s found."
|
||||
% len(app_list)
|
||||
)
|
||||
create_pkg(
|
||||
source_app=Path(app_list[0]),
|
||||
output_pkg=Path(output),
|
||||
mkbom_tool=Path(mkbom_tool),
|
||||
xar_tool=Path(xar_tool),
|
||||
cpio_tool=Path(cpio_tool),
|
||||
)
|
@ -1,19 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<installer-gui-script minSpecVersion="1">
|
||||
<pkg-ref id="${CFBundleIdentifier}">
|
||||
<bundle-version>
|
||||
<bundle CFBundleShortVersionString="${CFBundleShortVersionString}" CFBundleVersion="${CFBundleVersion}" id="${CFBundleIdentifier}" path="${app_name}.app"/>
|
||||
</bundle-version>
|
||||
</pkg-ref>
|
||||
<options customize="never" require-scripts="false" hostArchitectures="x86_64,arm64"/>
|
||||
<choices-outline>
|
||||
<line choice="default">
|
||||
<line choice="${CFBundleIdentifier}"/>
|
||||
</line>
|
||||
</choices-outline>
|
||||
<choice id="default"/>
|
||||
<choice id="${CFBundleIdentifier}" visible="false">
|
||||
<pkg-ref id="${CFBundleIdentifier}"/>
|
||||
</choice>
|
||||
<pkg-ref id="${CFBundleIdentifier}" version="${simple_version}" installKBytes="${installKBytes}">#${app_name_url_encoded}.pkg</pkg-ref>
|
||||
</installer-gui-script>
|
@ -1,19 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<pkg-info overwrite-permissions="true" relocatable="false" identifier="${CFBundleIdentifier}" postinstall-action="none" version="${simple_version}" format-version="2" generator-version="InstallCmds-681 (18F132)" install-location="/Applications" auth="root">
|
||||
<payload numberOfFiles="${numberOfFiles}" installKBytes="${installKBytes}"/>
|
||||
<bundle path="./${app_name}.app" id="${CFBundleIdentifier}" CFBundleShortVersionString="${CFBundleShortVersionString}" CFBundleVersion="${CFBundleVersion}"/>
|
||||
<bundle-version>
|
||||
<bundle id="${CFBundleIdentifier}"/>
|
||||
</bundle-version>
|
||||
<upgrade-bundle>
|
||||
<bundle id="${CFBundleIdentifier}"/>
|
||||
</upgrade-bundle>
|
||||
<update-bundle/>
|
||||
<atomic-update-bundle/>
|
||||
<strict-identifier>
|
||||
<bundle id="${CFBundleIdentifier}"/>
|
||||
</strict-identifier>
|
||||
<relocate>
|
||||
<bundle id="${CFBundleIdentifier}"/>
|
||||
</relocate>
|
||||
</pkg-info>
|
@ -1,308 +0,0 @@
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
import lzma
|
||||
import os
|
||||
import plistlib
|
||||
import struct
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
from string import Template
|
||||
from typing import List
|
||||
from urllib.parse import quote
|
||||
|
||||
import mozfile
|
||||
|
||||
TEMPLATE_DIRECTORY = Path(__file__).parent / "apple_pkg"
|
||||
RW_CHUNK_SIZE = 10240 * 1024 # 10MB read/write chunk sizes
|
||||
|
||||
|
||||
def check_tools(*tools: List[Path]):
|
||||
"""
|
||||
Check that each tool named in tools exists and is executable.
|
||||
|
||||
Args:
|
||||
tools: List<str>, list of tools to check
|
||||
|
||||
Raises:
|
||||
Exception: if tool not found from env, not a file, or not executable.
|
||||
"""
|
||||
for tool in tools:
|
||||
if not tool.is_file():
|
||||
raise Exception('Required tool "%s" not found.' % (tool))
|
||||
if not os.access(tool, os.X_OK):
|
||||
raise Exception('Required tool "%s" is not executable' % (tool))
|
||||
|
||||
|
||||
def get_apple_template(name: str) -> Template:
|
||||
"""
|
||||
Given <name>, open file at <TEMPLATE_DIRECTORY>/<name>, read contents and
|
||||
return as a Template
|
||||
|
||||
Args:
|
||||
name: str, Filename for the template
|
||||
|
||||
Returns:
|
||||
Template, loaded from file
|
||||
"""
|
||||
tmpl_path = TEMPLATE_DIRECTORY / name
|
||||
if not tmpl_path.is_file():
|
||||
raise Exception(f"Could not find template: {tmpl_path}")
|
||||
with tmpl_path.open("r") as tmpl:
|
||||
contents = tmpl.read()
|
||||
return Template(contents)
|
||||
|
||||
|
||||
def save_text_file(content: str, destination: Path):
|
||||
"""
|
||||
Saves a text file to <destination> with provided <content>
|
||||
Note: Overwrites contents
|
||||
|
||||
Args:
|
||||
content: str, The desired contents of the file
|
||||
destination: Path, The file path
|
||||
"""
|
||||
with destination.open("w") as out_fd:
|
||||
out_fd.write(content)
|
||||
print(f"Created text file at {destination}")
|
||||
print(f"Created text file size: {destination.stat().st_size} bytes")
|
||||
|
||||
|
||||
def get_app_info_plist(app_path: Path) -> dict:
|
||||
"""
|
||||
Retrieve most information from Info.plist file of an app.
|
||||
The Info.plist file should be located in ?.app/Contents/Info.plist
|
||||
|
||||
Note: Ignores properties that are not <string> type
|
||||
|
||||
Args:
|
||||
app_path: Path, the .app file/directory path
|
||||
|
||||
Returns:
|
||||
dict, the dictionary of properties found in Info.plist
|
||||
"""
|
||||
info_plist = app_path / "Contents/Info.plist"
|
||||
if not info_plist.is_file():
|
||||
raise Exception(f"Could not find Info.plist in {info_plist}")
|
||||
|
||||
print(f"Reading app Info.plist from: {info_plist}")
|
||||
|
||||
with info_plist.open("rb") as plist_fd:
|
||||
data = plistlib.load(plist_fd)
|
||||
|
||||
return data
|
||||
|
||||
|
||||
def create_payload(destination: Path, root_path: Path):
|
||||
"""
|
||||
Creates a payload at <destination> based on <root_path>
|
||||
|
||||
Args:
|
||||
destination: Path, the destination Path
|
||||
root_path: Path, the root directory Path
|
||||
"""
|
||||
# Files to be cpio'd are root folder + contents
|
||||
file_list = ["./"] + get_relative_glob_list(root_path, "**/*")
|
||||
|
||||
with mozfile.TemporaryDirectory() as tmp_dir:
|
||||
tmp_payload_path = Path(tmp_dir) / "Payload"
|
||||
print(f"Creating Payload with cpio from {root_path} to {tmp_payload_path}")
|
||||
print(f"Found {len(file_list)} files")
|
||||
with tmp_payload_path.open("wb") as tmp_payload:
|
||||
process = subprocess.run(
|
||||
[
|
||||
"cpio",
|
||||
"-o", # copy-out mode
|
||||
"--format",
|
||||
"odc", # old POSIX .1 portable format
|
||||
"--owner",
|
||||
"0:80", # clean ownership
|
||||
],
|
||||
stdout=tmp_payload,
|
||||
stderr=subprocess.PIPE,
|
||||
input="\n".join(file_list) + "\n",
|
||||
encoding="ascii",
|
||||
cwd=root_path,
|
||||
)
|
||||
# cpio outputs number of blocks to stderr
|
||||
print(f"[CPIO]: {process.stderr}")
|
||||
if process.returncode:
|
||||
raise Exception(f"CPIO error {process.returncode}")
|
||||
|
||||
tmp_payload_size = tmp_payload_path.stat().st_size
|
||||
print(f"Uncompressed Payload size: {tmp_payload_size // 1024}kb")
|
||||
|
||||
# Compress to xz
|
||||
lzcomp = lzma.LZMACompressor()
|
||||
xz_payload = Path(tmp_dir) / "Payload.xz"
|
||||
with tmp_payload_path.open("rb") as f_in, xz_payload.open("wb") as xz_f:
|
||||
while True:
|
||||
chunk = f_in.read(RW_CHUNK_SIZE)
|
||||
if not chunk:
|
||||
break
|
||||
xz_f.write(lzcomp.compress(chunk))
|
||||
xz_f.write(lzcomp.flush())
|
||||
|
||||
# Convert XZ file to pbzx Payload
|
||||
xz_payload_size = xz_payload.stat().st_size
|
||||
print(f"Compressed Payload size: {xz_payload_size // 1024}kb")
|
||||
with destination.open("wb") as f_out, xz_payload.open("rb") as xz_in:
|
||||
f_out.write(b"pbzx")
|
||||
f_out.write(struct.pack(">Q", tmp_payload_size))
|
||||
f_out.write(struct.pack(">Q", tmp_payload_size)) # yes, twice
|
||||
f_out.write(struct.pack(">Q", xz_payload_size))
|
||||
while True:
|
||||
chunk = xz_in.read(RW_CHUNK_SIZE)
|
||||
if not chunk:
|
||||
break
|
||||
f_out.write(chunk)
|
||||
|
||||
print(f"Compressed Payload file to {destination}")
|
||||
print(f"Compressed Payload size: {destination.stat().st_size // 1024}kb")
|
||||
|
||||
|
||||
def create_bom(bom_path: Path, root_path: Path, mkbom_tool: Path):
|
||||
"""
|
||||
Creates a Bill Of Materials file at <bom_path> based on <root_path>
|
||||
|
||||
Args:
|
||||
bom_path: Path, destination Path for the BOM file
|
||||
root_path: Path, root directory Path
|
||||
mkbom_tool: Path, mkbom tool Path
|
||||
"""
|
||||
print(f"Creating BOM file from {root_path} to {bom_path}")
|
||||
subprocess.check_call(
|
||||
[
|
||||
mkbom_tool,
|
||||
"-u",
|
||||
"0",
|
||||
"-g",
|
||||
"80",
|
||||
str(root_path),
|
||||
str(bom_path),
|
||||
]
|
||||
)
|
||||
print(f"Created BOM File size: {bom_path.stat().st_size // 1024}kb")
|
||||
|
||||
|
||||
def get_relative_glob_list(source: Path, glob: str) -> list[str]:
|
||||
"""
|
||||
Given a source path, return a list of relative path based on glob
|
||||
|
||||
Args:
|
||||
source: Path, source directory Path
|
||||
glob: str, unix style glob
|
||||
|
||||
Returns:
|
||||
list[str], paths found in source directory
|
||||
"""
|
||||
return [f"./{c.relative_to(source)}" for c in source.glob(glob)]
|
||||
|
||||
|
||||
def xar_package_folder(source_path: Path, destination: Path, xar_tool: Path):
|
||||
"""
|
||||
Create a pkg from <source_path> to <destination>
|
||||
The command is issued with <source_path> as cwd
|
||||
|
||||
Args:
|
||||
source_path: Path, source absolute Path
|
||||
destination: Path, destination absolute Path
|
||||
xar_tool: Path, xar tool Path
|
||||
"""
|
||||
if not source_path.is_absolute() or not destination.is_absolute():
|
||||
raise Exception("Source and destination should be absolute.")
|
||||
|
||||
print(f"Creating pkg from {source_path} to {destination}")
|
||||
# Create a list of ./<file> - noting xar takes care of <file>/**
|
||||
file_list = get_relative_glob_list(source_path, "*")
|
||||
|
||||
subprocess.check_call(
|
||||
[
|
||||
xar_tool,
|
||||
"--compression",
|
||||
"none",
|
||||
"-vcf",
|
||||
destination,
|
||||
*file_list,
|
||||
],
|
||||
cwd=source_path,
|
||||
)
|
||||
print(f"Created PKG file to {destination}")
|
||||
print(f"Created PKG size: {destination.stat().st_size // 1024}kb")
|
||||
|
||||
|
||||
def create_pkg(
|
||||
source_app: Path,
|
||||
output_pkg: Path,
|
||||
mkbom_tool: Path,
|
||||
xar_tool: Path,
|
||||
cpio_tool: Path,
|
||||
):
|
||||
"""
|
||||
Create a mac PKG installer from <source_app> to <output_pkg>
|
||||
|
||||
Args:
|
||||
source_app: Path, source .app file/directory Path
|
||||
output_pkg: Path, destination .pkg file
|
||||
mkbom_tool: Path, mkbom tool Path
|
||||
xar_tool: Path, xar tool Path
|
||||
cpio: Path, cpio tool Path
|
||||
"""
|
||||
check_tools(mkbom_tool, xar_tool, cpio_tool)
|
||||
|
||||
app_name = source_app.name.rsplit(".", maxsplit=1)[0]
|
||||
|
||||
with mozfile.TemporaryDirectory() as tmpdir:
|
||||
root_path = Path(tmpdir) / "darwin/root"
|
||||
flat_path = Path(tmpdir) / "darwin/flat"
|
||||
|
||||
# Create required directories
|
||||
# TODO: Investigate Resources folder contents for other lproj?
|
||||
(flat_path / "Resources/en.lproj").mkdir(parents=True, exist_ok=True)
|
||||
(flat_path / f"{app_name}.pkg").mkdir(parents=True, exist_ok=True)
|
||||
root_path.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
# Copy files over
|
||||
subprocess.check_call(
|
||||
[
|
||||
"cp",
|
||||
"-R",
|
||||
str(source_app),
|
||||
str(root_path),
|
||||
]
|
||||
)
|
||||
|
||||
# Count all files (innards + itself)
|
||||
file_count = len(list(source_app.glob("**/*"))) + 1
|
||||
print(f"Calculated source files count: {file_count}")
|
||||
# Get package contents size
|
||||
package_size = sum(f.stat().st_size for f in source_app.glob("**/*")) // 1024
|
||||
print(f"Calculated source package size: {package_size}kb")
|
||||
|
||||
app_info = get_app_info_plist(source_app)
|
||||
app_info["numberOfFiles"] = file_count
|
||||
app_info["installKBytes"] = package_size
|
||||
app_info["app_name"] = app_name
|
||||
app_info["app_name_url_encoded"] = quote(app_name)
|
||||
|
||||
# This seems arbitrary, there might be another way of doing it,
|
||||
# but Info.plist doesn't provide the simple version we need
|
||||
major_version = app_info["CFBundleShortVersionString"].split(".")[0]
|
||||
app_info["simple_version"] = f"{major_version}.0.0"
|
||||
|
||||
pkg_info_tmpl = get_apple_template("PackageInfo.template")
|
||||
pkg_info = pkg_info_tmpl.substitute(app_info)
|
||||
save_text_file(pkg_info, flat_path / f"{app_name}.pkg/PackageInfo")
|
||||
|
||||
distribution_tmp = get_apple_template("Distribution.template")
|
||||
distribution = distribution_tmp.substitute(app_info)
|
||||
save_text_file(distribution, flat_path / "Distribution")
|
||||
|
||||
payload_path = flat_path / f"{app_name}.pkg/Payload"
|
||||
create_payload(payload_path, root_path)
|
||||
|
||||
bom_path = flat_path / f"{app_name}.pkg/Bom"
|
||||
create_bom(bom_path, root_path, mkbom_tool)
|
||||
|
||||
xar_package_folder(flat_path, output_pkg, xar_tool)
|
@ -14,5 +14,4 @@ subsuite = mozbuild
|
||||
[test_packager_l10n.py]
|
||||
[test_packager_unpack.py]
|
||||
[test_path.py]
|
||||
[test_pkg.py]
|
||||
[test_unify.py]
|
||||
|
@ -1,158 +0,0 @@
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
import platform
|
||||
from pathlib import Path
|
||||
from string import Template
|
||||
from unittest import skipUnless
|
||||
from unittest.mock import patch
|
||||
|
||||
import mozpack.pkg
|
||||
import mozunit
|
||||
from mozpack.pkg import (
|
||||
check_tools,
|
||||
create_bom,
|
||||
create_payload,
|
||||
create_pkg,
|
||||
get_app_info_plist,
|
||||
get_apple_template,
|
||||
get_relative_glob_list,
|
||||
save_text_file,
|
||||
xar_package_folder,
|
||||
)
|
||||
from mozpack.test.test_files import TestWithTmpDir
|
||||
|
||||
|
||||
class TestPkg(TestWithTmpDir):
|
||||
maxDiff = None
|
||||
|
||||
class MockSubprocessRun:
|
||||
stderr = ""
|
||||
stdout = ""
|
||||
returncode = 0
|
||||
|
||||
def __init__(self, returncode=0):
|
||||
self.returncode = returncode
|
||||
|
||||
def _mk_test_file(self, name, mode=0o777):
|
||||
tool = Path(self.tmpdir) / f"{name}"
|
||||
tool.touch()
|
||||
tool.chmod(mode)
|
||||
return tool
|
||||
|
||||
def test_check_tools(self):
|
||||
check_tools(self._mk_test_file("tool-ok"))
|
||||
|
||||
@skipUnless(
|
||||
platform.system() in ["Darwin", "Linux"],
|
||||
"Testing file executability outside of Unix-like systems is not supported",
|
||||
)
|
||||
def test_check_tools_except_not_executable(self):
|
||||
read_only_tool = self._mk_test_file("tool-notexecutable", 0o444)
|
||||
with self.assertRaises(Exception):
|
||||
check_tools(read_only_tool)
|
||||
|
||||
def test_check_tools_except_not_file(self):
|
||||
doesnotexist = Path(self.tmpdir) / "tool-thisshouldnotexist"
|
||||
with self.assertRaises(Exception):
|
||||
check_tools(doesnotexist)
|
||||
|
||||
def test_get_apple_template(self):
|
||||
tmpl = get_apple_template("Distribution.template")
|
||||
assert type(tmpl) == Template
|
||||
|
||||
def test_get_apple_template_not_file(self):
|
||||
with self.assertRaises(Exception):
|
||||
get_apple_template("tmpl-should-not-exist")
|
||||
|
||||
def test_save_text_file(self):
|
||||
content = "Hello"
|
||||
destination = Path(self.tmpdir) / "test_save_text_file"
|
||||
save_text_file(content, destination)
|
||||
with destination.open("r") as file:
|
||||
assert content == file.read()
|
||||
|
||||
def test_get_app_info_plist(self):
|
||||
app_path = Path(self.tmpdir) / "app"
|
||||
(app_path / "Contents").mkdir(parents=True)
|
||||
(app_path / "Contents/Info.plist").touch()
|
||||
data = {"foo": "bar"}
|
||||
with patch.object(mozpack.pkg.plistlib, "load", lambda x: data):
|
||||
assert data == get_app_info_plist(app_path)
|
||||
|
||||
def test_get_app_info_plist_not_file(self):
|
||||
app_path = Path(self.tmpdir) / "app-does-not-exist"
|
||||
with self.assertRaises(Exception):
|
||||
get_app_info_plist(app_path)
|
||||
|
||||
def _mock_payload(self, returncode):
|
||||
def _mock_run(*args, **kwargs):
|
||||
return self.MockSubprocessRun(returncode)
|
||||
|
||||
return _mock_run
|
||||
|
||||
def test_create_payload(self):
|
||||
destination = Path(self.tmpdir) / "mockPayload"
|
||||
with patch.object(mozpack.pkg.subprocess, "run", self._mock_payload(0)):
|
||||
create_payload(destination, Path(self.tmpdir))
|
||||
|
||||
def test_create_bom(self):
|
||||
bom_path = Path(self.tmpdir) / "Bom"
|
||||
bom_path.touch()
|
||||
root_path = Path(self.tmpdir)
|
||||
tool_path = Path(self.tmpdir) / "not-really-used-during-test"
|
||||
with patch.object(mozpack.pkg.subprocess, "check_call", lambda *x: None):
|
||||
create_bom(bom_path, root_path, tool_path)
|
||||
|
||||
def get_relative_glob_list(self):
|
||||
source = Path(self.tmpdir)
|
||||
(source / "testfile").touch()
|
||||
glob = "*"
|
||||
assert len(get_relative_glob_list(source, glob)) == 1
|
||||
|
||||
def test_xar_package_folder(self):
|
||||
source = Path(self.tmpdir)
|
||||
dest = source / "fakedestination"
|
||||
dest.touch()
|
||||
tool = source / "faketool"
|
||||
with patch.object(mozpack.pkg.subprocess, "check_call", lambda *x, **y: None):
|
||||
xar_package_folder(source, dest, tool)
|
||||
|
||||
def test_xar_package_folder_not_absolute(self):
|
||||
source = Path("./some/relative/path")
|
||||
dest = Path("./some/other/relative/path")
|
||||
tool = source / "faketool"
|
||||
with patch.object(mozpack.pkg.subprocess, "check_call", lambda: None):
|
||||
with self.assertRaises(Exception):
|
||||
xar_package_folder(source, dest, tool)
|
||||
|
||||
def test_create_pkg(self):
|
||||
def noop(*x, **y):
|
||||
pass
|
||||
|
||||
def mock_get_app_info_plist(*args):
|
||||
return {"CFBundleShortVersionString": "1.0.0"}
|
||||
|
||||
def mock_get_apple_template(*args):
|
||||
return Template("fake template")
|
||||
|
||||
source = Path(self.tmpdir) / "FakeApp.app"
|
||||
source.mkdir()
|
||||
output = Path(self.tmpdir) / "output.pkg"
|
||||
fake_tool = Path(self.tmpdir) / "faketool"
|
||||
with patch.multiple(
|
||||
mozpack.pkg,
|
||||
check_tools=noop,
|
||||
get_app_info_plist=mock_get_app_info_plist,
|
||||
get_apple_template=mock_get_apple_template,
|
||||
save_text_file=noop,
|
||||
create_payload=noop,
|
||||
create_bom=noop,
|
||||
xar_package_folder=noop,
|
||||
):
|
||||
create_pkg(source, output, fake_tool, fake_tool, fake_tool)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
mozunit.main()
|
@ -282,20 +282,6 @@ hfsplus-tools:
|
||||
sha256: b01b203a97f9a3bf36a027c13ddfc59292730552e62722d690d33bd5c24f5497
|
||||
size: 411205
|
||||
|
||||
xar:
|
||||
description: xar source code
|
||||
fetch:
|
||||
type: git
|
||||
repo: https://github.com/gabrielesvelto/xar
|
||||
revision: 199ff76a7463f6b6a2548b4db29cd3dd5026df69
|
||||
|
||||
bomutils:
|
||||
description: bomutils (mkbom) source code
|
||||
fetch:
|
||||
type: git
|
||||
repo: https://github.com/hogliux/bomutils
|
||||
revision: 3f7dc2dbbc36ca1c957ec629970026f45594a52c
|
||||
|
||||
rust-size:
|
||||
description: rust-size source code
|
||||
fetch:
|
||||
|
@ -60,7 +60,7 @@ job-template:
|
||||
package-formats:
|
||||
by-build-platform:
|
||||
linux.*: [mar]
|
||||
macosx64\b.*: [mar, dmg, pkg]
|
||||
macosx64\b.*: [mar, dmg]
|
||||
win32\b.*: [mar, installer]
|
||||
win64\b.*: [mar, installer]
|
||||
fetches:
|
||||
|
@ -68,7 +68,7 @@ job-template:
|
||||
package-formats:
|
||||
by-build-platform:
|
||||
linux.*: [mar]
|
||||
macosx64\b.*: [mar, dmg, pkg]
|
||||
macosx64\b.*: [mar, dmg]
|
||||
win32\b.*: [mar, installer]
|
||||
win64\b.*: [mar, installer]
|
||||
fetches:
|
||||
|
@ -85,38 +85,6 @@ linux64-libdmg:
|
||||
- linux64-clang-toolchain
|
||||
- linux64-toolchain-sysroot
|
||||
|
||||
linux64-mkbom:
|
||||
description: "mkbom toolchain build"
|
||||
attributes:
|
||||
local-toolchain: true
|
||||
treeherder:
|
||||
symbol: TL(mkbom)
|
||||
run:
|
||||
script: build-mkbom-linux.sh
|
||||
toolchain-artifact: public/build/mkbom.tar.zst
|
||||
fetches:
|
||||
fetch:
|
||||
- bomutils
|
||||
toolchain:
|
||||
- linux64-clang-toolchain
|
||||
- linux64-toolchain-sysroot
|
||||
|
||||
linux64-xar:
|
||||
description: "xar toolchain build"
|
||||
attributes:
|
||||
local-toolchain: true
|
||||
treeherder:
|
||||
symbol: TL(xar)
|
||||
run:
|
||||
script: build-xar-linux.sh
|
||||
toolchain-artifact: public/build/xar.tar.zst
|
||||
fetches:
|
||||
fetch:
|
||||
- xar
|
||||
toolchain:
|
||||
- linux64-clang-toolchain
|
||||
- linux64-toolchain-sysroot
|
||||
|
||||
linux64-mar-tools:
|
||||
description: "mar-tools toolchain build"
|
||||
treeherder:
|
||||
|
@ -15,7 +15,6 @@ RUN /usr/local/sbin/setup_packages.sh $TASKCLUSTER_ROOT_URL $DOCKER_IMAGE_PACKAG
|
||||
# libc6-i386 and lib32gcc1 are needed for wine.
|
||||
# libdbus-glib-1-2 and libgtk-3-0 are needed to run xpcshell during the build.
|
||||
# lib32atomic1, lib32stdc++6 and lib32z1 are needed to run some 32-bits
|
||||
# cpio is needed by xar (mac repackaging on linux)
|
||||
# spidermonkey tests. libasound2 is needed to run xpcshell after we introduced
|
||||
# the dependencies on alsa via Web MIDI.
|
||||
RUN apt-get update && \
|
||||
@ -24,7 +23,6 @@ RUN apt-get update && \
|
||||
binutils \
|
||||
bzip2 \
|
||||
curl \
|
||||
cpio \
|
||||
file \
|
||||
gawk \
|
||||
gnupg \
|
||||
|
@ -8,15 +8,17 @@ Transform the repackage task into an actual task description.
|
||||
|
||||
import copy
|
||||
|
||||
from gecko_taskgraph.loader.single_dep import schema
|
||||
from gecko_taskgraph.transforms.job import job_description_schema
|
||||
from gecko_taskgraph.util.attributes import copy_attributes_from_dependent_job
|
||||
from gecko_taskgraph.util.platforms import architecture, archive_format
|
||||
from gecko_taskgraph.util.workertypes import worker_type_implementation
|
||||
from taskgraph.transforms.base import TransformSequence
|
||||
from taskgraph.util.schema import optionally_keyed_by, resolve_keyed_by
|
||||
from taskgraph.util.taskcluster import get_artifact_prefix
|
||||
from voluptuous import Extra, Optional, Required
|
||||
from taskgraph.util.schema import optionally_keyed_by, resolve_keyed_by
|
||||
from voluptuous import Required, Optional, Extra
|
||||
|
||||
from gecko_taskgraph.loader.single_dep import schema
|
||||
from gecko_taskgraph.util.attributes import copy_attributes_from_dependent_job
|
||||
from gecko_taskgraph.util.platforms import archive_format, architecture
|
||||
from gecko_taskgraph.util.workertypes import worker_type_implementation
|
||||
from gecko_taskgraph.transforms.job import job_description_schema
|
||||
|
||||
|
||||
packaging_description_schema = schema.extend(
|
||||
{
|
||||
@ -195,13 +197,6 @@ PACKAGE_FORMATS = {
|
||||
},
|
||||
"output": "target.dmg",
|
||||
},
|
||||
"pkg": {
|
||||
"args": ["pkg"],
|
||||
"inputs": {
|
||||
"input": "target{archive_format}",
|
||||
},
|
||||
"output": "target.pkg",
|
||||
},
|
||||
"installer": {
|
||||
"args": [
|
||||
"installer",
|
||||
@ -521,8 +516,6 @@ def make_job_description(config, jobs):
|
||||
"linux64-libdmg",
|
||||
"linux64-hfsplus",
|
||||
"linux64-node",
|
||||
"linux64-xar",
|
||||
"linux64-mkbom",
|
||||
]
|
||||
)
|
||||
yield task
|
||||
|
@ -1,17 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -x -e -v
|
||||
|
||||
# This script is for building mkbom for Linux.
|
||||
mkdir -p $UPLOAD_DIR
|
||||
|
||||
export PATH=$PATH:$MOZ_FETCHES_DIR/clang/bin
|
||||
cd $MOZ_FETCHES_DIR/bomutils
|
||||
|
||||
make_flags="-j$(nproc)"
|
||||
make "$make_flags"
|
||||
|
||||
cd $(mktemp -d)
|
||||
mkdir mkbom
|
||||
|
||||
cp $MOZ_FETCHES_DIR/bomutils/build/bin/mkbom ./mkbom/mkbom
|
||||
tar caf $UPLOAD_DIR/mkbom.tar.zst ./mkbom
|
@ -1,18 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -x -e -v
|
||||
|
||||
# This script is for building xar for Linux.
|
||||
mkdir -p $UPLOAD_DIR
|
||||
|
||||
export PATH=$PATH:$MOZ_FETCHES_DIR/clang/bin
|
||||
cd $MOZ_FETCHES_DIR/xar/xar
|
||||
|
||||
./autogen.sh --prefix=/builds/worker --enable-static
|
||||
make_flags="-j$(nproc)"
|
||||
make $make_flags
|
||||
|
||||
cd $(mktemp -d)
|
||||
mkdir xar
|
||||
|
||||
cp $MOZ_FETCHES_DIR/xar/xar/src/xar ./xar/xar
|
||||
tar caf $UPLOAD_DIR/xar.tar.zst ./xar
|
@ -2,6 +2,7 @@
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
from __future__ import absolute_import
|
||||
import os
|
||||
|
||||
config = {
|
||||
@ -9,7 +10,4 @@ config = {
|
||||
"locale": os.environ.get("LOCALE"),
|
||||
# ToolTool
|
||||
"tooltool_cache": os.environ.get("TOOLTOOL_CACHE"),
|
||||
# TODO: `create_pkg` doesn't require this.
|
||||
# We need to refactor `create_dmg` to remove this requirement
|
||||
"run_configure": True,
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user