Sync with Current (re-organize locales)

This commit is contained in:
Andrey Bondrov 2015-01-28 19:52:58 +10:00
parent 0f0e96f4a4
commit 7285b9dd91
8 changed files with 46 additions and 207 deletions

View file

@ -7,7 +7,7 @@ INSTALL-SUPPORTED-LOCALES=$(addprefix install-, $(SUPPORTED-LOCALES))
install-locales: $(INSTALL-SUPPORTED-LOCALES)
install-locales-dir:
mkdir -p $(DESTDIR)/usr/share/locale
mkdir -p $(DESTDIR)/usr/lib/locale
$(INSTALL-SUPPORTED-LOCALES): install-locales-dir
@locale=`echo $@ | sed -e 's/^install-//'`; \
@ -15,7 +15,7 @@ $(INSTALL-SUPPORTED-LOCALES): install-locales-dir
locale=`echo $$locale | sed -e 's,/[^/]*,,'`; \
input=`echo $$locale | sed 's/\([^.]*\)[^@]*\(.*\)/\1\2/'`; \
echo "localedef -i $$input -c -f $$charset" \
"$(DESTDIR)/usr/share/locale/$$locale"; \
"$(DESTDIR)/usr/lib/locale/$$locale"; \
localedef -i $$input -c -f $$charset \
$(DESTDIR)/usr/share/locale/$$locale; \
$(DESTDIR)/usr/lib/locale/$$locale; \

View file

@ -23,8 +23,9 @@
# Define Xen arches to build with -mno-tls-direct-seg-refs
%define xenarches %{ix86}
# Define to build nscd with selinux support
%bcond_with selinux
# Distro-specific default value is defined in branding-configs package
%{?build_selinux}%{?!build_selinux:%bcond_with selinux}
%{?build_systap}%{?!build_systap:%bcond_without systap}
# Allow make check to fail only when running kernels where we know
# tests must pass (no missing features or bugs in the kernel)
@ -42,12 +43,6 @@
%bcond_without nsscrypt
%bcond_without locales
%ifarch %{ix86} x86_64
%bcond_without systap
%else
%bcond_with systap
%endif
# build documentation by default
%bcond_without doc
%bcond_with pdf
@ -59,7 +54,7 @@ Summary: The GNU libc libraries
Name: glibc
Epoch: 6
Version: 2.19
Release: 8
Release: 13
License: LGPLv2+ and LGPLv2+ with exceptions and GPLv2+
Group: System/Libraries
Url: http://www.eglibc.org/
@ -88,9 +83,6 @@ Source100: %{name}.rpmlintrc
Source1000: locale-pkg
Source1001: locale_install.sh
Source1002: locale_uninstall.sh
Source1003: locales.sysconfig
Source1004: locales-hardlink.pl
Source1005: locales-softlink.pl
#-----------------------------------------------------------------------
# fedora patches
@ -172,7 +164,8 @@ Patch51: glibc-rh952799.patch
Patch56: eglibc-mandriva-localedef-archive-follow-symlinks.patch
Patch57: eglibc-mandriva-fix-dns-with-broken-routers.patch
Patch58: eglibc-mandriva-nss-upgrade.patch
Patch59: eglibc-mandriva-share-locale.patch
#Drop patch. Use default directory for locale definitions
#Patch59: eglibc-mandriva-share-locale.patch
Patch60: eglibc-mandriva-nsswitch.conf.patch
Patch61: eglibc-mandriva-xterm-xvt.patch
Patch62: eglibc-mandriva-nscd-enable.patch
@ -217,7 +210,7 @@ BuildRequires: patch
BuildRequires: perl
BuildRequires: cap-devel
%if %{with selinux}
BuildRequires: libselinux-devel >= 1.17.10
BuildRequires: pkgconfig(libselinux) >= 1.17.10
%endif
BuildRequires: texinfo
%if %{with pdf}
@ -607,6 +600,7 @@ These are configuration files that describe possible time zones.
%package -n locales
Summary: Base files for localization
Group: System/Internationalization
Requires: %{name}-i18ndata
%description -n locales
These are the base files for language localization.
@ -618,20 +612,13 @@ their ~/.profile configuration file.
%files -n locales
%{_bindir}/locale_install.sh
%{_bindir}/locale_uninstall.sh
%config(noreplace) %{_sysconfdir}/sysconfig/locales
%dir %{_datadir}/locale
%dir %{_prefix}/lib/locale
%ghost %{_prefix}/lib/locale/locale-archive
%{_datadir}/locale/ISO*
%{_datadir}/locale/CP*
%{_datadir}/locale/UTF*
%{_datadir}/locale/KOI*
%post -n locales
%{_bindir}/locale_install.sh "ENCODINGS"
%preun -n locales
%{_bindir}/locale_uninstall.sh "ENCODINGS"
%{_prefix}/lib/locale/ISO*
%{_prefix}/lib/locale/CP*
%{_prefix}/lib/locale/UTF*
%{_prefix}/lib/locale/KOI*
# Locale specifc packages
%{expand:%(sh %{SOURCE1000} Afar aa aa_DJ aa_ER aa_ET)}
@ -839,7 +826,6 @@ their ~/.profile configuration file.
%patch56 -p1
%patch57 -p1
%patch58 -p1 -b .nssUpgrade~
%patch59 -p1
%patch60 -p1
%patch61 -p1
%patch62 -p1
@ -1302,11 +1288,17 @@ rm -f %{buildroot}%{_infodir}/dir
%endif
%if ! %{without locales}
# Build locales...
export PATH=%{buildroot}%{_bindir}:%{buildroot}%{_sbindir}:$PATH
export LD_LIBRARY_PATH=%{buildroot}/%{_lib}:%{buildroot}%{_libdir}:$LD_LIBRARY_PATH
export I18NPATH=%{buildroot}%{_datadir}/i18n
# Needed for/used by locale-archive
mkdir -p %{buildroot}%{_prefix}/lib/locale
touch %{buildroot}%{_prefix}/lib/locale/locale-archive
# Locale related tools
install -c -m 755 %{SOURCE1001} %{SOURCE1002} %{buildroot}%{_bindir}/
# make default charset pseudo-locales
# those will be symlinked (for LC_CTYPE, LC_COLLATE mainly) from
# a lot of other locales, thus saving space
@ -1315,31 +1307,10 @@ for DEF_CHARSET in UTF-8 ISO-8859-1 ISO-8859-2 ISO-8859-3 ISO-8859-4 \
ISO-8859-13 ISO-8859-14 ISO-8859-15 KOI8-R KOI8-U CP1251
do
# don't use en_DK because of LC_MONETARY
localedef -c -f $DEF_CHARSET -i en_US %{buildroot}%{_datadir}/locale/$DEF_CHARSET || :
localedef -c -f $DEF_CHARSET -i en_US %{buildroot}%{_prefix}/lib/locale/$DEF_CHARSET || :
done
# TODO: REMOVE?^^^
# Build regular locales
# Don't try to use SMP make here - that would result in concurrent writes to the locale
# archive.
SUPPORTED=$I18NPATH/SUPPORTED DESTDIR=%{buildroot} make -f %{SOURCE20}
# Locale related tools
install -c -m 755 %{SOURCE1001} %{SOURCE1002} %{buildroot}%{_bindir}/
# And configs
mkdir -p %{buildroot}%{_sysconfdir}/sysconfig
install -c -m 644 %{SOURCE1003} %{buildroot}%{_sysconfdir}/sysconfig/locales
# Hardlink identical locales
perl %{SOURCE1004} %{buildroot}%{_datadir}/locale
# Symlink identical files
pushd %{buildroot}%{_datadir}/locale
for i in ??_??* ???_??*; do
LC_ALL=C perl %{SOURCE1005} $i
done
popd
# Needed for/used by locale-archive
mkdir -p %{buildroot}%{_prefix}/lib/locale
touch %{buildroot}%{_prefix}/lib/locale/locale-archive
%endif
# This will make the '-g' argument to be passed to eu-strip for these libraries, so that

View file

@ -41,13 +41,4 @@ fi
%files -n locales-$LOCALE
EOF
for i in "$@"; do
if echo $i |grep -q '@'; then
continue
fi
echo %optional %{_localedir}/$i
echo %optional %{_localedir}/$i.*
echo %optional %{_localedir}/$i@*
echo %exclude %{_localedir}/*/LC_MESSAGES/libc.mo
done
echo

View file

@ -4,28 +4,6 @@
# it gets the locale name(s) as parameter, and does the needed steps
# so that the new locale can be used by the system
# check if installing main locales package (just encodings)
if [ "$1" == "ENCODINGS" ]; then
# update encoding files used by locales
ENCODINGS="CP1251 ISO-8859-1 ISO-8859-13 ISO-8859-14 ISO-8859-15 \
ISO-8859-2 ISO-8859-3 ISO-8859-4 ISO-8859-5 ISO-8859-7 \
ISO-8859-9 KOI8-R KOI8-U UTF-8"
for enc in $ENCODINGS; do
if [ -r "/usr/share/locale/$enc/LC_CTYPE" ]; then
mkdir -p "/etc/locale/$enc/LC_MESSAGES"
for i in LC_ADDRESS LC_COLLATE LC_CTYPE \
LC_IDENTIFICATION LC_MEASUREMENT LC_MONETARY \
LC_NAME LC_NUMERIC LC_PAPER LC_TELEPHONE \
LC_TIME LC_MESSAGES/SYS_LC_MESSAGES
do
cp -fp "/usr/share/locale/$enc/$i" \
"/etc/locale/$enc/$i"
done
fi
done
exit 0
fi
# the list of languages that rpm installs their translations
if [ -r /etc/rpm/macros ]; then
RPM_INSTALL_LANG="`grep '^%_install_langs' /etc/rpm/macros | cut -d' ' -f2-`"
@ -33,48 +11,20 @@ fi
[ -z "$RPM_INSTALL_LANG" ] && RPM_INSTALL_LANG=C
OLD_RPM_INSTALL_LANG="$RPM_INSTALL_LANG"
# remove/update locale-archive based on system wide configuration
[ -r /etc/sysconfig/locales ] && . /etc/sysconfig/locales
case "$USE_LOCARCHIVE" in
yes|true|1)
update_locarchive=1
;;
*)
update_locarchive=0
rm -f /usr/share/locale/locale-archive
;;
esac
eval "`sed /usr/share/i18n/SUPPORTED -e 's/^SUPPORTED-LOCALES=\s*\\\\/SUPPORTED_LOCALES=\"\\\\/' -e '$a''"'`"
for i in "$@"; do
langs="$i"
for j in /usr/share/locale/$i.*; do
[ -d "$j" ] || continue
lng=`basename $j`
# sanity check
echo $lng | grep -q $i || continue
langs="$langs $lng"
done
for k in $langs; do
# copy the LC_* of the all system locales to /etc/locale, so
# everything is ok on boot time, even if /usr is not mounted
if [ -r "/usr/share/locale/$k/LC_CTYPE" ]; then
mkdir -p "/etc/locale/$k/LC_MESSAGES"
for j in LC_ADDRESS LC_IDENTIFICATION LC_MONETARY \
LC_PAPER LC_COLLATE LC_MEASUREMENT LC_NAME \
LC_TELEPHONE LC_CTYPE LC_NUMERIC LC_TIME \
LC_MESSAGES/SYS_LC_MESSAGES
do
cp -fpP "/usr/share/locale/$k/$j" \
"/etc/locale/$k/$j"
done
# maintain updated locale-archive file
[ "$update_locarchive" -eq 0 ] || \
localedef \
--replace \
--add-to-archive "/usr/share/locale/$k" \
> /dev/null
fi
for l in $SUPPORTED_LOCALES; do
case $l in
$i | $i.* | $i@* | $i/* )
# Generate locale definition and add it to the locale-archive file
charset=`echo $l | sed -e 's,.*/,,'`;
locale=`echo $l | sed -e 's,/[^/]*,,'`;
input=`echo $locale | sed 's/\([^.]*\)[^@]*\(.*\)/\1\2/'`;
localedef -i $input -c -f $charset $locale;
;;
*) ;;
esac
done
# make the installed locale known to rpm (so translations in that

View file

@ -3,27 +3,6 @@
# this script is to be called when a locale is removed from the sistem;
# so translations in the language(s) of the locale are no longer installed
if [ "$1" == "ENCODINGS" ]; then
# remove encoding files used by locales
ENCODINGS="CP1251 ISO-8859-1 ISO-8859-13 ISO-8859-14 ISO-8859-15 \
ISO-8859-2 ISO-8859-3 ISO-8859-4 ISO-8859-5 ISO-8859-7 \
ISO-8859-9 KOI8-R KOI8-U UTF-8"
for enc in $ENCODINGS; do
if [ -d "/etc/locale/$enc" ]; then
for i in LC_ADDRESS LC_COLLATE LC_CTYPE \
LC_IDENTIFICATION LC_MEASUREMENT LC_MONETARY \
LC_NAME LC_NUMERIC LC_PAPER LC_TELEPHONE \
LC_TIME LC_MESSAGES/SYS_LC_MESSAGES
do
rm -f "/etc/locale/$enc/$i"
done
rmdir "/etc/locale/$enc/LC_MESSAGES" > /dev/null 2>&1
rmdir "/etc/locale/$enc" > /dev/null 2>&1
fi
done
exit 0
fi
# the list of languages that rpm installs their translations
if [ -r /etc/rpm/macros ]; then
RPM_INSTALL_LANG="`grep '^%_install_langs' /etc/rpm/macros | cut -d' ' -f2-`"
@ -31,29 +10,16 @@ fi
[ -z "$RPM_INSTALL_LANG" ] && RPM_INSTALL_LANG=C
OLD_RPM_INSTALL_LANG="$RPM_INSTALL_LANG"
INSTALLED_LOCALES=`localedef --list`
for i in "$@"; do
langs="$i"
for j in /usr/share/locale/$i.*; do
[ -d "$j" ] || continue
lng=`basename $j`
# sanity check
echo $lng | grep -q $i || continue
langs="$langs $lng"
done
for k in $langs; do
# remove the LC_* of the all system locales from /etc/locale,
# copied by locale_install.sh
if [ -d "/etc/locale/$k" ]; then
for j in LC_ADDRESS LC_IDENTIFICATION LC_MONETARY \
LC_PAPER LC_COLLATE LC_MEASUREMENT LC_NAME \
LC_TELEPHONE LC_CTYPE LC_NUMERIC LC_TIME \
LC_MESSAGES/SYS_LC_MESSAGES
do
rm -f "/etc/locale/$k/$j"
done
rmdir "/etc/locale/$k/LC_MESSAGES" > /dev/null 2>&1
rmdir "/etc/locale/$k" > /dev/null 2>&1
fi
# Delete corresponding locale definitions from the locale-archive file
for l in $INSTALLED_LOCALES; do
case "$l" in
$i | $i.* | $i@* )
localedef --delete-from-archive $l
;;
*) ;;
esac
done
# remove the locale from the list known to rpm (so translations in that

View file

@ -1,15 +0,0 @@
#!/usr/bin/perl
# replace all identical files with hard links.
# script from Alastair McKinstry, 2000-07-03
@files = `find $ARGV[0] -type f -a -not -name "LC_C*" `;
foreach $fi (@files) {
chop ($fi);
($sum,$name) = split(/ /,`md5sum -b $fi`);
if ( $orig{$sum} eq "" ) {
$orig{$sum} =$fi;
} else {
`ln -f $orig{$sum} $fi`;
}
}

View file

@ -1,15 +0,0 @@
#!/usr/bin/perl
# make LC_CTYPE and LC_COLLATE symlinks
@files = `find [A-Z]* $ARGV[0]* -type f -a -name "LC_C*" `;
foreach $fi (@files) {
chop ($fi);
($sum,$name) = split(/ /,`md5sum -b $fi`);
if ( $orig{$sum} eq "" ) {
$orig{$sum} =$fi;
} else {
`rm $fi`;
`ln -s ../$orig{$sum} $fi`;
}
}

View file

@ -1,9 +0,0 @@
# Set USE_LOCARCHIVE to yes/true/1 if you want locale scripts to create and
# maintain /usr/share/locale/locale-archive. locale-archive can speed up
# loading of applications, but they duplicate locale information already
# present in /usr/share/locale/xx_XX/* directories, so if you need to save
# disk space you can disable it with this switch. If you disable it, you can
# delete /usr/share/locale/locale-archive file, otherwise it will be removed
# automatically on next locale scripts run, on locales package update
USE_LOCARCHIVE=yes