Bug 1458385: Generate MARs with the appropriate channel-id explicitly; r=nthomas

Rather than relying on the mar-channel-id set in the `mar` binary, set the channel
explicitly from taskcluster. This allows us to re-use the `mar` binary between
builds/channels.

Differential Revision: https://phabricator.services.mozilla.com/D37481

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Tom Prince 2019-07-11 16:40:13 +00:00
Родитель c390584851
Коммит 2208f1c2cf
7 изменённых файлов: 31 добавлений и 8 удалений

Просмотреть файл

@ -1292,9 +1292,19 @@ class Repackage(MachCommandBase):
help='Mar format')
@CommandArgument('--arch', type=str, required=True,
help='The archtecture you are building.')
def repackage_mar(self, input, mar, output, format, arch):
@CommandArgument('--mar-channel-id', type=str,
help='Mar channel id')
def repackage_mar(self, input, mar, output, format, arch, mar_channel_id):
from mozbuild.repackaging.mar import repackage_mar
repackage_mar(self.topsrcdir, input, mar, output, format, arch=arch)
repackage_mar(
self.topsrcdir,
input,
mar,
output,
format,
arch=arch,
mar_channel_id=mar_channel_id,
)
@CommandProvider

Просмотреть файл

@ -26,7 +26,9 @@ _BCJ_OPTIONS = {
}
def repackage_mar(topsrcdir, package, mar, output, mar_format='lzma', arch=None):
def repackage_mar(
topsrcdir, package, mar, output, mar_format="lzma", arch=None, mar_channel_id=None
):
if not zipfile.is_zipfile(package) and not tarfile.is_tarfile(package):
raise Exception("Package file %s is not a valid .zip or .tar file." % package)
if arch and arch not in _BCJ_OPTIONS:
@ -66,6 +68,8 @@ def repackage_mar(topsrcdir, package, mar, output, mar_format='lzma', arch=None)
env['BCJ_OPTIONS'] = ' '.join(_BCJ_OPTIONS[arch])
if mar_format == 'bz2':
env['MAR_OLD_FORMAT'] = '1'
if mar_channel_id:
env['MAR_CHANNEL_ID'] = mar_channel_id
# The Windows build systems have xz installed but it isn't in the path
# like it is on Linux and Mac OS X so just use the XZ env var so the mar
# generation scripts can find it.

Просмотреть файл

@ -236,7 +236,7 @@ async def generate_partial(work_env, from_dir, to_dir, dest_mar, mar_data,
log.info("Generating partial %s", dest_mar)
env = work_env.env
env["MOZ_PRODUCT_VERSION"] = mar_data['version']
env["MOZ_CHANNEL_ID"] = mar_data["ACCEPTED_MAR_CHANNEL_IDS"]
env["MAR_CHANNEL_ID"] = mar_data["ACCEPTED_MAR_CHANNEL_IDS"]
env['BRANCH'] = mar_data['branch']
env['PLATFORM'] = mar_data['platform']
if use_old_format:

Просмотреть файл

@ -84,6 +84,7 @@ PACKAGE_FORMATS = {
'args': [
'mar',
'--arch', '{architecture}',
'--mar-channel-id', '{mar-channel-id}',
],
'inputs': {
'input': 'target{archive_format}',
@ -95,6 +96,7 @@ PACKAGE_FORMATS = {
'args': [
'mar', "--format", "bz2",
'--arch', '{architecture}',
'--mar-channel-id', '{mar-channel-id}',
],
'inputs': {
'input': 'target{archive_format}',
@ -269,6 +271,7 @@ def make_job_description(config, jobs):
'_locale': _fetch_subst_locale,
'architecture': architecture(build_platform),
'version_display': config.params['version'],
'mar-channel-id': attributes['mar-channel-id'],
}
# Allow us to replace args a well, but specifying things expanded in mozharness
# Without breaking .format and without allowing unknown through

Просмотреть файл

@ -35,18 +35,20 @@ RELEASE_PROMOTION_PROJECTS = {
} | RELEASE_PROJECTS
_OPTIONAL_ATTRIBUTES = (
'accepted-mar-channel-ids',
'artifact_map',
'artifact_prefix',
'l10n_chunk',
'locale',
'mar-channel-id',
'nightly',
'required_signoffs',
'signed',
'shippable',
'shipping_phase',
'shipping_product',
'signed',
'stub-installer',
'update-channel',
'shippable',
)

Просмотреть файл

@ -121,6 +121,10 @@ if [[ -n $MOZ_PRODUCT_VERSION ]]
then
mar_command="$mar_command -V $MOZ_PRODUCT_VERSION"
fi
if [[ -n $MAR_CHANNEL_ID ]]
then
mar_command="$mar_command -H $MAR_CHANNEL_ID"
fi
mar_command="$mar_command -C \"$workdir\" -c output.mar"
eval "$mar_command $targetfiles"
mv -f "$workdir/output.mar" "$archive"

Просмотреть файл

@ -351,9 +351,9 @@ if [[ -n $MOZ_PRODUCT_VERSION ]]
then
mar_command="$mar_command -V $MOZ_PRODUCT_VERSION"
fi
if [[ -n $MOZ_CHANNEL_ID ]]
if [[ -n $MAR_CHANNEL_ID ]]
then
mar_command="$mar_command -H $MOZ_CHANNEL_ID"
mar_command="$mar_command -H $MAR_CHANNEL_ID"
fi
mar_command="$mar_command -C \"$workdir\" -c output.mar"
eval "$mar_command $archivefiles"