commit:     9e5d587b00d17b5d3c2fc3d76b2f9cd7803df3ee
Author:     WANG Xuerui <xen0n <AT> gentoo <DOT> org>
AuthorDate: Sun Aug 27 07:06:07 2023 +0000
Commit:     WANG Xuerui <xen0n <AT> gentoo <DOT> org>
CommitDate: Mon Sep 18 09:54:49 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9e5d587b

sys-libs/glibc: refresh ld.so.cache if natively installing >=2.38 on loong

The 2.38 change is ~loong-only to avoid triggering rebuilds on other
arches.

Closes: https://github.com/gentoo/gentoo/pull/32470
Reviewed-by: Sam James <sam <AT> gentoo.org>
Signed-off-by: WANG Xuerui <xen0n <AT> gentoo.org>

 .../{glibc-9999.ebuild => glibc-2.38-r3.ebuild}    | 31 ++++++++++++++++++++--
 sys-libs/glibc/glibc-9999.ebuild                   | 26 ++++++++++++++++++
 2 files changed, 55 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-9999.ebuild 
b/sys-libs/glibc/glibc-2.38-r3.ebuild
similarity index 98%
copy from sys-libs/glibc/glibc-9999.ebuild
copy to sys-libs/glibc/glibc-2.38-r3.ebuild
index 4e85a4b43e39..2e8876560419 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-2.38-r3.ebuild
@@ -6,7 +6,7 @@ EAPI=8
 # Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
 # Please read & adapt the page as necessary if obsolete.
 
-PYTHON_COMPAT=( python3_{9..11} )
+PYTHON_COMPAT=( python3_{9..12} )
 TMPFILES_OPTIONAL=1
 
 inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic 
gnuconfig \
@@ -20,7 +20,7 @@ SLOT="2.2"
 EMULTILIB_PKG="true"
 
 # Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=1
+PATCH_VER=3
 PATCH_DEV=dilfridge
 
 # gcc mulitilib bootstrap files version
@@ -40,6 +40,7 @@ if [[ ${PV} == 9999* ]]; then
        inherit git-r3
 else
        #KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips 
~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+       KEYWORDS="~loong"
        SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
        SRC_URI+=" 
https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz";
 fi
@@ -1638,6 +1639,21 @@ pkg_preinst() {
        fi
 }
 
+glibc_refresh_ldconfig() {
+       if [[ ${MERGE_TYPE} == buildonly ]]; then
+               return
+       fi
+
+       # Version check could be added to avoid unnecessary work, but ldconfig
+       # should finish quickly enough to not matter.
+       ebegin "Refreshing ld.so.cache"
+       ldconfig -i
+       if ! eend $?; then
+               ewarn "Failed to refresh the ld.so.cache for you. Some programs 
may be broken"
+               ewarn "before you manually do so (ldconfig -i)."
+       fi
+}
+
 pkg_postinst() {
        # nothing to do if just installing headers
        just_headers && return
@@ -1648,6 +1664,17 @@ pkg_postinst() {
        fi
 
        if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+               # glibc-2.38+ on loong has ldconfig support added, but the ELF 
e_flags
+               # handling has changed as well, which means stale ldconfig 
auxiliary
+               # cache entries and failure to lookup libgcc_s / libstdc++ 
(breaking
+               # every C++ application) / libgomp etc., among other breakages.
+               #
+               # To fix this, simply refresh the ld.so.cache without using the
+               # auxiliary cache if we're natively installing on loong. This 
should
+               # be done relatively soon because we want to minimize the 
breakage
+               # window for the affected programs.
+               use loong && glibc_refresh_ldconfig
+
                use compile-locales || run_locale_gen "${EROOT}/"
        fi
 

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 4e85a4b43e39..a293423678ba 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -1638,6 +1638,21 @@ pkg_preinst() {
        fi
 }
 
+glibc_refresh_ldconfig() {
+       if [[ ${MERGE_TYPE} == buildonly ]]; then
+               return
+       fi
+
+       # Version check could be added to avoid unnecessary work, but ldconfig
+       # should finish quickly enough to not matter.
+       ebegin "Refreshing ld.so.cache"
+       ldconfig -i
+       if ! eend $?; then
+               ewarn "Failed to refresh the ld.so.cache for you. Some programs 
may be broken"
+               ewarn "before you manually do so (ldconfig -i)."
+       fi
+}
+
 pkg_postinst() {
        # nothing to do if just installing headers
        just_headers && return
@@ -1648,6 +1663,17 @@ pkg_postinst() {
        fi
 
        if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+               # glibc-2.38+ on loong has ldconfig support added, but the ELF 
e_flags
+               # handling has changed as well, which means stale ldconfig 
auxiliary
+               # cache entries and failure to lookup libgcc_s / libstdc++ 
(breaking
+               # every C++ application) / libgomp etc., among other breakages.
+               #
+               # To fix this, simply refresh the ld.so.cache without using the
+               # auxiliary cache if we're natively installing on loong. This 
should
+               # be done relatively soon because we want to minimize the 
breakage
+               # window for the affected programs.
+               use loong && glibc_refresh_ldconfig
+
                use compile-locales || run_locale_gen "${EROOT}/"
        fi
 

Reply via email to