commit:     bd2656625bf0ed0b05e5b6de9ead4a73f09c58fe
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Nov 18 00:45:48 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Nov 19 03:02:40 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bd265662

sys-libs/musl: additional ROOT fixes for ldconfig

Move around some declarations so we get sensible default
values but only perform the sanity checks _after_ we
parse command line arguments to take into account e.g.
-r (root).

Bug: https://bugs.gentoo.org/666246
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/musl/files/ldconfig.in-r1                      | 17 +++++++++--------
 .../musl/{musl-9999.ebuild => musl-1.2.2-r5.ebuild}     | 11 +++++++++--
 sys-libs/musl/musl-9999.ebuild                          |  2 +-
 3 files changed, 19 insertions(+), 11 deletions(-)

diff --git a/sys-libs/musl/files/ldconfig.in-r1 
b/sys-libs/musl/files/ldconfig.in-r1
index 362d11ce815a..14aa7c3466b8 100644
--- a/sys-libs/musl/files/ldconfig.in-r1
+++ b/sys-libs/musl/files/ldconfig.in-r1
@@ -1,16 +1,9 @@
 #!/bin/bash -e
-# Copyright 1999-2015 Gentoo Foundation
+# Copyright 1999-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 ROOT="/"
-
 LDSO_CONF="/etc/ld.so.conf"
-if [[ ! -e $LDSO_CONF ]]; then
-       echo "$LDSO_CONF not found" >&2
-       exit 1
-fi
-
-LDSO_CONF_DIR=$(dirname $LDSO_CONF)
 
 VERBOSE=0
 
@@ -124,6 +117,14 @@ sanitize() {
 }
 
 get_options "$@"
+
+if [[ ! -e $LDSO_CONF ]]; then
+        echo "$LDSO_CONF not found" >&2
+        exit 1
+fi
+
+LDSO_CONF_DIR=$(dirname $LDSO_CONF)
+
 drs=$(read_ldso_conf "$LDSO_CONF")
 drs=$(sanitize $drs)
 

diff --git a/sys-libs/musl/musl-9999.ebuild b/sys-libs/musl/musl-1.2.2-r5.ebuild
similarity index 94%
copy from sys-libs/musl/musl-9999.ebuild
copy to sys-libs/musl/musl-1.2.2-r5.ebuild
index 1ba86e7846fb..79a60682c79f 100644
--- a/sys-libs/musl/musl-9999.ebuild
+++ b/sys-libs/musl/musl-1.2.2-r5.ebuild
@@ -9,7 +9,7 @@ if [[ ${PV} == "9999" ]] ; then
        inherit git-r3
 else
        SRC_URI="http://www.musl-libc.org/releases/${P}.tar.gz";
-       KEYWORDS="-* ~amd64 ~arm ~arm64 ~mips ~ppc ~ppc64 ~x86"
+       KEYWORDS="-* amd64 arm arm64 ~mips ppc ppc64 x86"
 fi
 GETENT_COMMIT="93a08815f8598db442d8b766b463d0150ed8e2ab"
 GETENT_FILE="musl-getent-${GETENT_COMMIT}.c"
@@ -71,6 +71,13 @@ src_unpack() {
        cp "${DISTDIR}"/iconv.c misc/iconv.c || die
 }
 
+src_prepare() {
+       default
+
+       # Expand gethostid instead of being just a stub
+       eapply "${FILESDIR}/${PN}-1.2.2-gethostid.patch"
+}
+
 src_configure() {
        tc-getCC ${CTARGET}
        just_headers && export CC=true
@@ -137,7 +144,7 @@ src_install() {
                        [[ -e "${ED}"/lib/ld-musl-${arch}.so.1 ]] || die
                fi
 
-               cp "${FILESDIR}"/ldconfig.in "${T}" || die
+               cp "${FILESDIR}"/ldconfig.in-r1 "${T}"/ldconfig.in || die
                sed -e "s|@@ARCH@@|${arch}|" "${T}"/ldconfig.in > 
"${T}"/ldconfig || die
                into /
                dosbin "${T}"/ldconfig

diff --git a/sys-libs/musl/musl-9999.ebuild b/sys-libs/musl/musl-9999.ebuild
index 1ba86e7846fb..0d528e720587 100644
--- a/sys-libs/musl/musl-9999.ebuild
+++ b/sys-libs/musl/musl-9999.ebuild
@@ -137,7 +137,7 @@ src_install() {
                        [[ -e "${ED}"/lib/ld-musl-${arch}.so.1 ]] || die
                fi
 
-               cp "${FILESDIR}"/ldconfig.in "${T}" || die
+               cp "${FILESDIR}"/ldconfig.in "${T}"/ldconfig.in || die
                sed -e "s|@@ARCH@@|${arch}|" "${T}"/ldconfig.in > 
"${T}"/ldconfig || die
                into /
                dosbin "${T}"/ldconfig

Reply via email to