commit:     89a6524e68e3c8ab28aa57ab55b62f86f877cb45
Author:     Michael Haubenwallner <haubi <AT> gentoo <DOT> org>
AuthorDate: Mon Mar 27 12:56:46 2017 +0000
Commit:     Michael Haubenwallner <haubi <AT> gentoo <DOT> org>
CommitDate: Mon Mar 27 12:56:46 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=89a6524e

sys-apps/baselayout-prefix: update prefix-chaining

Package-Manager: portage-2.3.3

 .../baselayout-prefix-2.2-r5.ebuild                | 14 +++++
 .../files/baselayout-2.2-prefix-chaining.patch     | 61 ++++++++++++++++++++++
 2 files changed, 75 insertions(+)

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 91de672e773..c6f34fa6a9a 100644
--- a/sys-apps/baselayout-prefix/baselayout-prefix-2.2-r5.ebuild
+++ b/sys-apps/baselayout-prefix/baselayout-prefix-2.2-r5.ebuild
@@ -13,6 +13,7 @@ SRC_URI="mirror://gentoo/${MY_P}.tar.bz2
 
 LICENSE="GPL-2"
 SLOT="0"
+IUSE="prefix-chaining"
 KEYWORDS="~arm ~ppc-aix ~x64-cygwin ~amd64-linux ~arm-linux ~x86-linux 
~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris 
~x64-solaris ~x86-solaris ~x86-winnt"
 
 RDEPEND="sys-apps/gentoo-functions"
@@ -27,6 +28,19 @@ pkg_preinst() {
        rm -f "${EROOT}"/etc/._cfg????_gentoo-release
 }
 
+src_prepare() {
+       if use prefix-chaining; then
+               epatch "${FILESDIR}"/baselayout-${PV}-prefix-chaining.patch
+
+               # need to set the PKG_CONFIG_PATH globally for this prefix, when
+               # chaining is enabled, since pkg-config may not be installed 
locally,
+               # 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
+       fi
+       default
+}
+
 src_install() {
        # make functions.sh available in /etc/init.d (from gentoo-functions)
        # Note: we cannot replace the symlink with a file here, or Portage will

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
new file mode 100644
index 00000000000..b6b51b969a8
--- /dev/null
+++ b/sys-apps/baselayout-prefix/files/baselayout-2.2-prefix-chaining.patch
@@ -0,0 +1,61 @@
+--- 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 @@
+ # environment for login shells.
+ #
+ 
++#
++# for prefix-chaining, the very first thing to do is to load
++# the profiles for all chained instances above.
++#
++# TODO: is it safe in any case to shell source make.conf?
++# don't do any recursive expansion here. if the parent can
++# use READONLY_EPREFIX's, it has to have the same profile as
++# we have here, and thus it will source parents before
++# evaluating anything from itself.
++#
++_ro_root=$(. /etc/make.conf && echo $READONLY_EPREFIX)
++_ro_deps=${_ro_root#*:}
++_ro_root=${_ro_root%:*}
++if [ -n "${_ro_root}" -a -f "${_ro_root}/"etc/profile ]; then
++      . "${_ro_root}/"etc/profile
++fi
++
++#
++# With prefix-chaining we want another set of variables that
++# should be retained for all prefixes. for example it is ok
++# to retain PKG_CONFIG_PATH if the parent of the chain can
++# be used to resolve RDEPEND...
++#
++if [[ -n "${_ro_root}" ]]; then
++      _ro_chained_path_vars="PATH MANPATH"
++
++      [[ ${_ro_deps} == *RDEPEND* ]] &&
++              _ro_chained_path_vars="${_ro_chained_path_vars} PKG_CONFIG_PATH"
++
++      for var in ${_ro_chained_path_vars}; do
++              eval "_ro_backupenv_paths_${var}=\${${var}}"
++      done
++fi
++
+ # 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 @@
+       [ -r "$sh" ] && . "$sh"
+ done
+ unset sh
++
++#
++# finally chain the save variables for previous prefixes in the chain.
++#
++if [[ -n "${_ro_chained_path_vars}" ]]; then
++      for var in ${_ro_chained_path_vars}; do
++              eval "export ${var}=\${${var}}:\${_ro_backupenv_paths_${var}}"
++              eval "unset _ro_backupenv_paths_${var}"
++      done
++fi
++
++unset _ro_root
++unset _ro_deps
++unset _ro_chained_path_vars

Reply via email to