# 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/. """
Transform the repackage task into an actual task description. """
from taskgraph.transforms.base import TransformSequence from taskgraph.util.copy import deepcopy from taskgraph.util.dependencies import get_primary_dependency from taskgraph.util.schema import Schema, optionally_keyed_by, resolve_keyed_by from taskgraph.util.taskcluster import get_artifact_prefix from voluptuous import Any, Extra, Optional, Required
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
packaging_description_schema = Schema(
{ # unique label to describe this repackaging task
Optional("label"): str,
Optional("worker-type"): str,
Optional("worker"): object,
Optional("attributes"): job_description_schema["attributes"],
Optional("dependencies"): job_description_schema["dependencies"], # treeherder is allowed here to override any defaults we use for repackaging. See # taskcluster/gecko_taskgraph/transforms/task.py for the schema details, and the # below transforms for defaults of various values.
Optional("treeherder"): job_description_schema["treeherder"], # If a l10n task, the corresponding locale
Optional("locale"): str, # Routes specific to this task, if defined
Optional("routes"): [str], # passed through directly to the job description
Optional("extra"): job_description_schema["extra"], # passed through to job description
Optional("fetches"): job_description_schema["fetches"],
Optional("run-on-projects"): job_description_schema["run-on-projects"], # Shipping product and phase
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", "build-type", [str]
),
Optional("msix"): {
Optional("channel"): optionally_keyed_by( "package-format", "level", "build-platform", "release-type", "shipping-product",
str,
),
Optional("identity-name"): optionally_keyed_by( "package-format", "level", "build-platform", "release-type", "shipping-product",
str,
),
Optional("publisher"): optionally_keyed_by( "package-format", "level", "build-platform", "release-type", "shipping-product",
str,
),
Optional("publisher-display-name"): optionally_keyed_by( "package-format", "level", "build-platform", "release-type", "shipping-product",
str,
),
Optional("vendor"): str,
}, # All l10n jobs use mozharness
Required("mozharness"): {
Extra: object, # Config files passed to the mozharness script
Required("config"): optionally_keyed_by("build-platform", [str]), # Additional paths to look for mozharness configs in. These should be # relative to the base of the source checkout
Optional("config-paths"): [str], # if true, perform a checkout of a comm-central based branch inside the # gecko checkout
Optional("comm-checkout"): bool,
Optional("run-as-root"): bool,
Optional("use-caches"): Any(bool, [str]),
},
Optional("task-from"): job_description_schema["task-from"],
}
)
@transforms.add def copy_in_useful_magic(config, jobs): """Copy attributes from upstream task to be used for keyed configuration.""" for job in jobs:
dep = get_primary_dependency(config, job) assert dep
@transforms.add def handle_keyed_by(config, jobs): """Resolve fields that can be keyed by platform, etc, but not `msix.*` fields
that can be keyed by `package-format`. Such fields are handled specially below. """
fields = [ "mozharness.config", "package-formats", "worker.max-run-time",
] for job in jobs:
job = deepcopy(job) # don't overwrite dict values here for field in fields:
resolve_keyed_by(
item=job,
field=field,
item_name="?",
**{ "release-type": config.params["release_type"], "level": config.params["level"],
},
) yield job
@transforms.add def make_repackage_description(config, jobs): for job in jobs:
dep_job = get_primary_dependency(config, job) assert dep_job
# The keys are unique, like `shippable-l10n-signing-linux64-shippable-1/opt`, so we # can't ask for the tasks directly, we must filter for them. for t in config.kind_dependencies_tasks.values(): if t.kind != "shippable-l10n-signing": continue if t.attributes["build_platform"] != "linux64-shippable": continue if t.attributes["build_type"] != "opt": continue
dependencies.update({t.label: t.label})
fetches.update(
{
t.label: [
{ "artifact": f"{loc}/target.langpack.xpi", "extract": False, # Otherwise we can't disambiguate locales! "dest": f"distribution/extensions/{loc}",
} for loc in t.attributes["chunk_locales"]
]
}
)
elif config.kind == "repackage-deb":
attributes["repackage_type"] = "repackage-deb"
description = ( "Repackaging the '{build_platform}/{build_type}' " "{version} build into a '.deb' package"
).format(
build_platform=attributes.get("build_platform"),
build_type=attributes.get("build_type"),
version=config.params["version"],
)
_fetch_subst_locale = "en-US" if locale:
_fetch_subst_locale = locale
repackage_config = []
package_formats = job.get("package-formats") if use_stub andnot repackage_signing_task and"msix"notin package_formats: # if repackage_signing_task doesn't exists, generate the stub installer
package_formats += ["installer-stub"] for format in package_formats:
command = deepcopy(PACKAGE_FORMATS[format])
substs = { "archive_format": archive_format(build_platform), "_locale": _fetch_subst_locale, "architecture": architecture(build_platform), "version_display": config.params["version"], "mar-channel-id": attributes["mar-channel-id"], "build_number": config.params["build_number"], "release_product": config.params["release_product"], "release_type": config.params["release_type"],
} # Allow us to replace `args` as well, but specifying things expanded in mozharness # without breaking .format and without allowing unknown through.
substs.update({name: f"{{{name}}}"for name in MOZHARNESS_EXPANSIONS})
# We need to resolve `msix.*` values keyed by `package-format` for each format, not # just once, so we update a temporary copy just for extracting these values.
temp_job = deepcopy(job) for msix_key in ( "channel", "identity-name", "publisher", "publisher-display-name", "vendor",
):
resolve_keyed_by(
item=temp_job,
field=f"msix.{msix_key}",
item_name="?",
**{ "package-format": format, "release-type": config.params["release_type"], "level": config.params["level"],
},
)
# Turn `msix.channel` into `msix-channel`, etc.
value = temp_job.get("msix", {}).get(msix_key) if value:
substs.update(
{f"msix-{msix_key}": value},
)
command["inputs"] = {
name: filename.format(**substs) for name, filename in command["inputs"].items()
}
command["args"] = [arg.format(**substs) for arg in command["args"]] if"installer"in format and"aarch64"notin build_platform:
command["args"].append("--use-upx")
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.