From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 0B8FD138C9D for ; Mon, 1 Jun 2015 06:35:00 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 1D94CE0930; Mon, 1 Jun 2015 06:34:58 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 8736FE0923 for ; Mon, 1 Jun 2015 06:34:57 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.gentoo.org (Postfix) with ESMTP id 9185C340C5B for ; Mon, 1 Jun 2015 06:34:56 +0000 (UTC) From: Mike Frysinger To: gentoo-portage-dev@lists.gentoo.org Subject: [gentoo-portage-dev] [PATCH] make PORTAGE_BIN_PATH settings relocatable Date: Mon, 1 Jun 2015 02:34:53 -0400 Message-Id: <1433140493-3288-1-git-send-email-vapier@gentoo.org> X-Mailer: git-send-email 2.4.1 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-portage-dev@lists.gentoo.org Reply-to: gentoo-portage-dev@lists.gentoo.org X-Archives-Salt: 5e767c81-1762-4751-b0dc-d7bc328126b8 X-Archives-Hash: 1f38bb165bd2fe3815131a52232a1aff Rather than hardcode /usr/lib/portage/bin everywhere, use the currently active script name to locate the right path. This helps out the Prefix project as they currently rewrite these on the fly, but even the latest portage no longer installs into that path. --- bin/ebuild-helpers/die | 5 ++++- bin/ebuild-helpers/dobin | 5 ++++- bin/ebuild-helpers/doconfd | 6 +++++- bin/ebuild-helpers/dodir | 5 ++++- bin/ebuild-helpers/dodoc | 5 ++++- bin/ebuild-helpers/doenvd | 6 +++++- bin/ebuild-helpers/doexe | 5 ++++- bin/ebuild-helpers/dohard | 5 ++++- bin/ebuild-helpers/doheader | 5 ++++- bin/ebuild-helpers/dohtml | 6 ++++-- bin/ebuild-helpers/doinfo | 5 ++++- bin/ebuild-helpers/doinitd | 6 +++++- bin/ebuild-helpers/doins | 5 ++++- bin/ebuild-helpers/dolib | 5 ++++- bin/ebuild-helpers/doman | 5 ++++- bin/ebuild-helpers/domo | 5 ++++- bin/ebuild-helpers/dosbin | 5 ++++- bin/ebuild-helpers/dosed | 5 ++++- bin/ebuild-helpers/dosym | 5 ++++- bin/ebuild-helpers/ecompress | 5 ++++- bin/ebuild-helpers/ecompressdir | 5 ++++- bin/ebuild-helpers/elog | 5 ++++- bin/ebuild-helpers/emake | 5 ++++- bin/ebuild-helpers/fowners | 5 ++++- bin/ebuild-helpers/fperms | 5 ++++- bin/ebuild-helpers/keepdir | 5 ++++- bin/ebuild-helpers/newins | 5 ++++- bin/ebuild-helpers/portageq | 5 ++++- bin/ebuild-helpers/prepall | 5 ++++- bin/ebuild-helpers/prepalldocs | 5 ++++- bin/ebuild-helpers/prepallinfo | 5 ++++- bin/ebuild-helpers/prepallman | 5 ++++- bin/ebuild-helpers/prepallstrip | 5 ++++- bin/ebuild-helpers/prepinfo | 5 ++++- bin/ebuild-helpers/prepman | 5 ++++- bin/ebuild-helpers/prepstrip | 6 +++++- bin/ebuild-helpers/unprivileged/chown | 7 +++++-- bin/ebuild-helpers/xattr/install | 5 ++++- bin/ebuild-ipc | 4 +++- bin/ebuild.sh | 4 +++- bin/helper-functions.sh | 5 ++++- bin/isolated-functions.sh | 5 ++++- bin/misc-functions.sh | 5 ++++- 43 files changed, 175 insertions(+), 45 deletions(-) diff --git a/bin/ebuild-helpers/die b/bin/ebuild-helpers/die index 9869141..09d1c74 100755 --- a/bin/ebuild-helpers/die +++ b/bin/ebuild-helpers/die @@ -2,6 +2,9 @@ # Copyright 2010 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh +if [[ -z ${PORTAGE_BIN_PATH} ]] ; then + PORTAGE_BIN_PATH=$(dirname "$(dirname "$(readlink -f "$0")")") +fi +source "${PORTAGE_BIN_PATH}"/isolated-functions.sh die "$@" exit 1 diff --git a/bin/ebuild-helpers/dobin b/bin/ebuild-helpers/dobin index 0ba1eb0..cf5a9bc 100755 --- a/bin/ebuild-helpers/dobin +++ b/bin/ebuild-helpers/dobin @@ -2,7 +2,10 @@ # Copyright 1999-2012 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh +if [[ -z ${PORTAGE_BIN_PATH} ]] ; then + PORTAGE_BIN_PATH=$(dirname "$(dirname "$(readlink -f "$0")")") +fi +source "${PORTAGE_BIN_PATH}"/isolated-functions.sh if [[ $# -lt 1 ]] ; then __helpers_die "${0##*/}: at least one argument needed" diff --git a/bin/ebuild-helpers/doconfd b/bin/ebuild-helpers/doconfd index 1baa3ed..3d5a0f6 100755 --- a/bin/ebuild-helpers/doconfd +++ b/bin/ebuild-helpers/doconfd @@ -2,8 +2,12 @@ # Copyright 1999-2010 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 +if [[ -z ${PORTAGE_BIN_PATH} ]] ; then + PORTAGE_BIN_PATH=$(dirname "$(dirname "$(readlink -f "$0")")") +fi + if [[ $# -lt 1 ]] ; then - source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh + source "${PORTAGE_BIN_PATH}"/isolated-functions.sh __helpers_die "${0##*/}: at least one argument needed" exit 1 fi diff --git a/bin/ebuild-helpers/dodir b/bin/ebuild-helpers/dodir index e03ba9a..34ba300 100755 --- a/bin/ebuild-helpers/dodir +++ b/bin/ebuild-helpers/dodir @@ -2,7 +2,10 @@ # Copyright 1999-2012 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh +if [[ -z ${PORTAGE_BIN_PATH} ]] ; then + PORTAGE_BIN_PATH=$(dirname "$(dirname "$(readlink -f "$0")")") +fi +source "${PORTAGE_BIN_PATH}"/isolated-functions.sh if ! ___eapi_has_prefix_variables; then ED=${D} diff --git a/bin/ebuild-helpers/dodoc b/bin/ebuild-helpers/dodoc index 6ccf0a4..2d18e26 100755 --- a/bin/ebuild-helpers/dodoc +++ b/bin/ebuild-helpers/dodoc @@ -2,7 +2,10 @@ # Copyright 1999-2012 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh +if [[ -z ${PORTAGE_BIN_PATH} ]] ; then + PORTAGE_BIN_PATH=$(dirname "$(dirname "$(readlink -f "$0")")") +fi +source "${PORTAGE_BIN_PATH}"/isolated-functions.sh if ___eapi_dodoc_supports_-r; then __PORTAGE_HELPER='dodoc' exec doins "$@" diff --git a/bin/ebuild-helpers/doenvd b/bin/ebuild-helpers/doenvd index 67bb934..77e926f 100755 --- a/bin/ebuild-helpers/doenvd +++ b/bin/ebuild-helpers/doenvd @@ -2,8 +2,12 @@ # Copyright 1999-2010 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 +if [[ -z ${PORTAGE_BIN_PATH} ]] ; then + PORTAGE_BIN_PATH=$(dirname "$(dirname "$(readlink -f "$0")")") +fi + if [[ $# -lt 1 ]] ; then - source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh + source "${PORTAGE_BIN_PATH}"/isolated-functions.sh __helpers_die "${0##*/}: at least one argument needed" exit 1 fi diff --git a/bin/ebuild-helpers/doexe b/bin/ebuild-helpers/doexe index c34fcae..4c00c2a 100755 --- a/bin/ebuild-helpers/doexe +++ b/bin/ebuild-helpers/doexe @@ -2,7 +2,10 @@ # Copyright 1999-2012 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh +if [[ -z ${PORTAGE_BIN_PATH} ]] ; then + PORTAGE_BIN_PATH=$(dirname "$(dirname "$(readlink -f "$0")")") +fi +source "${PORTAGE_BIN_PATH}"/isolated-functions.sh if [[ $# -lt 1 ]] ; then __helpers_die "${0##*/}: at least one argument needed" diff --git a/bin/ebuild-helpers/dohard b/bin/ebuild-helpers/dohard index e0a44fa..669afd8 100755 --- a/bin/ebuild-helpers/dohard +++ b/bin/ebuild-helpers/dohard @@ -2,7 +2,10 @@ # Copyright 1999-2012 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh +if [[ -z ${PORTAGE_BIN_PATH} ]] ; then + PORTAGE_BIN_PATH=$(dirname "$(dirname "$(readlink -f "$0")")") +fi +source "${PORTAGE_BIN_PATH}"/isolated-functions.sh if ! ___eapi_has_dohard; then die "'${0##*/}' has been banned for EAPI '$EAPI'" diff --git a/bin/ebuild-helpers/doheader b/bin/ebuild-helpers/doheader index e4cae6a..3d093f2 100755 --- a/bin/ebuild-helpers/doheader +++ b/bin/ebuild-helpers/doheader @@ -2,7 +2,10 @@ # Copyright 1999-2012 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh +if [[ -z ${PORTAGE_BIN_PATH} ]] ; then + PORTAGE_BIN_PATH=$(dirname "$(dirname "$(readlink -f "$0")")") +fi +source "${PORTAGE_BIN_PATH}"/isolated-functions.sh if ! ___eapi_has_doheader; then die "${0##*/} is not supported in EAPI ${EAPI}" diff --git a/bin/ebuild-helpers/dohtml b/bin/ebuild-helpers/dohtml index 0478e49..9c08b11 100755 --- a/bin/ebuild-helpers/dohtml +++ b/bin/ebuild-helpers/dohtml @@ -2,13 +2,15 @@ # Copyright 2009-2013 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh +if [[ -z ${PORTAGE_BIN_PATH} ]] ; then + PORTAGE_BIN_PATH=$(dirname "$(dirname "$(readlink -f "$0")")") +fi +source "${PORTAGE_BIN_PATH}"/isolated-functions.sh if ___eapi_has_dohtml_deprecated; then eqawarn "'${0##*/}' is deprecated in EAPI '$EAPI'" fi -PORTAGE_BIN_PATH=${PORTAGE_BIN_PATH:-/usr/lib/portage/bin} PORTAGE_PYM_PATH=${PORTAGE_PYM_PATH:-/usr/lib/portage/pym} # Use safe cwd, avoiding unsafe import for bug #469338. export __PORTAGE_HELPER_CWD=${PWD} diff --git a/bin/ebuild-helpers/doinfo b/bin/ebuild-helpers/doinfo index 2edbdc5..f8a9b6e 100755 --- a/bin/ebuild-helpers/doinfo +++ b/bin/ebuild-helpers/doinfo @@ -2,7 +2,10 @@ # Copyright 1999-2012 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh +if [[ -z ${PORTAGE_BIN_PATH} ]] ; then + PORTAGE_BIN_PATH=$(dirname "$(dirname "$(readlink -f "$0")")") +fi +source "${PORTAGE_BIN_PATH}"/isolated-functions.sh if [[ -z $1 ]] ; then __helpers_die "${0##*/}: at least one argument needed" diff --git a/bin/ebuild-helpers/doinitd b/bin/ebuild-helpers/doinitd index aa7b66c..5887652 100755 --- a/bin/ebuild-helpers/doinitd +++ b/bin/ebuild-helpers/doinitd @@ -2,8 +2,12 @@ # Copyright 1999-2010 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 +if [[ -z ${PORTAGE_BIN_PATH} ]] ; then + PORTAGE_BIN_PATH=$(dirname "$(dirname "$(readlink -f "$0")")") +fi + if [[ $# -lt 1 ]] ; then - source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh + source "${PORTAGE_BIN_PATH}"/isolated-functions.sh __helpers_die "${0##*/}: at least one argument needed" exit 1 fi diff --git a/bin/ebuild-helpers/doins b/bin/ebuild-helpers/doins index c60e057..ba1f7c7 100755 --- a/bin/ebuild-helpers/doins +++ b/bin/ebuild-helpers/doins @@ -2,7 +2,10 @@ # Copyright 1999-2012 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh +if [[ -z ${PORTAGE_BIN_PATH} ]] ; then + PORTAGE_BIN_PATH=$(dirname "$(dirname "$(readlink -f "$0")")") +fi +source "${PORTAGE_BIN_PATH}"/isolated-functions.sh helper=${__PORTAGE_HELPER:-${0##*/}} diff --git a/bin/ebuild-helpers/dolib b/bin/ebuild-helpers/dolib index fd92d7f..2d08c6f 100755 --- a/bin/ebuild-helpers/dolib +++ b/bin/ebuild-helpers/dolib @@ -2,7 +2,10 @@ # Copyright 1999-2012 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh +if [[ -z ${PORTAGE_BIN_PATH} ]] ; then + PORTAGE_BIN_PATH=$(dirname "$(dirname "$(readlink -f "$0")")") +fi +source "${PORTAGE_BIN_PATH}"/isolated-functions.sh if ! ___eapi_has_prefix_variables; then ED=${D} diff --git a/bin/ebuild-helpers/doman b/bin/ebuild-helpers/doman index d680859..6c78a31 100755 --- a/bin/ebuild-helpers/doman +++ b/bin/ebuild-helpers/doman @@ -2,7 +2,10 @@ # Copyright 1999-2012 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh +if [[ -z ${PORTAGE_BIN_PATH} ]] ; then + PORTAGE_BIN_PATH=$(dirname "$(dirname "$(readlink -f "$0")")") +fi +source "${PORTAGE_BIN_PATH}"/isolated-functions.sh if [[ $# -lt 1 ]] ; then __helpers_die "${0##*/}: at least one argument needed" diff --git a/bin/ebuild-helpers/domo b/bin/ebuild-helpers/domo index 9a8dda3..7709da3 100755 --- a/bin/ebuild-helpers/domo +++ b/bin/ebuild-helpers/domo @@ -2,7 +2,10 @@ # Copyright 1999-2012 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh +if [[ -z ${PORTAGE_BIN_PATH} ]] ; then + PORTAGE_BIN_PATH=$(dirname "$(dirname "$(readlink -f "$0")")") +fi +source "${PORTAGE_BIN_PATH}"/isolated-functions.sh mynum=${#} if [ ${mynum} -lt 1 ] ; then diff --git a/bin/ebuild-helpers/dosbin b/bin/ebuild-helpers/dosbin index 361ca83..4b4b589 100755 --- a/bin/ebuild-helpers/dosbin +++ b/bin/ebuild-helpers/dosbin @@ -2,7 +2,10 @@ # Copyright 1999-2012 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh +if [[ -z ${PORTAGE_BIN_PATH} ]] ; then + PORTAGE_BIN_PATH=$(dirname "$(dirname "$(readlink -f "$0")")") +fi +source "${PORTAGE_BIN_PATH}"/isolated-functions.sh if [[ $# -lt 1 ]] ; then __helpers_die "${0##*/}: at least one argument needed" diff --git a/bin/ebuild-helpers/dosed b/bin/ebuild-helpers/dosed index 7db0629..1793a26 100755 --- a/bin/ebuild-helpers/dosed +++ b/bin/ebuild-helpers/dosed @@ -2,7 +2,10 @@ # Copyright 1999-2012 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh +if [[ -z ${PORTAGE_BIN_PATH} ]] ; then + PORTAGE_BIN_PATH=$(dirname "$(dirname "$(readlink -f "$0")")") +fi +source "${PORTAGE_BIN_PATH}"/isolated-functions.sh if ! ___eapi_has_dosed; then die "'${0##*/}' has been banned for EAPI '$EAPI'" diff --git a/bin/ebuild-helpers/dosym b/bin/ebuild-helpers/dosym index 649b100..967e158 100755 --- a/bin/ebuild-helpers/dosym +++ b/bin/ebuild-helpers/dosym @@ -2,7 +2,10 @@ # Copyright 1999-2012 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh +if [[ -z ${PORTAGE_BIN_PATH} ]] ; then + PORTAGE_BIN_PATH=$(dirname "$(dirname "$(readlink -f "$0")")") +fi +source "${PORTAGE_BIN_PATH}"/isolated-functions.sh if [[ $# -ne 2 ]] ; then __helpers_die "${0##*/}: two arguments needed" diff --git a/bin/ebuild-helpers/ecompress b/bin/ebuild-helpers/ecompress index 71287b4..57e2ead 100755 --- a/bin/ebuild-helpers/ecompress +++ b/bin/ebuild-helpers/ecompress @@ -2,7 +2,10 @@ # Copyright 1999-2010 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh +if [[ -z ${PORTAGE_BIN_PATH} ]] ; then + PORTAGE_BIN_PATH=$(dirname "$(dirname "$(readlink -f "$0")")") +fi +source "${PORTAGE_BIN_PATH}"/isolated-functions.sh if [[ -z $1 ]] ; then __helpers_die "${0##*/}: at least one argument needed" diff --git a/bin/ebuild-helpers/ecompressdir b/bin/ebuild-helpers/ecompressdir index eca5888..f9ae9c3 100755 --- a/bin/ebuild-helpers/ecompressdir +++ b/bin/ebuild-helpers/ecompressdir @@ -2,7 +2,10 @@ # Copyright 1999-2013 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/helper-functions.sh +if [[ -z ${PORTAGE_BIN_PATH} ]] ; then + PORTAGE_BIN_PATH=$(dirname "$(dirname "$(readlink -f "$0")")") +fi +source "${PORTAGE_BIN_PATH}"/helper-functions.sh if [[ -z $1 ]] ; then __helpers_die "${0##*/}: at least one argument needed" diff --git a/bin/ebuild-helpers/elog b/bin/ebuild-helpers/elog index a2303af..2ffd3a9 100755 --- a/bin/ebuild-helpers/elog +++ b/bin/ebuild-helpers/elog @@ -2,6 +2,9 @@ # Copyright 1999-2009 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh +if [[ -z ${PORTAGE_BIN_PATH} ]] ; then + PORTAGE_BIN_PATH=$(dirname "$(dirname "$(readlink -f "$0")")") +fi +source "${PORTAGE_BIN_PATH}"/isolated-functions.sh ${0##*/} "$@" diff --git a/bin/ebuild-helpers/emake b/bin/ebuild-helpers/emake index 2a3c2f0..5748312 100755 --- a/bin/ebuild-helpers/emake +++ b/bin/ebuild-helpers/emake @@ -9,7 +9,10 @@ # # With newer EAPIs, we also automatically fail the build if make itself fails. -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh +if [[ -z ${PORTAGE_BIN_PATH} ]] ; then + PORTAGE_BIN_PATH=$(dirname "$(dirname "$(readlink -f "$0")")") +fi +source "${PORTAGE_BIN_PATH}"/isolated-functions.sh cmd=( ${MAKE:-make} ${MAKEOPTS} "$@" ${EXTRA_EMAKE} diff --git a/bin/ebuild-helpers/fowners b/bin/ebuild-helpers/fowners index cee4108..28ee049 100755 --- a/bin/ebuild-helpers/fowners +++ b/bin/ebuild-helpers/fowners @@ -2,7 +2,10 @@ # Copyright 1999-2012 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh +if [[ -z ${PORTAGE_BIN_PATH} ]] ; then + PORTAGE_BIN_PATH=$(dirname "$(dirname "$(readlink -f "$0")")") +fi +source "${PORTAGE_BIN_PATH}"/isolated-functions.sh if ! ___eapi_has_prefix_variables; then EPREFIX= ED=${D} diff --git a/bin/ebuild-helpers/fperms b/bin/ebuild-helpers/fperms index d854ebb..644a811 100755 --- a/bin/ebuild-helpers/fperms +++ b/bin/ebuild-helpers/fperms @@ -2,7 +2,10 @@ # Copyright 1999-2012 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh +if [[ -z ${PORTAGE_BIN_PATH} ]] ; then + PORTAGE_BIN_PATH=$(dirname "$(dirname "$(readlink -f "$0")")") +fi +source "${PORTAGE_BIN_PATH}"/isolated-functions.sh if ! ___eapi_has_prefix_variables; then ED=${D} diff --git a/bin/ebuild-helpers/keepdir b/bin/ebuild-helpers/keepdir index bec2feb..b6af2e9 100755 --- a/bin/ebuild-helpers/keepdir +++ b/bin/ebuild-helpers/keepdir @@ -2,7 +2,10 @@ # Copyright 1999-2013 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh +if [[ -z ${PORTAGE_BIN_PATH} ]] ; then + PORTAGE_BIN_PATH=$(dirname "$(dirname "$(readlink -f "$0")")") +fi +source "${PORTAGE_BIN_PATH}"/isolated-functions.sh if ! ___eapi_has_prefix_variables; then ED=${D} diff --git a/bin/ebuild-helpers/newins b/bin/ebuild-helpers/newins index 0335985..062a40f 100755 --- a/bin/ebuild-helpers/newins +++ b/bin/ebuild-helpers/newins @@ -2,7 +2,10 @@ # Copyright 1999-2012 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh +if [[ -z ${PORTAGE_BIN_PATH} ]] ; then + PORTAGE_BIN_PATH=$(dirname "$(dirname "$(readlink -f "$0")")") +fi +source "${PORTAGE_BIN_PATH}"/isolated-functions.sh helper=${0##*/} diff --git a/bin/ebuild-helpers/portageq b/bin/ebuild-helpers/portageq index ba889eb..a824df6 100755 --- a/bin/ebuild-helpers/portageq +++ b/bin/ebuild-helpers/portageq @@ -5,7 +5,10 @@ scriptpath=${BASH_SOURCE[0]} scriptname=${scriptpath##*/} -PORTAGE_BIN_PATH=${PORTAGE_BIN_PATH:-/usr/lib/portage/bin} +if [[ -z ${PORTAGE_BIN_PATH} ]] ; then + PORTAGE_BIN_PATH=$(dirname "$(dirname "$(readlink -f "$0")")") +fi + PORTAGE_PYM_PATH=${PORTAGE_PYM_PATH:-/usr/lib/portage/pym} # Use safe cwd, avoiding unsafe import for bug #469338. cd "${PORTAGE_PYM_PATH}" diff --git a/bin/ebuild-helpers/prepall b/bin/ebuild-helpers/prepall index fb5c2db..99ec50a 100755 --- a/bin/ebuild-helpers/prepall +++ b/bin/ebuild-helpers/prepall @@ -2,7 +2,10 @@ # Copyright 1999-2012 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh +if [[ -z ${PORTAGE_BIN_PATH} ]] ; then + PORTAGE_BIN_PATH=$(dirname "$(dirname "$(readlink -f "$0")")") +fi +source "${PORTAGE_BIN_PATH}"/isolated-functions.sh if ! ___eapi_has_prefix_variables; then ED=${D} diff --git a/bin/ebuild-helpers/prepalldocs b/bin/ebuild-helpers/prepalldocs index 3094661..ed09c6e 100755 --- a/bin/ebuild-helpers/prepalldocs +++ b/bin/ebuild-helpers/prepalldocs @@ -2,7 +2,10 @@ # Copyright 1999-2012 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh +if [[ -z ${PORTAGE_BIN_PATH} ]] ; then + PORTAGE_BIN_PATH=$(dirname "$(dirname "$(readlink -f "$0")")") +fi +source "${PORTAGE_BIN_PATH}"/isolated-functions.sh if ___eapi_has_docompress; then die "'${0##*/}' has been banned for EAPI '$EAPI'" diff --git a/bin/ebuild-helpers/prepallinfo b/bin/ebuild-helpers/prepallinfo index 1a20275..7ce9ce5 100755 --- a/bin/ebuild-helpers/prepallinfo +++ b/bin/ebuild-helpers/prepallinfo @@ -2,7 +2,10 @@ # Copyright 1999-2012 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh +if [[ -z ${PORTAGE_BIN_PATH} ]] ; then + PORTAGE_BIN_PATH=$(dirname "$(dirname "$(readlink -f "$0")")") +fi +source "${PORTAGE_BIN_PATH}"/isolated-functions.sh if ! ___eapi_has_prefix_variables; then ED=${D} diff --git a/bin/ebuild-helpers/prepallman b/bin/ebuild-helpers/prepallman index 5331eaf..5547115 100755 --- a/bin/ebuild-helpers/prepallman +++ b/bin/ebuild-helpers/prepallman @@ -2,7 +2,10 @@ # Copyright 1999-2012 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh +if [[ -z ${PORTAGE_BIN_PATH} ]] ; then + PORTAGE_BIN_PATH=$(dirname "$(dirname "$(readlink -f "$0")")") +fi +source "${PORTAGE_BIN_PATH}"/isolated-functions.sh # replaced by controllable compression in EAPI 4 ___eapi_has_docompress && exit 0 diff --git a/bin/ebuild-helpers/prepallstrip b/bin/ebuild-helpers/prepallstrip index 1aa6686..34e6174 100755 --- a/bin/ebuild-helpers/prepallstrip +++ b/bin/ebuild-helpers/prepallstrip @@ -2,7 +2,10 @@ # Copyright 1999-2012 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh +if [[ -z ${PORTAGE_BIN_PATH} ]] ; then + PORTAGE_BIN_PATH=$(dirname "$(dirname "$(readlink -f "$0")")") +fi +source "${PORTAGE_BIN_PATH}"/isolated-functions.sh if ! ___eapi_has_prefix_variables; then ED=${D} diff --git a/bin/ebuild-helpers/prepinfo b/bin/ebuild-helpers/prepinfo index 5afc18a..9312f64 100755 --- a/bin/ebuild-helpers/prepinfo +++ b/bin/ebuild-helpers/prepinfo @@ -2,7 +2,10 @@ # Copyright 1999-2012 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh +if [[ -z ${PORTAGE_BIN_PATH} ]] ; then + PORTAGE_BIN_PATH=$(dirname "$(dirname "$(readlink -f "$0")")") +fi +source "${PORTAGE_BIN_PATH}"/isolated-functions.sh if ! ___eapi_has_prefix_variables; then ED=${D} diff --git a/bin/ebuild-helpers/prepman b/bin/ebuild-helpers/prepman index fb5dcb4..95d7d25 100755 --- a/bin/ebuild-helpers/prepman +++ b/bin/ebuild-helpers/prepman @@ -5,7 +5,10 @@ # Do not compress man pages which are smaller than this (in bytes). #169260 SIZE_LIMIT='128' -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh +if [[ -z ${PORTAGE_BIN_PATH} ]] ; then + PORTAGE_BIN_PATH=$(dirname "$(dirname "$(readlink -f "$0")")") +fi +source "${PORTAGE_BIN_PATH}"/isolated-functions.sh if ! ___eapi_has_prefix_variables; then ED=${D} diff --git a/bin/ebuild-helpers/prepstrip b/bin/ebuild-helpers/prepstrip index 2ef8a1a..f80838b 100755 --- a/bin/ebuild-helpers/prepstrip +++ b/bin/ebuild-helpers/prepstrip @@ -2,8 +2,12 @@ # Copyright 1999-2014 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 +if [[ -z ${PORTAGE_BIN_PATH} ]] ; then + PORTAGE_BIN_PATH=$(dirname "$(dirname "$(readlink -f "$0")")") +fi + PORTAGE_PYM_PATH=${PORTAGE_PYM_PATH:-/usr/lib/portage/pym} -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/helper-functions.sh +source "${PORTAGE_BIN_PATH}"/helper-functions.sh # avoid multiple calls to `has`. this creates things like: # FEATURES_foo=false diff --git a/bin/ebuild-helpers/unprivileged/chown b/bin/ebuild-helpers/unprivileged/chown index 2f1f161..dde0d78 100755 --- a/bin/ebuild-helpers/unprivileged/chown +++ b/bin/ebuild-helpers/unprivileged/chown @@ -2,6 +2,11 @@ # Copyright 2012-2015 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 +if [[ -z ${PORTAGE_BIN_PATH} ]] ; then + PORTAGE_BIN_PATH=$(dirname "$(dirname "$(dirname "$(readlink -f "$0")")")") +fi +source "${PORTAGE_BIN_PATH}"/isolated-functions.sh + scriptpath=${BASH_SOURCE[0]} scriptname=${scriptpath##*/} @@ -23,8 +28,6 @@ for path in ${PATH}; do output="${output}\n ... (further messages truncated)" fi - source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh - if ! ___eapi_has_prefix_variables; then EPREFIX= fi diff --git a/bin/ebuild-helpers/xattr/install b/bin/ebuild-helpers/xattr/install index 2d2a693..c48f7c5 100755 --- a/bin/ebuild-helpers/xattr/install +++ b/bin/ebuild-helpers/xattr/install @@ -2,7 +2,10 @@ # Copyright 2013-2015 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -PORTAGE_BIN_PATH=${PORTAGE_BIN_PATH:-/usr/lib/portage/bin} +if [[ -z ${PORTAGE_BIN_PATH} ]] ; then + PORTAGE_BIN_PATH=$(dirname "$(dirname "$(dirname "$(readlink -f "$0")")")") +fi + PORTAGE_PYM_PATH=${PORTAGE_PYM_PATH:-/usr/lib/portage/pym} INSTALL_XATTR=${EPREFIX}/usr/bin/install-xattr # Use safe cwd, avoiding unsafe import for bug #469338. diff --git a/bin/ebuild-ipc b/bin/ebuild-ipc index 820005f..7d12e05 100755 --- a/bin/ebuild-ipc +++ b/bin/ebuild-ipc @@ -2,7 +2,9 @@ # Copyright 2010-2013 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -PORTAGE_BIN_PATH=${PORTAGE_BIN_PATH:-/usr/lib/portage/bin} +if [[ -z ${PORTAGE_BIN_PATH} ]] ; then + PORTAGE_BIN_PATH=$(dirname "$(readlink -f "$0")") +fi PORTAGE_PYM_PATH=${PORTAGE_PYM_PATH:-/usr/lib/portage/pym} # Use safe cwd, avoiding unsafe import for bug #469338. cd "${PORTAGE_PYM_PATH}" diff --git a/bin/ebuild.sh b/bin/ebuild.sh index 4e26f87..4b0f0f9 100755 --- a/bin/ebuild.sh +++ b/bin/ebuild.sh @@ -2,7 +2,9 @@ # Copyright 1999-2015 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -PORTAGE_BIN_PATH="${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}" +if [[ -z ${PORTAGE_BIN_PATH} ]] ; then + PORTAGE_BIN_PATH=$(dirname "$(readlink -f "$0")") +fi PORTAGE_PYM_PATH="${PORTAGE_PYM_PATH:-/usr/lib/portage/pym}" # Prevent aliases from causing portage to act inappropriately. diff --git a/bin/helper-functions.sh b/bin/helper-functions.sh index b9bc74a..5cd8de1 100644 --- a/bin/helper-functions.sh +++ b/bin/helper-functions.sh @@ -5,7 +5,10 @@ # For routines we want to use in ebuild-helpers/ but don't want to # expose to the general ebuild environment. -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh +if [[ -z ${PORTAGE_BIN_PATH} ]] ; then + PORTAGE_BIN_PATH=$(dirname "$(readlink -f "$0")") +fi +source "${PORTAGE_BIN_PATH}"/isolated-functions.sh # # API functions for doing parallel processing diff --git a/bin/isolated-functions.sh b/bin/isolated-functions.sh index 8e789ec..5fe2e3d 100644 --- a/bin/isolated-functions.sh +++ b/bin/isolated-functions.sh @@ -2,7 +2,10 @@ # Copyright 1999-2014 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}/eapi.sh" +if [[ -z ${PORTAGE_BIN_PATH} ]] ; then + PORTAGE_BIN_PATH=$(dirname "$(readlink -f "$0")") +fi +source "${PORTAGE_BIN_PATH}/eapi.sh" # We need this next line for "die" and "assert". It expands # It _must_ preceed all the calls to die and assert. diff --git a/bin/misc-functions.sh b/bin/misc-functions.sh index 24941af..8013d7d 100755 --- a/bin/misc-functions.sh +++ b/bin/misc-functions.sh @@ -14,7 +14,10 @@ MISC_FUNCTIONS_ARGS="$@" shift $# -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}/ebuild.sh" +if [[ -z ${PORTAGE_BIN_PATH} ]] ; then + PORTAGE_BIN_PATH=$(dirname "$(readlink -f "$0")") +fi +source "${PORTAGE_BIN_PATH}/ebuild.sh" install_symlink_html_docs() { if ! ___eapi_has_prefix_variables; then -- 2.4.1