public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/portage:master commit in: bin/, bin/ebuild-helpers/
@ 2018-03-04 21:05 Michał Górny
  0 siblings, 0 replies; 8+ messages in thread
From: Michał Górny @ 2018-03-04 21:05 UTC (permalink / raw
  To: gentoo-commits

commit:     9326ac37c0163b111397594c289e728f3dcd4ad7
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Thu Sep 21 14:35:47 2017 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sun Mar  4 21:03:52 2018 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=9326ac37

Ban dohtml for EAPI 7

Bug: https://bugs.gentoo.org/show_bug.cgi?id=520546

 bin/eapi.sh               | 6 +++++-
 bin/ebuild-helpers/dohtml | 7 ++++++-
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/bin/eapi.sh b/bin/eapi.sh
index 7d35852cd..38d91a17f 100644
--- a/bin/eapi.sh
+++ b/bin/eapi.sh
@@ -52,8 +52,12 @@ ___eapi_has_einstall() {
 	[[ ${1-${EAPI-0}} =~ ^(0|1|2|3|4|4-python|4-slot-abi|5|5-hdepend|5-progress)$ ]]
 }
 
+___eapi_has_dohtml() {
+	[[ ${1-${EAPI-0}} =~ ^(0|1|2|3|4|4-python|4-slot-abi|5|5-hdepend|5-progress|6)$ ]]
+}
+
 ___eapi_has_dohtml_deprecated() {
-	[[ ! ${1-${EAPI-0}} =~ ^(0|1|2|3|4|4-python|4-slot-abi|5|5-hdepend|5-progress)$ ]]
+	[[ ${1-${EAPI-0}} == 6 ]]
 }
 
 ___eapi_has_docompress() {

diff --git a/bin/ebuild-helpers/dohtml b/bin/ebuild-helpers/dohtml
index 860d4abbe..49d6a6dfb 100755
--- a/bin/ebuild-helpers/dohtml
+++ b/bin/ebuild-helpers/dohtml
@@ -1,9 +1,14 @@
 #!/bin/bash
-# Copyright 2009-2013 Gentoo Foundation
+# Copyright 2009-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
 
+if ! ___eapi_has_dohtml; then
+	die "'${0##*/}' has been banned for EAPI '$EAPI'"
+	exit 1
+fi
+
 if ___eapi_has_dohtml_deprecated; then
 	eqawarn "'${0##*/}' is deprecated in EAPI '$EAPI'"
 fi


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [gentoo-commits] proj/portage:master commit in: bin/, bin/ebuild-helpers/
@ 2018-03-04 21:05 Michał Górny
  0 siblings, 0 replies; 8+ messages in thread
From: Michał Górny @ 2018-03-04 21:05 UTC (permalink / raw
  To: gentoo-commits

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 ++--
 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 &&


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [gentoo-commits] proj/portage:master commit in: bin/, bin/ebuild-helpers/
@ 2018-03-04 21:05 Michał Górny
  0 siblings, 0 replies; 8+ messages in thread
From: Michał Górny @ 2018-03-04 21:05 UTC (permalink / raw
  To: gentoo-commits

commit:     04a8eba03539b6e401022aee3aacf1fde3a8eeca
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Thu Sep 21 14:43:29 2017 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sun Mar  4 21:03:53 2018 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=04a8eba0

Ban dolib/libopts for EAPI 7

Bug: https://bugs.gentoo.org/630416

 bin/eapi.sh                 | 4 ++++
 bin/ebuild-helpers/dolib    | 7 ++++++-
 bin/ebuild-helpers/dolib.a  | 4 ++--
 bin/ebuild-helpers/dolib.so | 4 ++--
 bin/phase-helpers.sh        | 6 +++++-
 5 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/bin/eapi.sh b/bin/eapi.sh
index 38d91a17f..5a1a9aa40 100644
--- a/bin/eapi.sh
+++ b/bin/eapi.sh
@@ -60,6 +60,10 @@ ___eapi_has_dohtml_deprecated() {
 	[[ ${1-${EAPI-0}} == 6 ]]
 }
 
+___eapi_has_dolib_libopts() {
+	[[ ${1-${EAPI-0}} =~ ^(0|1|2|3|4|4-python|4-slot-abi|5|5-hdepend|5-progress|6)$ ]]
+}
+
 ___eapi_has_docompress() {
 	[[ ! ${1-${EAPI-0}} =~ ^(0|1|2|3)$ ]]
 }

diff --git a/bin/ebuild-helpers/dolib b/bin/ebuild-helpers/dolib
index a11bad463..62e04b385 100755
--- a/bin/ebuild-helpers/dolib
+++ b/bin/ebuild-helpers/dolib
@@ -1,9 +1,14 @@
 #!/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
 
+if [[ -z ${PORTAGE_INTERNAL_DOLIB} ]] && ! ___eapi_has_dolib_libopts; then
+	die "'${0##*/}' has been banned for EAPI '$EAPI'"
+	exit 1
+fi
+
 if ! ___eapi_has_prefix_variables; then
 	ED=${D}
 fi

diff --git a/bin/ebuild-helpers/dolib.a b/bin/ebuild-helpers/dolib.a
index 61961e4ed..5ea126b5d 100755
--- a/bin/ebuild-helpers/dolib.a
+++ b/bin/ebuild-helpers/dolib.a
@@ -1,5 +1,5 @@
 #!/bin/bash
-# Copyright 1999-2006 Gentoo Foundation
+# Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
-LIBOPTIONS='-m0644' exec dolib "$@"
+LIBOPTIONS='-m0644' PORTAGE_INTERNAL_DOLIB=1 exec dolib "$@"

diff --git a/bin/ebuild-helpers/dolib.so b/bin/ebuild-helpers/dolib.so
index eab8c9110..a3b579e5e 100755
--- a/bin/ebuild-helpers/dolib.so
+++ b/bin/ebuild-helpers/dolib.so
@@ -1,5 +1,5 @@
 #!/bin/bash
-# Copyright 1999-2006 Gentoo Foundation
+# Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
-LIBOPTIONS='-m0755' exec dolib "$@"
+LIBOPTIONS='-m0755' PORTAGE_INTERNAL_DOLIB=1 exec dolib "$@"

diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
index 49dad234d..12ccf6716 100644
--- a/bin/phase-helpers.sh
+++ b/bin/phase-helpers.sh
@@ -1,5 +1,5 @@
 #!/bin/bash
-# Copyright 1999-2017 Gentoo Foundation
+# Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 export DESTTREE=/usr
@@ -111,6 +111,10 @@ exeopts() {
 }
 
 libopts() {
+	if ! ___eapi_has_dolib_libopts; then
+		die "'${FUNCNAME}' has been banned for EAPI '$EAPI'"
+	fi
+
 	export LIBOPTIONS="$@"
 
 	# `install` should never be called with '-s' ...


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [gentoo-commits] proj/portage:master commit in: bin/, bin/ebuild-helpers/
@ 2018-03-28  5:19 Zac Medico
  0 siblings, 0 replies; 8+ messages in thread
From: Zac Medico @ 2018-03-28  5:19 UTC (permalink / raw
  To: gentoo-commits

commit:     a67dc215adb52392505d03870c236e828dca3625
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue Mar 27 03:19:10 2018 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Wed Mar 28 04:38:53 2018 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=a67dc215

prepstrip: rename to bin/estrip (refactor for EAPI 7 dostrip)

This matches the rename in portage-mgorny.

 bin/ebuild-helpers/prepstrip             | 400 +------------------------------
 bin/{ebuild-helpers/prepstrip => estrip} |   0
 2 files changed, 2 insertions(+), 398 deletions(-)

diff --git a/bin/ebuild-helpers/prepstrip b/bin/ebuild-helpers/prepstrip
index 2136e0d4d..0ec4c16b3 100755
--- a/bin/ebuild-helpers/prepstrip
+++ b/bin/ebuild-helpers/prepstrip
@@ -2,402 +2,6 @@
 # Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
-source "${PORTAGE_BIN_PATH}"/helper-functions.sh || exit 1
+source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
 
-# avoid multiple calls to `has`.  this creates things like:
-#   FEATURES_foo=false
-# if "foo" is not in $FEATURES
-tf() { "$@" && echo true || echo false ; }
-exp_tf() {
-	local flag var=$1
-	shift
-	for flag in "$@" ; do
-		eval ${var}_${flag}=$(tf has ${flag} ${!var})
-	done
-}
-exp_tf FEATURES compressdebug installsources nostrip splitdebug xattr
-exp_tf RESTRICT binchecks installsources splitdebug strip
-
-if ! ___eapi_has_prefix_variables; then
-	EPREFIX= ED=${D}
-fi
-
-banner=false
-SKIP_STRIP=false
-if ${RESTRICT_strip} || ${FEATURES_nostrip} ; then
-	SKIP_STRIP=true
-	banner=true
-	${FEATURES_installsources} || exit 0
-fi
-
-PRESERVE_XATTR=false
-if [[ ${KERNEL} == linux ]] && ${FEATURES_xattr} ; then
-	PRESERVE_XATTR=true
-	if type -P getfattr >/dev/null && type -P setfattr >/dev/null ; then
-		dump_xattrs() {
-			getfattr -d -m - --absolute-names "$1"
-		}
-		restore_xattrs() {
-			setfattr --restore=-
-		}
-	else
-		dump_xattrs() {
-			PYTHONPATH=${PORTAGE_PYTHONPATH:-${PORTAGE_PYM_PATH}} \
-			"${PORTAGE_PYTHON:-/usr/bin/python}" \
-			"${PORTAGE_BIN_PATH}/xattr-helper.py" --dump < <(echo -n "$1")
-		}
-		restore_xattrs() {
-			PYTHONPATH=${PORTAGE_PYTHONPATH:-${PORTAGE_PYM_PATH}} \
-			"${PORTAGE_PYTHON:-/usr/bin/python}" \
-			"${PORTAGE_BIN_PATH}/xattr-helper.py" --restore
-		}
-	fi
-fi
-
-# look up the tools we might be using
-for t in STRIP:strip OBJCOPY:objcopy READELF:readelf ; do
-	v=${t%:*} # STRIP
-	t=${t#*:} # strip
-	eval ${v}=\"${!v:-${CHOST}-${t}}\"
-	type -P -- ${!v} >/dev/null || eval ${v}=${t}
-done
-
-# Figure out what tool set we're using to strip stuff
-unset SAFE_STRIP_FLAGS DEF_STRIP_FLAGS SPLIT_STRIP_FLAGS
-case $(${STRIP} --version 2>/dev/null) in
-*elfutils*) # dev-libs/elfutils
-	# elfutils default behavior is always safe, so don't need to specify
-	# any flags at all
-	SAFE_STRIP_FLAGS=""
-	DEF_STRIP_FLAGS="--remove-comment"
-	SPLIT_STRIP_FLAGS="-f"
-	;;
-*GNU*) # sys-devel/binutils
-	# We'll leave out -R .note for now until we can check out the relevance
-	# of the section when it has the ALLOC flag set on it ...
-	SAFE_STRIP_FLAGS="--strip-unneeded"
-	DEF_STRIP_FLAGS="-R .comment -R .GCC.command.line -R .note.gnu.gold-version"
-	SPLIT_STRIP_FLAGS=
-	;;
-esac
-: ${PORTAGE_STRIP_FLAGS=${SAFE_STRIP_FLAGS} ${DEF_STRIP_FLAGS}}
-
-prepstrip_sources_dir=${EPREFIX}/usr/src/debug/${CATEGORY}/${PF}
-
-debugedit=$(type -P debugedit)
-if [[ -z ${debugedit} ]]; then
-	debugedit_paths=(
-		"${EPREFIX}/usr/libexec/rpm/debugedit"
-	)
-	for x in "${debugedit_paths[@]}"; do
-		if [[ -x ${x} ]]; then
-			debugedit=${x}
-			break
-		fi
-	done
-fi
-[[ ${debugedit} ]] && debugedit_found=true || debugedit_found=false
-debugedit_warned=false
-
-__multijob_init
-
-# Setup $T filesystem layout that we care about.
-tmpdir="${T}/prepstrip"
-rm -rf "${tmpdir}"
-mkdir -p "${tmpdir}"/{inodes,splitdebug,sources}
-
-# Usage: save_elf_sources <elf>
-save_elf_sources() {
-	${FEATURES_installsources} || return 0
-	${RESTRICT_installsources} && return 0
-	if ! ${debugedit_found} ; then
-		if ! ${debugedit_warned} ; then
-			debugedit_warned=true
-			ewarn "FEATURES=installsources is enabled but the debugedit binary could not be"
-			ewarn "found. This feature will not work unless debugedit or rpm is installed!"
-		fi
-		return 0
-	fi
-
-	local x=$1
-
-	# since we're editing the ELF here, we should recompute the build-id
-	# (the -i flag below).  save that output so we don't need to recompute
-	# it later on in the save_elf_debug step.
-	buildid=$("${debugedit}" -i \
-		-b "${WORKDIR}" \
-		-d "${prepstrip_sources_dir}" \
-		-l "${tmpdir}/sources/${x##*/}.${BASHPID:-$(__bashpid)}" \
-		"${x}")
-}
-
-# Usage: save_elf_debug <elf> [splitdebug file]
-save_elf_debug() {
-	${FEATURES_splitdebug} || return 0
-	${RESTRICT_splitdebug} && return 0
-
-	# NOTE: Debug files must be installed in
-	# ${EPREFIX}/usr/lib/debug/${EPREFIX} (note that ${EPREFIX} occurs
-	# twice in this path) in order for gdb's debug-file-directory
-	# lookup to work correctly.
-	local x=$1
-	local inode_debug=$2
-	local splitdebug=$3
-	local d_noslash=${D%/}
-	local y=${ED%/}/usr/lib/debug/${x:${#d_noslash}}.debug
-
-	# dont save debug info twice
-	[[ ${x} == *".debug" ]] && return 0
-
-	mkdir -p "${y%/*}"
-
-	if [ -f "${inode_debug}" ] ; then
-		ln "${inode_debug}" "${y}" || die "ln failed unexpectedly"
-	else
-		if [[ -n ${splitdebug} ]] ; then
-			mv "${splitdebug}" "${y}"
-		else
-			local objcopy_flags="--only-keep-debug"
-			${FEATURES_compressdebug} && objcopy_flags+=" --compress-debug-sections"
-			${OBJCOPY} ${objcopy_flags} "${x}" "${y}"
-			${OBJCOPY} --add-gnu-debuglink="${y}" "${x}"
-		fi
-		# Only do the following if the debug file was
-		# successfully created (see bug #446774).
-		if [ $? -eq 0 ] ; then
-			local args="a-x,o-w"
-			[[ -g ${x} || -u ${x} ]] && args+=",go-r"
-			chmod ${args} "${y}"
-			ln "${y}" "${inode_debug}" || die "ln failed unexpectedly"
-		fi
-	fi
-
-	# if we don't already have build-id from debugedit, look it up
-	if [[ -z ${buildid} ]] ; then
-		# convert the readelf output to something useful
-		buildid=$(${READELF} -n "${x}" 2>/dev/null | awk '/Build ID:/{ print $NF; exit }')
-	fi
-	if [[ -n ${buildid} ]] ; then
-		local buildid_dir="${ED%/}/usr/lib/debug/.build-id/${buildid:0:2}"
-		local buildid_file="${buildid_dir}/${buildid:2}"
-		mkdir -p "${buildid_dir}"
-		[ -L "${buildid_file}".debug ] || ln -s "../../${x:${#D}}.debug" "${buildid_file}.debug"
-		[ -L "${buildid_file}" ] || ln -s "/${x:${#D}}" "${buildid_file}"
-	fi
-}
-
-# Usage: process_elf <elf>
-process_elf() {
-	local x=$1 inode_link=$2 strip_flags=${*:3}
-	local already_stripped lockfile xt_data
-
-	__vecho "   ${x:${#ED}}"
-
-	# If two processes try to debugedit or strip the same hardlink at the
-	# same time, it may corrupt files or cause loss of splitdebug info.
-	# So, use a lockfile to prevent interference (easily observed with
-	# dev-vcs/git which creates ~111 hardlinks to one file in
-	# /usr/libexec/git-core).
-	lockfile=${inode_link}_lockfile
-	if ! ln "${inode_link}" "${lockfile}" 2>/dev/null ; then
-		while [[ -f ${lockfile} ]] ; do
-			sleep 1
-		done
-		unset lockfile
-	fi
-
-	[ -f "${inode_link}_stripped" ] && already_stripped=true || already_stripped=false
-
-	if ! ${already_stripped} ; then
-		if ${PRESERVE_XATTR} ; then
-			xt_data=$(dump_xattrs "${x}")
-		fi
-		save_elf_sources "${x}"
-	fi
-
-	if ${strip_this} ; then
-
-		# see if we can split & strip at the same time
-		if [[ -n ${SPLIT_STRIP_FLAGS} ]] ; then
-			local shortname="${x##*/}.debug"
-			local splitdebug="${tmpdir}/splitdebug/${shortname}.${BASHPID:-$(__bashpid)}"
-			${already_stripped} || \
-			${STRIP} ${strip_flags} \
-				-f "${splitdebug}" \
-				-F "${shortname}" \
-				"${x}"
-			save_elf_debug "${x}" "${inode_link}_debug" "${splitdebug}"
-		else
-			save_elf_debug "${x}" "${inode_link}_debug"
-			${already_stripped} || \
-			${STRIP} ${strip_flags} "${x}"
-		fi
-	fi
-
-	if ${already_stripped} ; then
-		rm -f "${x}" || die "rm failed unexpectedly"
-		ln "${inode_link}_stripped" "${x}" || die "ln failed unexpectedly"
-	else
-		ln "${x}" "${inode_link}_stripped" || die "ln failed unexpectedly"
-		if [[ ${xt_data} ]] ; then
-			restore_xattrs <<< "${xt_data}"
-		fi
-	fi
-
-	[[ -n ${lockfile} ]] && rm -f "${lockfile}"
-}
-
-# The existance of the section .symtab tells us that a binary is stripped.
-# We want to log already stripped binaries, as this may be a QA violation.
-# They prevent us from getting the splitdebug data.
-if ! ${RESTRICT_binchecks} && ! ${RESTRICT_strip} ; then
-	# We need to do the non-stripped scan serially first before we turn around
-	# and start stripping the files ourselves.  The log parsing can be done in
-	# parallel though.
-	log=${tmpdir}/scanelf-already-stripped.log
-	scanelf -yqRBF '#k%F' -k '!.symtab' "$@" | sed -e "s#^${ED%/}/##" > "${log}"
-	(
-	__multijob_child_init
-	qa_var="QA_PRESTRIPPED_${ARCH/-/_}"
-	[[ -n ${!qa_var} ]] && QA_PRESTRIPPED="${!qa_var}"
-	if [[ -n ${QA_PRESTRIPPED} && -s ${log} && \
-		${QA_STRICT_PRESTRIPPED-unset} = unset ]] ; then
-		shopts=$-
-		set -o noglob
-		for x in ${QA_PRESTRIPPED} ; do
-			sed -e "s#^${x#/}\$##" -i "${log}"
-		done
-		set +o noglob
-		set -${shopts}
-	fi
-	sed -e "/^\$/d" -e "s#^#/#" -i "${log}"
-	if [[ -s ${log} ]] ; then
-		__vecho -e "\n"
-		eqawarn "QA Notice: Pre-stripped files found:"
-		eqawarn "$(<"${log}")"
-	else
-		rm -f "${log}"
-	fi
-	) &
-	__multijob_post_fork
-fi
-
-# Since strip creates a new inode, we need to know the initial set of
-# inodes in advance, so that we can avoid interference due to trying
-# to strip the same (hardlinked) file multiple times in parallel.
-# See bug #421099.
-if  [[ ${USERLAND} == BSD ]] ; then
-	get_inode_number() { stat -f '%i' "$1"; }
-else
-	get_inode_number() { stat -c '%i' "$1"; }
-fi
-cd "${tmpdir}/inodes" || die "cd failed unexpectedly"
-while read -r x ; do
-	inode_link=$(get_inode_number "${x}") || die "stat failed unexpectedly"
-	echo "${x}" >> "${inode_link}" || die "echo failed unexpectedly"
-done < <(
-	# Use sort -u to eliminate duplicates for bug #445336.
-	(
-		scanelf -yqRBF '#k%F' -k '.symtab' "$@"
-		find "$@" -type f ! -type l -name '*.a'
-	) | LC_ALL=C sort -u
-)
-
-# Now we look for unstripped binaries.
-for inode_link in $(shopt -s nullglob; echo *) ; do
-while read -r x
-do
-
-	if ! ${banner} ; then
-		__vecho "strip: ${STRIP} ${PORTAGE_STRIP_FLAGS}"
-		banner=true
-	fi
-
-	(
-	__multijob_child_init
-	f=$(file "${x}") || exit 0
-	[[ -z ${f} ]] && exit 0
-
-	if ! ${SKIP_STRIP} ; then
-		# The noglob funk is to support STRIP_MASK="/*/booga" and to keep
-		#  the for loop from expanding the globs.
-		# The eval echo is to support STRIP_MASK="/*/{booga,bar}" sex.
-		set -o noglob
-		strip_this=true
-		for m in $(eval echo ${STRIP_MASK}) ; do
-			[[ /${x#${ED%/}} == ${m} ]] && strip_this=false && break
-		done
-		set +o noglob
-	else
-		strip_this=false
-	fi
-
-	# In Prefix we are usually an unprivileged user, so we can't strip
-	# unwritable objects.  Make them temporarily writable for the
-	# stripping.
-	was_not_writable=false
-	if [[ ! -w ${x} ]] ; then
-		was_not_writable=true
-		chmod u+w "${x}"
-	fi
-
-	# only split debug info for final linked objects
-	# or kernel modules as debuginfo for intermediatary
-	# files (think crt*.o from gcc/glibc) is useless and
-	# actually causes problems.  install sources for all
-	# elf types though cause that stuff is good.
-
-	buildid=
-	if [[ ${f} == *"current ar archive"* ]] ; then
-		__vecho "   ${x:${#ED}}"
-		if ${strip_this} ; then
-			# If we have split debug enabled, then do not strip this.
-			# There is no concept of splitdebug for objects not yet
-			# linked in (only for finally linked ELFs), so we have to
-			# retain the debug info in the archive itself.
-			if ! ${FEATURES_splitdebug} || ${RESTRICT_splitdebug} ; then
-				${STRIP} -g "${x}"
-			fi
-		fi
-	elif [[ ${f} == *"SB executable"* || ${f} == *"SB shared object"* ]] ; then
-		process_elf "${x}" "${inode_link}" ${PORTAGE_STRIP_FLAGS}
-	elif [[ ${f} == *"SB relocatable"* ]] ; then
-		process_elf "${x}" "${inode_link}" ${SAFE_STRIP_FLAGS}
-	fi
-
-	if ${was_not_writable} ; then
-		chmod u-w "${x}"
-	fi
-	) &
-	__multijob_post_fork
-
-done < "${inode_link}"
-done
-
-# With a bit more work, we could run the rsync processes below in
-# parallel, but not sure that'd be an overall improvement.
-__multijob_finish
-
-cd "${tmpdir}"/sources/ && cat * > "${tmpdir}/debug.sources" 2>/dev/null
-if [[ -s ${tmpdir}/debug.sources ]] && \
-   ${FEATURES_installsources} && \
-   ! ${RESTRICT_installsources} && \
-   ${debugedit_found}
-then
-	__vecho "installsources: rsyncing source files"
-	[[ -d ${D%/}/${prepstrip_sources_dir#/} ]] || mkdir -p "${D%/}/${prepstrip_sources_dir#/}"
-	grep -zv '/<[^/>]*>$' "${tmpdir}"/debug.sources | \
-		(cd "${WORKDIR}"; LANG=C sort -z -u | \
-		rsync -tL0 --chmod=ugo-st,a+r,go-w,Da+x,Fa-x --files-from=- "${WORKDIR}/" "${D%/}/${prepstrip_sources_dir#/}/" )
-
-	# Preserve directory structure.
-	# Needed after running save_elf_sources.
-	# https://bugzilla.redhat.com/show_bug.cgi?id=444310
-	while read -r -d $'\0' emptydir
-	do
-		>> "${emptydir}"/.keepdir
-	done < <(find "${D%/}/${prepstrip_sources_dir#/}/" -type d -empty -print0)
-fi
-
-cd "${T}"
-rm -rf "${tmpdir}"
+exec -a "${0}" "${PORTAGE_BIN_PATH}"/estrip "${@}"

diff --git a/bin/ebuild-helpers/prepstrip b/bin/estrip
similarity index 100%
copy from bin/ebuild-helpers/prepstrip
copy to bin/estrip


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [gentoo-commits] proj/portage:master commit in: bin/, bin/ebuild-helpers/
@ 2018-03-28  5:47 Zac Medico
  0 siblings, 0 replies; 8+ messages in thread
From: Zac Medico @ 2018-03-28  5:47 UTC (permalink / raw
  To: gentoo-commits

commit:     9897d71134187f4cd7f28d8eec9e81e9274d54e6
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Wed Mar 28 05:46:15 2018 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Wed Mar 28 05:47:11 2018 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=9897d711

prepstrip: fix ${0} usage

Fixes: a67dc215adb5 ("prepstrip: rename to bin/estrip (refactor for EAPI 7 dostrip)")

 bin/ebuild-helpers/prepstrip | 2 +-
 bin/estrip                   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/bin/ebuild-helpers/prepstrip b/bin/ebuild-helpers/prepstrip
index 9db06284d..ecbea47ec 100755
--- a/bin/ebuild-helpers/prepstrip
+++ b/bin/ebuild-helpers/prepstrip
@@ -8,4 +8,4 @@ if ___eapi_has_dostrip; then
 	die "${0##*/}: ${0##*/} has been banned for EAPI '$EAPI'; use 'dostrip' instead"
 fi
 
-exec -a "${0}" "${PORTAGE_BIN_PATH}"/estrip "${@}"
+__PORTAGE_HELPER=prepstrip exec "${PORTAGE_BIN_PATH}"/estrip "${@}"

diff --git a/bin/estrip b/bin/estrip
index fbd5882fa..41686aa39 100755
--- a/bin/estrip
+++ b/bin/estrip
@@ -30,7 +30,7 @@ if ${RESTRICT_strip} || ${FEATURES_nostrip} ; then
 	${FEATURES_installsources} || exit 0
 fi
 
-[[ ${0##*/} == prepstrip ]] && prepstrip=true || prepstrip=false
+[[ ${__PORTAGE_HELPER} == prepstrip ]] && prepstrip=true || prepstrip=false
 
 if ! ${prepstrip}; then
 while [[ $# -gt 0 ]] ; do


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [gentoo-commits] proj/portage:master commit in: bin/, bin/ebuild-helpers/
@ 2018-09-17  6:45 Michał Górny
  0 siblings, 0 replies; 8+ messages in thread
From: Michał Górny @ 2018-09-17  6:45 UTC (permalink / raw
  To: gentoo-commits

commit:     2f1c3a0e7e0e5b6d61ede0c5328ea8010881f9b5
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Thu Mar 22 21:49:29 2018 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon Sep 17 06:45:13 2018 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=2f1c3a0e

Ban prepall in ebuild scope

Reviewed-by: Zac Medico <zmedico <AT> gentoo.org>

 bin/ebuild-helpers/prepall | 28 ++--------------------------
 bin/misc-functions.sh      | 27 ++++++++++++++++++++++++++-
 2 files changed, 28 insertions(+), 27 deletions(-)

diff --git a/bin/ebuild-helpers/prepall b/bin/ebuild-helpers/prepall
index 87e1ca20c..e23a6d410 100755
--- a/bin/ebuild-helpers/prepall
+++ b/bin/ebuild-helpers/prepall
@@ -4,29 +4,5 @@
 
 source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
 
-if ! ___eapi_has_prefix_variables; then
-	ED=${D}
-fi
-
-if has chflags $FEATURES ; then
-	# Save all the file flags for restoration at the end of prepall.
-	mtree -c -p "${ED}" -k flags > "${T}/bsdflags.mtree"
-	# Remove all the file flags so that prepall can do anything necessary.
-	chflags -R noschg,nouchg,nosappnd,nouappnd "${ED}"
-	chflags -R nosunlnk,nouunlnk "${ED}" 2>/dev/null
-fi
-
-if ! ___eapi_has_docompress; then
-	while IFS= read -r -d '' mandir ; do
-		mandir=${mandir#${ED}}
-		prepman "${mandir%/man}"
-	done < <(find "${ED}" -type d -name man -print0)
-fi
-[[ -d ${ED%/}/usr/share/info ]] && prepinfo
-
-___eapi_has_dostrip || prepallstrip
-
-if has chflags $FEATURES ; then
-	# Restore all the file flags that were saved at the beginning of prepall.
-	mtree -U -e -p "${ED}" -k flags < "${T}/bsdflags.mtree" &> /dev/null
-fi
+die "'${0##*/}' is not allowed in ebuild scope"
+exit 1

diff --git a/bin/misc-functions.sh b/bin/misc-functions.sh
index 34492e086..d25bc8498 100755
--- a/bin/misc-functions.sh
+++ b/bin/misc-functions.sh
@@ -162,6 +162,31 @@ prepcompress() {
 	return 0
 }
 
+__prepall() {
+	if has chflags $FEATURES ; then
+		# Save all the file flags for restoration at the end of prepall.
+		mtree -c -p "${ED}" -k flags > "${T}/bsdflags.mtree"
+		# Remove all the file flags so that prepall can do anything necessary.
+		chflags -R noschg,nouchg,nosappnd,nouappnd "${ED}"
+		chflags -R nosunlnk,nouunlnk "${ED}" 2>/dev/null
+	fi
+
+	if ! ___eapi_has_docompress; then
+		while IFS= read -r -d '' mandir ; do
+			mandir=${mandir#${ED}}
+			prepman "${mandir%/man}"
+		done < <(find "${ED}" -type d -name man -print0)
+	fi
+	[[ -d ${ED%/}/usr/share/info ]] && prepinfo
+
+	___eapi_has_dostrip || prepallstrip
+
+	if has chflags $FEATURES ; then
+		# Restore all the file flags that were saved at the beginning of prepall.
+		mtree -U -e -p "${ED}" -k flags < "${T}/bsdflags.mtree" &> /dev/null
+	fi
+}
+
 install_qa_check() {
 	local d f i qa_var x paths qa_checks=() checks_run=()
 	if ! ___eapi_has_prefix_variables; then
@@ -219,7 +244,7 @@ install_qa_check() {
 	done < <(printf "%s\0" "${qa_checks[@]}" | LC_ALL=C sort -u -z)
 
 	export STRIP_MASK
-	prepall
+	__prepall
 	___eapi_has_docompress && prepcompress
 	ecompressdir --dequeue
 	ecompress --dequeue


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [gentoo-commits] proj/portage:master commit in: bin/, bin/ebuild-helpers/
@ 2021-05-24  6:08 Zac Medico
  0 siblings, 0 replies; 8+ messages in thread
From: Zac Medico @ 2021-05-24  6:08 UTC (permalink / raw
  To: gentoo-commits

commit:     dfa50503f76f3e70bac50f959a9c7248e6ea880d
Author:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
AuthorDate: Mon Nov 23 09:06:49 2020 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon May 24 05:55:41 2021 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=dfa50503

dosym: Implement -r option for EAPI 8.

"dosym -r <target> <link>" will expand the (apparent) path of <target>
relative to the (apparent) path of the directory containing <link>.
The main aim of this is to allow for an absolute path to be specified
as the link target, and the function will count path components and
convert it into a relative path.

Since we're inside ED at this point but the image will finally be
installed in EROOT, we don't try to resolve any pre-existing symlinks
in <target> or <link>. In other words, path expansion only looks at
the specified apparent paths, without touching any actual files in ED
or EROOT.

Bug: https://bugs.gentoo.org/708360
Signed-off-by: Ulrich Müller <ulm <AT> gentoo.org>
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
Signed-off-by: Zac Medico <zmedico <AT> gentoo.org>

 bin/eapi.sh              |  4 +++
 bin/ebuild-helpers/dosym | 67 +++++++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 70 insertions(+), 1 deletion(-)

diff --git a/bin/eapi.sh b/bin/eapi.sh
index 80bade87e..362cc07c0 100644
--- a/bin/eapi.sh
+++ b/bin/eapi.sh
@@ -266,6 +266,10 @@ ___eapi_has_DESTTREE_INSDESTTREE() {
 	[[ ${1-${EAPI-0}} =~ ^(0|1|2|3|4|4-python|4-slot-abi|5|5-progress|6)$ ]]
 }
 
+___eapi_has_dosym_r() {
+	[[ ! ${1-${EAPI-0}} =~ ^(0|1|2|3|4|4-python|4-slot-abi|5|5-progress|6|7)$ ]]
+}
+
 ___eapi_usev_has_second_arg() {
 	[[ ! ${1-${EAPI-0}} =~ ^(0|1|2|3|4|4-python|4-slot-abi|5|5-progress|6|7)$ ]]
 }

diff --git a/bin/ebuild-helpers/dosym b/bin/ebuild-helpers/dosym
index abd4da4f0..69d38956f 100755
--- a/bin/ebuild-helpers/dosym
+++ b/bin/ebuild-helpers/dosym
@@ -4,6 +4,12 @@
 
 source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
 
+option_r=
+if [[ ___eapi_has_dosym_r && $1 == -r ]]; then
+	option_r=t
+	shift
+fi
+
 if [[ $# -ne 2 ]] ; then
 	__helpers_die "${0##*/}: two arguments needed"
 	exit 1
@@ -18,9 +24,68 @@ if [[ ${2} == */ ]] || [[ -d ${ED%/}/${2#/} && ! -L ${ED%/}/${2#/} ]] ; then
 	__helpers_die "${0##*/}: dosym target omits basename: '${2}'"
 fi
 
+target=$1
+
+if [[ ${option_r} ]]; then
+	# Transparent bash-only replacement for GNU "realpath -m -s".
+	# Resolve references to "/./", "/../" and remove extra "/" characters
+	# from <path>, without touching any actual file.
+	dosym_canonicalize() {
+		local path slash i prev out IFS=/
+
+		path=( $1 )
+		[[ $1 == /* ]] && slash=/
+
+		while true; do
+			# Find first instance of non-".." path component followed by "..",
+			# or as a special case, "/.." at the beginning of the path.
+			# Also drop empty and "." path components as we go along.
+			prev=
+			for i in ${!path[@]}; do
+				if [[ -z ${path[i]} || ${path[i]} == . ]]; then
+					unset "path[i]"
+				elif [[ ${path[i]} != .. ]]; then
+					prev=${i}
+				elif [[ ${prev} || ${slash} ]]; then
+					# Found, remove path components and reiterate
+					[[ ${prev} ]] && unset "path[prev]"
+					unset "path[i]"
+					continue 2
+				fi
+			done
+			# No (further) instance found, so we're done
+			break
+		done
+
+		out="${slash}${path[*]}"
+		echo "${out:-.}"
+	}
+
+	# Expansion makes sense only for an absolute target path
+	[[ ${target} == /* ]] || __helpers_die \
+		"${0##*/}: -r specified but no absolute target path: '${target}'"
+
+	target=$(dosym_canonicalize "${target}")
+	linkdir=$(dosym_canonicalize "/${2#/}")
+	linkdir=${linkdir%/*}	# poor man's dirname(1)
+	linkdir=${linkdir:-/}	# always keep the initial "/"
+
+	IFS=/
+	for comp in ${linkdir}; do
+		if [[ ${target%%/*} == "${comp}" ]]; then
+			target=${target#"${comp}"}
+			target=${target#/}
+		else
+			target=..${target:+/}${target}
+		fi
+	done
+	unset IFS
+	target=${target:-.}
+fi
+
 destdir=${2%/*}
 [[ ! -d ${ED%/}/${destdir#/} ]] && dodir "${destdir}"
-ln -snf "${1}" "${ED%/}/${2#/}"
+ln -snf "${target}" "${ED%/}/${2#/}"
 
 ret=$?
 [[ $ret -ne 0 ]] && __helpers_die "${0##*/} failed"


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [gentoo-commits] proj/portage:master commit in: bin/, bin/ebuild-helpers/
@ 2023-10-21 19:23 Ulrich Müller
  0 siblings, 0 replies; 8+ messages in thread
From: Ulrich Müller @ 2023-10-21 19:23 UTC (permalink / raw
  To: gentoo-commits

commit:     ce929d243678a2b1a3dc05fe9a21e1bf07fbcac6
Author:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
AuthorDate: Fri May 12 17:27:32 2023 +0000
Commit:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
CommitDate: Sat Oct 21 08:01:24 2023 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=ce929d24

prepinfo: Ban in ebuild scope

Also drop compatibility code from install_qa_check, i.e. don't recurse
into subdirectories for removal of Info dir files.

Closes: https://bugs.gentoo.org/899898
Signed-off-by: Ulrich Müller <ulm <AT> gentoo.org>

 bin/ebuild-helpers/prepinfo | 36 ++----------------------------------
 bin/misc-functions.sh       | 13 -------------
 2 files changed, 2 insertions(+), 47 deletions(-)

diff --git a/bin/ebuild-helpers/prepinfo b/bin/ebuild-helpers/prepinfo
index af5ae9f088..80fcecba60 100755
--- a/bin/ebuild-helpers/prepinfo
+++ b/bin/ebuild-helpers/prepinfo
@@ -4,37 +4,5 @@
 
 source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
 
-eqawarn "QA Notice: '${0##*/}' is not allowed in ebuild scope"
-
-if ! ___eapi_has_prefix_variables ; then
-	ED=${D}
-fi
-
-if [[ -z ${1} ]] ; then
-	infodir="/usr/share/info"
-else
-	if [[ -d ${ED%/}/${1#/}/share/info ]] ; then
-		infodir="${1#/}/share/info"
-	else
-		infodir="${1#/}/info"
-	fi
-fi
-
-if [[ ! -d ${ED%/}/${infodir#/} ]] ; then
-	if [[ -n $1 ]] ; then
-		__vecho "${0##*/}: '${infodir}' does not exist!"
-		exit 1
-	else
-		exit 0
-	fi
-fi
-
-find "${ED%/}/${infodir#/}" -type d -print0 | while read -r -d $'\0' x ; do
-	for f in "${x}"/.keepinfodir*; do
-		[[ -e ${f} ]] && continue 2
-	done
-
-	rm -f "${x}"/dir{,.info}{,.Z,.gz,.bz2,.lzma,.lz,.xz,.zst}
-done
-
-exit 0
+die "'${0##*/}' is not allowed in ebuild scope"
+exit 1

diff --git a/bin/misc-functions.sh b/bin/misc-functions.sh
index d9319d5af8..4ce3acbfdc 100755
--- a/bin/misc-functions.sh
+++ b/bin/misc-functions.sh
@@ -147,19 +147,6 @@ install_qa_check() {
 		# Portage regenerates this on the installed system.
 		rm -f "${ED%/}"/usr/share/info/dir{,.info}{,.Z,.gz,.bz2,.lzma,.lz,.xz,.zst} \
 			|| die "rm failed"
-		# Recurse into subdirs. Remove this code after 2023-12-31. #899898
-		while read -r -d '' x; do
-			( shopt -s failglob; : "${x}"/.keepinfodir* ) 2>/dev/null \
-				&& continue
-			for f in "${x}"/dir{,.info}{,.Z,.gz,.bz2,.lzma,.lz,.xz,.zst}; do
-				if [[ -e ${f} ]]; then
-					eqawarn "QA Notice: Removing Info directory file '${f}'."
-					eqawarn "Relying on this behavior is deprecated and may"
-					eqawarn "cause file collisions in future."
-					rm -f "${f}" || die "rm failed"
-				fi
-			done
-		done < <(find "${ED%/}"/usr/share/info -mindepth 1 -type d -print0)
 	fi
 
 	# If binpkg-docompress is enabled, apply compression before creating


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-10-21 19:23 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-05-24  6:08 [gentoo-commits] proj/portage:master commit in: bin/, bin/ebuild-helpers/ Zac Medico
  -- strict thread matches above, loose matches on Subject: below --
2023-10-21 19:23 Ulrich Müller
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
2018-03-04 21:05 Michał Górny

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox