Commits (3)
......@@ -288,6 +288,13 @@ time.faketimes
Note that the clock continues to run during the build. It is possible for
``faketime(1)`` to freeze it, but we don't yet support that yet; it has a
higher chance of causing your build to fail or misbehave.
locales.locale
A semicolon-separated list one or more locales to test when
performing locales variations.
If multiple locales are specified, one will be chosen at random.
Some more interesting locales are fr_CH.UTF-8, ru_RU.CP1251, kk_KZ.RK1048
or zh_CN.
Default is et_EE.UTF-8 if unspecified.
The difference between --vary and --variations is that the former appends onto
previous values but the latter resets them. Furthermore, the last value set for
......
......@@ -367,9 +367,10 @@ def locales(ctx, build, vary):
if not vary:
return build.add_env('LANG', 'C.UTF-8').add_env('LANGUAGE', 'en_US:en')
else:
# TODO: support specifying locale to vary
# Use an Estonian locale by default, which has interesting sort order for ASCII characters
loc = 'et_EE.UTF-8'
if ctx.spec.locales.locale:
loc = random.choice(ctx.spec.locales.locale)
if ctx.verbosity >= 1:
logger.info("LOCALE variation: LC_ALL = " + loc + " LANGUAGE = " + loc + ":fr")
return build.add_env('LANG', loc).add_env('LC_ALL', loc).add_env('LANGUAGE', '%s:fr' % loc)
......@@ -576,6 +577,10 @@ class DomainHostVariation(collections.namedtuple('_DomainHostVariation', 'use_su
def default(cls):
return cls(0)
class LocalesVariation(collections.namedtuple('_LocaleVariation', 'locale')):
@classmethod
def default(cls):
return cls(mdiffconf.strlist_set(";"))
class VariationSpec(mdiffconf.ImmutableNamespace):
@classmethod
......@@ -585,6 +590,7 @@ class VariationSpec(mdiffconf.ImmutableNamespace):
"user_group": UserGroupVariation.default(),
"time": TimeVariation.default(),
"domain_host": DomainHostVariation.default(),
"locales": LocalesVariation.default(),
}
return cls(**{k: default_overrides.get(k, True) for k in variations})
......