sys-apps/baselayout-prefix: fix etc/profile in chained prefix
authorMichael Haubenwallner <haubi@gentoo.org>
Wed, 5 Apr 2017 14:07:06 +0000 (16:07 +0200)
committerMichael Haubenwallner <haubi@gentoo.org>
Wed, 5 Apr 2017 14:07:20 +0000 (16:07 +0200)
Package-Manager: portage-2.3.3

sys-apps/baselayout-prefix/baselayout-prefix-2.2-r5.ebuild
sys-apps/baselayout-prefix/files/baselayout-2.2-prefix-chaining.patch

index c6f34fa6a9a64eff03b8f622d201b527c4038b65..628b47af038e443920ba979875dc221d444f90ab 100644 (file)
@@ -37,6 +37,9 @@ src_prepare() {
                # but still .pc files should be found for all RDEPENDable prefixes in
                # the chain.
                echo "PKG_CONFIG_PATH=\"/usr/lib/pkgconfig:/usr/share/pkgconfig\"" >> etc/env.d/00basic
+               echo "PORTAGE_OVERRIDE_EPREFIX=\"${EPREFIX}\"" >> etc/env.d/00basic
+               echo "PORTAGE_CONFIGROOT=\"${EPREFIX}\"" >> etc/env.d/00basic
+               echo "EPREFIX=\"${EPREFIX}\"" >> etc/env.d/00basic
        fi
        default
 }
@@ -52,9 +55,13 @@ src_install() {
        sed \
                -e "/PATH=/!s:/\(etc\|usr/bin\|bin\):\"${EPREFIX}\"/\1:g" \
                -e "/PATH=/s|\([:\"]\)/|\1${EPREFIX}/|g" \
-               -e "/PATH=.*\/sbin/s|\"$|:/usr/sbin:/sbin\"|" \
-               -e "/PATH=.*\/bin/s|\"$|:/usr/bin:/bin\"|" \
                etc/profile > "${ED}"/etc/profile || die
+       if ! use prefix-chaining; then
+               sed \
+                       -e "/PATH=.*\/sbin/s|\"$|:/usr/sbin:/sbin\"|" \
+                       -e "/PATH=.*\/bin/s|\"$|:/usr/bin:/bin\"|" \
+                       -i "${ED}"/etc/profile || die
+       fi
        dodir etc/env.d
        sed \
                -e "s:/\(etc/env.d\|opt\|usr\):${EPREFIX}/\1:g" \
index b6b51b969a8ed11e3d4eff48b638eb8b72603f8a..98e41b95bb9194bf53dd34bc2120bcccfde547ff 100644 (file)
@@ -1,6 +1,6 @@
 --- baselayout-2.2/etc/profile.orig    2017-03-23 16:46:29.922123300 +0100
 +++ baselayout-2.2/etc/profile 2017-03-23 16:58:43.578360900 +0100
-@@ -4,6 +4,40 @@
+@@ -4,6 +4,46 @@
  # environment for login shells.
  #
  
 +# we have here, and thus it will source parents before
 +# evaluating anything from itself.
 +#
-+_ro_root=$(. /etc/make.conf && echo $READONLY_EPREFIX)
++if [[ -r /etc/portage/make.conf ]]; then
++      _ro_root=$(. /etc/portage/make.conf && echo $READONLY_EPREFIX)
++elif [[ -r /etc/make.conf ]]; then
++      _ro_root=$(. /etc/make.conf && echo $READONLY_EPREFIX)
++else
++      echo "Failed to read" /etc/portage/make.conf >&2
++fi
 +_ro_deps=${_ro_root#*:}
 +_ro_root=${_ro_root%:*}
 +if [ -n "${_ro_root}" -a -f "${_ro_root}/"etc/profile ]; then
@@ -41,7 +47,7 @@
  # Load environment settings from profile.env, which is created by
  # env-update from the files in /etc/env.d
  if [ -e /etc/profile.env ] ; then
-@@ -61,3 +95,17 @@
+@@ -61,3 +101,17 @@
        [ -r "$sh" ] && . "$sh"
  done
  unset sh