#!/bin/bash
-# Copyright 1999-2010 Gentoo Foundation
+# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
exit 1
fi
-case "$EAPI" in 0|1|2) ED=${D} ;; esac
+[[ " ${USE} " == *" prefix "* ]] || \
+ case "$EAPI" in 0|1|2) ED=${D} ;; esac
if [[ ! -d ${ED}${DESTTREE}/bin ]] ; then
install -d "${ED}${DESTTREE}/bin" || { helpers_die "${0##*/}: failed to install ${ED}${DESTTREE}/bin"; exit 2; }
source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
-case "$EAPI" in 0|1|2) ED=${D} ;; esac
+[[ " ${USE} " == *" prefix "* ]] || \
+ case "$EAPI" in 0|1|2) ED=${D} ;; esac
install -d ${DIROPTIONS} "${@/#/${ED}/}"
ret=$?
exit 1
fi
-case "$EAPI" in 0|1|2) ED=${D} ;; esac
+[[ " ${USE} " == *" prefix "* ]] || \
+ case "$EAPI" in 0|1|2) ED=${D} ;; esac
dir="${ED}usr/share/doc/${PF}/${_E_DOCDESTTREE_}"
if [ ! -d "${dir}" ] ; then
exit 1
fi
-case "$EAPI" in 0|1|2) ED=${D} ;; esac
+[[ " ${USE} " == *" prefix "* ]] || \
+ case "$EAPI" in 0|1|2) ED=${D} ;; esac
if [[ ! -d ${ED}${_E_EXEDESTTREE_} ]] ; then
install -d "${ED}${_E_EXEDESTTREE_}"
exit 1
fi
-case "$EAPI" in 0|1|2) ED=${D} ;; esac
+[[ " ${USE} " == *" prefix "* ]] || \
+ case "$EAPI" in 0|1|2) ED=${D} ;; esac
destdir=${2%/*}
[[ ! -d ${ED}${destdir} ]] && dodir "${destdir}"
exit 1
fi
-case "$EAPI" in 0|1|2) ED=${D} ;; esac
+[[ " ${USE} " == *" prefix "* ]] || \
+ case "$EAPI" in 0|1|2) ED=${D} ;; esac
if [[ ! -d ${ED}usr/share/info ]] ; then
install -d "${ED}usr/share/info" || { helpers_die "${0##*/}: failed to install ${ED}usr/share/info"; exit 1; }
DOINSRECUR=n
fi
-case "$EAPI" in 0|1|2) export ED="${D}" ;; esac
+[[ " ${USE} " == *" prefix "* ]] || \
+ case "$EAPI" in 0|1|2) export ED="${D}" ;; esac
if [[ ${INSDESTTREE#${ED}} != "${INSDESTTREE}" ]]; then
vecho "-------------------------------------------------------" 1>&2
source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
-case "$EAPI" in 0|1|2) ED=${D} ;; esac
+[[ " ${USE} " == *" prefix "* ]] || \
+ case "$EAPI" in 0|1|2) ED=${D} ;; esac
# Setup ABI cruft
LIBDIR_VAR="LIBDIR_${ABI}"
exit 1
fi
-case "$EAPI" in 0|1|2) ED=${D} ;; esac
+[[ " ${USE} " == *" prefix "* ]] || \
+ case "$EAPI" in 0|1|2) ED=${D} ;; esac
i18n=""
exit 1
fi
-case "$EAPI" in 0|1|2) ED=${D} ;; esac
+[[ " ${USE} " == *" prefix "* ]] || \
+ case "$EAPI" in 0|1|2) ED=${D} ;; esac
if [ ! -d "${ED}${DESTTREE}/share/locale" ] ; then
install -d "${ED}${DESTTREE}/share/locale/"
exit 1
fi
-case "$EAPI" in 0|1|2) ED=${D} ;; esac
+[[ " ${USE} " == *" prefix "* ]] || \
+ case "$EAPI" in 0|1|2) ED=${D} ;; esac
if [[ ! -d ${ED}${DESTTREE}/sbin ]] ; then
install -d "${ED}${DESTTREE}/sbin" || { helpers_die "${0##*/}: failed to install ${ED}${DESTTREE}/sbin"; exit 2; }
exit 1
fi
-case "$EAPI" in 0|1|2) ED=${D} ;; esac
+[[ " ${USE} " == *" prefix "* ]] || \
+ case "$EAPI" in 0|1|2) ED=${D} ;; esac
ret=0
file_found=0
exit 1
fi
-case "$EAPI" in 0|1|2) ED=${D} ;; esac
+[[ " ${USE} " == *" prefix "* ]] || \
+ case "$EAPI" in 0|1|2) ED=${D} ;; esac
if [[ ${2} == */ ]] || \
[[ -d ${ED}${2} && ! -L ${ED}${2} ]] ; then
exit 1
fi
-case "$EAPI" in 0|1|2) ED=${D} ;; esac
+[[ " ${USE} " == *" prefix "* ]] || \
+ case "$EAPI" in 0|1|2) ED=${D} ;; esac
case $1 in
--ignore)
source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
-case "$EAPI" in 0|1|2) ED=${D} ;; esac
+[[ " ${USE} " == *" prefix "* ]] || \
+ case "$EAPI" in 0|1|2) ED=${D} ;; esac
# we can't prefix all arguments because
# chown takes random options
source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
-case "$EAPI" in 0|1|2) ED=${D} ;; esac
+[[ " ${USE} " == *" prefix "* ]] || \
+ case "$EAPI" in 0|1|2) ED=${D} ;; esac
+
# we can't prefix all arguments because
# chmod takes random options
slash="/"
source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
-case "$EAPI" in 0|1|2) ED=${D} ;; esac
+[[ " ${USE} " == *" prefix "* ]] || \
+ case "$EAPI" in 0|1|2) ED=${D} ;; esac
if has chflags $FEATURES ; then
# Save all the file flags for restoration at the end of prepall.
vecho "${0##*/}: invalid usage; takes no arguments" 1>&2
fi
-case "$EAPI" in 0|1|2) ED=${D} ;; esac
+[[ " ${USE} " == *" prefix "* ]] || \
+ case "$EAPI" in 0|1|2) ED=${D} ;; esac
[[ -d ${ED}usr/share/doc ]] || exit 0
source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
-case "$EAPI" in 0|1|2) ED=${D} ;; esac
+[[ " ${USE} " == *" prefix "* ]] || \
+ case "$EAPI" in 0|1|2) ED=${D} ;; esac
[[ -d ${ED}usr/share/info ]] || exit 0
# replaced by controllable compression in EAPI 4
has "${EAPI}" 0 1 2 3 || exit 0
-case "$EAPI" in 0|1|2) ED=${D} ;; esac
+[[ " ${USE} " == *" prefix "* ]] || \
+ case "$EAPI" in 0|1|2) ED=${D} ;; esac
ret=0
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-case "$EAPI" in 0|1|2) ED=${D} ;; esac
+[[ " ${USE} " == *" prefix "* ]] || \
+ case "$EAPI" in 0|1|2) ED=${D} ;; esac
exec prepstrip "${ED}"
source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
-case "$EAPI" in 0|1|2) ED=${D} ;; esac
+[[ " ${USE} " == *" prefix "* ]] || \
+ case "$EAPI" in 0|1|2) ED=${D} ;; esac
if [[ -z $1 ]] ; then
infodir="/usr/share/info"
eqawarn "QA Notice: Deprecated call to 'preplib'"
-case "$EAPI" in 0|1|2) ED=${D} ;; esac
+[[ " ${USE} " == *" prefix "* ]] || \
+ case "$EAPI" in 0|1|2) ED=${D} ;; esac
LIBDIR_VAR="LIBDIR_${ABI}"
if [ -n "${ABI}" -a -n "${!LIBDIR_VAR}" ]; then
source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
-case "$EAPI" in 0|1|2) ED=${D} ;; esac
+[[ " ${USE} " == *" prefix "* ]] || \
+ case "$EAPI" in 0|1|2) ED=${D} ;; esac
if [[ -z $1 ]] ; then
mandir="${ED}usr/share/man"
exp_tf FEATURES installsources nostrip splitdebug
exp_tf RESTRICT binchecks installsources strip
-case "$EAPI" in 0|1|2) ED=${D} ;; esac
+[[ " ${USE} " == *" prefix "* ]] || \
+ case "$EAPI" in 0|1|2) ED=${D} ;; esac
banner=false
SKIP_STRIP=false
declare -r $PORTAGE_READONLY_METADATA $PORTAGE_READONLY_VARS
case "$EAPI" in
0|1|2)
+ [[ " ${USE} " == *" prefix "* ]] && \
+ declare -r ED EPREFIX EROOT
;;
*)
declare -r ED EPREFIX EROOT
source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}/ebuild.sh"
install_symlink_html_docs() {
- case "$EAPI" in 0|1|2) local ED=${D} ;; esac
+ [[ " ${USE} " == *" prefix "* ]] || \
+ case "$EAPI" in 0|1|2) local ED=${D} ;; esac
cd "${ED}" || die "cd failed"
#symlink the html documentation (if DOC_SYMLINKS_DIR is set in make.conf)
if [ -n "${DOC_SYMLINKS_DIR}" ] ; then
prepcompress() {
local -a include exclude incl_d incl_f
local f g i real_f real_d
- case "$EAPI" in 0|1|2) local ED=${D} ;; esac
+ [[ " ${USE} " == *" prefix "* ]] || \
+ case "$EAPI" in 0|1|2) local ED=${D} ;; esac
# Canonicalize path names and check for their existence.
real_d=$(canonicalize "${ED}")
install_qa_check() {
local f i x
- case "$EAPI" in 0|1|2) local ED=${D} ;; esac
+ [[ " ${USE} " == *" prefix "* ]] || \
+ case "$EAPI" in 0|1|2) local ED=${D} ;; esac
cd "${ED}" || die "cd failed"
return 1
fi
- case "$EAPI" in 0|1|2) local ED=${D} ;; esac
+ [[ " ${USE} " == *" prefix "* ]] || \
+ case "$EAPI" in 0|1|2) local ED=${D} ;; esac
# Make sure $PWD is not ${D} so that we don't leave gmon.out files
# in there in case any tools were built with -pg in CFLAGS.
return 1
fi
- case "$EAPI" in 0|1|2) local ED=${D} ;; esac
+ [[ " ${USE} " == *" prefix "* ]] || \
+ case "$EAPI" in 0|1|2) local ED=${D} ;; esac
# Smart FileSystem Permissions
if has sfperms $FEATURES; then
return 1
fi
- case "$EAPI" in 0|1|2) local ED=${D} ;; esac
+ [[ " ${USE} " == *" prefix "* ]] || \
+ case "$EAPI" in 0|1|2) local ED=${D} ;; esac
# total suid control.
if has suidctl $FEATURES; then
dyn_package() {
- case "$EAPI" in 0|1|2) local ED=${D} ;; esac
+ [[ " ${USE} " == *" prefix "* ]] || \
+ case "$EAPI" in 0|1|2) local ED=${D} ;; esac
# Make sure $PWD is not ${D} so that we don't leave gmon.out files
# in there in case any tools were built with -pg in CFLAGS.
dyn_rpm() {
- case "$EAPI" in 0|1|2) local EPREFIX= ;; esac
+ [[ " ${USE} " == *" prefix "* ]] || \
+ case "$EAPI" in 0|1|2) local EPREFIX= ;; esac
cd "${T}" || die "cd failed"
local machine_name=$(uname -m)
# supported by the current EAPI.
case "${EAPI:-0}" in
0|1|2)
+ [[ " ${USE} " == *" prefix "* ]] && \
+ filtered_vars+=" ED EPREFIX EROOT"
;;
*)
filtered_vars+=" ED EPREFIX EROOT"
ebuild_phase pre_src_install
_x=${ED}
- case "$EAPI" in 0|1|2) _x=${D} ;; esac
+ [[ " ${USE} " == *" prefix "* ]] || \
+ case "$EAPI" in 0|1|2) _x=${D} ;; esac
rm -rf "${D}"
mkdir -p "${_x}"
unset _x
export DESTTREE=""
else
export DESTTREE=$1
- case "$EAPI" in 0|1|2) local ED=${D} ;; esac
+ [[ " ${USE} " == *" prefix "* ]] || \
+ case "$EAPI" in 0|1|2) local ED=${D} ;; esac
if [ ! -d "${ED}${DESTTREE}" ]; then
install -d "${ED}${DESTTREE}"
local ret=$?
export INSDESTTREE=""
else
export INSDESTTREE=$1
- case "$EAPI" in 0|1|2) local ED=${D} ;; esac
+ [[ " ${USE} " == *" prefix "* ]] || \
+ case "$EAPI" in 0|1|2) local ED=${D} ;; esac
if [ ! -d "${ED}${INSDESTTREE}" ]; then
install -d "${ED}${INSDESTTREE}"
local ret=$?
export _E_EXEDESTTREE_=""
else
export _E_EXEDESTTREE_="$1"
- case "$EAPI" in 0|1|2) local ED=${D} ;; esac
+ [[ " ${USE} " == *" prefix "* ]] || \
+ case "$EAPI" in 0|1|2) local ED=${D} ;; esac
if [ ! -d "${ED}${_E_EXEDESTTREE_}" ]; then
install -d "${ED}${_E_EXEDESTTREE_}"
local ret=$?
export _E_DOCDESTTREE_=""
else
export _E_DOCDESTTREE_="$1"
- case "$EAPI" in 0|1|2) local ED=${D} ;; esac
+ [[ " ${USE} " == *" prefix "* ]] || \
+ case "$EAPI" in 0|1|2) local ED=${D} ;; esac
if [ ! -d "${ED}usr/share/doc/${PF}/${_E_DOCDESTTREE_}" ]; then
install -d "${ED}usr/share/doc/${PF}/${_E_DOCDESTTREE_}"
local ret=$?
keepdir() {
dodir "$@"
local x
- case "$EAPI" in 0|1|2) local ED=${D} ;; esac
+ [[ " ${USE} " == *" prefix "* ]] || \
+ case "$EAPI" in 0|1|2) local ED=${D} ;; esac
if [ "$1" == "-R" ] || [ "$1" == "-r" ]; then
shift
find "$@" -type d -printf "${ED}%p/.keep_${CATEGORY}_${PN}-${SLOT}\n" \
econf() {
local x
- case "$EAPI" in 0|1|2) local EPREFIX= ;; esac
+ [[ " ${USE} " == *" prefix "* ]] || \
+ case "$EAPI" in 0|1|2) local EPREFIX= ;; esac
_hasg() {
local x s=$1
einstall() {
# CONF_PREFIX is only set if they didn't pass in libdir above.
local LOCAL_EXTRA_EINSTALL="${EXTRA_EINSTALL}"
- case "$EAPI" in 0|1|2) local ED=${D} ;; esac
+ [[ " ${USE} " == *" prefix "* ]] || \
+ case "$EAPI" in 0|1|2) local ED=${D} ;; esac
LIBDIR_VAR="LIBDIR_${ABI}"
if [ -n "${ABI}" -a -n "${!LIBDIR_VAR}" ]; then
CONF_LIBDIR="${!LIBDIR_VAR}"
local eroot
case "$EAPI" in
0|1|2)
- eroot=${ROOT}
+ [[ " ${USE} " == *" prefix "* ]] && \
+ eroot=${ROOT%/}${EPREFIX}/ || eroot=${ROOT}
;;
*)
eroot=${ROOT%/}${EPREFIX}/
local eroot
case "$EAPI" in
0|1|2)
- eroot=${ROOT}
+ [[ " ${USE} " == *" prefix "* ]] && \
+ eroot=${ROOT%/}${EPREFIX}/ || eroot=${ROOT}
;;
*)
eroot=${ROOT%/}${EPREFIX}/
if not eapi_exports_merge_type(eapi):
mydict.pop("MERGE_TYPE", None)
- # Prefix variables are supported starting with EAPI 3.
- if phase == 'depend' or eapi is None or not eapi_supports_prefix(eapi):
+ # Prefix variables are supported beginning with EAPI 3, or when EPREFIX
+ # is non-empty (implying that EPREFIX support is required in the
+ # current environment, regardless of EAPI). For EAPIs prior to 3,
+ # ebuild helpers rely on these variables only when USE=prefix is
+ # enabled. This is safe because the prefix flag should be masked in all
+ # non-prefix profiles, and older EAPIs would otherwise be useless with
+ # prefix configurations. This brings compatibility with the prefix
+ # branch of portage, which also supports EPREFIX for all EAPIs (for
+ # obvious reasons).
+ if phase == 'depend' or eapi is None or \
+ (not eapi_supports_prefix(eapi) and not mydict.get("EPREFIX")):
mydict.pop("ED", None)
mydict.pop("EPREFIX", None)
mydict.pop("EROOT", None)