commit:     8984aa4a29074f6040de6ff6630391ecb6925dc3
Author:     Michael Haubenwallner <haubi <AT> gentoo <DOT> org>
AuthorDate: Wed Apr  5 14:07:06 2017 +0000
Commit:     Michael Haubenwallner <haubi <AT> gentoo <DOT> org>
CommitDate: Wed Apr  5 14:07:20 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8984aa4a

sys-apps/baselayout-prefix: fix etc/profile in chained prefix

Package-Manager: portage-2.3.3

 sys-apps/baselayout-prefix/baselayout-prefix-2.2-r5.ebuild   | 11 +++++++++--
 .../files/baselayout-2.2-prefix-chaining.patch               | 12 +++++++++---
 2 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/sys-apps/baselayout-prefix/baselayout-prefix-2.2-r5.ebuild 
b/sys-apps/baselayout-prefix/baselayout-prefix-2.2-r5.ebuild
index c6f34fa6a9a..628b47af038 100644
--- a/sys-apps/baselayout-prefix/baselayout-prefix-2.2-r5.ebuild
+++ b/sys-apps/baselayout-prefix/baselayout-prefix-2.2-r5.ebuild
@@ -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" \

diff --git 
a/sys-apps/baselayout-prefix/files/baselayout-2.2-prefix-chaining.patch 
b/sys-apps/baselayout-prefix/files/baselayout-2.2-prefix-chaining.patch
index b6b51b969a8..98e41b95bb9 100644
--- a/sys-apps/baselayout-prefix/files/baselayout-2.2-prefix-chaining.patch
+++ b/sys-apps/baselayout-prefix/files/baselayout-2.2-prefix-chaining.patch
@@ -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.
  #
  
@@ -14,7 +14,13 @@
 +# 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

Reply via email to