Bug 1975800 - Also run ensure_l10n_central on build installers-* (single locale repack) a=RyanVM DONTBUILD
In D246824 we moved the `l10n-central` clone step out of `l10n.mk`. We added it to the code path for the `package-multi-locale` command, but we did not add it to `build installers-$AB_CD` command. This made single locale repacks not download the `l10n-central` repo and single locales silently run without actuall doing localizations. Original Revision: https://phabricator.services.mozilla.com/D258311 Differential Revision: https://phabricator.services.mozilla.com/D261995
This commit is contained in:
committed by
rvandermeulen@mozilla.com
parent
251e895995
commit
e8b179b639
@@ -12,7 +12,7 @@ from mach.decorators import Command, CommandArgument
|
||||
|
||||
from mozbuild.backend import backends
|
||||
from mozbuild.mozconfig import MozconfigLoader
|
||||
from mozbuild.util import MOZBUILD_METRICS_PATH
|
||||
from mozbuild.util import MOZBUILD_METRICS_PATH, ensure_l10n_central
|
||||
|
||||
BUILD_WHAT_HELP = """
|
||||
What to build. Can be a top-level make target or a relative directory. If
|
||||
@@ -168,6 +168,11 @@ def build(
|
||||
if not _set_priority(priority, verbose):
|
||||
print("--priority not supported on this platform.")
|
||||
|
||||
for target in what:
|
||||
if target.startswith("installers-"):
|
||||
ensure_l10n_central(command_context)
|
||||
break
|
||||
|
||||
if doing_pgo:
|
||||
if what:
|
||||
raise Exception("Cannot specify targets (%s) in MOZ_PGO=1 builds" % what)
|
||||
|
||||
@@ -35,7 +35,11 @@ from mozbuild.base import (
|
||||
MozbuildObject,
|
||||
)
|
||||
from mozbuild.base import MachCommandConditions as conditions
|
||||
from mozbuild.util import MOZBUILD_METRICS_PATH, ForwardingArgumentParser
|
||||
from mozbuild.util import (
|
||||
MOZBUILD_METRICS_PATH,
|
||||
ForwardingArgumentParser,
|
||||
ensure_l10n_central,
|
||||
)
|
||||
|
||||
here = os.path.abspath(os.path.dirname(__file__))
|
||||
|
||||
@@ -57,18 +61,6 @@ warning heuristic.
|
||||
"""
|
||||
|
||||
|
||||
class MissingL10nError(Exception):
|
||||
"""Raised when the l10n repositories haven’t been checked out."""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class NotAGitRepositoryError(Exception):
|
||||
"""Raised when the directory isn’t a git repository."""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class StoreDebugParamsAndWarnAction(argparse.Action):
|
||||
def __call__(self, parser, namespace, values, option_string=None):
|
||||
sys.stderr.write(
|
||||
@@ -3491,46 +3483,6 @@ def repackage_desktop_file(
|
||||
desktop_file.write(desktop)
|
||||
|
||||
|
||||
def _ensure_l10n_central(command_context):
|
||||
# For nightly builds, we automatically check out missing localizations
|
||||
# from firefox-l10n. We never automatically check out in automation:
|
||||
# automation builds check out revisions that have been signed-off by
|
||||
# l10n drivers prior to use.
|
||||
l10n_base_dir = Path(command_context.substs["L10NBASEDIR"])
|
||||
moz_automation = os.environ.get("MOZ_AUTOMATION")
|
||||
if moz_automation:
|
||||
if not l10n_base_dir.exists():
|
||||
raise MissingL10nError(
|
||||
f"Automation requires l10n repositories to be checked out: {l10n_base_dir}"
|
||||
)
|
||||
|
||||
nightly_build = command_context.substs.get("NIGHTLY_BUILD")
|
||||
if nightly_build:
|
||||
git = os.environ.get("GIT", "git")
|
||||
if not l10n_base_dir.exists():
|
||||
l10n_base_dir.mkdir(parents=True)
|
||||
subprocess.run(
|
||||
[
|
||||
git,
|
||||
"clone",
|
||||
"https://github.com/mozilla-l10n/firefox-l10n.git",
|
||||
str(l10n_base_dir),
|
||||
"--depth",
|
||||
"1",
|
||||
],
|
||||
check=True,
|
||||
)
|
||||
if not moz_automation:
|
||||
if (l10n_base_dir / ".git").exists():
|
||||
subprocess.run(
|
||||
[git, "-C", str(l10n_base_dir), "pull", "--quiet"], check=True
|
||||
)
|
||||
else:
|
||||
raise NotAGitRepositoryError(
|
||||
f"Directory is not a git repository: {l10n_base_dir}"
|
||||
)
|
||||
|
||||
|
||||
@Command(
|
||||
"package-multi-locale",
|
||||
category="post-build",
|
||||
@@ -3567,7 +3519,7 @@ def package_l10n(command_context, verbose=False, locales=[]):
|
||||
"MOZ_CHROME_MULTILOCALE": " ".join(locales),
|
||||
}
|
||||
|
||||
_ensure_l10n_central(command_context)
|
||||
ensure_l10n_central(command_context)
|
||||
|
||||
command_context.log(
|
||||
logging.INFO,
|
||||
|
||||
@@ -36,6 +36,18 @@ else:
|
||||
system_encoding = "utf-8"
|
||||
|
||||
|
||||
class MissingL10nError(Exception):
|
||||
"""Raised when the l10n repositories haven’t been checked out."""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class NotAGitRepositoryError(Exception):
|
||||
"""Raised when the directory isn’t a git repository."""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
def _open(path, mode):
|
||||
if "b" in mode:
|
||||
return open(path, mode)
|
||||
@@ -1296,3 +1308,43 @@ def macos_performance_cores():
|
||||
if proc.returncode != 0:
|
||||
return -1
|
||||
return int(proc.stdout.decode("ascii", "replace").strip())
|
||||
|
||||
|
||||
def ensure_l10n_central(command_context):
|
||||
# For nightly builds, we automatically check out missing localizations
|
||||
# from firefox-l10n. We never automatically check out in automation:
|
||||
# automation builds check out revisions that have been signed-off by
|
||||
# l10n drivers prior to use.
|
||||
l10n_base_dir = Path(command_context.substs["L10NBASEDIR"])
|
||||
moz_automation = os.environ.get("MOZ_AUTOMATION")
|
||||
if moz_automation:
|
||||
if not l10n_base_dir.exists():
|
||||
raise MissingL10nError(
|
||||
f"Automation requires l10n repositories to be checked out: {l10n_base_dir}"
|
||||
)
|
||||
|
||||
nightly_build = command_context.substs.get("NIGHTLY_BUILD")
|
||||
if nightly_build:
|
||||
git = os.environ.get("GIT", "git")
|
||||
if not l10n_base_dir.exists():
|
||||
l10n_base_dir.mkdir(parents=True)
|
||||
subprocess.run(
|
||||
[
|
||||
git,
|
||||
"clone",
|
||||
"https://github.com/mozilla-l10n/firefox-l10n.git",
|
||||
str(l10n_base_dir),
|
||||
"--depth",
|
||||
"1",
|
||||
],
|
||||
check=True,
|
||||
)
|
||||
if not moz_automation:
|
||||
if (l10n_base_dir / ".git").exists():
|
||||
subprocess.run(
|
||||
[git, "-C", str(l10n_base_dir), "pull", "--quiet"], check=True
|
||||
)
|
||||
else:
|
||||
raise NotAGitRepositoryError(
|
||||
f"Directory is not a git repository: {l10n_base_dir}"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user