[arch-commits] Commit in glibc/trunk (locale-gen)
Allan McRae
allan at nymeria.archlinux.org
Wed Oct 9 03:43:57 UTC 2013
Date: Wednesday, October 9, 2013 @ 05:43:57
Author: allan
Revision: 196230
parallel generation of locales (FS#36955)
Modified:
glibc/trunk/locale-gen
------------+
locale-gen | 53 ++++++++++++++++++++++++++++++-----------------------
1 file changed, 30 insertions(+), 23 deletions(-)
Modified: locale-gen
===================================================================
--- locale-gen 2013-10-08 23:21:16 UTC (rev 196229)
+++ locale-gen 2013-10-09 03:43:57 UTC (rev 196230)
@@ -4,39 +4,46 @@
LOCALEGEN=/etc/locale.gen
LOCALES=/usr/share/i18n/locales
-if [ -n "$POSIXLY_CORRECT" ]; then
- unset POSIXLY_CORRECT
-fi
+unset POSIXLY_CORRECT
+[ -s "$LOCALEGEN" ] || exit 0
-[ -f $LOCALEGEN -a -s $LOCALEGEN ] || exit 0;
-
# Remove all old locale dir and locale-archive before generating new
# locale data.
-rm -rf /usr/lib/locale/* || true
+rm -rf /usr/lib/locale/*
umask 022
-is_entry_ok() {
- if [ -n "$locale" -a -n "$charset" ] ; then
- true
- else
- echo "error: Bad entry '$locale $charset'"
- false
- fi
+gen() {
+ local locale=$1
+ local charset=$2
+ local input=
+
+ if [ -z "$locale" ] || [ -z "$charset" ]; then
+ echo "error: Bad entry '$locale $charset'"
+ return
+ fi
+
+ printf ' %s.%s\n' "$(echo "$locale" | sed 's/\([^.\@]*\).*/\1/')" "$charset"
+
+ if [ -f "$LOCALES/$locale" ]; then
+ input=$locale
+ else
+ input=$(echo $locale | sed 's/\([^.]*\)[^@]*\(.*\)/\1\2/')
+ fi
+
+ localedef -i "$input" -c -f "$charset" -A /usr/share/locale/locale.alias "$locale"
}
echo "Generating locales..."
while read locale charset; do \
- case $locale in \#*) continue;; "") continue;; esac; \
- is_entry_ok || continue
- echo -n " `echo $locale | sed 's/\([^.\@]*\).*/\1/'`"; \
- echo -n ".$charset"; \
- echo -n `echo $locale | sed 's/\([^\@]*\)\(\@.*\)*/\2/'`; \
- echo -n '...'; \
- if [ -f $LOCALES/$locale ]; then input=$locale; else \
- input=`echo $locale | sed 's/\([^.]*\)[^@]*\(.*\)/\1\2/'`; fi; \
- localedef -i $input -c -f $charset -A /usr/share/locale/locale.alias $locale; \
- echo ' done'; \
+ case $locale in
+ \#*|'')
+ continue
+ ;;
+ esac
+ gen "$locale" "$charset" &
done < $LOCALEGEN
+wait
+
echo "Generation complete."
More information about the arch-commits
mailing list