From 4d258cdf9d1f07a51593d6833a57ceff9a4e8d57 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Thu, 15 Sep 2011 16:17:49 -0400 Subject: [PATCH] enter_chroot: restore auto locale generation First let's add a chroot upgrade hook that'll declare a small list of locales to speed up glibc upgrades. The other blocker was that `cros_sdk --enter` took an inordinate amount of time to execute (`locale-gen -u` specifically) when the number of existing locales is huge. This seems to be a bug in the bash/glibc stack which is resolved in newer versions, but we can workaround the issue by forcing locale-gen to run in a C locale. The tool itself does not care about its locale and we silence its output. BUG=chromium-os:20378 TEST=`cros_sdk --enter`; see no locales in /etc/locale.gen; run `./build_packages` and see upgrade hook work TEST=generate all 400 locales; `cros_sdk --enter`; see that it was quick Change-Id: I8fcc5e26bd8e1bcfd52b6a6c7ef3cacf0a252081 Reviewed-on: http://gerrit.chromium.org/gerrit/7806 Reviewed-by: David James Reviewed-by: Zdenek Behan Commit-Ready: Mike Frysinger Tested-by: Mike Frysinger --- chroot_version_hooks.d/10_default_locales | 16 ++++++++++++++++ sdk_lib/enter_chroot.sh | 15 ++++++++------- 2 files changed, 24 insertions(+), 7 deletions(-) create mode 100644 chroot_version_hooks.d/10_default_locales diff --git a/chroot_version_hooks.d/10_default_locales b/chroot_version_hooks.d/10_default_locales new file mode 100644 index 0000000000..51d573ba07 --- /dev/null +++ b/chroot_version_hooks.d/10_default_locales @@ -0,0 +1,16 @@ +# Copyright (c) 2011 The Chromium OS Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# Make sure existing chroot's have default locales enabled +# to match the new make_chroot behavior +# http://crosbug.com/20378 +if ! grep -q -v -e '^#' -e '^$' /etc/locale.gen ; then + sudo_append /etc/locale.gen <