Bug 1864958 - Fix devedition .deb package branding r=releng-reviewers,taskgraph-reviewers,jlorenzo,gbrown
Depends on D193953 Differential Revision: https://phabricator.services.mozilla.com/D193954
This commit is contained in:
@@ -2376,6 +2376,12 @@ def repackage_deb(
|
||||
required=True,
|
||||
help="Location of the templates used to generate the debian/ directory files",
|
||||
)
|
||||
@CommandArgument(
|
||||
"--release-product",
|
||||
type=str,
|
||||
required=True,
|
||||
help="The product being shipped. Used to disambiguate beta/devedition etc.",
|
||||
)
|
||||
def repackage_deb_l10n(
|
||||
command_context,
|
||||
input_xpi_file,
|
||||
@@ -2384,6 +2390,7 @@ def repackage_deb_l10n(
|
||||
version,
|
||||
build_number,
|
||||
templates,
|
||||
release_product,
|
||||
):
|
||||
for input_file in (input_xpi_file, input_tar_file):
|
||||
if not os.path.exists(input_file):
|
||||
@@ -2398,7 +2405,13 @@ def repackage_deb_l10n(
|
||||
from mozbuild.repackaging.deb import repackage_deb_l10n
|
||||
|
||||
repackage_deb_l10n(
|
||||
input_xpi_file, input_tar_file, output, template_dir, version, build_number
|
||||
input_xpi_file,
|
||||
input_tar_file,
|
||||
output,
|
||||
template_dir,
|
||||
version,
|
||||
build_number,
|
||||
release_product,
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -79,6 +79,7 @@ def repackage_deb(
|
||||
application_ini_data,
|
||||
arch,
|
||||
depends="${shlibs:Depends},",
|
||||
release_product=release_product,
|
||||
)
|
||||
|
||||
_copy_plain_deb_config(template_dir, source_dir)
|
||||
@@ -119,7 +120,13 @@ def repackage_deb(
|
||||
|
||||
|
||||
def repackage_deb_l10n(
|
||||
input_xpi_file, input_tar_file, output, template_dir, version, build_number
|
||||
input_xpi_file,
|
||||
input_tar_file,
|
||||
output,
|
||||
template_dir,
|
||||
version,
|
||||
build_number,
|
||||
release_product,
|
||||
):
|
||||
arch = "all"
|
||||
|
||||
@@ -132,13 +139,20 @@ def repackage_deb_l10n(
|
||||
input_tar_file, version, build_number
|
||||
)
|
||||
langpack_id = langpack_metadata["langpack_id"]
|
||||
if release_product == "devedition":
|
||||
depends = (
|
||||
f"firefox-devedition (= {application_ini_data['deb_pkg_version']})"
|
||||
)
|
||||
else:
|
||||
depends = f"{application_ini_data['remoting_name']} (= {application_ini_data['deb_pkg_version']})"
|
||||
build_variables = _get_build_variables(
|
||||
application_ini_data,
|
||||
arch,
|
||||
depends=f"{application_ini_data['remoting_name']} (= {application_ini_data['deb_pkg_version']})",
|
||||
depends=depends,
|
||||
# Debian package names are only lowercase
|
||||
package_name_suffix=f"-l10n-{langpack_id.lower()}",
|
||||
description_suffix=f" - {langpack_metadata['description']}",
|
||||
release_product=release_product,
|
||||
)
|
||||
_copy_plain_deb_config(template_dir, source_dir)
|
||||
_render_deb_templates(template_dir, source_dir, build_variables)
|
||||
@@ -248,12 +262,19 @@ def _get_build_variables(
|
||||
depends,
|
||||
package_name_suffix="",
|
||||
description_suffix="",
|
||||
release_product="",
|
||||
):
|
||||
if release_product == "devedition":
|
||||
deb_pkg_install_path = "usr/lib/firefox-devedition"
|
||||
deb_pkg_name = f"firefox-devedition{package_name_suffix}"
|
||||
else:
|
||||
deb_pkg_install_path = f"usr/lib/{application_ini_data['remoting_name']}"
|
||||
deb_pkg_name = f"{application_ini_data['remoting_name']}{package_name_suffix}"
|
||||
return {
|
||||
"DEB_DESCRIPTION": f"{application_ini_data['vendor']} {application_ini_data['display_name']}"
|
||||
f"{description_suffix}",
|
||||
"DEB_PKG_INSTALL_PATH": f"usr/lib/{application_ini_data['remoting_name']}",
|
||||
"DEB_PKG_NAME": f"{application_ini_data['remoting_name']}{package_name_suffix}",
|
||||
"DEB_PKG_INSTALL_PATH": deb_pkg_install_path,
|
||||
"DEB_PKG_NAME": deb_pkg_name,
|
||||
"DEB_PKG_VERSION": application_ini_data["deb_pkg_version"],
|
||||
"DEB_CHANGELOG_DATE": format_datetime(application_ini_data["timestamp"]),
|
||||
"DEB_ARCH_NAME": _DEB_ARCH[arch],
|
||||
|
||||
@@ -73,87 +73,220 @@ def test_extract_application_ini_data_from_directory():
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"version, build_number, package_name_suffix, description_suffix, expected",
|
||||
"version, build_number, package_name_suffix, description_suffix, release_product, application_ini_data, expected, raises",
|
||||
(
|
||||
(
|
||||
"112.0a1",
|
||||
1,
|
||||
"",
|
||||
"",
|
||||
"firefox",
|
||||
{
|
||||
"name": "Firefox",
|
||||
"display_name": "Firefox",
|
||||
"vendor": "Mozilla",
|
||||
"remoting_name": "firefox-nightly-try",
|
||||
"build_id": "20230222000000",
|
||||
},
|
||||
{
|
||||
"DEB_DESCRIPTION": "Mozilla Firefox",
|
||||
"DEB_PKG_INSTALL_PATH": "usr/lib/firefox-nightly-try",
|
||||
"DEB_PKG_NAME": "firefox-nightly-try",
|
||||
"DEB_PKG_VERSION": "112.0a1~20230222000000",
|
||||
},
|
||||
does_not_raise(),
|
||||
),
|
||||
(
|
||||
"112.0a1",
|
||||
1,
|
||||
"-l10n-fr",
|
||||
" - Language pack for Firefox Nightly for fr",
|
||||
"firefox",
|
||||
{
|
||||
"name": "Firefox",
|
||||
"display_name": "Firefox",
|
||||
"vendor": "Mozilla",
|
||||
"remoting_name": "firefox-nightly-try",
|
||||
"build_id": "20230222000000",
|
||||
},
|
||||
{
|
||||
"DEB_DESCRIPTION": "Mozilla Firefox - Language pack for Firefox Nightly for fr",
|
||||
"DEB_PKG_INSTALL_PATH": "usr/lib/firefox-nightly-try",
|
||||
"DEB_PKG_NAME": "firefox-nightly-try-l10n-fr",
|
||||
"DEB_PKG_VERSION": "112.0a1~20230222000000",
|
||||
},
|
||||
does_not_raise(),
|
||||
),
|
||||
(
|
||||
"112.0b1",
|
||||
1,
|
||||
"",
|
||||
"",
|
||||
"firefox",
|
||||
{
|
||||
"name": "Firefox",
|
||||
"display_name": "Firefox",
|
||||
"vendor": "Mozilla",
|
||||
"remoting_name": "firefox-nightly-try",
|
||||
"build_id": "20230222000000",
|
||||
},
|
||||
{
|
||||
"DEB_DESCRIPTION": "Mozilla Firefox",
|
||||
"DEB_PKG_INSTALL_PATH": "usr/lib/firefox-nightly-try",
|
||||
"DEB_PKG_NAME": "firefox-nightly-try",
|
||||
"DEB_PKG_VERSION": "112.0b1~build1",
|
||||
},
|
||||
does_not_raise(),
|
||||
),
|
||||
(
|
||||
"112.0",
|
||||
2,
|
||||
"",
|
||||
"",
|
||||
"firefox",
|
||||
{
|
||||
"name": "Firefox",
|
||||
"display_name": "Firefox",
|
||||
"vendor": "Mozilla",
|
||||
"remoting_name": "firefox-nightly-try",
|
||||
"build_id": "20230222000000",
|
||||
},
|
||||
{
|
||||
"DEB_DESCRIPTION": "Mozilla Firefox",
|
||||
"DEB_PKG_INSTALL_PATH": "usr/lib/firefox-nightly-try",
|
||||
"DEB_PKG_NAME": "firefox-nightly-try",
|
||||
"DEB_PKG_VERSION": "112.0~build2",
|
||||
},
|
||||
does_not_raise(),
|
||||
),
|
||||
(
|
||||
"120.0b9",
|
||||
1,
|
||||
"",
|
||||
"",
|
||||
"devedition",
|
||||
{
|
||||
"name": "Firefox",
|
||||
"display_name": "Firefox Developer Edition",
|
||||
"vendor": "Mozilla",
|
||||
"remoting_name": "firefox-aurora",
|
||||
"build_id": "20230222000000",
|
||||
},
|
||||
{
|
||||
"DEB_DESCRIPTION": "Mozilla Firefox Developer Edition",
|
||||
"DEB_PKG_INSTALL_PATH": "usr/lib/firefox-devedition",
|
||||
"DEB_PKG_NAME": "firefox-devedition",
|
||||
"DEB_PKG_VERSION": "120.0b9~build1",
|
||||
},
|
||||
does_not_raise(),
|
||||
),
|
||||
(
|
||||
"120.0b9",
|
||||
1,
|
||||
"-l10n-ach",
|
||||
" - Firefox Developer Edition Language Pack for Acholi (ach) – Acoli",
|
||||
"devedition",
|
||||
{
|
||||
"name": "Firefox",
|
||||
"display_name": "Firefox Developer Edition",
|
||||
"vendor": "Mozilla",
|
||||
"remoting_name": "firefox-aurora",
|
||||
"build_id": "20230222000000",
|
||||
},
|
||||
{
|
||||
"DEB_DESCRIPTION": "Mozilla Firefox Developer Edition - Firefox Developer Edition Language Pack for Acholi (ach) – Acoli",
|
||||
"DEB_PKG_INSTALL_PATH": "usr/lib/firefox-devedition",
|
||||
"DEB_PKG_NAME": "firefox-devedition-l10n-ach",
|
||||
"DEB_PKG_VERSION": "120.0b9~build1",
|
||||
},
|
||||
does_not_raise(),
|
||||
),
|
||||
(
|
||||
"120.0b9",
|
||||
1,
|
||||
"-l10n-ach",
|
||||
" - Firefox Developer Edition Language Pack for Acholi (ach) – Acoli",
|
||||
"devedition",
|
||||
{
|
||||
"name": "Firefox",
|
||||
"display_name": "Firefox Developer Edition",
|
||||
"vendor": "Mozilla",
|
||||
"remoting_name": "firefox-aurora",
|
||||
"build_id": "20230222000000",
|
||||
},
|
||||
{
|
||||
"DEB_DESCRIPTION": "Mozilla Firefox Developer Edition - Firefox Developer Edition Language Pack for Acholi (ach) – Acoli",
|
||||
"DEB_PKG_INSTALL_PATH": "usr/lib/firefox-devedition",
|
||||
"DEB_PKG_NAME": "firefox-devedition-l10n-ach",
|
||||
"DEB_PKG_VERSION": "120.0b9~build1",
|
||||
},
|
||||
does_not_raise(),
|
||||
),
|
||||
(
|
||||
"120.0b9",
|
||||
1,
|
||||
"-l10n-ach",
|
||||
" - Firefox Developer Edition Language Pack for Acholi (ach) – Acoli",
|
||||
"devedition",
|
||||
{
|
||||
"name": "Firefox",
|
||||
"display_name": "Firefox Developer Edition",
|
||||
"vendor": "Mozilla",
|
||||
"remoting_name": "firefox-aurora",
|
||||
"build_id": "20230222000000",
|
||||
},
|
||||
{
|
||||
"DEB_DESCRIPTION": "Mozilla Firefox Developer Edition - Firefox Developer Edition Language Pack for Acholi (ach) – Acoli",
|
||||
"DEB_PKG_INSTALL_PATH": "usr/lib/firefox-aurora",
|
||||
"DEB_PKG_NAME": "firefox-aurora-l10n-ach",
|
||||
"DEB_PKG_VERSION": "120.0b9~build1",
|
||||
},
|
||||
pytest.raises(AssertionError),
|
||||
),
|
||||
),
|
||||
)
|
||||
def test_get_build_variables(
|
||||
version, build_number, package_name_suffix, description_suffix, expected
|
||||
version,
|
||||
build_number,
|
||||
package_name_suffix,
|
||||
description_suffix,
|
||||
release_product,
|
||||
application_ini_data,
|
||||
expected,
|
||||
raises,
|
||||
):
|
||||
application_ini_data = deb._parse_application_ini_data(
|
||||
{
|
||||
"name": "Firefox",
|
||||
"display_name": "Firefox",
|
||||
"vendor": "Mozilla",
|
||||
"remoting_name": "firefox-nightly-try",
|
||||
"build_id": "20230222000000",
|
||||
},
|
||||
application_ini_data,
|
||||
version,
|
||||
build_number,
|
||||
)
|
||||
with raises:
|
||||
if not package_name_suffix:
|
||||
depends = "${shlibs:Depends},"
|
||||
elif release_product == "devedition":
|
||||
depends = (
|
||||
f"firefox-devedition (= {application_ini_data['deb_pkg_version']})"
|
||||
)
|
||||
else:
|
||||
depends = f"{application_ini_data['remoting_name']} (= {application_ini_data['deb_pkg_version']})"
|
||||
|
||||
assert deb._get_build_variables(
|
||||
application_ini_data,
|
||||
"x86",
|
||||
depends="${shlibs:Depends},",
|
||||
package_name_suffix=package_name_suffix,
|
||||
description_suffix=description_suffix,
|
||||
) == {
|
||||
**{
|
||||
"DEB_CHANGELOG_DATE": "Wed, 22 Feb 2023 00:00:00 -0000",
|
||||
"DEB_ARCH_NAME": "i386",
|
||||
"DEB_DEPENDS": "${shlibs:Depends},",
|
||||
},
|
||||
**expected,
|
||||
}
|
||||
build_variables = deb._get_build_variables(
|
||||
application_ini_data,
|
||||
"x86",
|
||||
depends=depends,
|
||||
package_name_suffix=package_name_suffix,
|
||||
description_suffix=description_suffix,
|
||||
release_product=release_product,
|
||||
)
|
||||
|
||||
assert build_variables == {
|
||||
**{
|
||||
"DEB_CHANGELOG_DATE": "Wed, 22 Feb 2023 00:00:00 -0000",
|
||||
"DEB_ARCH_NAME": "i386",
|
||||
"DEB_DEPENDS": depends,
|
||||
},
|
||||
**expected,
|
||||
}
|
||||
|
||||
|
||||
def test_copy_plain_deb_config(monkeypatch):
|
||||
|
||||
@@ -281,6 +281,8 @@ PACKAGE_FORMATS = {
|
||||
"{build_number}",
|
||||
"--templates",
|
||||
"browser/installer/linux/langpack/debian",
|
||||
"--release-product",
|
||||
"{release_product}",
|
||||
],
|
||||
"inputs": {
|
||||
"input-xpi-file": "target.langpack.xpi",
|
||||
|
||||
Reference in New Issue
Block a user