From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 92712138331 for ; Sun, 4 Mar 2018 21:05:15 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 7C4DCE09B0; Sun, 4 Mar 2018 21:05:13 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 4A9E2E09B0 for ; Sun, 4 Mar 2018 21:05:13 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 2CF48335CA0 for ; Sun, 4 Mar 2018 21:05:12 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 9E3A7244 for ; Sun, 4 Mar 2018 21:05:09 +0000 (UTC) From: "Michał Górny" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Michał Górny" Message-ID: <1520197436.a5d0111d0bdaa7ee9e5c68e22b4a97ce415e119b.mgorny@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: bin/, bin/ebuild-helpers/ X-VCS-Repository: proj/portage X-VCS-Files: bin/eapi.sh bin/ebuild-helpers/dobin bin/ebuild-helpers/doconfd bin/ebuild-helpers/doenvd bin/ebuild-helpers/doheader bin/ebuild-helpers/doins bin/ebuild-helpers/dolib bin/ebuild-helpers/domo bin/ebuild-helpers/dosbin bin/phase-functions.sh bin/phase-helpers.sh bin/save-ebuild-env.sh X-VCS-Directories: bin/ebuild-helpers/ bin/ X-VCS-Committer: mgorny X-VCS-Committer-Name: Michał Górny X-VCS-Revision: a5d0111d0bdaa7ee9e5c68e22b4a97ce415e119b X-VCS-Branch: master Date: Sun, 4 Mar 2018 21:05:09 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 16ca4708-ef6e-4cea-afba-39bfcbd8f52a X-Archives-Hash: 6fae434ee50ba222c5936e93e0357ff5 commit: a5d0111d0bdaa7ee9e5c68e22b4a97ce415e119b Author: Michał Górny gentoo org> AuthorDate: Sun Mar 4 09:49:35 2018 +0000 Commit: Michał Górny gentoo org> CommitDate: Sun Mar 4 21:03:56 2018 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=a5d0111d 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 gentoo.org> bin/eapi.sh | 4 ++++ bin/ebuild-helpers/dobin | 16 ++++++++++++---- bin/ebuild-helpers/doconfd | 4 ++-- bin/ebuild-helpers/doenvd | 4 ++-- bin/ebuild-helpers/doheader | 4 ++-- bin/ebuild-helpers/doins | 18 +++++++++++++----- bin/ebuild-helpers/dolib | 10 +++++++++- bin/ebuild-helpers/domo | 16 ++++++++++++---- bin/ebuild-helpers/dosbin | 16 ++++++++++++---- bin/phase-functions.sh | 11 ++++++++--- bin/phase-helpers.sh | 33 +++++++++++++++++++++++---------- bin/save-ebuild-env.sh | 4 ++-- 12 files changed, 101 insertions(+), 39 deletions(-) diff --git a/bin/eapi.sh b/bin/eapi.sh index ba4008acf..fa254485c 100644 --- a/bin/eapi.sh +++ b/bin/eapi.sh @@ -190,6 +190,10 @@ ___eapi_domo_respects_into() { [[ ${1-${EAPI-0}} =~ ^(0|1|2|3|4|4-python|4-slot-abi|5|5-hdepend|5-progress|6)$ ]] } +___eapi_has_DESTTREE_INSDESTTREE() { + [[ ${1-${EAPI-0}} =~ ^(0|1|2|3|4|4-python|4-slot-abi|5|5-hdepend|5-progress|6)$ ]] +} + # OTHERS ___eapi_enables_failglob_in_global_scope() { 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 diff --git a/bin/phase-functions.sh b/bin/phase-functions.sh index 0ffabd99e..d95012d6b 100644 --- a/bin/phase-functions.sh +++ b/bin/phase-functions.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 1999-2015 Gentoo Foundation +# Copyright 1999-2018 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # Hardcoded bash lists are needed for backward compatibility with @@ -584,8 +584,13 @@ __dyn_install() { # Reset exeinto(), docinto(), insinto(), and into() state variables # in case the user is running the install phase multiple times # consecutively via the ebuild command. - export DESTTREE=/usr - export INSDESTTREE="" + if ___eapi_has_DESTTREE_INSDESTTREE; then + export DESTTREE=/usr + export INSDESTTREE="" + else + export _E_DESTTREE_=/usr + export _E_INSDESTTREE_="" + fi export _E_EXEDESTTREE_="" export _E_DOCDESTTREE_="" diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh index 12ccf6716..3a2138636 100644 --- a/bin/phase-helpers.sh +++ b/bin/phase-helpers.sh @@ -2,8 +2,13 @@ # Copyright 1999-2018 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -export DESTTREE=/usr -export INSDESTTREE="" +if ___eapi_has_DESTTREE_INSDESTTREE; then + export DESTTREE=/usr + export INSDESTTREE="" +else + export _E_DESTTREE_=/usr + export _E_INSDESTTREE_="" +fi export _E_EXEDESTTREE_="" export _E_DOCDESTTREE_="" export INSOPTIONS="-m0644" @@ -18,14 +23,14 @@ declare -a PORTAGE_DOCOMPRESS_SKIP=( /usr/share/doc/${PF}/html ) into() { if [ "$1" == "/" ]; then - export DESTTREE="" + export _E_DESTTREE_="" else - export DESTTREE=$1 + export _E_DESTTREE_=$1 if ! ___eapi_has_prefix_variables; then local ED=${D} fi - if [ ! -d "${ED}${DESTTREE}" ]; then - install -d "${ED}${DESTTREE}" + if [ ! -d "${ED}${_E_DESTTREE_}" ]; then + install -d "${ED}${_E_DESTTREE_}" local ret=$? if [[ $ret -ne 0 ]] ; then __helpers_die "${FUNCNAME[0]} failed" @@ -33,18 +38,22 @@ into() { fi fi fi + + if ___eapi_has_DESTTREE_INSDESTTREE; then + export DESTTREE=${_E_DESTTREE_} + fi } insinto() { if [ "$1" == "/" ]; then - export INSDESTTREE="" + export _E_INSDESTTREE_="" else - export INSDESTTREE=$1 + export _E_INSDESTTREE_=$1 if ! ___eapi_has_prefix_variables; then local ED=${D} fi - if [ ! -d "${ED}${INSDESTTREE}" ]; then - install -d "${ED}${INSDESTTREE}" + if [ ! -d "${ED}${_E_INSDESTTREE_}" ]; then + install -d "${ED}${_E_INSDESTTREE_}" local ret=$? if [[ $ret -ne 0 ]] ; then __helpers_die "${FUNCNAME[0]} failed" @@ -52,6 +61,10 @@ insinto() { fi fi fi + + if ___eapi_has_DESTTREE_INSDESTTREE; then + export INSDESTTREE=${_E_INSDESTTREE_} + fi } exeinto() { diff --git a/bin/save-ebuild-env.sh b/bin/save-ebuild-env.sh index f0bf00130..e5ae8af88 100644 --- a/bin/save-ebuild-env.sh +++ b/bin/save-ebuild-env.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 1999-2014 Gentoo Foundation +# Copyright 1999-2018 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # @FUNCTION: __save_ebuild_env @@ -13,7 +13,7 @@ __save_ebuild_env() { ( if has --exclude-init-phases $* ; then - unset S _E_DOCDESTTREE_ _E_EXEDESTTREE_ \ + unset S _E_DESTTREE _E_INSDESTTREE _E_DOCDESTTREE_ _E_EXEDESTTREE_ \ PORTAGE_DOCOMPRESS_SIZE_LIMIT PORTAGE_DOCOMPRESS \ PORTAGE_DOCOMPRESS_SKIP if [[ -n $PYTHONPATH &&