Restore /usr/lib/locale/locale-archive under its original name (#1716710)

This commit is contained in:
Florian Weimer 2019-06-05 12:20:08 +02:00
parent 819bb4065c
commit bd8d2430b4
2 changed files with 36 additions and 194 deletions

View File

@ -1,183 +0,0 @@
Author: Florian Weimer <fweimer@redhat.com>
Date: Tue Jun 4 14:34:42 2019 +0200
locale: Make the file name of the locale archive configurable
This improves support for parallel installation and upgrade scenarios
involving changes to the locale archive format or the data stored in
it.
diff --git a/INSTALL b/INSTALL
index e137a71169651929..0244b0aa9689336a 100644
--- a/INSTALL
+++ b/INSTALL
@@ -106,6 +106,14 @@ if 'CFLAGS' is specified it must enable optimization. For example:
particular case and potentially change debugging information and
metadata only).
+'--with-locale-archive-name=NAME'
+ Use NAME as the file name of the locale archive, and not the
+ default 'locale-archive'. Usually, the locale archive is stored in
+ the directory '/usr/lib/locale' (for both 32-bit and 64-bit
+ targets). For parallel installation of partially compatible
+ versions of the GNU C Library, this option can be used to alter the
+ name of the file used by glibc and by the 'localedef' tool.
+
'--disable-shared'
Don't build shared libraries even if it is possible. Not all
systems support shared libraries; you need ELF support and
diff --git a/config.h.in b/config.h.in
index 824dfe8d8cb61dd1..7d263447ed153766 100644
--- a/config.h.in
+++ b/config.h.in
@@ -189,6 +189,9 @@
/* Define if the linker defines __ehdr_start. */
#undef HAVE_EHDR_START
+/* The file name of the locale archive (without the directory). */
+#undef LOCALE_ARCHIVE_NAME
+
/*
*/
diff --git a/config.make.in b/config.make.in
index 2fed3da773020a09..a6421039ebbbd966 100644
--- a/config.make.in
+++ b/config.make.in
@@ -23,6 +23,7 @@ datarootdir = @datarootdir@
localstatedir = @libc_cv_localstatedir@
localedir = @localedir@
multidir= @libc_cv_multidir@
+locale-archive-name = @locale_archive_name@
# Should we use and build ldconfig?
use-ldconfig = @use_ldconfig@
diff --git a/configure b/configure
index c773c487b542b3be..0d9645c389d3f111 100755
--- a/configure
+++ b/configure
@@ -687,6 +687,7 @@ hardcoded_path_in_tests
enable_timezone_tools
extra_nonshared_cflags
use_default_link
+locale_archive_name
sysheaders
ac_ct_CXX
CXXFLAGS
@@ -763,6 +764,7 @@ with_gd_lib
with_binutils
with_selinux
with_headers
+with_locale_archive_name
with_default_link
with_nonshared_cflags
enable_sanity_checks
@@ -1484,6 +1486,9 @@ Optional Packages:
--with-selinux if building with SELinux support
--with-headers=PATH location of system headers to use (for example
/usr/src/linux/include) [default=compiler default]
+ --with-locale-archive-name=NAME
+ file name of the locale archive
+ [default=locale-archive]
--with-default-link do not use explicit linker scripts
--with-nonshared-cflags=CFLAGS
build nonshared libraries with additional CFLAGS
@@ -3335,6 +3340,20 @@ fi
+# Check whether --with-locale-archive-name was given.
+if test "${with_locale_archive_name+set}" = set; then :
+ withval=$with_locale_archive_name; locale_archive_name=$withval
+else
+ locale_archive_name=locale-archive
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define LOCALE_ARCHIVE_NAME "$locale_archive_name"
+_ACEOF
+
+
+
+
# Check whether --with-default-link was given.
if test "${with_default_link+set}" = set; then :
diff --git a/configure.ac b/configure.ac
index 598ba6c4aed08a3b..1b33559103b65e8f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -147,6 +147,15 @@ AC_ARG_WITH([headers],
[sysheaders=''])
AC_SUBST(sysheaders)
+AC_ARG_WITH([locale-archive-name],
+ AC_HELP_STRING([--with-locale-archive-name=NAME],
+ [file name of the locale archive
+ @<:@default=locale-archive@:>@]),
+ [locale_archive_name=$withval],
+ [locale_archive_name=locale-archive])
+AC_DEFINE_UNQUOTED(LOCALE_ARCHIVE_NAME, "$locale_archive_name")
+AC_SUBST(locale_archive_name)
+
AC_SUBST(use_default_link)
AC_ARG_WITH([default-link],
AC_HELP_STRING([--with-default-link],
diff --git a/locale/loadarchive.c b/locale/loadarchive.c
index 803c1cf2a45838a7..834f794abf6a830c 100644
--- a/locale/loadarchive.c
+++ b/locale/loadarchive.c
@@ -42,7 +42,7 @@
/* Name of the locale archive file. */
-static const char archfname[] = COMPLOCALEDIR "/locale-archive";
+static const char archfname[] = COMPLOCALEDIR "/" LOCALE_ARCHIVE_NAME;
/* Size of initial mapping window, optimal if large enough to
cover the header plus the initial locale. */
diff --git a/locale/programs/locale.c b/locale/programs/locale.c
index 6eae3175bb3cad9a..be8f07b20f100a10 100644
--- a/locale/programs/locale.c
+++ b/locale/programs/locale.c
@@ -46,7 +46,7 @@
#include "../locarchive.h"
#include <programs/xmalloc.h>
-#define ARCHIVE_NAME COMPLOCALEDIR "/locale-archive"
+#define ARCHIVE_NAME COMPLOCALEDIR "/" LOCALE_ARCHIVE_NAME
/* If set print the name of the category. */
static int show_category_name;
diff --git a/locale/programs/locarchive.c b/locale/programs/locarchive.c
index e6310b18beee8dd2..02f44f682452de3e 100644
--- a/locale/programs/locarchive.c
+++ b/locale/programs/locarchive.c
@@ -57,7 +57,7 @@
extern const char *output_prefix;
-#define ARCHIVE_NAME COMPLOCALEDIR "/locale-archive"
+#define ARCHIVE_NAME COMPLOCALEDIR "/" LOCALE_ARCHIVE_NAME
static const char *locnames[] =
{
diff --git a/manual/install.texi b/manual/install.texi
index 29f6b68e25d04e4b..19e1f9ca161032b1 100644
--- a/manual/install.texi
+++ b/manual/install.texi
@@ -131,6 +131,14 @@ that the objects in @file{libc_nonshared.a} are compiled with this flag
(although this will not affect the generated code in this particular
case and potentially change debugging information and metadata only).
+@item --with-locale-archive-name=@var{name}
+Use @var{name} as the file name of the locale archive, and not the
+default @file{locale-archive}. Usually, the locale archive is stored
+in the directory @file{/usr/lib/locale} (for both 32-bit and 64-bit
+targets). For parallel installation of partially compatible versions
+of @theglibc{}, this option can be used to alter the name of the file
+used by glibc and by the @command{localedef} tool.
+
@c disable static doesn't work currently
@c @item --disable-static
@c Don't build static libraries. Static libraries aren't that useful these

View File

@ -87,7 +87,7 @@
Summary: The GNU libc libraries
Name: glibc
Version: %{glibcversion}
Release: 25%{?dist}
Release: 26%{?dist}
# In general, GPLv2+ is used by programs, LGPLv2+ is used for
# libraries.
@ -160,8 +160,6 @@ Patch28: glibc-rh1615608.patch
# https://www.sourceware.org/ml/libc-alpha/2019-03/msg00436.html
Patch31: glibc-fedora-nscd-warnings.patch
Patch32: glibc-rh1716710.patch
##############################################################################
# Continued list of core "glibc" package information:
##############################################################################
@ -509,11 +507,6 @@ end
# and thus satisfies glibc's requirement for installed locales.
# Users can add one more other langauge packs and then eventually
# uninstall all-langpacks to save space.
#
# Historically, the postun scriptlet of glibc-all-langpacks deleted
# the locale-archive file. Therefore, we tell glibc to use a
# different, release-specific name.
%global locale_archive_name locale-archive.%{version}-%{release}
%package all-langpacks
Summary: All language packs for %{name}.
Requires: %{name} = %{version}-%{release}
@ -835,7 +828,6 @@ build()
--prefix=%{_prefix} \
--with-headers=%{_prefix}/include $EnableKernel \
--with-nonshared-cflags="$BuildFlagsNonshared" \
--with-locale-archive-name="%{locale_archive_name}" \
--enable-bind-now \
--build=%{target} \
--enable-stack-protector=strong \
@ -1039,13 +1031,18 @@ rm -f %{glibc_sysroot}%{_infodir}/libc.info*
%ifnarch %{auxarches}
olddir=`pwd`
pushd %{glibc_sysroot}%{_prefix}/lib/locale
rm -f %{locale_archive_name}
rm -f locale-archive
$olddir/build-%{target}/elf/ld.so \
--library-path $olddir/build-%{target}/ \
$olddir/build-%{target}/locale/localedef \
--alias-file=$olddir/intl/locale.alias \
--prefix %{glibc_sysroot} --add-to-archive \
eo *_*
# Historically, glibc-all-langpacks deleted the file on updates (sic),
# so we need to restore it in the posttrans scriptlet (like the old
# glibc-all-langpacks versions)
ln locale-archive locale-archive.real
# Create the file lists for the language specific sub-packages:
for i in eo *_*
do
@ -1876,6 +1873,30 @@ else
io.stdout:write ("Error: Missing " .. iconv_cache .. " file.\n")
end
%posttrans all-langpacks -e -p <lua>
-- The old glibc-all-langpacks postun scriptlet deleted the locale-archive
-- file, so we may have to resurrect it on upgrades.
local archive_path = "%{_prefix}/lib/locale/locale-archive"
local real_path = "%{_prefix}/lib/locale/locale-archive.real"
local stat_archive = posix.stat(archive_path)
local stat_real = posix.stat(real_path)
-- If the hard link was removed, restore it.
if stat_archive ~= nil and stat_real ~= nil
and (stat_archive.ino ~= stat_real.ino
or stat_archive.dev ~= stat_real.dev) then
posix.unlink(archive_path)
stat_archive = nil
end
-- If the file is gone, restore it.
if stat_archive == nil then
posix.link(real_path, archive_path)
end
-- Remove .rpmsave file potentially created due to config file change.
local save_path = archive_path .. ".rpmsave"
if posix.access(save_path) then
posix.unlink(save_path)
end
%pre headers
# this used to be a link and it is causing nightmares now
if [ -L %{_prefix}/include/scsi ] ; then
@ -1932,7 +1953,8 @@ fi
%doc documentation/gai.conf
%files all-langpacks
%attr(0644,root,root) %{_prefix}/lib/locale/%{locale_archive_name}
%{_prefix}/lib/locale/locale-archive
%{_prefix}/lib/locale/locale-archive.real
%files locale-source
%dir %{_prefix}/share/i18n/locales
@ -1993,6 +2015,9 @@ fi
%files -f compat-libpthread-nonshared.filelist -n compat-libpthread-nonshared
%changelog
* Wed Jun 5 2019 Florian Weimer <fweimer@redhat.com> - 2.29.9000-26
- Restore /usr/lib/locale/locale-archive under its original name (#1716710)
* Tue Jun 4 2019 Florian Weimer <fweimer@redhat.com> - 2.29.9000-25
- Add glibc version to locale-archive name (#1716710)