mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-27 23:02:20 +00:00
Bug 1816992 - Add sentinel attribution to repackage jobs r=taskgraph-reviewers,releng-reviewers,bhearsum
Depends on D189259 Differential Revision: https://phabricator.services.mozilla.com/D189404
This commit is contained in:
parent
3ab7874b7d
commit
24b944a39c
@ -2405,14 +2405,17 @@ def repackage_deb_l10n(
|
||||
@SubCommand("repackage", "dmg", description="Repackage a tar file into a .dmg for OSX")
|
||||
@CommandArgument("--input", "-i", type=str, required=True, help="Input filename")
|
||||
@CommandArgument("--output", "-o", type=str, required=True, help="Output filename")
|
||||
def repackage_dmg(command_context, input, output):
|
||||
@CommandArgument(
|
||||
"--attribution_sentinel", type=str, required=False, help="DMGs with attribution."
|
||||
)
|
||||
def repackage_dmg(command_context, input, output, attribution_sentinel):
|
||||
if not os.path.exists(input):
|
||||
print("Input file does not exist: %s" % input)
|
||||
return 1
|
||||
|
||||
from mozbuild.repackaging.dmg import repackage_dmg
|
||||
|
||||
repackage_dmg(input, output)
|
||||
repackage_dmg(input, output, attribution_sentinel)
|
||||
|
||||
|
||||
@SubCommand("repackage", "pkg", description="Repackage a tar file into a .pkg for OSX")
|
||||
|
@ -12,7 +12,7 @@ from mozbuild.bootstrap import bootstrap_toolchain
|
||||
from mozbuild.repackaging.application_ini import get_application_ini_value
|
||||
|
||||
|
||||
def repackage_dmg(infile, output):
|
||||
def repackage_dmg(infile, output, attribution_sentinel=None):
|
||||
if not tarfile.is_tarfile(infile):
|
||||
raise Exception("Input file %s is not a valid tarfile." % infile)
|
||||
|
||||
@ -52,4 +52,5 @@ def repackage_dmg(infile, output):
|
||||
dmg_tool=Path(dmg_tool),
|
||||
hfs_tool=Path(hfs_tool),
|
||||
mkfshfs_tool=Path(mkfshfs_tool),
|
||||
attribution_sentinel=attribution_sentinel,
|
||||
)
|
||||
|
@ -85,17 +85,37 @@ def create_dmg_from_staged(
|
||||
volume_name: str,
|
||||
hfs_tool: Path = None,
|
||||
dmg_tool: Path = None,
|
||||
mkfshfs_tool: Path = None,
|
||||
attribution_sentinel: str = None,
|
||||
):
|
||||
"Given a prepared directory stagedir, produce a DMG at output_dmg."
|
||||
|
||||
if is_linux:
|
||||
# The dmg tool doesn't create the destination directories, and silently
|
||||
# returns success if the parent directory doesn't exist.
|
||||
ensureParentDir(output_dmg)
|
||||
|
||||
hfs = os.path.join(tmpdir, "staged.hfs")
|
||||
subprocess.check_call([hfs_tool, hfs, "addall", stagedir])
|
||||
|
||||
dmg_cmd = [dmg_tool, "build", hfs, output_dmg]
|
||||
if attribution_sentinel:
|
||||
while len(attribution_sentinel) < 1024:
|
||||
attribution_sentinel += "\t"
|
||||
subprocess.check_call(
|
||||
[
|
||||
hfs_tool,
|
||||
hfs,
|
||||
"setattr",
|
||||
f"{volume_name}.app",
|
||||
"com.apple.application-instance",
|
||||
attribution_sentinel,
|
||||
]
|
||||
)
|
||||
subprocess.check_call(["cp", hfs, str(Path(output_dmg).parent)])
|
||||
dmg_cmd.append(attribution_sentinel)
|
||||
|
||||
subprocess.check_call(
|
||||
[dmg_tool, "build", hfs, output_dmg],
|
||||
dmg_cmd,
|
||||
# dmg is seriously chatty
|
||||
stdout=subprocess.DEVNULL,
|
||||
)
|
||||
@ -140,6 +160,7 @@ def create_dmg(
|
||||
dmg_tool: Path,
|
||||
hfs_tool: Path,
|
||||
mkfshfs_tool: Path,
|
||||
attribution_sentinel: str = None,
|
||||
):
|
||||
"""
|
||||
Create a DMG disk image at the path output_dmg from source_directory.
|
||||
@ -171,7 +192,14 @@ def create_dmg(
|
||||
set_folder_icon(stagedir, tmpdir, hfs_tool)
|
||||
chmod(stagedir)
|
||||
create_dmg_from_staged(
|
||||
stagedir, output_dmg, tmpdir, volume_name, hfs_tool, dmg_tool
|
||||
stagedir,
|
||||
output_dmg,
|
||||
tmpdir,
|
||||
volume_name,
|
||||
hfs_tool,
|
||||
dmg_tool,
|
||||
mkfshfs_tool,
|
||||
attribution_sentinel,
|
||||
)
|
||||
|
||||
|
||||
|
@ -55,6 +55,10 @@ jobs:
|
||||
- repackage/win64_partner.py
|
||||
package-formats:
|
||||
by-build-platform:
|
||||
macosx64\b.*: [dmg]
|
||||
macosx64\b.*:
|
||||
by-build-type:
|
||||
# Debug builds can't be attributable
|
||||
debug: [dmg]
|
||||
default: [dmg-attrib]
|
||||
win32\b.*: [installer]
|
||||
win64\b.*: [installer]
|
||||
|
@ -56,6 +56,10 @@ jobs:
|
||||
- repackage/win64_partner.py
|
||||
package-formats:
|
||||
by-build-platform:
|
||||
macosx64\b.*: [dmg]
|
||||
macosx64\b.*:
|
||||
by-build-type:
|
||||
# Debug builds can't be attributable
|
||||
debug: [dmg]
|
||||
default: [dmg-attrib]
|
||||
win32\b.*: [installer]
|
||||
win64\b.*: [installer]
|
||||
|
@ -71,8 +71,12 @@ jobs:
|
||||
- repackage/win64_signed.py
|
||||
package-formats:
|
||||
by-build-platform:
|
||||
macosx64\b.*:
|
||||
by-build-type:
|
||||
# Debug builds can't be attributable
|
||||
debug: [dmg]
|
||||
default: [dmg-attrib]
|
||||
linux.*: [mar]
|
||||
macosx64\b.*: [mar, dmg, pkg]
|
||||
win32\b.*: [mar, installer]
|
||||
win64\b.*: [mar, installer]
|
||||
fetches:
|
||||
|
@ -84,8 +84,12 @@ jobs:
|
||||
- repackage/win64_signed.py
|
||||
package-formats:
|
||||
by-build-platform:
|
||||
macosx64\b.*:
|
||||
by-build-type:
|
||||
# Debug builds can't be attributable
|
||||
debug: [dmg]
|
||||
default: [dmg-attrib]
|
||||
linux.*: [mar]
|
||||
macosx64\b.*: [mar, dmg, pkg]
|
||||
win32\b.*: [mar, installer]
|
||||
win64\b.*: [mar, installer]
|
||||
fetches:
|
||||
|
@ -42,7 +42,7 @@ packaging_description_schema = Schema(
|
||||
Optional("shipping-product"): job_description_schema["shipping-product"],
|
||||
Optional("shipping-phase"): job_description_schema["shipping-phase"],
|
||||
Required("package-formats"): optionally_keyed_by(
|
||||
"build-platform", "release-type", [str]
|
||||
"build-platform", "release-type", "build-type", [str]
|
||||
),
|
||||
Optional("msix"): {
|
||||
Optional("channel"): optionally_keyed_by(
|
||||
@ -204,6 +204,17 @@ PACKAGE_FORMATS = {
|
||||
},
|
||||
"output": "target.dmg",
|
||||
},
|
||||
"dmg-attrib": {
|
||||
"args": [
|
||||
"dmg",
|
||||
"--attribution_sentinel",
|
||||
"__MOZCUSTOM__",
|
||||
],
|
||||
"inputs": {
|
||||
"input": "target{archive_format}",
|
||||
},
|
||||
"output": "target.dmg",
|
||||
},
|
||||
"pkg": {
|
||||
"args": ["pkg"],
|
||||
"inputs": {
|
||||
|
Loading…
Reference in New Issue
Block a user