From 01272616249f1a85eeb09d43d56f797b75b9fec6 Mon Sep 17 00:00:00 2001 From: Fabian Groffen Date: Wed, 9 Dec 2009 19:00:23 +0000 Subject: [PATCH] Rename --with-default-path into --with-extra-path, since it never completely defines DEFAULT_PATH (it only appends) and we need to ensure that whatever is given always comes as last in the PATH. Added full compatability for non Prefix (trunk) by setting DEFAULT_PATH to the expected value as in trunk when no offset prefix is used. svn path=/main/branches/prefix/; revision=14984 --- bin/ebuild.sh | 12 ++++++++---- cnf/make.globals | 2 ++ configure.in | 14 +++++++++----- subst-install.in | 1 + 4 files changed, 20 insertions(+), 9 deletions(-) diff --git a/bin/ebuild.sh b/bin/ebuild.sh index 0479f8ccc..caab7eca4 100755 --- a/bin/ebuild.sh +++ b/bin/ebuild.sh @@ -29,8 +29,12 @@ ROOTPATH=${ROOTPATH%%:} PREROOTPATH=${PREROOTPATH##:} PREROOTPATH=${PREROOTPATH%%:} #PATH=$PORTAGE_BIN_PATH/ebuild-helpers:$PREROOTPATH${PREROOTPATH:+:}/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin${ROOTPATH:+:}$ROOTPATH -# PREFIX: we deviate in path order, should we split up DEFAULT_PATH? -PATH="$PORTAGE_BIN_PATH/ebuild-helpers:$PREROOTPATH${PREROOTPATH:+:}${DEFAULT_PATH}:${ROOTPATH:+:}$ROOTPATH" +# PREFIX: our DEFAULT_PATH is equal to the above when not using an +# offset prefix. With such prefix, the usr/local bits are excluded, and +# the prefixed variants of {usr/,}{s,}bin are taken. The additional +# paths given during configure, always come as last thing since they +# should never override anything from the prefix itself. +PATH="$PORTAGE_BIN_PATH/ebuild-helpers:$PREROOTPATH${PREROOTPATH:+:}${DEFAULT_PATH}${ROOTPATH:+:}$ROOTPATH${EXTRA_PATH:+:}${EXTRA_PATH}" export PATH # These two functions wrap sourcing and calling respectively. At present they @@ -1953,8 +1957,8 @@ ebuild_main() { esac #PATH=$ebuild_helpers_path:$PREROOTPATH${PREROOTPATH:+:}/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin${ROOTPATH:+:}$ROOTPATH - # PREFIX: same deviation as at the top of this file - PATH="$ebuild_helpers_path:$PREROOTPATH${PREROOTPATH:+:}${DEFAULT_PATH}${ROOTPATH:+:}$ROOTPATH" + # PREFIX: same notes apply as at the top of this file + PATH="$ebuild_helpers_path:$PREROOTPATH${PREROOTPATH:+:}${DEFAULT_PATH}${ROOTPATH:+:}$ROOTPATH${EXTRA_PATH:+:}${EXTRA_PATH}" unset ebuild_helpers_path if ! hasq $EBUILD_SH_ARGS clean depend help info nofetch ; then diff --git a/cnf/make.globals b/cnf/make.globals index 2e54d2409..7650b3e08 100644 --- a/cnf/make.globals +++ b/cnf/make.globals @@ -99,6 +99,8 @@ PORTAGE_INST_GID="@rootgid@" # Default PATH for ebuild env DEFAULT_PATH="@DEFAULT_PATH@" +# Any extra PATHs to add to the ebuild environment's PATH (if any) +EXTRA_PATH="@EXTRA_PATH@" # Mode bits for ${WORKDIR} (see ebuild.5). PORTAGE_WORKDIR_MODE="0700" diff --git a/configure.in b/configure.in index 3d0f8ba32..81d1ce1c6 100644 --- a/configure.in +++ b/configure.in @@ -198,13 +198,16 @@ AC_HELP_STRING([--with-offset-prefix], if test "x$PORTAGE_EPREFIX" != "x" then PORTAGE_EPREFIX=`${PORTAGE_PYTHON} -c "import os; print os.path.normpath('$PORTAGE_EPREFIX')"` + DEFAULT_PATH="${PORTAGE_EPREFIX}/usr/sbin:${PORTAGE_EPREFIX}/usr/bin:${PORTAGE_EPREFIX}/sbin:${PORTAGE_EPREFIX}/bin" +else + # this is what trunk uses in ebuild.sh + DEFAULT_PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" fi -DEFAULT_PATH="${PORTAGE_EPREFIX}/usr/bin:${PORTAGE_EPREFIX}/usr/sbin:${PORTAGE_EPREFIX}/bin:${PORTAGE_EPREFIX}/sbin:${PORTAGE_EPREFIX}/bin" -AC_ARG_WITH(default-path, -AC_HELP_STRING([--with-default-path], [specify additional PATHs available to the portage build environment ]), -[DEFAULT_PATH="${DEFAULT_PATH}":$withval], -[DEFAULT_PATH="${DEFAULT_PATH}"]) +AC_ARG_WITH(extra-path, +AC_HELP_STRING([--with-extra-path], [specify additional PATHs available to the portage build environment (use with care)]), +[EXTRA_PATH="$withval"], +[EXTRA_PATH=""]) AC_SUBST(portageuser) AC_SUBST(portagegroup) @@ -213,6 +216,7 @@ AC_SUBST(rootuid) AC_SUBST(rootgid) AC_SUBST(PORTAGE_EPREFIX) AC_SUBST(DEFAULT_PATH) +AC_SUBST(EXTRA_PATH) AC_SUBST(PORTAGE_BASE,['${exec_prefix}/lib/portage']) AC_SUBST(PORTAGE_RM) diff --git a/subst-install.in b/subst-install.in index 01cd845ec..24dc4fa7b 100644 --- a/subst-install.in +++ b/subst-install.in @@ -21,6 +21,7 @@ portageuser=${portageuser//\\/\\\\\\\\} at='@' sedexp=( -e "s,${at}DEFAULT_PATH${at},@DEFAULT_PATH@,g" + -e "s,${at}EXTRA_PATH${at},@EXTRA_PATH@,g" -e "s,${at}EGREP${at},@EGREP@,g" -e "s,${at}PORTAGE_BASE${at},@PORTAGE_BASE@,g" -e "s,${at}PORTAGE_BASENAME${at},@PORTAGE_BASENAME@,g" -- 2.26.2