bug 1370506, for Nightly builds, automatically clone l10n repos for localized installers, r?glandium draft
authorAxel Hecht <axel@pike.org>
Thu, 15 Jun 2017 19:47:28 +0200
changeset 619227 5e503563a2f89b3caa1412944f42f49c9ca7463b
parent 619226 0ef7e009b8d70d61aa1b3cccca08906adc679524
child 619228 fded0da4224f19b0a7d6bf0d8d494d7417a52d06
push id71621
push useraxel@mozilla.com
push dateTue, 01 Aug 2017 19:49:47 +0000
reviewersglandium
bugs1370506
milestone56.0a1
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
toolkit/locales/l10n.mk
toolkit/moz.configure
--- a/toolkit/locales/l10n.mk
+++ b/toolkit/locales/l10n.mk
@@ -172,18 +172,40 @@ TK_DEFINES = $(firstword \
    $(MOZILLA_DIR)/toolkit/locales/en-US/defines.inc)
 
 # Dealing with app sub dirs: If DIST_SUBDIRS is defined it contains a
 # listing of app sub-dirs we should include in langpack xpis. If not,
 # check DIST_SUBDIR, and if that isn't present, just package the default
 # 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) $*
 
 langpack-%: LANGPACK_FILE=$(ABS_DIST)/$(PKG_LANGPACK_PATH)$(PKG_LANGPACK_BASENAME).xpi
 langpack-%: AB_CD=$*
 langpack-%: XPI_NAME=locale-$*
 langpack-%: IS_LANGUAGE_REPACK=1
 langpack-%: IS_LANGPACK=1
--- a/toolkit/moz.configure
+++ b/toolkit/moz.configure
@@ -81,22 +81,30 @@ include('../build/moz.configure/rust.con
 
 # L10N
 # ==============================================================
 option('--with-l10n-base', nargs=1, env='L10NBASEDIR',
        help='Path to l10n repositories')
 
 @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)
 
 
 # Default toolkit
 # ==============================================================
 # Normally, we'd want to use the `default` field on the option, but that
 # requires --target to be resolved at --help time, which requires to run