diff options
author | Michał Górny <mgorny@gentoo.org> | 2018-03-04 10:49:35 +0100 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2018-03-04 22:03:56 +0100 |
commit | a5d0111d0bdaa7ee9e5c68e22b4a97ce415e119b (patch) | |
tree | 633f057e88ce4f78207c81d6d7218bddc39c6c8e /bin/ebuild-helpers | |
parent | domo: force /usr prefix in EAPI 7 (diff) | |
download | portage-a5d0111d0bdaa7ee9e5c68e22b4a97ce415e119b.tar.gz portage-a5d0111d0bdaa7ee9e5c68e22b4a97ce415e119b.tar.bz2 portage-a5d0111d0bdaa7ee9e5c68e22b4a97ce415e119b.zip |
Ban DESTTREE/INSDESTTREE in EAPI 7
Ban the direct use of DESTTREE/INSDESTTREE in EAPI 7. Use new _E_*
helper variables for into/insinto.
Bug: https://bugs.gentoo.org/173630
Closes: https://github.com/gentoo/portage/pull/261
Series-Reviewed-by: Zac Medico <zmedico@gentoo.org>
Diffstat (limited to 'bin/ebuild-helpers')
-rwxr-xr-x | bin/ebuild-helpers/dobin | 16 | ||||
-rwxr-xr-x | bin/ebuild-helpers/doconfd | 4 | ||||
-rwxr-xr-x | bin/ebuild-helpers/doenvd | 4 | ||||
-rwxr-xr-x | bin/ebuild-helpers/doheader | 4 | ||||
-rwxr-xr-x | bin/ebuild-helpers/doins | 18 | ||||
-rwxr-xr-x | bin/ebuild-helpers/dolib | 10 | ||||
-rwxr-xr-x | bin/ebuild-helpers/domo | 16 | ||||
-rwxr-xr-x | bin/ebuild-helpers/dosbin | 16 |
8 files changed, 64 insertions, 24 deletions
diff --git a/bin/ebuild-helpers/dobin b/bin/ebuild-helpers/dobin index 9f4d73dc4..f43871f49 100755 --- a/bin/ebuild-helpers/dobin +++ b/bin/ebuild-helpers/dobin @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 1999-2012 Gentoo Foundation +# Copyright 1999-2018 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1 @@ -13,15 +13,23 @@ if ! ___eapi_has_prefix_variables; then ED=${D} fi -if [[ ! -d ${ED}${DESTTREE}/bin ]] ; then - install -d "${ED}${DESTTREE}/bin" || { __helpers_die "${0##*/}: failed to install ${ED}${DESTTREE}/bin"; exit 2; } +if ! ___eapi_has_DESTTREE_INSDESTTREE; then + [[ -n ${DESTTREE} ]] && + die "${0##*/}: \${DESTTREE} has been banned for EAPI '$EAPI'; use 'into' instead" +else + # backwards compatibility + _E_DESTTREE_=${DESTTREE} +fi + +if [[ ! -d ${ED}${_E_DESTTREE_}/bin ]] ; then + install -d "${ED}${_E_DESTTREE_}/bin" || { __helpers_die "${0##*/}: failed to install ${ED}${_E_DESTTREE_}/bin"; exit 2; } fi ret=0 for x in "$@" ; do if [[ -e ${x} ]] ; then - install -m0755 -o ${PORTAGE_INST_UID:-0} -g ${PORTAGE_INST_GID:-0} "${x}" "${ED}${DESTTREE}/bin" + install -m0755 -o ${PORTAGE_INST_UID:-0} -g ${PORTAGE_INST_GID:-0} "${x}" "${ED}${_E_DESTTREE_}/bin" else echo "!!! ${0##*/}: $x does not exist" 1>&2 false diff --git a/bin/ebuild-helpers/doconfd b/bin/ebuild-helpers/doconfd index 926c31839..38cf58234 100755 --- a/bin/ebuild-helpers/doconfd +++ b/bin/ebuild-helpers/doconfd @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 1999-2010 Gentoo Foundation +# Copyright 1999-2018 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 if [[ $# -lt 1 ]] ; then @@ -8,4 +8,4 @@ if [[ $# -lt 1 ]] ; then exit 1 fi -INSDESTTREE='/etc/conf.d/' exec doins "$@" +_E_INSDESTTREE_='/etc/conf.d/' exec doins "$@" diff --git a/bin/ebuild-helpers/doenvd b/bin/ebuild-helpers/doenvd index eb31f375b..a15cec7f2 100755 --- a/bin/ebuild-helpers/doenvd +++ b/bin/ebuild-helpers/doenvd @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 1999-2010 Gentoo Foundation +# Copyright 1999-2018 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 if [[ $# -lt 1 ]] ; then @@ -8,4 +8,4 @@ if [[ $# -lt 1 ]] ; then exit 1 fi -INSDESTTREE='/etc/env.d/' exec doins "$@" +_E_INSDESTTREE_='/etc/env.d/' exec doins "$@" diff --git a/bin/ebuild-helpers/doheader b/bin/ebuild-helpers/doheader index b827086ec..03bf23b1c 100755 --- a/bin/ebuild-helpers/doheader +++ b/bin/ebuild-helpers/doheader @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 1999-2012 Gentoo Foundation +# Copyright 1999-2018 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1 @@ -13,4 +13,4 @@ if [[ $# -lt 1 ]] || [[ $1 == -r && $# -lt 2 ]] ; then exit 1 fi -INSDESTTREE='/usr/include/' exec doins "$@" +_E_INSDESTTREE_='/usr/include/' exec doins "$@" diff --git a/bin/ebuild-helpers/doins b/bin/ebuild-helpers/doins index 73c9d8b91..327d409a4 100755 --- a/bin/ebuild-helpers/doins +++ b/bin/ebuild-helpers/doins @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 1999-2012 Gentoo Foundation +# Copyright 1999-2018 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1 @@ -15,7 +15,15 @@ if [[ ${helper} == dodoc ]] ; then exit 0 fi export INSOPTIONS=-m0644 - export INSDESTTREE=usr/share/doc/${PF}/${_E_DOCDESTTREE_} + export _E_INSDESTTREE_=usr/share/doc/${PF}/${_E_DOCDESTTREE_} +else + if ! ___eapi_has_DESTTREE_INSDESTTREE; then + [[ -n ${INSDESTTREE} ]] && + die "${0##*/}: \${INSDESTTREE} has been banned for EAPI '$EAPI'; use 'into' instead" + else + # backwards compatibility + _E_INSDESTTREE_=${INSDESTTREE} + fi fi if [ $# -lt 1 ] ; then @@ -33,10 +41,10 @@ if ! ___eapi_has_prefix_variables; then export ED="${D}" fi -if [[ ${INSDESTTREE#${ED}} != "${INSDESTTREE}" ]]; then +if [[ ${_E_INSDESTTREE_#${ED}} != "${_E_INSDESTTREE_}" ]]; then __vecho "-------------------------------------------------------" 1>&2 __vecho "You should not use \${D} or \${ED} with helpers." 1>&2 - __vecho " --> ${INSDESTTREE}" 1>&2 + __vecho " --> ${_E_INSDESTTREE_}" 1>&2 __vecho "-------------------------------------------------------" 1>&2 __helpers_die "${helper} used with \${D} or \${ED}" exit 1 @@ -75,7 +83,7 @@ fi DOINS_ARGS+=( "--helper=${helper}" - "--dest=${ED}${INSDESTTREE}" + "--dest=${ED}${_E_INSDESTTREE_}" ) # Explicitly set PYTHONPATH to non empty. diff --git a/bin/ebuild-helpers/dolib b/bin/ebuild-helpers/dolib index 62e04b385..2800fad76 100755 --- a/bin/ebuild-helpers/dolib +++ b/bin/ebuild-helpers/dolib @@ -13,6 +13,14 @@ if ! ___eapi_has_prefix_variables; then ED=${D} fi +if ! ___eapi_has_DESTTREE_INSDESTTREE; then + [[ -n ${DESTTREE} ]] && + die "${0##*/}: \${DESTTREE} has been banned for EAPI '$EAPI'; use 'into' instead" +else + # backwards compatibility + _E_DESTTREE_=${DESTTREE} +fi + # Setup ABI cruft LIBDIR_VAR="LIBDIR_${ABI}" if [[ -n ${ABI} && -n ${!LIBDIR_VAR} ]] ; then @@ -21,7 +29,7 @@ fi unset LIBDIR_VAR # we need this to default to lib so that things dont break CONF_LIBDIR=${CONF_LIBDIR:-lib} -libdir="${ED}${DESTTREE}/${CONF_LIBDIR}" +libdir="${ED}${_E_DESTTREE_}/${CONF_LIBDIR}" if [[ $# -lt 1 ]] ; then diff --git a/bin/ebuild-helpers/domo b/bin/ebuild-helpers/domo index e08e55a3a..70f93d61e 100755 --- a/bin/ebuild-helpers/domo +++ b/bin/ebuild-helpers/domo @@ -14,13 +14,21 @@ if ! ___eapi_has_prefix_variables; then ED=${D} fi +if ! ___eapi_has_DESTTREE_INSDESTTREE; then + [[ -n ${DESTTREE} ]] && + die "${0##*/}: \${DESTTREE} has been banned for EAPI '$EAPI'; use 'into' instead" +else + # backwards compatibility + _E_DESTTREE_=${DESTTREE} +fi + # newer EAPIs force /usr consistently with other /usr/share helpers if ! ___eapi_domo_respects_into; then - DESTTREE=/usr + _E_DESTTREE_=/usr fi -if [ ! -d "${ED}${DESTTREE}/share/locale" ] ; then - install -d "${ED}${DESTTREE}/share/locale/" +if [ ! -d "${ED}${_E_DESTTREE_}/share/locale" ] ; then + install -d "${ED}${_E_DESTTREE_}/share/locale/" fi ret=0 @@ -28,7 +36,7 @@ ret=0 for x in "$@" ; do if [ -e "${x}" ] ; then mytiny="${x##*/}" - mydir="${ED}${DESTTREE}/share/locale/${mytiny%.*}/LC_MESSAGES" + mydir="${ED}${_E_DESTTREE_}/share/locale/${mytiny%.*}/LC_MESSAGES" if [ ! -d "${mydir}" ] ; then install -d "${mydir}" fi diff --git a/bin/ebuild-helpers/dosbin b/bin/ebuild-helpers/dosbin index 2fee9d4e9..f698f6fbb 100755 --- a/bin/ebuild-helpers/dosbin +++ b/bin/ebuild-helpers/dosbin @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 1999-2012 Gentoo Foundation +# Copyright 1999-2018 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1 @@ -13,15 +13,23 @@ if ! ___eapi_has_prefix_variables; then ED=${D} fi -if [[ ! -d ${ED}${DESTTREE}/sbin ]] ; then - install -d "${ED}${DESTTREE}/sbin" || { __helpers_die "${0##*/}: failed to install ${ED}${DESTTREE}/sbin"; exit 2; } +if ! ___eapi_has_DESTTREE_INSDESTTREE; then + [[ -n ${DESTTREE} ]] && + die "${0##*/}: \${DESTTREE} has been banned for EAPI '$EAPI'; use 'into' instead" +else + # backwards compatibility + _E_DESTTREE_=${DESTTREE} +fi + +if [[ ! -d ${ED}${_E_DESTTREE_}/sbin ]] ; then + install -d "${ED}${_E_DESTTREE_}/sbin" || { __helpers_die "${0##*/}: failed to install ${ED}${_E_DESTTREE_}/sbin"; exit 2; } fi ret=0 for x in "$@" ; do if [[ -e ${x} ]] ; then - install -m0755 -o ${PORTAGE_INST_UID:-0} -g ${PORTAGE_INST_GID:-0} "${x}" "${ED}${DESTTREE}/sbin" + install -m0755 -o ${PORTAGE_INST_UID:-0} -g ${PORTAGE_INST_GID:-0} "${x}" "${ED}${_E_DESTTREE_}/sbin" else echo "!!! ${0##*/}: ${x} does not exist" 1>&2 false |