Use UsrMove (Changes/UsrMerge) path destination in the RPMs (RHEL-65334)

This commit updates most occurrences of /%{_lib} to %{_libdir}.
The glibc build process is not changed, instead the symbolic links
are created right before installing the files, to redirect them
to their final locations.  The symbolic links are removed again
so that they do not end up in the shipped packages.

Resolves: RHEL-65334
This commit is contained in:
Florian Weimer 2024-10-25 12:49:29 +02:00
parent 901a0b41b3
commit fb0599e12c

View File

@ -157,7 +157,7 @@ end \
Summary: The GNU libc libraries Summary: The GNU libc libraries
Name: glibc Name: glibc
Version: %{glibcversion} Version: %{glibcversion}
Release: 145%{?dist} Release: 146%{?dist}
# In general, GPLv2+ is used by programs, LGPLv2+ is used for # In general, GPLv2+ is used by programs, LGPLv2+ is used for
# libraries. # libraries.
@ -279,7 +279,7 @@ local original = rpm.expand("%{macrobody:__debug_install_post}")
-- Avoid embedded newlines that confuse the macro definition. -- Avoid embedded newlines that confuse the macro definition.
original = original:match("^%s*(.-)%s*$"):gsub("\\\n", "") original = original:match("^%s*(.-)%s*$"):gsub("\\\n", "")
rpm.define("__debug_install_post bash " .. wrapper rpm.define("__debug_install_post bash " .. wrapper
.. " " .. sysroot .. " %{glibc_ldso} " .. original) .. " " .. sysroot .. " %{_prefix}/%{glibc_ldso} " .. original)
} }
# sysroot package support. These contain arch-specific packages, so # sysroot package support. These contain arch-specific packages, so
@ -1029,6 +1029,18 @@ Patch718: glibc-RHEL-56032.patch
############################################################################## ##############################################################################
Obsoletes: glibc-profile < 2.4 Obsoletes: glibc-profile < 2.4
Provides: ldconfig Provides: ldconfig
Provides: /sbin/ldconfig
Provides: /usr/sbin/ldconfig
# Historic file paths provided for backwards compatibility.
Provides: %{glibc_ldso}
Provides: /%{_lib}/libanl.so.1
Provides: /%{_lib}/libc.so.6
Provides: /%{_lib}/libdl.so.2
Provides: /%{_lib}/libm.so.6
Provides: /%{_lib}/libpthread.so.0
Provides: /%{_lib}/libresolv.so.2
Provides: /%{_lib}/librt.so.1
Provides: /%{_lib}/libutil.so.1
# The dynamic linker supports DT_GNU_HASH # The dynamic linker supports DT_GNU_HASH
Provides: rtld(GNU_HASH) Provides: rtld(GNU_HASH)
@ -2062,11 +2074,20 @@ build
# distribution that supports multiple installed glibc versions. # distribution that supports multiple installed glibc versions.
%define glibc_sysroot $RPM_BUILD_ROOT %define glibc_sysroot $RPM_BUILD_ROOT
# Create symbolic links for Features/UsrMove (aka UsrMerge, MoveToUsr).
# See below: Remove UsrMove symbolic links.
usrmove_file_names="bin lib lib64 sbin"
for d in $usrmove_file_names ; do
mkdir -p "%{glibc_sysroot}/usr/$d"
ln -s "usr/$d" "%{glibc_sysroot}/$d"
done
%ifarch riscv64 %ifarch riscv64
# RISC-V ABI wants to install everything in /lib64/lp64d or /usr/lib64/lp64d. # RISC-V ABI wants to install everything in /usr/lib64/lp64d.
# Make these be symlinks to /usr/lib64. See:
# Make these be symlinks to /lib64 or /usr/lib64 respectively. See: # Make these be symlinks to /lib64 or /usr/lib64 respectively. See:
# https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/DRHT5YTPK4WWVGL3GIN5BF2IKX2ODHZ3/ # https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/DRHT5YTPK4WWVGL3GIN5BF2IKX2ODHZ3/
for d in %{glibc_sysroot}%{_libdir} %{glibc_sysroot}/%{_lib}; do for d in %{glibc_sysroot}%{_libdir}; do
mkdir -p $d mkdir -p $d
(cd $d && ln -sf . lp64d) (cd $d && ln -sf . lp64d)
done done
@ -2127,7 +2148,7 @@ install_different()
libbase=${lib#*/} libbase=${lib#*/}
# Take care that `libbaseso' has a * that needs expanding so # Take care that `libbaseso' has a * that needs expanding so
# take care with quoting. # take care with quoting.
libbaseso=$(basename %{glibc_sysroot}/%{_lib}/${libbase}.so.*) libbaseso=$(basename %{glibc_sysroot}/%{_libdir}/${libbase}.so.*)
# Only install if different from default build library. # Only install if different from default build library.
if cmp -s ${lib}.so ../build-%{target}/${lib}.so; then if cmp -s ${lib}.so ../build-%{target}/${lib}.so; then
ln -sf "$subdir_up"/$libbaseso $libdestdir/$libbaseso ln -sf "$subdir_up"/$libbaseso $libdestdir/$libbaseso
@ -2153,11 +2174,10 @@ install -p -D -m 0644 %{SOURCE13} ${RPM_BUILD_ROOT}%{_sysusersdir}/nscd.conf
# XXX: This looks like a bug in glibc that accidentally installed these # XXX: This looks like a bug in glibc that accidentally installed these
# wrong files. We probably don't need this today. # wrong files. We probably don't need this today.
rm -f %{glibc_sysroot}/%{_libdir}/libNoVersion* rm -f %{glibc_sysroot}/%{_libdir}/libNoVersion*
rm -f %{glibc_sysroot}/%{_lib}/libNoVersion*
# Remove the old nss modules. # Remove the old nss modules.
rm -f %{glibc_sysroot}/%{_lib}/libnss1-* rm -f %{glibc_sysroot}%{_libdir}/libnss1-*
rm -f %{glibc_sysroot}/%{_lib}/libnss-*.so.1 rm -f %{glibc_sysroot}%{_libdir}/libnss-*.so.1
# This statically linked binary is no longer necessary in a world where # This statically linked binary is no longer necessary in a world where
# the default Fedora install uses an initramfs, and further we have rpm-ostree # the default Fedora install uses an initramfs, and further we have rpm-ostree
@ -2331,13 +2351,6 @@ mkdir -p %{glibc_sysroot}/var/{db,run}/nscd
touch %{glibc_sysroot}/var/{db,run}/nscd/{passwd,group,hosts,services} touch %{glibc_sysroot}/var/{db,run}/nscd/{passwd,group,hosts,services}
touch %{glibc_sysroot}/var/run/nscd/{socket,nscd.pid} touch %{glibc_sysroot}/var/run/nscd/{socket,nscd.pid}
# Move libpcprofile.so and libmemusage.so into the proper library directory.
# They can be moved without any real consequences because users would not use
# them directly.
mkdir -p %{glibc_sysroot}%{_libdir}
mv -f %{glibc_sysroot}/%{_lib}/lib{pcprofile,memusage}.so \
%{glibc_sysroot}%{_libdir}
# Disallow linking against libc_malloc_debug. # Disallow linking against libc_malloc_debug.
rm %{glibc_sysroot}%{_libdir}/libc_malloc_debug.so rm %{glibc_sysroot}%{_libdir}/libc_malloc_debug.so
@ -2363,7 +2376,14 @@ done
# that have old linker scripts that reference this file. We ship this only # that have old linker scripts that reference this file. We ship this only
# in compat-libpthread-nonshared sub-package. # in compat-libpthread-nonshared sub-package.
############################################################################## ##############################################################################
ar cr %{glibc_sysroot}%{_prefix}/%{_lib}/libpthread_nonshared.a ar cr %{glibc_sysroot}%{_libdir}/libpthread_nonshared.a
# Remove UsrMove symbolic links.
# These should not end in the packaged contents.
# They are part of the filesystem package.
for d in $usrmove_file_names ; do
rm "%{glibc_sysroot}/$d"
done
############################################################################### ###############################################################################
# Sysroot package creation. # Sysroot package creation.
@ -2571,12 +2591,12 @@ fi
echo ====================TESTING END===================== echo ====================TESTING END=====================
PLTCMD='/^Relocation section .*\(\.rela\?\.plt\|\.rela\.IA_64\.pltoff\)/,/^$/p' PLTCMD='/^Relocation section .*\(\.rela\?\.plt\|\.rela\.IA_64\.pltoff\)/,/^$/p'
echo ====================PLT RELOCS LD.SO================ echo ====================PLT RELOCS LD.SO================
readelf -Wr %{glibc_sysroot}/%{_lib}/ld-*.so | sed -n -e "$PLTCMD" readelf -Wr %{glibc_sysroot}%{_libdir}/ld-*.so | sed -n -e "$PLTCMD"
echo ====================PLT RELOCS LIBC.SO============== echo ====================PLT RELOCS LIBC.SO==============
readelf -Wr %{glibc_sysroot}/%{_lib}/libc-*.so | sed -n -e "$PLTCMD" readelf -Wr %{glibc_sysroot}%{_libdir}/libc-*.so | sed -n -e "$PLTCMD"
echo ====================PLT RELOCS END================== echo ====================PLT RELOCS END==================
run_ldso="%{glibc_sysroot}/%{glibc_ldso} --library-path %{glibc_sysroot}/%{_lib}" run_ldso="%{glibc_sysroot}/%{_prefix}%{glibc_ldso} --library-path %{glibc_sysroot}/%{_libdir}"
# Show the auxiliary vector as seen by the new library # Show the auxiliary vector as seen by the new library
# (even if we do not perform the valgrind test). # (even if we do not perform the valgrind test).
@ -2802,30 +2822,30 @@ update_gconv_modules_cache ()
%systemd_postun_with_restart nscd.service %systemd_postun_with_restart nscd.service
%files -f glibc.filelist %files -f glibc.filelist
/sbin/ldconfig %{_sbindir}/ldconfig
%{_sbindir}/iconvconfig %{_sbindir}/iconvconfig
%{_libexecdir}/getconf %{_libexecdir}/getconf
%{glibc_ldso} %{_prefix}%{glibc_ldso}
/%{_lib}/libBrokenLocale.so.1 %{_libdir}/libBrokenLocale.so.1
/%{_lib}/libSegFault.so %{_libdir}/libSegFault.so
/%{_lib}/libanl.so.1 %{_libdir}/libanl.so.1
/%{_lib}/libc.so.6 %{_libdir}/libc.so.6
/%{_lib}/libc_malloc_debug.so.0 %{_libdir}/libc_malloc_debug.so.0
/%{_lib}/libdl.so.2 %{_libdir}/libdl.so.2
/%{_lib}/libm.so.6 %{_libdir}/libm.so.6
/%{_lib}/libnss_compat.so.2
/%{_lib}/libnss_dns.so.2
/%{_lib}/libnss_files.so.2
/%{_lib}/libpthread.so.0
/%{_lib}/libresolv.so.2
/%{_lib}/librt.so.1
/%{_lib}/libthread_db.so.1
/%{_lib}/libutil.so.1
%{_libdir}/audit
%{_libdir}/libmemusage.so %{_libdir}/libmemusage.so
%{_libdir}/libnss_compat.so.2
%{_libdir}/libnss_dns.so.2
%{_libdir}/libnss_files.so.2
%{_libdir}/libpcprofile.so %{_libdir}/libpcprofile.so
%{_libdir}/libpthread.so.0
%{_libdir}/libresolv.so.2
%{_libdir}/librt.so.1
%{_libdir}/libthread_db.so.1
%{_libdir}/libutil.so.1
%{_libdir}/audit
%if %{glibc_has_libmvec} %if %{glibc_has_libmvec}
/%{_lib}/libmvec.so.1 %{_libdir}/libmvec.so.1
%endif %endif
%if %{buildpower10} %if %{buildpower10}
%{_libdir}/glibc-hwcaps %{_libdir}/glibc-hwcaps
@ -2951,8 +2971,8 @@ update_gconv_modules_cache ()
%config(noreplace) /etc/nscd.conf %config(noreplace) /etc/nscd.conf
%dir %attr(0755,root,root) /var/run/nscd %dir %attr(0755,root,root) /var/run/nscd
%dir %attr(0755,root,root) /var/db/nscd %dir %attr(0755,root,root) /var/db/nscd
/lib/systemd/system/nscd.service %{_prefix}/lib/systemd/system/nscd.service
/lib/systemd/system/nscd.socket %{_prefix}/lib/systemd/system/nscd.socket
%{_tmpfilesdir}/nscd.conf %{_tmpfilesdir}/nscd.conf
%attr(0644,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/run/nscd/nscd.pid %attr(0644,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/run/nscd/nscd.pid
%attr(0666,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/run/nscd/socket %attr(0666,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/run/nscd/socket
@ -2969,10 +2989,10 @@ update_gconv_modules_cache ()
%files -n nss_db %files -n nss_db
%{_bindir}/makedb %{_bindir}/makedb
/%{_lib}/libnss_db.so.2 %{_libdir}/libnss_db.so.2
/var/db/Makefile /var/db/Makefile
%files -n nss_hesiod %files -n nss_hesiod
/%{_lib}/libnss_hesiod.so.2 %{_libdir}/libnss_hesiod.so.2
%doc hesiod/README.hesiod %doc hesiod/README.hesiod
%files nss-devel %files nss-devel
%{_libdir}/libnss_compat.so %{_libdir}/libnss_compat.so
@ -2980,7 +3000,7 @@ update_gconv_modules_cache ()
%{_libdir}/libnss_hesiod.so %{_libdir}/libnss_hesiod.so
%files -n libnsl %files -n libnsl
/%{_lib}/libnsl.so.1 %{_libdir}/libnsl.so.1
%if %{with benchtests} %if %{with benchtests}
%files benchtests %files benchtests
@ -2996,6 +3016,9 @@ update_gconv_modules_cache ()
%endif %endif
%changelog %changelog
* Mon Dec 9 2024 Florian Weimer <fweimer@redhat.com> - 2.34-146
- Use UsrMove path destination in the RPM files (RHEL-65334)
* Thu Dec 5 2024 DJ Delorie <dj@redhat.com> - 2.34-145 * Thu Dec 5 2024 DJ Delorie <dj@redhat.com> - 2.34-145
- add GB18030-2022 charmap and tests (RHEL-56032) - add GB18030-2022 charmap and tests (RHEL-56032)