bug 1370506, always merge for l10n repacks, with internally set merge dir, r=glandium

To not merge the en-US language pack, the merge-% steps are in
a conditional function that disables that for en-US. Using a function
here as that's easier than a shell if in the merge rule, and
Makefile conditionals don't get evaluated late enough.

To liberate the l10n builds from settings in the automation,
we move the patch logic from LOCALE_MERGEDIR to REAL_LOCALE_MERGEDIR.

To determine strongly when we're in a repack or building a langpack,
the trick here is to

  export IS_LANGUAGE_REPACK

in l10n.mk, and only set that to true in the entry-point rules.

Now, we can use that value in config.mk to define the l10n-specific
rules.

I did the same thing for langpack-%, which allows us to disable
the crashreporter files for language packs, for example.

With that,

  make installers-de

just works, if you have localizations checked out.

For a while, we might run l10n-merge twice in automation, but it's really not
optional, so let's just make sure we run it.


MozReview-Commit-ID: 3nr33CKxkBQ

--HG--
extra : rebase_source : 0605a4adba018fa4b85d563cdafba80b0533bc91
This commit is contained in:
Axel Hecht 2017-06-16 15:21:16 +02:00
parent bdccebaf44
commit aebc0e7f7e
6 changed files with 37 additions and 25 deletions

View File

@ -33,9 +33,9 @@ BRANDING_FILES = \
include $(topsrcdir)/config/config.mk
ifdef LOCALE_MERGEDIR
ifdef IS_LANGUAGE_REPACK
PPL_LOCALE_ARGS = \
--l10n-dir=$(LOCALE_MERGEDIR)/browser/installer \
--l10n-dir=$(REAL_LOCALE_MERGEDIR)/browser/installer \
--l10n-dir=$(call EXPAND_LOCALE_SRCDIR,browser/locales)/installer \
--l10n-dir=$(topsrcdir)/browser/locales/en-US/installer \
$(NULL)

View File

@ -87,6 +87,7 @@ DEFINES += -DBOOKMARKS_INCLUDE_DIR=$(dir $(call MERGE_FILE,profile/bookmarks.inc
libs-%: AB_CD=$*
libs-%:
$(if $(filter en-US,$(AB_CD)),, @$(MAKE) merge-$*)
$(NSINSTALL) -D $(DIST)/install
@$(MAKE) -C ../../toolkit/locales libs-$* XPI_ROOT_APPID='$(XPI_ROOT_APPID)'
@$(MAKE) -C ../../services/sync/locales AB_CD=$* XPI_NAME=locale-$*
@ -109,7 +110,9 @@ endif
@$(MAKE) -C $(DEPTH)/$(MOZ_BRANDING_DIRECTORY)/locales AB_CD=$* XPI_NAME=locale-$*
chrome-%: AB_CD=$*
chrome-%: IS_LANGUAGE_REPACK=1
chrome-%:
$(if $(filter en-US,$(AB_CD)),, @$(MAKE) merge-$*)
@$(MAKE) -C ../../toolkit/locales chrome-$*
@$(MAKE) -C ../../services/sync/locales chrome AB_CD=$*
@$(MAKE) -C ../../extensions/spellcheck/locales chrome AB_CD=$*
@ -157,6 +160,7 @@ langpack: langpack-$(AB_CD)
# builds, and repack an installer if applicable. It is called from the
# tinderbox scripts. Alter it with caution.
installers-%: IS_LANGUAGE_REPACK=1
installers-%: clobber-% langpack-% repackage-win32-installer-% repackage-zip-%
@echo 'repackaging done'
@ -177,10 +181,12 @@ else
endif
endif
ifndef IS_LANGPACK
ifdef MOZ_CRASHREPORTER
libs:: $(call MERGE_FILE,crashreporter/crashreporter-override.ini)
$(SYSINSTALL) $(IFLAGS1) $^ $(FINAL_TARGET)
endif
endif
ident:
@printf 'fx_revision '
@ -190,14 +196,6 @@ ident:
@$(PYTHON) $(topsrcdir)/config/printconfigsetting.py \
$(STAGEDIST)/application.ini App BuildID
merge-%: AB_CD=$*
merge-%:
ifdef LOCALE_MERGEDIR
$(RM) -rf $(LOCALE_MERGEDIR)
$(topsrcdir)/mach compare-locales --merge-dir $(LOCALE_MERGEDIR) $*
endif
@echo
# test target, depends on make package
# try to repack x-test, with just toolkit/defines.inc being there
l10n-check:: INNER_UNMAKE_PACKAGE=true
@ -209,7 +207,7 @@ l10n-check::
@# we do the same for WIN32_INSTALLER_IN, which are based on MOZ_SIMPLE_PACKAGE_NAME
@# not being reset, overwriting the value they would get with MOZ_SIMPLE_PACKAGE_NAME
@# reset.
$(MAKE) installers-x-test L10NBASEDIR='$(PWD)' LOCALE_MERGEDIR='$(PWD)/mergedir' \
$(MAKE) installers-x-test L10NBASEDIR='$(PWD)' \
ZIP_IN='$(ZIP_IN)' WIN32_INSTALLER_IN='$(WIN32_INSTALLER_IN)' MOZ_SIMPLE_PACKAGE_NAME=
$(PYTHON) $(topsrcdir)/toolkit/mozapps/installer/unpack.py $(DIST)/l10n-stage/$(MOZ_PKG_DIR)$(_RESPATH)
cd $(DIST)/l10n-stage && test $$(cat $(MOZ_PKG_DIR)$(_RESPATH)/update.locale) = x-test

View File

@ -481,8 +481,6 @@ ACDEFINES += -DAB_CD=$(AB_CD)
ifndef L10NBASEDIR
L10NBASEDIR = $(error L10NBASEDIR not defined by configure)
else
IS_LANGUAGE_REPACK = 1
endif
EXPAND_LOCALE_SRCDIR = $(if $(filter en-US,$(AB_CD)),$(topsrcdir)/$(1)/en-US,$(or $(realpath $(L10NBASEDIR)),$(abspath $(L10NBASEDIR)))/$(AB_CD)/$(subst /locales,,$(1)))
@ -494,8 +492,8 @@ endif
ifdef relativesrcdir
MAKE_JARS_FLAGS += --relativesrcdir=$(relativesrcdir)
ifneq (en-US,$(AB_CD))
ifdef LOCALE_MERGEDIR
MAKE_JARS_FLAGS += --locale-mergedir=$(LOCALE_MERGEDIR)
ifdef IS_LANGUAGE_REPACK
MAKE_JARS_FLAGS += --locale-mergedir=$(REAL_LOCALE_MERGEDIR)
endif
ifdef IS_LANGUAGE_REPACK
MAKE_JARS_FLAGS += --l10n-base=$(L10NBASEDIR)/$(AB_CD)
@ -507,9 +505,9 @@ else
MAKE_JARS_FLAGS += -c $(LOCALE_SRCDIR)
endif # ! relativesrcdir
ifdef LOCALE_MERGEDIR
ifdef IS_LANGUAGE_REPACK
MERGE_FILE = $(firstword \
$(wildcard $(LOCALE_MERGEDIR)/$(subst /locales,,$(relativesrcdir))/$(1)) \
$(wildcard $(REAL_LOCALE_MERGEDIR)/$(subst /locales,,$(relativesrcdir))/$(1)) \
$(wildcard $(LOCALE_SRCDIR)/$(1)) \
$(srcdir)/en-US/$(1) )
else

View File

@ -31,8 +31,11 @@ clobber-stage:
$(RM) $(DEPTH)/mobile/android/base/res/values-*/strings.xml
$(RM) $(DEPTH)/mobile/android/base/res/raw-*/suggestedsites.json
# merge if we're not en-US, using conditional function as we need
# the current value of AB_CD
libs-%: AB_CD=$*
libs-%:
$(if $(filter en-US,$(AB_CD)),, @$(MAKE) merge-$*)
@$(MAKE) -C $(DEPTH)/mobile/locales libs-$*
@$(MAKE) libs AB_CD=$* XPI_NAME=locale-$* PREF_DIR=defaults/pref
ifeq ($(OS_TARGET),Android)
@ -40,8 +43,12 @@ ifeq ($(OS_TARGET),Android)
endif
# Tailored target to just add the chrome processing for multi-locale builds
# merge if we're not en-US, using conditional function as we need
# the current value of AB_CD
chrome-%: AB_CD=$*
chrome-%: IS_LANGUAGE_REPACK=1
chrome-%:
$(if $(filter en-US,$(AB_CD)),, @$(MAKE) merge-$*)
@$(MAKE) -C $(DEPTH)/mobile/locales chrome-$*
@$(MAKE) chrome AB_CD=$*
ifeq ($(OS_TARGET),Android)
@ -51,6 +58,7 @@ endif
# This is a generic target that will make a langpack and repack tarball
# builds. It is called from the tinderbox scripts. Alter it with caution.
installers-%: IS_LANGUAGE_REPACK=1
installers-%: clobber-stage repackage-zip-%
@echo 'repackaging done'
@ -71,11 +79,3 @@ ident:
@$(PYTHON) $(topsrcdir)/config/printconfigsetting.py $(FENNEC_APPLICATION_INI_PATH) App SourceStamp
@printf 'buildid '
@$(PYTHON) $(topsrcdir)/config/printconfigsetting.py $(FENNEC_APPLICATION_INI_PATH) App BuildID
merge-%: AB_CD=$*
merge-%:
ifdef LOCALE_MERGEDIR
$(RM) -rf $(LOCALE_MERGEDIR)
$(topsrcdir)/mach compare-locales --merge-dir $(LOCALE_MERGEDIR) $*
endif
@echo

View File

@ -24,6 +24,7 @@ chrome-%:
libs:: update.locale
sed -e 's/%AB_CD%/$(AB_CD)/' $< > $(FINAL_TARGET)/update.locale
ifndef IS_LANGPACK
ifdef MOZ_CRASHREPORTER
libs:: $(call MERGE_FILE,crashreporter/crashreporter.ini)
ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
@ -32,3 +33,4 @@ else
$(SYSINSTALL) $(IFLAGS1) $^ $(FINAL_TARGET)
endif
endif
endif

View File

@ -56,6 +56,13 @@ ACDEFINES += \
-DPKG_INST_BASENAME='$(PKG_INST_BASENAME)' \
$(NULL)
# export some global defines for l10n repacks
BASE_MERGE:=$(CURDIR)/merge-dir
export REAL_LOCALE_MERGEDIR=$(BASE_MERGE)/$(AB_CD)
# is an l10n repack step:
export IS_LANGUAGE_REPACK
# is a language pack:
export IS_LANGPACK
clobber-%: AB_CD=$*
clobber-%:
@ -170,9 +177,16 @@ TK_DEFINES = $(firstword \
# chrome directory.
PKG_ZIP_DIRS = chrome $(or $(DIST_SUBDIRS),$(DIST_SUBDIR))
merge-%: IS_LANGUAGE_REPACK=1
merge-%:
$(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
langpack-%: libs-%
@echo 'Making langpack $(LANGPACK_FILE)'
$(NSINSTALL) -D $(DIST)/$(PKG_LANGPACK_PATH)