Bug 1975800 - Add logging output to ensure_l10n_central function a=RyanVM DONTBUILD
Original Revision: https://phabricator.services.mozilla.com/D258312 Differential Revision: https://phabricator.services.mozilla.com/D261996
This commit is contained in:
committed by
rvandermeulen@mozilla.com
parent
e8b179b639
commit
d2702ecdac
@@ -12,6 +12,7 @@ import difflib
|
||||
import functools
|
||||
import hashlib
|
||||
import itertools
|
||||
import logging
|
||||
import os
|
||||
import re
|
||||
import subprocess
|
||||
@@ -1311,6 +1312,13 @@ def macos_performance_cores():
|
||||
|
||||
|
||||
def ensure_l10n_central(command_context):
|
||||
command_context.log(
|
||||
logging.INFO,
|
||||
"ensure_l10n_central",
|
||||
{},
|
||||
"Ensuring that the l10n-central repository exists and is up to date.",
|
||||
)
|
||||
|
||||
# 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
|
||||
@@ -1322,6 +1330,13 @@ def ensure_l10n_central(command_context):
|
||||
raise MissingL10nError(
|
||||
f"Automation requires l10n repositories to be checked out: {l10n_base_dir}"
|
||||
)
|
||||
else:
|
||||
command_context.log(
|
||||
logging.INFO,
|
||||
"ensure_l10n_central",
|
||||
{"l10n_base_dir": str(l10n_base_dir)},
|
||||
f"Detected existing l10n-central checkout at {l10n_base_dir}",
|
||||
)
|
||||
|
||||
nightly_build = command_context.substs.get("NIGHTLY_BUILD")
|
||||
if nightly_build:
|
||||
@@ -1339,11 +1354,36 @@ def ensure_l10n_central(command_context):
|
||||
],
|
||||
check=True,
|
||||
)
|
||||
command_context.log(
|
||||
logging.INFO,
|
||||
"ensure_l10n_central",
|
||||
{"l10n_base_dir": str(l10n_base_dir)},
|
||||
f"Successfully cloned firefox-l10n into {l10n_base_dir}",
|
||||
)
|
||||
elif not moz_automation:
|
||||
command_context.log(
|
||||
logging.INFO,
|
||||
"ensure_l10n_central",
|
||||
{"l10n_base_dir": str(l10n_base_dir)},
|
||||
f"Detected existing l10n-central checkout at {l10n_base_dir}",
|
||||
)
|
||||
if not moz_automation:
|
||||
if (l10n_base_dir / ".git").exists():
|
||||
command_context.log(
|
||||
logging.INFO,
|
||||
"ensure_l10n_central",
|
||||
{"l10n_base_dir": str(l10n_base_dir)},
|
||||
f"Pulling latest l10n-central updates in {l10n_base_dir}",
|
||||
)
|
||||
subprocess.run(
|
||||
[git, "-C", str(l10n_base_dir), "pull", "--quiet"], check=True
|
||||
)
|
||||
command_context.log(
|
||||
logging.INFO,
|
||||
"ensure_l10n_central",
|
||||
{"l10n_base_dir": str(l10n_base_dir)},
|
||||
f"Successfully pulled latest updates in {l10n_base_dir}",
|
||||
)
|
||||
else:
|
||||
raise NotAGitRepositoryError(
|
||||
f"Directory is not a git repository: {l10n_base_dir}"
|
||||
|
||||
Reference in New Issue
Block a user