From 1f44615a0ab07bc719abc22c7b207953ea1e78c8 Mon Sep 17 00:00:00 2001 From: Arjun Shankar Date: Tue, 8 Mar 2022 22:09:51 +0100 Subject: [PATCH] locale: symlink identical langpack LC_CTYPEs to C.utf8 version (#2054789) Also: * localedef is fixed so that it can handle symbolic links. * glibc-fedora-localedef.patch is dropped and locale installation adjusted. Reviewed-by: Carlos O'Donell --- glibc-fedora-localedef.patch | 21 --------------------- glibc-rh2054789.patch | 27 +++++++++++++++++++++++++++ glibc.spec | 31 +++++++++++++++++++++++++------ 3 files changed, 52 insertions(+), 27 deletions(-) delete mode 100644 glibc-fedora-localedef.patch create mode 100644 glibc-rh2054789.patch diff --git a/glibc-fedora-localedef.patch b/glibc-fedora-localedef.patch deleted file mode 100644 index 515611a..0000000 --- a/glibc-fedora-localedef.patch +++ /dev/null @@ -1,21 +0,0 @@ -Short description: Fedora-specific glibc install locale changes. -Author(s): Fedora glibc team -Origin: PATCH -Upstream status: not-needed - -The Fedora glibc build and install does not need the normal install -behaviour which updates the locale archive. The Fedora install phase -in the spec file of the rpm will handle this manually. - -diff --git a/localedata/Makefile b/localedata/Makefile -index 0eea396ad86da956..54caabda33728207 100644 ---- a/localedata/Makefile -+++ b/localedata/Makefile -@@ -413,6 +413,7 @@ define build-one-locale - echo -n '...'; \ - input=`echo $$locale | sed 's/\([^.]*\)[^@]*\(.*\)/\1\2/'`; \ - $(LOCALEDEF) $$flags --alias-file=../intl/locale.alias \ -+ --no-archive \ - -i locales/$$input -f charmaps/$$charset \ - $(addprefix --prefix=,$(install_root)) $$locale \ - && echo ' done'; diff --git a/glibc-rh2054789.patch b/glibc-rh2054789.patch new file mode 100644 index 0000000..68fff2f --- /dev/null +++ b/glibc-rh2054789.patch @@ -0,0 +1,27 @@ +commit ea89d5bbd9e5e514b606045d909e6ab87d851c88 +Author: Arjun Shankar +Date: Thu Feb 24 21:43:09 2022 +0100 + + localedef: Handle symbolic links when generating locale-archive + + Whenever locale data for any locale included symbolic links, localedef + would throw the error "incomplete set of locale files" and exclude it + from the generated locale archive. This commit fixes that. + + Co-authored-by: Florian Weimer + + Reviewed-by: Carlos O'Donell + +diff --git a/locale/programs/locarchive.c b/locale/programs/locarchive.c +index f38e835c52e4a967..d79278b6ed7340bf 100644 +--- a/locale/programs/locarchive.c ++++ b/locale/programs/locarchive.c +@@ -1391,7 +1391,7 @@ add_locales_to_archive (size_t nlist, char *list[], bool replace) + { + char fullname[fnamelen + 2 * strlen (d->d_name) + 7]; + +- if (d_type == DT_UNKNOWN) ++ if (d_type == DT_UNKNOWN || d_type == DT_LNK) + { + strcpy (stpcpy (stpcpy (fullname, fname), "/"), + d->d_name); diff --git a/glibc.spec b/glibc.spec index 11ec2c1..81a2eb1 100644 --- a/glibc.spec +++ b/glibc.spec @@ -148,7 +148,7 @@ end \ Summary: The GNU libc libraries Name: glibc Version: %{glibcversion} -Release: 27%{?dist} +Release: 28%{?dist} # In general, GPLv2+ is used by programs, LGPLv2+ is used for # libraries. @@ -215,7 +215,6 @@ rpm.define("__debug_install_post bash " .. wrapper ############################################################################## Patch1: glibc-fedora-nscd.patch Patch4: glibc-fedora-linux-tcsetattr.patch -Patch6: glibc-fedora-localedef.patch Patch8: glibc-fedora-manual-dircategory.patch Patch9: glibc-rh827510.patch Patch13: glibc-fedora-localedata-rh61908.patch @@ -378,6 +377,7 @@ Patch173: glibc-upstream-2.34-107.patch Patch174: glibc-rh2058224-1.patch Patch175: glibc-rh2058224-2.patch Patch176: glibc-rh2058230.patch +Patch177: glibc-rh2054789.patch ############################################################################## # Continued list of core "glibc" package information: @@ -1412,11 +1412,11 @@ done pushd build-%{target} %make_build install_root=%{glibc_sysroot} install %make_build install_root=%{glibc_sysroot} \ - install-locales -C ../localedata objdir=`pwd` + install-locale-files -C ../localedata objdir=`pwd` popd -# Locale creation may produce different groups of hardlinks in an -# unpredictable manner. Re-grouping makes those differences go away. -hardlink %{glibc_sysroot}/usr/lib/locale +# Locale creation via install-locale-files does not group identical files +# via hardlinks, so we must group them ourselves. +hardlink -c %{glibc_sysroot}/usr/lib/locale # install_different: # Install all core libraries into DESTDIR/SUBDIR. Either the file is @@ -1538,6 +1538,19 @@ $olddir/build-%{target}/elf/ld.so \ # glibc-all-langpacks versions) ln locale-archive locale-archive.real +# Almost half the LC_CTYPE files in langpacks are identical to the C.utf8 +# variant which is installed by default. When we keep them as hardlinks, +# each langpack ends up retaining a copy. If we convert these to symbolic +# links instead, we save ~350K each when they get installed that way. +# +# LC_MEASUREMENT and LC_PAPER also have several duplicates but we don't +# bother with these because they are only ~30 bytes each. +pushd %{glibc_sysroot}/usr/lib/locale +for f in $(find eo *_* -samefile C.utf8/LC_CTYPE); do + rm $f && ln -s '../C.utf8/LC_CTYPE' $f +done +popd + # Create the file lists for the language specific sub-packages: for i in eo *_* do @@ -2421,6 +2434,12 @@ fi %files -f compat-libpthread-nonshared.filelist -n compat-libpthread-nonshared %changelog +* Tue Mar 08 2022 Arjun Shankar - 2.34-28 +- Reduce installed size of some langpacks by de-duplicating LC_CTYPE (#2054789) +- Fix localedef so it can handle symbolic links when generating locale-archive. +- Drop glibc-fedora-localedef.patch and adjust locale installation + accordingly so that installed content remains unchanged. + * Mon Feb 28 2022 Florian Weimer - 2.34-27 - Fix regression (ldd crash) during dependency sorting in ld.so (#2058230)