From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/portage:master commit in: bin/, bin/ebuild-helpers/
Date: Sun, 4 Mar 2018 21:05:09 +0000 (UTC) [thread overview]
Message-ID: <1520197436.a5d0111d0bdaa7ee9e5c68e22b4a97ce415e119b.mgorny@gentoo> (raw)
commit: a5d0111d0bdaa7ee9e5c68e22b4a97ce415e119b
Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sun Mar 4 09:49:35 2018 +0000
Commit: Michał Górny <mgorny <AT> gentoo <DOT> 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 <zmedico <AT> gentoo.org>
bin/eapi.sh | 4 ++++
bin/ebuild-helpers/dobin | 16 ++++++++++++----
bin/ebuild-helpers/doconfd | 4 ++--
bin/ebuild-helpers/doenvd | 4 ++--
| 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 "$@"
--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 &&
next reply other threads:[~2018-03-04 21:05 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-04 21:05 Michał Górny [this message]
-- strict thread matches above, loose matches on Subject: below --
2023-10-21 19:23 [gentoo-commits] proj/portage:master commit in: bin/, bin/ebuild-helpers/ Ulrich Müller
2021-05-24 6:08 Zac Medico
2018-09-17 6:45 Michał Górny
2018-03-28 5:47 Zac Medico
2018-03-28 5:19 Zac Medico
2018-03-04 21:05 Michał Górny
2018-03-04 21:05 Michał Górny
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1520197436.a5d0111d0bdaa7ee9e5c68e22b4a97ce415e119b.mgorny@gentoo \
--to=mgorny@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox