bug 1370506, for Nightly builds, automatically clone l10n repos for localized installers, r=glandium

Making more decisions on behalf of developers:

L10NBASEDIR is always defined, if not specified, it's ~/.mozbuild/l10n-central,
or in MOZBUILD_STATE_PATH/l10n-central if the state path in defined in the
environment.
If a locale isn't checked out, do that. The targets for which that works are
merge-%, installers-%, langpack-%

But only do that for Nightly builds, as for Beta and beyond, we have
explicit revisions to use for the builds, and we don't want to break release
builds silently with this.

MozReview-Commit-ID: EhGJPLuiyYO

--HG--
extra : rebase_source : 61a92396920965107a8811679552c1992b29155e
This commit is contained in:
Axel Hecht 2017-06-15 19:47:28 +02:00
parent aebc0e7f7e
commit b9f1d30851
2 changed files with 31 additions and 1 deletions

View File

@ -177,8 +177,30 @@ TK_DEFINES = $(firstword \
# chrome directory.
PKG_ZIP_DIRS = chrome $(or $(DIST_SUBDIRS),$(DIST_SUBDIR))
# Clone a l10n repository, either via hg or git
# Make this a variable as it's embedded in a sh conditional
ifeq ($(VCS_CHECKOUT_TYPE),hg)
L10N_CO = $(HG) --cwd $(L10NBASEDIR) clone https://hg.mozilla.org/l10n-central/$(AB_CD)/
else
ifeq ($(VCS_CHECKOUT_TYPE),git)
L10N_CO = $(GIT) -C $(L10NBASEDIR) clone hg://hg.mozilla.org/l10n-central/$(AB_CD)/
else
L10N_CO = $(error You need to use either hg or git)
endif
endif
merge-%: IS_LANGUAGE_REPACK=1
merge-%: AB_CD=$*
merge-%:
# For nightly builds, we automatically check out missing localizations
# from l10n-central.
ifdef NIGHTLY_BUILD
@if ! test -d $(L10NBASEDIR)/$(AB_CD) ; then \
$(NSINSTALL) -D $(L10NBASEDIR) ; \
$(L10N_CO) ; \
fi
endif
$(RM) -rf $(REAL_LOCALE_MERGEDIR)
$(MOZILLA_DIR)/mach compare-locales --l10n-base $(L10NBASEDIR) --merge-dir $(REAL_LOCALE_MERGEDIR) $*

View File

@ -86,12 +86,20 @@ option('--with-l10n-base', nargs=1, env='L10NBASEDIR',
@depends('--with-l10n-base')
@imports(_from='os.path', _import='isdir')
@imports(_from='os.path', _import='expanduser')
@imports(_from='os', _import='environ')
def l10n_base(value):
if value:
path = value[0]
if not isdir(path):
die("Invalid value --with-l10n-base, %s doesn't exist", path)
return os.path.realpath(os.path.abspath(path))
else:
path = os.path.join(
environ.get(
'MOZBUILD_STATE_PATH',
expanduser(os.path.join('~', '.mozbuild'))),
'l10n-central')
return os.path.realpath(os.path.abspath(path))
set_config('L10NBASEDIR', l10n_base)