public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/portage:master commit in: bin/ebuild-helpers/, bin/
@ 2018-03-28  5:19 Zac Medico
  0 siblings, 0 replies; 20+ messages in thread
From: Zac Medico @ 2018-03-28  5:19 UTC (permalink / raw
  To: gentoo-commits

commit:     9aaa652c86b21b925bc56fafd57b561b86ace0f8
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Mon Mar 26 19:12:51 2018 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Wed Mar 28 05:09:15 2018 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=9aaa652c

Add dostrip for EAPI 7

This patch includes the essential parts of the dostrip implementation
from portage-mgorny. All of the prepstrip code has moved to
bin/estrip, without any changes except the addition of argument
parsing for estrip --ignore, --queue, and --deque modes which are
equivalent to the corresponding ecompressdir modes.

Due to overlap, also ban the non-standard prepstrip and prepallstrip
helpers in EAPI 7, with a die message suggesting to use 'dostrip'
instead. Also ignore the non-standard STRIP_MASK variable for EAPI 7.

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

 bin/eapi.sh                     |  4 +++
 bin/ebuild-helpers/prepall      |  2 +-
 bin/ebuild-helpers/prepallstrip |  4 +++
 bin/ebuild-helpers/prepstrip    |  4 +++
 bin/ebuild.sh                   |  2 +-
 bin/estrip                      | 74 +++++++++++++++++++++++++++++++++++++++--
 bin/misc-functions.sh           |  6 ++++
 bin/phase-helpers.sh            | 29 ++++++++++++++++
 bin/save-ebuild-env.sh          |  4 +--
 9 files changed, 122 insertions(+), 7 deletions(-)

diff --git a/bin/eapi.sh b/bin/eapi.sh
index 326eb387e..f9a4744e9 100644
--- a/bin/eapi.sh
+++ b/bin/eapi.sh
@@ -76,6 +76,10 @@ ___eapi_has_docompress() {
 	[[ ! ${1-${EAPI-0}} =~ ^(0|1|2|3)$ ]]
 }
 
+___eapi_has_dostrip() {
+	[[ ${1-${EAPI-0}} =~ ^(0|1|2|3|4|4-python|4-slot-abi|5|5-hdepend|5-progress|6)$ ]]
+}
+
 ___eapi_has_nonfatal() {
 	[[ ! ${1-${EAPI-0}} =~ ^(0|1|2|3)$ ]]
 }

diff --git a/bin/ebuild-helpers/prepall b/bin/ebuild-helpers/prepall
index 44643bb58..bc77af4a1 100755
--- a/bin/ebuild-helpers/prepall
+++ b/bin/ebuild-helpers/prepall
@@ -19,7 +19,7 @@ fi
 prepallman
 prepallinfo
 
-prepallstrip
+___eapi_has_dostrip || prepallstrip
 
 if has chflags $FEATURES ; then
 	# Restore all the file flags that were saved at the beginning of prepall.

diff --git a/bin/ebuild-helpers/prepallstrip b/bin/ebuild-helpers/prepallstrip
index 59fa7cc61..4bde1f4b2 100755
--- a/bin/ebuild-helpers/prepallstrip
+++ b/bin/ebuild-helpers/prepallstrip
@@ -4,6 +4,10 @@
 
 source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
 
+if ___eapi_has_dostrip; then
+	die "${0##*/}: ${0##*/} has been banned for EAPI '$EAPI'; use 'dostrip' instead"
+fi
+
 if ! ___eapi_has_prefix_variables; then
 	ED=${D}
 fi

diff --git a/bin/ebuild-helpers/prepstrip b/bin/ebuild-helpers/prepstrip
index 0ec4c16b3..9db06284d 100755
--- a/bin/ebuild-helpers/prepstrip
+++ b/bin/ebuild-helpers/prepstrip
@@ -4,4 +4,8 @@
 
 source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
 
+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 "${@}"

diff --git a/bin/ebuild.sh b/bin/ebuild.sh
index 061b1aff4..11441bfb2 100755
--- a/bin/ebuild.sh
+++ b/bin/ebuild.sh
@@ -59,7 +59,7 @@ else
 	# These dummy functions are for things that are likely to be called
 	# in global scope, even though they are completely useless during
 	# the "depend" phase.
-	funcs="diropts docompress exeopts get_KV insopts
+	funcs="diropts docompress dostrip exeopts get_KV insopts
 		KV_major KV_micro KV_minor KV_to_int
 		libopts register_die_hook register_success_hook
 		__strip_duplicate_slashes

diff --git a/bin/estrip b/bin/estrip
index 2136e0d4d..fbd5882fa 100755
--- a/bin/estrip
+++ b/bin/estrip
@@ -30,6 +30,64 @@ if ${RESTRICT_strip} || ${FEATURES_nostrip} ; then
 	${FEATURES_installsources} || exit 0
 fi
 
+[[ ${0##*/} == prepstrip ]] && prepstrip=true || prepstrip=false
+
+if ! ${prepstrip}; then
+while [[ $# -gt 0 ]] ; do
+	case $1 in
+	--ignore)
+		shift
+
+		skip_dirs=()
+		for skip; do
+			if [[ -d ${ED%/}/${skip#/} ]]; then
+				skip_dirs+=( "${ED%/}/${skip#/}" )
+			else
+				rm -f "${ED%/}/${skip#/}.estrip" || die
+			fi
+		done
+
+		if [[ ${skip_dirs[@]} ]]; then
+			find "${skip_dirs[@]}" -name '*.estrip' -delete || die
+		fi
+
+		exit 0
+		;;
+	--queue)
+		shift
+
+		find_paths=()
+		for path; do
+			if [[ -e ${ED%/}/${path#/} ]]; then
+				find_paths+=( "${ED%/}/${path#/}" )
+			fi
+		done
+
+		if [[ ${find_paths[@]} ]]; then
+			while IFS= read -r path; do
+				>> "${path}.estrip" || die
+			done < <(
+				scanelf -yqRBF '#k%F' -k '.symtab' "${find_paths[@]}"
+				find "${find_paths[@]}" -type f ! -type l -name '*.a'
+			)
+		fi
+
+		exit 0
+		;;
+	--dequeue)
+		[[ -n ${2} ]] && die "${0##*/}: --dequeue takes no additional arguments"
+		break
+		;;
+	*)
+		die "${0##*/}: unknown arguments '$*'"
+		exit 1
+		;;
+	esac
+	shift
+done
+set -- "${ED}"
+fi
+
 PRESERVE_XATTR=false
 if [[ ${KERNEL} == linux ]] && ${FEATURES_xattr} ; then
 	PRESERVE_XATTR=true
@@ -292,6 +350,7 @@ else
 	get_inode_number() { stat -c '%i' "$1"; }
 fi
 cd "${tmpdir}/inodes" || die "cd failed unexpectedly"
+if ${prepstrip}; then
 while read -r x ; do
 	inode_link=$(get_inode_number "${x}") || die "stat failed unexpectedly"
 	echo "${x}" >> "${inode_link}" || die "echo failed unexpectedly"
@@ -302,6 +361,13 @@ done < <(
 		find "$@" -type f ! -type l -name '*.a'
 	) | LC_ALL=C sort -u
 )
+else
+while IFS= read -d '' -r x ; do
+	rm -f "${x}" || die
+	inode_link=$(get_inode_number "${x%.estrip}") || die "stat failed unexpectedly"
+	echo "${x%.estrip}" >> "${inode_link}" || die "echo failed unexpectedly"
+done < <(find "${ED}" -name '*.estrip' -print0)
+fi
 
 # Now we look for unstripped binaries.
 for inode_link in $(shopt -s nullglob; echo *) ; do
@@ -318,7 +384,11 @@ do
 	f=$(file "${x}") || exit 0
 	[[ -z ${f} ]] && exit 0
 
-	if ! ${SKIP_STRIP} ; then
+	if ${SKIP_STRIP} ; then
+		strip_this=false
+	elif ! ${prepstrip}; then
+		strip_this=true
+	else
 		# 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.
@@ -328,8 +398,6 @@ 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

diff --git a/bin/misc-functions.sh b/bin/misc-functions.sh
index 7643af7b5..df8361036 100755
--- a/bin/misc-functions.sh
+++ b/bin/misc-functions.sh
@@ -224,6 +224,12 @@ install_qa_check() {
 	ecompressdir --dequeue
 	ecompress --dequeue
 
+	if ___eapi_has_dostrip; then
+		"${PORTAGE_BIN_PATH}"/estrip --queue "${PORTAGE_DOSTRIP[@]}"
+		"${PORTAGE_BIN_PATH}"/estrip --ignore "${PORTAGE_DOSTRIP_SKIP[@]}"
+		"${PORTAGE_BIN_PATH}"/estrip --dequeue
+	fi
+
 	# Create NEEDED.ELF.2 regardless of RESTRICT=binchecks, since this info is
 	# too useful not to have (it's required for things like preserve-libs), and
 	# it's tempting for ebuild authors to set RESTRICT=binchecks for packages

diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
index 5eeecfef7..556d089b5 100644
--- a/bin/phase-helpers.sh
+++ b/bin/phase-helpers.sh
@@ -20,6 +20,9 @@ export MOPREFIX=${PN}
 export PORTAGE_DOCOMPRESS_SIZE_LIMIT="128"
 declare -a PORTAGE_DOCOMPRESS=( /usr/share/{doc,info,man} )
 declare -a PORTAGE_DOCOMPRESS_SKIP=( /usr/share/doc/${PF}/html )
+declare -a PORTAGE_DOSTRIP=( / )
+has strip ${RESTRICT} && PORTAGE_DOSTRIP=()
+declare -a PORTAGE_DOSTRIP_SKIP=()
 
 into() {
 	if [ "$1" == "/" ]; then
@@ -160,6 +163,32 @@ docompress() {
 	fi
 }
 
+dostrip() {
+	___eapi_has_dostrip || die "'${FUNCNAME}' not supported in this EAPI"
+
+	local f g
+	if [[ $1 = "-x" ]]; then
+		shift
+		for f; do
+			f=$(__strip_duplicate_slashes "${f}"); f=${f%/}
+			[[ ${f:0:1} = / ]] || f="/${f}"
+			for g in "${PORTAGE_DOSTRIP_SKIP[@]}"; do
+				[[ ${f} = "${g}" ]] && continue 2
+			done
+			PORTAGE_DOSTRIP_SKIP+=( "${f}" )
+		done
+	else
+		for f; do
+			f=$(__strip_duplicate_slashes "${f}"); f=${f%/}
+			[[ ${f:0:1} = / ]] || f="/${f}"
+			for g in "${PORTAGE_DOSTRIP[@]}"; do
+				[[ ${f} = "${g}" ]] && continue 2
+			done
+			PORTAGE_DOSTRIP+=( "${f}" )
+		done
+	fi
+}
+
 useq() {
 	has $EBUILD_PHASE prerm postrm || eqawarn \
 		"QA Notice: The 'useq' function is deprecated (replaced by 'use')"

diff --git a/bin/save-ebuild-env.sh b/bin/save-ebuild-env.sh
index e5ae8af88..947ac79d5 100644
--- a/bin/save-ebuild-env.sh
+++ b/bin/save-ebuild-env.sh
@@ -15,7 +15,7 @@ __save_ebuild_env() {
 	if has --exclude-init-phases $* ; then
 		unset S _E_DESTTREE _E_INSDESTTREE _E_DOCDESTTREE_ _E_EXEDESTTREE_ \
 			PORTAGE_DOCOMPRESS_SIZE_LIMIT PORTAGE_DOCOMPRESS \
-			PORTAGE_DOCOMPRESS_SKIP
+			PORTAGE_DOCOMPRESS_SKIP PORTAGE_DOSTRIP PORTAGE_DOSTRIP_SKIP
 		if [[ -n $PYTHONPATH &&
 			${PYTHONPATH%%:*} -ef $PORTAGE_PYM_PATH ]] ; then
 			if [[ $PYTHONPATH == *:* ]] ; then
@@ -60,7 +60,7 @@ __save_ebuild_env() {
 		unpack __strip_duplicate_slashes econf einstall \
 		__dyn_setup __dyn_unpack __dyn_clean \
 		into insinto exeinto docinto \
-		insopts diropts exeopts libopts docompress \
+		insopts diropts exeopts libopts docompress dostrip \
 		__abort_handler __abort_prepare __abort_configure __abort_compile \
 		__abort_test __abort_install __dyn_prepare __dyn_configure \
 		__dyn_compile __dyn_test __dyn_install \


^ permalink raw reply related	[flat|nested] 20+ messages in thread
* [gentoo-commits] proj/portage:master commit in: bin/ebuild-helpers/, bin/
@ 2024-06-01 11:14 Ulrich Müller
  0 siblings, 0 replies; 20+ messages in thread
From: Ulrich Müller @ 2024-06-01 11:14 UTC (permalink / raw
  To: gentoo-commits

commit:     5e1477724ec3e284c05dcbf71c45ca35f1ca100c
Author:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
AuthorDate: Sun May 26 08:59:42 2024 +0000
Commit:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
CommitDate: Sat Jun  1 11:11:35 2024 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=5e147772

eapi.sh: Drop ___eapi_has_dohtml_deprecated()

This was added because of a council decision 10 years ago:
https://projects.gentoo.org/council/meeting-logs/20140909-summary.txt

It has outlived its usefulness since dohtml is banned in EAPI 7 and
later.

Signed-off-by: Ulrich Müller <ulm <AT> gentoo.org>

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

diff --git a/bin/eapi.sh b/bin/eapi.sh
index ae815f3a63..5e894e17dd 100644
--- a/bin/eapi.sh
+++ b/bin/eapi.sh
@@ -1,5 +1,5 @@
 #!/usr/bin/env bash
-# Copyright 2012-2023 Gentoo Authors
+# Copyright 2012-2024 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # PHASES
@@ -80,10 +80,6 @@ ___eapi_has_dohtml() {
 	[[ ${1-${EAPI-0}} =~ ^(0|1|2|3|4|4-slot-abi|5|6)$ ]]
 }
 
-___eapi_has_dohtml_deprecated() {
-	[[ ${1-${EAPI-0}} == 6 ]]
-}
-
 ___eapi_has_dolib_libopts() {
 	[[ ${1-${EAPI-0}} =~ ^(0|1|2|3|4|4-slot-abi|5|6)$ ]]
 }

diff --git a/bin/ebuild-helpers/dohtml b/bin/ebuild-helpers/dohtml
index 4d4efd496c..b8929ceff8 100755
--- a/bin/ebuild-helpers/dohtml
+++ b/bin/ebuild-helpers/dohtml
@@ -1,5 +1,5 @@
 #!/usr/bin/env bash
-# Copyright 2009-2018 Gentoo Foundation
+# Copyright 2009-2024 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
@@ -9,10 +9,6 @@ if ! ___eapi_has_dohtml; then
 	exit 1
 fi
 
-if ___eapi_has_dohtml_deprecated; then
-	eqawarn "QA Notice: '${0##*/}' is deprecated in EAPI '${EAPI}'"
-fi
-
 # Use safe cwd, avoiding unsafe import for bug #469338.
 export __PORTAGE_HELPER_CWD=${PWD}
 cd "${PORTAGE_PYM_PATH}" || die


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

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

prep{,all}strip: Ban in ebuild scope

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

 bin/ebuild-helpers/prepallstrip | 13 ++-----------
 bin/ebuild-helpers/prepstrip    |  9 ++-------
 bin/estrip                      |  4 +---
 3 files changed, 5 insertions(+), 21 deletions(-)

diff --git a/bin/ebuild-helpers/prepallstrip b/bin/ebuild-helpers/prepallstrip
index f22483a531..80fcecba60 100755
--- a/bin/ebuild-helpers/prepallstrip
+++ b/bin/ebuild-helpers/prepallstrip
@@ -4,14 +4,5 @@
 
 source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
 
-if ___eapi_has_dostrip; then
-	die "${0##*/}: ${0##*/} has been banned for EAPI '${EAPI}'; use 'dostrip' instead"
-fi
-
-eqawarn "QA Notice: '${0##*/}' is not allowed in ebuild scope"
-
-if ! ___eapi_has_prefix_variables; then
-	ED=${D}
-fi
-
-exec prepstrip "${ED}"
+die "'${0##*/}' is not allowed in ebuild scope"
+exit 1

diff --git a/bin/ebuild-helpers/prepstrip b/bin/ebuild-helpers/prepstrip
index 0da4c65166..80fcecba60 100755
--- a/bin/ebuild-helpers/prepstrip
+++ b/bin/ebuild-helpers/prepstrip
@@ -4,10 +4,5 @@
 
 source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
 
-if ___eapi_has_dostrip; then
-	die "${0##*/}: ${0##*/} has been banned for EAPI '${EAPI}'; use 'dostrip' instead"
-fi
-
-eqawarn "QA Notice: '${0##*/}' is not allowed in ebuild scope"
-
-__PORTAGE_HELPER=prepstrip exec "${PORTAGE_BIN_PATH}"/estrip "${@}"
+die "'${0##*/}' is not allowed in ebuild scope"
+exit 1

diff --git a/bin/estrip b/bin/estrip
index 8a2f5adc1f..3ac6a16927 100755
--- a/bin/estrip
+++ b/bin/estrip
@@ -30,9 +30,8 @@ if ${PORTAGE_RESTRICT_strip} || ${FEATURES_nostrip} ; then
 	${FEATURES_installsources} || exit 0
 fi
 
-[[ ${__PORTAGE_HELPER} == prepstrip ]] && prepstrip=true || prepstrip=false
+prepstrip=false
 
-if ! ${prepstrip}; then
 while [[ $# -gt 0 ]] ; do
 	case $1 in
 	--ignore)
@@ -130,7 +129,6 @@ while [[ $# -gt 0 ]] ; do
 	shift
 done
 set -- "${ED}"
-fi
 
 PRESERVE_XATTR=false
 if [[ ${KERNEL} == linux ]] && ${FEATURES_xattr} ; then


^ permalink raw reply related	[flat|nested] 20+ messages in thread
* [gentoo-commits] proj/portage:master commit in: bin/ebuild-helpers/, bin/
@ 2021-05-24  4:55 Zac Medico
  0 siblings, 0 replies; 20+ messages in thread
From: Zac Medico @ 2021-05-24  4:55 UTC (permalink / raw
  To: gentoo-commits

commit:     cbe923acdb6fae689cdaedc7f00901cd00e2557a
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Wed May 12 17:38:16 2021 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon May 24 04:52:34 2021 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=cbe923ac

Make doconf, doenvd, doheader & doinitd ignore ins/exeopts in EAPI 8

Bug: https://bugs.gentoo.org/657580
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
Signed-off-by: Zac Medico <zmedico <AT> gentoo.org>

 bin/eapi.sh                 | 16 ++++++++++++++++
 bin/ebuild-helpers/doconfd  |  8 +++++++-
 bin/ebuild-helpers/doenvd   |  8 +++++++-
 bin/ebuild-helpers/doheader |  8 +++++++-
 bin/ebuild-helpers/doinitd  |  9 ++++++++-
 5 files changed, 45 insertions(+), 4 deletions(-)

diff --git a/bin/eapi.sh b/bin/eapi.sh
index d3cac807c..eea8d0d0f 100644
--- a/bin/eapi.sh
+++ b/bin/eapi.sh
@@ -266,6 +266,22 @@ ___eapi_usev_has_second_arg() {
 	[[ ! ${1-${EAPI-0}} =~ ^(0|1|2|3|4|4-python|4-slot-abi|5|5-progress|6|7)$ ]]
 }
 
+___eapi_doconfd_respects_insopts() {
+	[[ ${1-${EAPI-0}} =~ ^(0|1|2|3|4|4-python|4-slot-abi|5|5-progress|6|7)$ ]]
+}
+
+___eapi_doenvd_respects_insopts() {
+	[[ ${1-${EAPI-0}} =~ ^(0|1|2|3|4|4-python|4-slot-abi|5|5-progress|6|7)$ ]]
+}
+
+___eapi_doheader_respects_insopts() {
+	[[ ${1-${EAPI-0}} =~ ^(0|1|2|3|4|4-python|4-slot-abi|5|5-progress|6|7)$ ]]
+}
+
+___eapi_doinitd_respects_exeopts() {
+	[[ ${1-${EAPI-0}} =~ ^(0|1|2|3|4|4-python|4-slot-abi|5|5-progress|6|7)$ ]]
+}
+
 # OTHERS
 
 ___eapi_enables_failglob_in_global_scope() {

diff --git a/bin/ebuild-helpers/doconfd b/bin/ebuild-helpers/doconfd
index 15ad980f3..572629a54 100755
--- a/bin/ebuild-helpers/doconfd
+++ b/bin/ebuild-helpers/doconfd
@@ -1,5 +1,5 @@
 #!/bin/bash
-# Copyright 1999-2018 Gentoo Foundation
+# Copyright 1999-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
@@ -13,4 +13,10 @@ export _E_INSDESTTREE_='/etc/conf.d/'
 if ___eapi_has_DESTTREE_INSDESTTREE; then
 	export INSDESTTREE=${_E_INSDESTTREE_}
 fi
+
+if ! ___eapi_doconfd_respects_insopts; then
+	export INSOPTIONS=-m0644
+	export DIROPTIONS=""
+fi
+
 exec doins "$@"

diff --git a/bin/ebuild-helpers/doenvd b/bin/ebuild-helpers/doenvd
index f14b95104..f1310c848 100755
--- a/bin/ebuild-helpers/doenvd
+++ b/bin/ebuild-helpers/doenvd
@@ -1,5 +1,5 @@
 #!/bin/bash
-# Copyright 1999-2018 Gentoo Foundation
+# Copyright 1999-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
@@ -13,4 +13,10 @@ export _E_INSDESTTREE_='/etc/env.d/'
 if ___eapi_has_DESTTREE_INSDESTTREE; then
 	export INSDESTTREE=${_E_INSDESTTREE_}
 fi
+
+if ! ___eapi_doenvd_respects_insopts; then
+	export INSOPTIONS=-m0644
+	export DIROPTIONS=""
+fi
+
 exec doins "$@"

diff --git a/bin/ebuild-helpers/doheader b/bin/ebuild-helpers/doheader
index aedc2322a..2f21a5a2a 100755
--- a/bin/ebuild-helpers/doheader
+++ b/bin/ebuild-helpers/doheader
@@ -1,5 +1,5 @@
 #!/bin/bash
-# Copyright 1999-2018 Gentoo Foundation
+# Copyright 1999-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
@@ -17,4 +17,10 @@ export _E_INSDESTTREE_='/usr/include/'
 if ___eapi_has_DESTTREE_INSDESTTREE; then
 	export INSDESTTREE=${_E_INSDESTTREE_}
 fi
+
+if ! ___eapi_doheader_respects_insopts; then
+	export INSOPTIONS=-m0644
+	export DIROPTIONS=""
+fi
+
 exec doins "$@"

diff --git a/bin/ebuild-helpers/doinitd b/bin/ebuild-helpers/doinitd
index a216d9827..1863aedac 100755
--- a/bin/ebuild-helpers/doinitd
+++ b/bin/ebuild-helpers/doinitd
@@ -1,11 +1,18 @@
 #!/bin/bash
-# Copyright 1999-2010 Gentoo Foundation
+# Copyright 1999-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
+source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
+
 if [[ $# -lt 1 ]] ; then
 	source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
 	__helpers_die "${0##*/}: at least one argument needed"
 	exit 1
 fi
 
+if ! ___eapi_doinitd_respects_exeopts; then
+	export EXEOPTIONS=-m0755
+	export DIROPTIONS=""
+fi
+
 _E_EXEDESTTREE_='/etc/init.d/' exec doexe "$@"


^ permalink raw reply related	[flat|nested] 20+ messages in thread
* [gentoo-commits] proj/portage:master commit in: bin/ebuild-helpers/, bin/
@ 2018-09-20 18:49 Michał Górny
  0 siblings, 0 replies; 20+ messages in thread
From: Michał Górny @ 2018-09-20 18:49 UTC (permalink / raw
  To: gentoo-commits

commit:     6da3070ceeea4affce59310a15c6df86c89d1095
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sat Mar 24 15:23:43 2018 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Thu Sep 20 18:48:15 2018 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=6da3070c

Replace implicit doc compression with dir compression in old EAPIs

Unify the documentation compression methods in all EAPIs to compress
per-directory rather than implicitly compress files installed by dodoc,
doinfo and doman. Old EAPIs don't provide docompress to control which
directories are compressed but they don't say anything about dodoc etc.
compressing anything either.

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
Reviewed-by: Zac Medico <zmedico <AT> gentoo.org>

 bin/ebuild-helpers/dodoc    |  3 +--
 bin/ebuild-helpers/prepinfo |  3 +--
 bin/ebuild-helpers/prepman  | 35 ++---------------------------------
 bin/misc-functions.sh       |  8 +-------
 4 files changed, 5 insertions(+), 44 deletions(-)

diff --git a/bin/ebuild-helpers/dodoc b/bin/ebuild-helpers/dodoc
index 84936e400..e83091045 100755
--- a/bin/ebuild-helpers/dodoc
+++ b/bin/ebuild-helpers/dodoc
@@ -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
@@ -28,7 +28,6 @@ for x in "$@" ; do
 		eqawarn "QA Notice: dodoc argument '${x}' is a directory"
 	elif [ -s "${x}" ] ; then
 		install -m0644 "${x}" "${dir}" || { ((ret|=1)); continue; }
-		ecompress --queue "${dir}/${x##*/}"
 	elif [ ! -e "${x}" ] ; then
 		echo "!!! ${0##*/}: $x does not exist" 1>&2
 		((ret|=1))

diff --git a/bin/ebuild-helpers/prepinfo b/bin/ebuild-helpers/prepinfo
index eb1b6a7e3..9d33e6e9a 100755
--- a/bin/ebuild-helpers/prepinfo
+++ b/bin/ebuild-helpers/prepinfo
@@ -34,5 +34,4 @@ find "${ED%/}/${infodir#/}" -type d -print0 | while read -r -d $'\0' x ; do
 	rm -f "${x}"/dir{,.info}{,.gz,.bz2}
 done
 
-___eapi_has_docompress && exit 0
-exec ecompressdir --queue "${infodir}"
+exit 0

diff --git a/bin/ebuild-helpers/prepman b/bin/ebuild-helpers/prepman
index 5e9fe45b6..4c6d47bb2 100755
--- a/bin/ebuild-helpers/prepman
+++ b/bin/ebuild-helpers/prepman
@@ -2,38 +2,7 @@
 # Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
-# Do not compress man pages which are smaller than this (in bytes). #169260
-SIZE_LIMIT='128'
-
-source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
-
-if ! ___eapi_has_prefix_variables; then
-	ED=${D}
-fi
-
-if [[ -z $1 ]] ; then
-	mandir="${ED%/}/usr/share/man"
-else
-	mandir="${ED%/}/${1#/}/man"
-fi
-
-if [[ ! -d ${mandir} ]] ; then
-	eqawarn "QA Notice: prepman called with non-existent dir '${mandir#${ED%/}}'"
-	exit 0
-fi
-
-# replaced by controllable compression in EAPI 4
-___eapi_has_docompress && exit 0
-
-shopt -s nullglob
-
-really_is_mandir=0
-
-# use some heuristics to test if this is a real mandir
-for subdir in "${mandir}"/man* "${mandir}"/*/man* ; do
-	[[ -d ${subdir} ]] && really_is_mandir=1 && break
-done
-
-[[ ${really_is_mandir} == 1 ]] && exec ecompressdir --limit ${SIZE_LIMIT} --queue "${mandir#${ED%/}}"
+# Note: this really does nothing these days. It's going to be banned
+# when the last consumers are gone.
 
 exit 0

diff --git a/bin/misc-functions.sh b/bin/misc-functions.sh
index d25bc8498..ed66e90ca 100755
--- a/bin/misc-functions.sh
+++ b/bin/misc-functions.sh
@@ -171,12 +171,6 @@ __prepall() {
 		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
@@ -245,7 +239,7 @@ install_qa_check() {
 
 	export STRIP_MASK
 	__prepall
-	___eapi_has_docompress && prepcompress
+	prepcompress
 	ecompressdir --dequeue
 	ecompress --dequeue
 


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

commit:     bab6cc7268d0788d501e05f15b79b220de71664f
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Thu Sep 21 15:07:17 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=bab6cc72

domo: force /usr prefix in EAPI 7

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

 bin/eapi.sh             | 4 ++++
 bin/ebuild-helpers/domo | 7 ++++++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/bin/eapi.sh b/bin/eapi.sh
index 5a1a9aa40..ba4008acf 100644
--- a/bin/eapi.sh
+++ b/bin/eapi.sh
@@ -186,6 +186,10 @@ ___eapi_die_can_respect_nonfatal() {
 	[[ ! ${1-${EAPI-0}} =~ ^(0|1|2|3|4|4-python|4-slot-abi|5|5-hdepend|5-progress)$ ]]
 }
 
+___eapi_domo_respects_into() {
+	[[ ${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/domo b/bin/ebuild-helpers/domo
index 9742173ac..e08e55a3a 100755
--- a/bin/ebuild-helpers/domo
+++ b/bin/ebuild-helpers/domo
@@ -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
@@ -14,6 +14,11 @@ if ! ___eapi_has_prefix_variables; then
 	ED=${D}
 fi
 
+# newer EAPIs force /usr consistently with other /usr/share helpers
+if ! ___eapi_domo_respects_into; then
+	DESTTREE=/usr
+fi
+
 if [ ! -d "${ED}${DESTTREE}/share/locale" ] ; then
 	install -d "${ED}${DESTTREE}/share/locale/"
 fi


^ permalink raw reply related	[flat|nested] 20+ messages in thread
* [gentoo-commits] proj/portage:master commit in: bin/ebuild-helpers/, bin/
@ 2014-12-04 14:01 Michał Górny
  0 siblings, 0 replies; 20+ messages in thread
From: Michał Górny @ 2014-12-04 14:01 UTC (permalink / raw
  To: gentoo-commits

commit:     e3ea27ee19ddd849b1796360afc86d80946ab646
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Mon Dec  1 19:54:14 2014 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Thu Dec  4 14:01:35 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=e3ea27ee

Deprecate dohtml for EAPI 6

---
 bin/eapi.sh               | 4 ++++
 bin/ebuild-helpers/dohtml | 4 ++++
 2 files changed, 8 insertions(+)

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

diff --git a/bin/ebuild-helpers/dohtml b/bin/ebuild-helpers/dohtml
index 75d3d00..0478e49 100755
--- a/bin/ebuild-helpers/dohtml
+++ b/bin/ebuild-helpers/dohtml
@@ -4,6 +4,10 @@
 
 source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/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.


^ permalink raw reply related	[flat|nested] 20+ messages in thread
* [gentoo-commits] proj/portage:master commit in: bin/ebuild-helpers/, bin/
@ 2014-08-19  7:01 Michał Górny
  0 siblings, 0 replies; 20+ messages in thread
From: Michał Górny @ 2014-08-19  7:01 UTC (permalink / raw
  To: gentoo-commits

commit:     49ec4696f0d933957c75b8ecc0f775bc79c78010
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Thu Jul 24 22:11:47 2014 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sat Aug  9 23:41:47 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=49ec4696

emake: pass EXTRA_EMAKE after user's "$@", not before

Patch allows easier override or ebuild things, like
    #foo-9999.ebuild:
    src_compile() {
        emake V=1
    }

    EXTRA_EMAKE="V=0" emerge =foo-9999

That way it's easier to eyeball upstream builds for new warnings.

This behaviour is more in line with EXTRA_ECONF variable.

Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

---
 bin/ebuild-helpers/emake | 4 ++--
 bin/phase-helpers.sh     | 8 ++++----
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/bin/ebuild-helpers/emake b/bin/ebuild-helpers/emake
index 69d836f..4618053 100755
--- a/bin/ebuild-helpers/emake
+++ b/bin/ebuild-helpers/emake
@@ -13,7 +13,7 @@ source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
 
 if [[ $PORTAGE_QUIET != 1 ]] ; then
 	(
-	for arg in ${MAKE:-make} $MAKEOPTS $EXTRA_EMAKE "$@" ; do
+	for arg in ${MAKE:-make} $MAKEOPTS "$@" $EXTRA_EMAKE ; do
 		[[ ${arg} == *" "* ]] \
 			&& printf "'%s' " "${arg}" \
 			|| printf "%s " "${arg}"
@@ -22,7 +22,7 @@ if [[ $PORTAGE_QUIET != 1 ]] ; then
 	) >&2
 fi
 
-${MAKE:-make} ${MAKEOPTS} ${EXTRA_EMAKE} "$@"
+${MAKE:-make} ${MAKEOPTS} "$@" ${EXTRA_EMAKE}
 ret=$?
 [[ $ret -ne 0 ]] && __helpers_die "${0##*/} failed"
 exit $ret

diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
index 412decb..47bd843 100644
--- a/bin/phase-helpers.sh
+++ b/bin/phase-helpers.sh
@@ -617,8 +617,8 @@ einstall() {
 				mandir="${ED}usr/share/man" \
 				sysconfdir="${ED}etc" \
 				${LOCAL_EXTRA_EINSTALL} \
-				${MAKEOPTS} ${EXTRA_EMAKE} -j1 \
-				"$@" install
+				${MAKEOPTS} -j1 \
+				"$@" ${EXTRA_EMAKE} install
 		fi
 		${MAKE:-make} prefix="${ED}usr" \
 			datadir="${ED}usr/share" \
@@ -627,8 +627,8 @@ einstall() {
 			mandir="${ED}usr/share/man" \
 			sysconfdir="${ED}etc" \
 			${LOCAL_EXTRA_EINSTALL} \
-			${MAKEOPTS} ${EXTRA_EMAKE} -j1 \
-			"$@" install || die "einstall failed"
+			${MAKEOPTS} -j1 \
+			"$@" ${EXTRA_EMAKE} install || die "einstall failed"
 	else
 		die "no Makefile found"
 	fi


^ permalink raw reply related	[flat|nested] 20+ messages in thread
* [gentoo-commits] proj/portage:master commit in: bin/ebuild-helpers/, bin/
@ 2014-08-10  0:10 Brian Dolbec
  0 siblings, 0 replies; 20+ messages in thread
From: Brian Dolbec @ 2014-08-10  0:10 UTC (permalink / raw
  To: gentoo-commits

commit:     49ec4696f0d933957c75b8ecc0f775bc79c78010
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Thu Jul 24 22:11:47 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sat Aug  9 23:41:47 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=49ec4696

emake: pass EXTRA_EMAKE after user's "$@", not before

Patch allows easier override or ebuild things, like
    #foo-9999.ebuild:
    src_compile() {
        emake V=1
    }

    EXTRA_EMAKE="V=0" emerge =foo-9999

That way it's easier to eyeball upstream builds for new warnings.

This behaviour is more in line with EXTRA_ECONF variable.

Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

---
 bin/ebuild-helpers/emake | 4 ++--
 bin/phase-helpers.sh     | 8 ++++----
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/bin/ebuild-helpers/emake b/bin/ebuild-helpers/emake
index 69d836f..4618053 100755
--- a/bin/ebuild-helpers/emake
+++ b/bin/ebuild-helpers/emake
@@ -13,7 +13,7 @@ source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
 
 if [[ $PORTAGE_QUIET != 1 ]] ; then
 	(
-	for arg in ${MAKE:-make} $MAKEOPTS $EXTRA_EMAKE "$@" ; do
+	for arg in ${MAKE:-make} $MAKEOPTS "$@" $EXTRA_EMAKE ; do
 		[[ ${arg} == *" "* ]] \
 			&& printf "'%s' " "${arg}" \
 			|| printf "%s " "${arg}"
@@ -22,7 +22,7 @@ if [[ $PORTAGE_QUIET != 1 ]] ; then
 	) >&2
 fi
 
-${MAKE:-make} ${MAKEOPTS} ${EXTRA_EMAKE} "$@"
+${MAKE:-make} ${MAKEOPTS} "$@" ${EXTRA_EMAKE}
 ret=$?
 [[ $ret -ne 0 ]] && __helpers_die "${0##*/} failed"
 exit $ret

diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
index 412decb..47bd843 100644
--- a/bin/phase-helpers.sh
+++ b/bin/phase-helpers.sh
@@ -617,8 +617,8 @@ einstall() {
 				mandir="${ED}usr/share/man" \
 				sysconfdir="${ED}etc" \
 				${LOCAL_EXTRA_EINSTALL} \
-				${MAKEOPTS} ${EXTRA_EMAKE} -j1 \
-				"$@" install
+				${MAKEOPTS} -j1 \
+				"$@" ${EXTRA_EMAKE} install
 		fi
 		${MAKE:-make} prefix="${ED}usr" \
 			datadir="${ED}usr/share" \
@@ -627,8 +627,8 @@ einstall() {
 			mandir="${ED}usr/share/man" \
 			sysconfdir="${ED}etc" \
 			${LOCAL_EXTRA_EINSTALL} \
-			${MAKEOPTS} ${EXTRA_EMAKE} -j1 \
-			"$@" install || die "einstall failed"
+			${MAKEOPTS} -j1 \
+			"$@" ${EXTRA_EMAKE} install || die "einstall failed"
 	else
 		die "no Makefile found"
 	fi


^ permalink raw reply related	[flat|nested] 20+ messages in thread
* [gentoo-commits] proj/portage:master commit in: bin/ebuild-helpers/, bin/
@ 2013-05-12 20:47 Zac Medico
  0 siblings, 0 replies; 20+ messages in thread
From: Zac Medico @ 2013-05-12 20:47 UTC (permalink / raw
  To: gentoo-commits

commit:     e54be5ed25fdd0462aee579364983e6406c22983
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun May 12 20:47:42 2013 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun May 12 20:47:42 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=e54be5ed

dohtml: safe cwd, bug #469338

---
 bin/dohtml.py             |    5 ++++-
 bin/ebuild-helpers/dohtml |    3 +++
 2 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/bin/dohtml.py b/bin/dohtml.py
index 3af2705..1b6ba89 100755
--- a/bin/dohtml.py
+++ b/bin/dohtml.py
@@ -1,5 +1,5 @@
 #!/usr/bin/python
-# Copyright 1999-2012 Gentoo Foundation
+# Copyright 1999-2013 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 #
@@ -33,6 +33,9 @@ from __future__ import print_function
 import os
 import sys
 
+# Change back to original cwd _after_ all imports (bug #469338).
+os.chdir(os.environ["__PORTAGE_HELPER_CWD"])
+
 def dodir(path):
 	os.spawnlp(os.P_WAIT, "install", "install", "-d", path)
 

diff --git a/bin/ebuild-helpers/dohtml b/bin/ebuild-helpers/dohtml
index aec5e79..4be9bc2 100755
--- a/bin/ebuild-helpers/dohtml
+++ b/bin/ebuild-helpers/dohtml
@@ -6,6 +6,9 @@ source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
 
 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}
+cd "${PORTAGE_PYM_PATH}"
 PYTHONPATH=$PORTAGE_PYM_PATH${PYTHONPATH:+:}$PYTHONPATH \
 	"${PORTAGE_PYTHON:-/usr/bin/python}" "$PORTAGE_BIN_PATH/dohtml.py" "$@"
 


^ permalink raw reply related	[flat|nested] 20+ messages in thread
* [gentoo-commits] proj/portage:master commit in: bin/ebuild-helpers/, bin/
@ 2013-05-12 11:16 Zac Medico
  0 siblings, 0 replies; 20+ messages in thread
From: Zac Medico @ 2013-05-12 11:16 UTC (permalink / raw
  To: gentoo-commits

commit:     3f3bd1762f48bafe7e48729048cdd9d7d86c7fca
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun May 12 11:09:14 2013 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun May 12 11:15:23 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=3f3bd176

ebuild-ipc: use safe cwd for import, bug #469338

---
 bin/ebuild-helpers/portageq |    4 +++-
 bin/ebuild-ipc              |    4 +++-
 bin/phase-helpers.sh        |   23 ++++++++---------------
 3 files changed, 14 insertions(+), 17 deletions(-)

diff --git a/bin/ebuild-helpers/portageq b/bin/ebuild-helpers/portageq
index ec30b66..7bd330b 100755
--- a/bin/ebuild-helpers/portageq
+++ b/bin/ebuild-helpers/portageq
@@ -1,8 +1,10 @@
 #!/bin/bash
-# Copyright 2009-2010 Gentoo Foundation
+# Copyright 2009-2013 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 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.
+cd "${PORTAGE_PYM_PATH}"
 PYTHONPATH=$PORTAGE_PYM_PATH${PYTHONPATH:+:}$PYTHONPATH \
 	exec "${PORTAGE_PYTHON:-/usr/bin/python}" "$PORTAGE_BIN_PATH/portageq" "$@"

diff --git a/bin/ebuild-ipc b/bin/ebuild-ipc
index 43e4a02..9ff6f1c 100755
--- a/bin/ebuild-ipc
+++ b/bin/ebuild-ipc
@@ -1,8 +1,10 @@
 #!/bin/bash
-# Copyright 2010 Gentoo Foundation
+# 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}
 PORTAGE_PYM_PATH=${PORTAGE_PYM_PATH:-/usr/lib/portage/pym}
+# Use safe cwd, avoiding unsafe import for bug #469338.
+cd "${PORTAGE_PYM_PATH}"
 PYTHONPATH=$PORTAGE_PYM_PATH${PYTHONPATH:+:}$PYTHONPATH \
 	exec "${PORTAGE_PYTHON:-/usr/bin/python}" "$PORTAGE_BIN_PATH/ebuild-ipc.py" "$@"

diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
index 4812db3..a97323a 100644
--- a/bin/phase-helpers.sh
+++ b/bin/phase-helpers.sh
@@ -1,5 +1,5 @@
 #!/bin/bash
-# Copyright 1999-2012 Gentoo Foundation
+# Copyright 1999-2013 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 export DESTTREE=/usr
@@ -683,8 +683,7 @@ has_version() {
 	if [[ -n $PORTAGE_IPC_DAEMON ]] ; then
 		"$PORTAGE_BIN_PATH"/ebuild-ipc has_version "${eroot}" "${atom}"
 	else
-		PYTHONPATH=${PORTAGE_PYM_PATH}${PYTHONPATH:+:}${PYTHONPATH} \
-		"${PORTAGE_PYTHON:-/usr/bin/python}" "${PORTAGE_BIN_PATH}/portageq" has_version "${eroot}" "${atom}"
+		"${PORTAGE_BIN_PATH}/ebuild-helpers/portageq" has_version "${eroot}" "${atom}"
 	fi
 	local retval=$?
 	case "${retval}" in
@@ -736,8 +735,7 @@ best_version() {
 	if [[ -n $PORTAGE_IPC_DAEMON ]] ; then
 		"$PORTAGE_BIN_PATH"/ebuild-ipc best_version "${eroot}" "${atom}"
 	else
-		PYTHONPATH=${PORTAGE_PYM_PATH}${PYTHONPATH:+:}${PYTHONPATH} \
-		"${PORTAGE_PYTHON:-/usr/bin/python}" "${PORTAGE_BIN_PATH}/portageq" best_version "${eroot}" "${atom}"
+		"${PORTAGE_BIN_PATH}/ebuild-helpers/portageq" best_version "${eroot}" "${atom}"
 	fi
 	local retval=$?
 	case "${retval}" in
@@ -766,8 +764,7 @@ if ___eapi_has_master_repositories; then
 		if [[ -n ${PORTAGE_IPC_DAEMON} ]]; then
 			"${PORTAGE_BIN_PATH}/ebuild-ipc" master_repositories "${EROOT}" "${repository}"
 		else
-			output=$(PYTHONPATH=${PORTAGE_PYM_PATH}${PYTHONPATH:+:}${PYTHONPATH} \
-			"${PORTAGE_PYTHON:-/usr/bin/python}" "${PORTAGE_BIN_PATH}/portageq" master_repositories "${EROOT}" "${repository}")
+			output=$("${PORTAGE_BIN_PATH}/ebuild-helpers/portageq" master_repositories "${EROOT}" "${repository}")
 		fi
 		retval=$?
 		[[ -n ${output} ]] && echo "${output}"
@@ -798,8 +795,7 @@ if ___eapi_has_repository_path; then
 		if [[ -n ${PORTAGE_IPC_DAEMON} ]]; then
 			"${PORTAGE_BIN_PATH}/ebuild-ipc" repository_path "${EROOT}" "${repository}"
 		else
-			output=$(PYTHONPATH=${PORTAGE_PYM_PATH}${PYTHONPATH:+:}${PYTHONPATH} \
-			"${PORTAGE_PYTHON:-/usr/bin/python}" "${PORTAGE_BIN_PATH}/portageq" get_repo_path "${EROOT}" "${repository}")
+			output=$("${PORTAGE_BIN_PATH}/ebuild-helpers/portageq" get_repo_path "${EROOT}" "${repository}")
 		fi
 		retval=$?
 		[[ -n ${output} ]] && echo "${output}"
@@ -829,8 +825,7 @@ if ___eapi_has_available_eclasses; then
 		if [[ -n ${PORTAGE_IPC_DAEMON} ]]; then
 			"${PORTAGE_BIN_PATH}/ebuild-ipc" available_eclasses "${EROOT}" "${repository}"
 		else
-			output=$(PYTHONPATH=${PORTAGE_PYM_PATH}${PYTHONPATH:+:}${PYTHONPATH} \
-			"${PORTAGE_PYTHON:-/usr/bin/python}" "${PORTAGE_BIN_PATH}/portageq" available_eclasses "${EROOT}" "${repository}")
+			output=$("${PORTAGE_BIN_PATH}/ebuild-helpers/portageq" available_eclasses "${EROOT}" "${repository}")
 		fi
 		retval=$?
 		[[ -n ${output} ]] && echo "${output}"
@@ -861,8 +856,7 @@ if ___eapi_has_eclass_path; then
 		if [[ -n ${PORTAGE_IPC_DAEMON} ]]; then
 			"${PORTAGE_BIN_PATH}/ebuild-ipc" eclass_path "${EROOT}" "${repository}" "${eclass}"
 		else
-			output=$(PYTHONPATH=${PORTAGE_PYM_PATH}${PYTHONPATH:+:}${PYTHONPATH} \
-			"${PORTAGE_PYTHON:-/usr/bin/python}" "${PORTAGE_BIN_PATH}/portageq" eclass_path "${EROOT}" "${repository}" "${eclass}")
+			output=$("${PORTAGE_BIN_PATH}/ebuild-helpers/portageq" eclass_path "${EROOT}" "${repository}" "${eclass}")
 		fi
 		retval=$?
 		[[ -n ${output} ]] && echo "${output}"
@@ -893,8 +887,7 @@ if ___eapi_has_license_path; then
 		if [[ -n ${PORTAGE_IPC_DAEMON} ]]; then
 			"${PORTAGE_BIN_PATH}/ebuild-ipc" license_path "${EROOT}" "${repository}" "${license}"
 		else
-			output=$(PYTHONPATH=${PORTAGE_PYM_PATH}${PYTHONPATH:+:}${PYTHONPATH} \
-			"${PORTAGE_PYTHON:-/usr/bin/python}" "${PORTAGE_BIN_PATH}/portageq" license_path "${EROOT}" "${repository}" "${license}")
+			output=$("${PORTAGE_BIN_PATH}/ebuild-helpers/portageq" license_path "${EROOT}" "${repository}" "${license}")
 		fi
 		retval=$?
 		[[ -n ${output} ]] && echo "${output}"


^ permalink raw reply related	[flat|nested] 20+ messages in thread
* [gentoo-commits] proj/portage:master commit in: bin/ebuild-helpers/, bin/
@ 2012-12-11  9:01 Zac Medico
  0 siblings, 0 replies; 20+ messages in thread
From: Zac Medico @ 2012-12-11  9:01 UTC (permalink / raw
  To: gentoo-commits

commit:     3464e5ace3ef520344a330601e0aac69bcdef222
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue Dec 11 09:00:25 2012 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Dec 11 09:01:03 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=3464e5ac

prepstrip: preserve xattrs, bug #446420

---
 bin/ebuild-helpers/prepstrip |   36 ++++++++-
 bin/xattr-helper.py          |  173 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 206 insertions(+), 3 deletions(-)

diff --git a/bin/ebuild-helpers/prepstrip b/bin/ebuild-helpers/prepstrip
index 6a09ff4..fb20777 100755
--- a/bin/ebuild-helpers/prepstrip
+++ b/bin/ebuild-helpers/prepstrip
@@ -15,7 +15,7 @@ exp_tf() {
 		eval ${var}_${flag}=$(tf has ${flag} ${!var})
 	done
 }
-exp_tf FEATURES compressdebug installsources nostrip splitdebug
+exp_tf FEATURES compressdebug installsources nostrip splitdebug xattr
 exp_tf RESTRICT binchecks installsources strip
 
 if ! ___eapi_has_prefix_variables; then
@@ -30,6 +30,28 @@ if ${RESTRICT_strip} || ${FEATURES_nostrip} ; then
 	${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 --absolute-names "$1"
+		}
+		restore_xattrs() {
+			setfattr --restore=-
+		}
+	else
+		dump_xattrs() {
+			"${PORTAGE_PYTHON:-/usr/bin/python}" \
+			"${PORTAGE_BIN_PATH}/xattr-helper.py" --dump < <(echo -n "$1")
+		}
+		restore_xattrs() {
+			"${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
@@ -152,7 +174,7 @@ save_elf_debug() {
 # Usage: process_elf <elf>
 process_elf() {
 	local x=$1 inode_link=$2 strip_flags=${*:3}
-	local already_stripped lockfile
+	local already_stripped lockfile xt_data
 
 	__vecho "   ${x:${#ED}}"
 
@@ -171,7 +193,12 @@ process_elf() {
 
 	[ -f "${inode_link}_stripped" ] && already_stripped=true || already_stripped=false
 
-	${already_stripped} || save_elf_sources "${x}"
+	if ! ${already_stripped} ; then
+		if ${PRESERVE_XATTR} ; then
+			xt_data=$(dump_xattrs "${x}")
+		fi
+		save_elf_sources "${x}"
+	fi
 
 	if ${strip_this} ; then
 
@@ -197,6 +224,9 @@ process_elf() {
 		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}"

diff --git a/bin/xattr-helper.py b/bin/xattr-helper.py
new file mode 100755
index 0000000..d40217c
--- /dev/null
+++ b/bin/xattr-helper.py
@@ -0,0 +1,173 @@
+#!/usr/bin/python
+# Copyright 2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+import array
+import optparse
+import os
+import re
+import sys
+
+if hasattr(os, "getxattr"):
+
+	class xattr(object):
+		get = os.getxattr
+		set = os.setxattr
+		list = os.listxattr
+
+else:
+	import xattr
+
+_unquote_re = re.compile(br'\\[0-7]{3}')
+_fs_encoding = sys.getfilesystemencoding()
+
+if sys.hexversion < 0x3000000:
+
+	def octal_quote_byte(b):
+		return b'\\%03o' % ord(b)
+
+	def unicode_encode(s):
+		if isinstance(s, unicode):
+			s = s.encode(_fs_encoding)
+		return s
+else:
+
+	def octal_quote_byte(b):
+		return ('\\%03o' % ord(b)).encode('ascii')
+
+	def unicode_encode(s):
+		if isinstance(s, str):
+			s = s.encode(_fs_encoding)
+		return s
+
+def quote(s, quote_chars):
+
+	quote_re = re.compile(b'[' + quote_chars + b']')
+	result = []
+	pos = 0
+	s_len = len(s)
+
+	while pos < s_len:
+		m = quote_re.search(s, pos=pos)
+		if m is None:
+			result.append(s[pos:])
+			pos = s_len
+		else:
+			start = m.start()
+			result.append(s[pos:start])
+			result.append(octal_quote_byte(s[start:start+1]))
+			pos = start + 1
+
+	return b"".join(result)
+
+def unquote(s):
+
+	result = []
+	pos = 0
+	s_len = len(s)
+
+	while pos < s_len:
+		m = _unquote_re.search(s, pos=pos)
+		if m is None:
+			result.append(s[pos:])
+			pos = s_len
+		else:
+			start = m.start()
+			result.append(s[pos:start])
+			pos = start + 4
+			a = array.array('B')
+			a.append(int(s[start + 1:pos], 8))
+			try:
+				# Python >= 3.2
+				result.append(a.tobytes())
+			except AttributeError:
+				result.append(a.tostring())
+
+	return b"".join(result)
+
+def dump_xattrs(file_in, file_out):
+
+	for pathname in file_in.read().split(b'\0'):
+		if not pathname:
+			continue
+
+		attrs = xattr.list(pathname)
+		if not attrs:
+			continue
+		file_out.write(b'# file: ' + quote(pathname, b'\n\r') + b'\n')
+		for attr in attrs:
+			attr = unicode_encode(attr)
+			file_out.write(quote(attr, b'=\n\r') + b'="' +
+				quote(xattr.get(pathname, attr), b'\\\0\n\r"') + b'"\n')
+
+def restore_xattrs(file_in):
+
+	pathname = None
+	for i, line in enumerate(file_in):
+		if line.startswith(b'# file: '):
+			pathname = unquote(line.rstrip(b'\n')[8:])
+		else:
+			parts = line.split(b'=', 1)
+			if len(parts) == 2:
+				if pathname is None:
+					raise AssertionError('line %d: missing pathname' % i + 1)
+				attr = unquote(parts[0])
+				# strip trailing newline and quotes 
+				value = unquote(parts[1].rstrip(b'\n')[1:-1])
+				xattr.set(pathname, attr, value)
+			elif line.strip():
+				raise AssertionError("line %d: malformed entry" % i + 1)
+
+def main(argv):
+
+	description = "Dump and restore extended attributes," \
+		" using format like that used by getfattr --dump."
+	usage = "usage: %s [--dump | --restore]\n" % \
+		os.path.basename(argv[0])
+
+	parser = optparse.OptionParser(description=description, usage=usage)
+
+	actions = optparse.OptionGroup(parser, 'Actions')
+	actions.add_option("--dump",
+		action="store_true",
+		help="Dump the values of all extended "
+			"attributes associated with null-separated"
+			" paths read from stdin.")
+	actions.add_option("--restore",
+		action="store_true",
+		help="Restore extended attributes using"
+			" a dump read from stdin.")
+	parser.add_option_group(actions)
+
+	options, args = parser.parse_args(argv[1:])
+
+	if len(args) != 0:
+		parser.error("expected zero arguments, "
+			"got %s" % len(args))
+
+	if sys.hexversion >= 0x3000000:
+		file_in = sys.stdin.buffer.raw
+	else:
+		file_in = sys.stdin
+
+	if options.dump:
+
+		if sys.hexversion >= 0x3000000:
+			file_out = sys.stdout.buffer
+		else:
+			file_out = sys.stdout
+
+		dump_xattrs(file_in, file_out)
+
+	elif options.restore:
+
+		restore_xattrs(file_in)
+
+	else:
+		parser.error("available actions: --dump, --restore")
+
+	return os.EX_OK
+
+if __name__ == "__main__":
+	rval = main(sys.argv[:])
+	sys.exit(rval)


^ permalink raw reply related	[flat|nested] 20+ messages in thread
* [gentoo-commits] proj/portage:master commit in: bin/ebuild-helpers/, bin/
@ 2012-11-22 22:06 Mike Frysinger
  0 siblings, 0 replies; 20+ messages in thread
From: Mike Frysinger @ 2012-11-22 22:06 UTC (permalink / raw
  To: gentoo-commits

commit:     e9dc56625152991ba535f5be3ab88fc7ec8dbcfc
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Thu Nov 22 17:42:42 2012 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Thu Nov 22 17:42:42 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=e9dc5662

strip trailing whitespace

No functional changes here.

Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>

---
 bin/archive-conf           |    2 +-
 bin/ebuild-helpers/dodoc   |    2 +-
 bin/ebuild-helpers/doinfo  |    2 +-
 bin/ebuild-helpers/prepman |    2 +-
 bin/egencache              |    2 +-
 bin/emerge-webrsync        |    2 +-
 bin/glsa-check             |   14 +++++++-------
 bin/misc-functions.sh      |   10 +++++-----
 bin/repoman                |   28 ++++++++++++++--------------
 9 files changed, 32 insertions(+), 32 deletions(-)

diff --git a/bin/archive-conf b/bin/archive-conf
index af34db6..80fa308 100755
--- a/bin/archive-conf
+++ b/bin/archive-conf
@@ -35,7 +35,7 @@ except ImportError:
         for ix in range(len(md5sum)):
             hexform = hexform + "%02x" % ord(md5sum[ix])
         return hexform.lower()
-    
+
     def perform_checksum(filename):
         f = open(filename, 'rb')
         blocksize=32768

diff --git a/bin/ebuild-helpers/dodoc b/bin/ebuild-helpers/dodoc
index c551735..99122c4 100755
--- a/bin/ebuild-helpers/dodoc
+++ b/bin/ebuild-helpers/dodoc
@@ -13,7 +13,7 @@ fi
 
 if [ $# -lt 1 ] ; then
 	__helpers_die "${0##*/}: at least one argument needed"
-	exit 1 	
+	exit 1
 fi
 
 if ! ___eapi_has_prefix_variables; then

diff --git a/bin/ebuild-helpers/doinfo b/bin/ebuild-helpers/doinfo
index 355047f..2edbdc5 100755
--- a/bin/ebuild-helpers/doinfo
+++ b/bin/ebuild-helpers/doinfo
@@ -6,7 +6,7 @@ source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
 
 if [[ -z $1 ]] ; then
 	__helpers_die "${0##*/}: at least one argument needed"
-	exit 1 	
+	exit 1
 fi
 
 if ! ___eapi_has_prefix_variables; then

diff --git a/bin/ebuild-helpers/prepman b/bin/ebuild-helpers/prepman
index 142d404..55a9483 100755
--- a/bin/ebuild-helpers/prepman
+++ b/bin/ebuild-helpers/prepman
@@ -8,7 +8,7 @@ if ! ___eapi_has_prefix_variables; then
 	ED=${D}
 fi
 
-if [[ -z $1 ]] ; then 
+if [[ -z $1 ]] ; then
 	mandir="${ED}usr/share/man"
 else
 	mandir="${ED}$1/man"

diff --git a/bin/egencache b/bin/egencache
index 9d88237..8870d99 100755
--- a/bin/egencache
+++ b/bin/egencache
@@ -474,7 +474,7 @@ class GenUseLocalDesc(object):
 		self._portdb = portdb
 		self._output = output
 		self._preserve_comments = preserve_comments
-	
+
 	def run(self):
 		repo_path = self._portdb.porttrees[0]
 		ops = {'<':0, '<=':1, '=':2, '>=':3, '>':4}

diff --git a/bin/emerge-webrsync b/bin/emerge-webrsync
index e826ec4..76d31f5 100755
--- a/bin/emerge-webrsync
+++ b/bin/emerge-webrsync
@@ -429,7 +429,7 @@ do_latest_snapshot() {
 usage() {
 	cat <<-EOF
 	Usage: $0 [options]
-	
+
 	Options:
 	  --revert=yyyymmdd   Revert to snapshot
 	  -k, --keep          Keep snapshots in DISTDIR (don't delete)

diff --git a/bin/glsa-check b/bin/glsa-check
index bfae0f9..b3eb146 100755
--- a/bin/glsa-check
+++ b/bin/glsa-check
@@ -114,7 +114,7 @@ glsalist = []
 if "new" in params:
 	glsalist = todolist
 	params.remove("new")
-	
+
 if "all" in params:
 	glsalist = completelist
 	params.remove("all")
@@ -183,7 +183,7 @@ def summarylist(myglsalist, fd1=sys.stdout, fd2=sys.stderr):
 		fd1.write(")")
 		if list_cve:
 			fd1.write(" "+(",".join([r[:13] for r in myglsa.references if r[:4] in ["CAN-", "CVE-"]])))
-		fd1.write("\n")		
+		fd1.write("\n")
 	return 0
 
 if mode == "list":
@@ -267,7 +267,7 @@ if mode == "mail":
 	import portage.mail, socket
 	from io import StringIO
 	from email.mime.text import MIMEText
-	
+
 	# color doesn't make any sense for mail
 	nocolor()
 
@@ -275,7 +275,7 @@ if mode == "mail":
 		myrecipient = portage.settings["PORTAGE_ELOG_MAILURI"].split()[0]
 	else:
 		myrecipient = "root@localhost"
-	
+
 	if "PORTAGE_ELOG_MAILFROM" in portage.settings:
 		myfrom = portage.settings["PORTAGE_ELOG_MAILFROM"]
 	else:
@@ -303,12 +303,12 @@ if mode == "mail":
 		myglsa.dump(outstream=myfd)
 		myattachments.append(MIMEText(str(myfd.getvalue()), _charset="utf8"))
 		myfd.close()
-		
+
 	mymessage = portage.mail.create_message(myfrom, myrecipient, mysubject, summary, myattachments)
 	portage.mail.send_mail(portage.settings, mymessage)
-		
+
 	sys.exit(0)
-	
+
 # something wrong here, all valid paths are covered with sys.exit()
 sys.stderr.write("nothing more to do\n")
 sys.exit(2)

diff --git a/bin/misc-functions.sh b/bin/misc-functions.sh
index db023e4..853489a 100755
--- a/bin/misc-functions.sh
+++ b/bin/misc-functions.sh
@@ -397,7 +397,7 @@ install_qa_check() {
 
 		# Check for files built without respecting LDFLAGS
 		if [[ "${LDFLAGS}" == *,--hash-style=gnu* ]] && \
-			! has binchecks ${RESTRICT} ; then 
+			! has binchecks ${RESTRICT} ; then
 			f=$(scanelf -qyRF '%k %p' -k .hash "${ED}" | sed -e "s:\.hash ::")
 			if [[ -n ${f} ]] ; then
 				echo "${f}" > "${T}"/scanelf-ignored-LDFLAGS.log
@@ -620,8 +620,8 @@ install_qa_check() {
 		done
 	done
 
-	# When installing static libraries into /usr/lib and shared libraries into 
-	# /lib, we have to make sure we have a linker script in /usr/lib along side 
+	# When installing static libraries into /usr/lib and shared libraries into
+	# /lib, we have to make sure we have a linker script in /usr/lib along side
 	# the static library, or gcc will utilize the static lib when linking :(.
 	# http://bugs.gentoo.org/4411
 	abort="no"
@@ -1121,10 +1121,10 @@ preinst_selinux_labels() {
 			(
 				eval "$(/usr/sbin/selinuxconfig)" || \
 					die "Failed to determine SELinux policy paths.";
-	
+
 				addwrite /selinux/context
 				addwrite /sys/fs/selinux/context
-	
+
 				/usr/sbin/setfiles "${file_contexts_path}" -r "${D}" "${D}"
 			) || die "Failed to set SELinux security labels."
 		else

diff --git a/bin/repoman b/bin/repoman
index 91a9815..7ecdc6d 100755
--- a/bin/repoman
+++ b/bin/repoman
@@ -125,7 +125,7 @@ signal.signal(signal.SIGINT,exithandler)
 class RepomanHelpFormatter(optparse.IndentedHelpFormatter):
 	"""Repoman needs it's own HelpFormatter for now, because the default ones
 	murder the help text."""
-	
+
 	def __init__(self, indent_increment=1, max_help_position=24, width=150, short_first=1):
 		optparse.HelpFormatter.__init__(self, indent_increment, max_help_position, width, short_first)
 
@@ -135,7 +135,7 @@ class RepomanHelpFormatter(optparse.IndentedHelpFormatter):
 class RepomanOptionParser(optparse.OptionParser):
 	"""Add the on_tail function, ruby has it, optionParser should too
 	"""
-	
+
 	def __init__(self, *args, **kwargs):
 		optparse.OptionParser.__init__(self, *args, **kwargs)
 		self.tail = ""
@@ -169,7 +169,7 @@ def ParseArgs(argv, qahelp):
 		'help' : 'Show this screen',
 		'manifest' : 'Generate a Manifest (fetches files if necessary)',
 		'manifest-check' : 'Check Manifests for missing or incorrect digests',
-		'scan' : 'Scan directory tree for QA issues' 
+		'scan' : 'Scan directory tree for QA issues'
 	}
 
 	mode_keys = list(modes)
@@ -196,7 +196,7 @@ def ParseArgs(argv, qahelp):
 
 	parser.add_option('-p', '--pretend', dest='pretend', default=False,
 		action='store_true', help='don\'t commit or fix anything; just show what would be done')
-	
+
 	parser.add_option('-q', '--quiet', dest="quiet", action="count", default=0,
 		help='do not print unnecessary messages')
 
@@ -244,7 +244,7 @@ def ParseArgs(argv, qahelp):
 	parser.add_option('--without-mask', dest='without_mask', action='store_true',
 		default=False, help='behave as if no package.mask entries exist (not allowed with commit mode)')
 
-	parser.add_option('--mode', type='choice', dest='mode', choices=list(modes), 
+	parser.add_option('--mode', type='choice', dest='mode', choices=list(modes),
 		help='specify which mode repoman will run in (default=full)')
 
 	parser.on_tail("\n " + green("Modes".ljust(20) + " Description\n"))
@@ -279,7 +279,7 @@ def ParseArgs(argv, qahelp):
 
 	if not opts.mode:
 		opts.mode = 'full'
-	
+
 	if opts.mode == 'ci':
 		opts.mode = 'commit'  # backwards compat shortcut
 
@@ -329,7 +329,7 @@ qahelp={
 	"KEYWORDS.dropped":"Ebuilds that appear to have dropped KEYWORDS for some arch",
 	"KEYWORDS.missing":"Ebuilds that have a missing or empty KEYWORDS variable",
 	"KEYWORDS.stable":"Ebuilds that have been added directly with stable KEYWORDS",
-	"KEYWORDS.stupid":"Ebuilds that use KEYWORDS=-* instead of package.mask", 
+	"KEYWORDS.stupid":"Ebuilds that use KEYWORDS=-* instead of package.mask",
 	"LICENSE.missing":"Ebuilds that have a missing or empty LICENSE variable",
 	"LICENSE.virtual":"Virtuals that have a non-empty LICENSE variable",
 	"DESCRIPTION.missing":"Ebuilds that have a missing or empty DESCRIPTION variable",
@@ -1632,7 +1632,7 @@ for x in effective_scanlist:
 	if check_changelog and "ChangeLog" not in checkdirlist:
 		stats["changelog.missing"]+=1
 		fails["changelog.missing"].append(x+"/ChangeLog")
-	
+
 	musedict = {}
 	#metadata.xml file check
 	if "metadata.xml" not in checkdirlist:
@@ -1995,7 +1995,7 @@ for x in effective_scanlist:
 
 		badlicsyntax = len([z for z in type_list if z == "LICENSE"])
 		badprovsyntax = len([z for z in type_list if z == "PROVIDE"])
-		baddepsyntax = len(type_list) != badlicsyntax + badprovsyntax 
+		baddepsyntax = len(type_list) != badlicsyntax + badprovsyntax
 		badlicsyntax = badlicsyntax > 0
 		badprovsyntax = badprovsyntax > 0
 
@@ -2025,7 +2025,7 @@ for x in effective_scanlist:
 
 		for mypos in range(len(myuse)):
 			stats["IUSE.invalid"]=stats["IUSE.invalid"]+1
-			fails["IUSE.invalid"].append(x+"/"+y+".ebuild: %s" % myuse[mypos])	
+			fails["IUSE.invalid"].append(x+"/"+y+".ebuild: %s" % myuse[mypos])
 
 		# license checks
 		if not badlicsyntax:
@@ -2127,7 +2127,7 @@ for x in effective_scanlist:
 				# A missing profile will create an error further down
 				# during the KEYWORDS verification.
 				continue
-				
+
 			for prof in profiles[arch]:
 
 				if prof.status not in ("stable", "dev") or \
@@ -2192,7 +2192,7 @@ for x in effective_scanlist:
 						suffix=suffix+"indev"
 
 					for mytype in Package._dep_keys:
-						
+
 						mykey = "dependency.bad" + suffix
 						myvalue = myaux[mytype]
 						if not myvalue:
@@ -2403,7 +2403,7 @@ else:
 		with repoman_popen("hg status --no-status --unknown .") as f:
 			myunadded = f.readlines()
 		myunadded = ["./" + elem.rstrip() for elem in myunadded]
-		
+
 		# Mercurial doesn't handle manually deleted files as removed from
 		# the repository, so the user need to remove them before commit,
 		# using "hg remove [FILES]"
@@ -2707,7 +2707,7 @@ else:
 			elif vcs == "svn":
 				if myfile not in expansion:
 					continue
-				
+
 				# Subversion keywords are case-insensitive in svn:keywords properties, but case-sensitive in contents of files.
 				enabled_keywords = []
 				for k in expansion[myfile]:


^ permalink raw reply related	[flat|nested] 20+ messages in thread
* [gentoo-commits] proj/portage:master commit in: bin/ebuild-helpers/, bin/
@ 2012-09-26 20:33 Arfrever Frehtes Taifersar Arahesis
  0 siblings, 0 replies; 20+ messages in thread
From: Arfrever Frehtes Taifersar Arahesis @ 2012-09-26 20:33 UTC (permalink / raw
  To: gentoo-commits

commit:     ab46499322311c1faa710c63d0a5339e49a9061a
Author:     Arfrever Frehtes Taifersar Arahesis <Arfrever <AT> Apache <DOT> Org>
AuthorDate: Wed Sep 26 20:31:20 2012 +0000
Commit:     Arfrever Frehtes Taifersar Arahesis <arfrever.fta <AT> gmail <DOT> com>
CommitDate: Wed Sep 26 20:31:20 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=ab464993

Add eapi.sh with ___eapi_*() functions and use these functions in other files.

---
 bin/eapi.sh                     |  113 ++++++++++++++++++++++++++++
 bin/ebuild-helpers/dobin        |    7 +-
 bin/ebuild-helpers/dodir        |    7 +-
 bin/ebuild-helpers/dodoc        |   21 ++---
 bin/ebuild-helpers/doexe        |    7 +-
 bin/ebuild-helpers/dohard       |   19 ++---
 bin/ebuild-helpers/doheader     |    8 +-
 bin/ebuild-helpers/doinfo       |    7 +-
 bin/ebuild-helpers/doins        |   18 ++---
 bin/ebuild-helpers/dolib        |    7 +-
 bin/ebuild-helpers/doman        |    7 +-
 bin/ebuild-helpers/domo         |    7 +-
 bin/ebuild-helpers/dosbin       |    7 +-
 bin/ebuild-helpers/dosed        |   19 ++---
 bin/ebuild-helpers/dosym        |    5 +-
 bin/ebuild-helpers/ecompressdir |    7 +-
 bin/ebuild-helpers/fowners      |    5 +-
 bin/ebuild-helpers/fperms       |    7 +-
 bin/ebuild-helpers/newins       |   17 ++---
 bin/ebuild-helpers/prepall      |    7 +-
 bin/ebuild-helpers/prepalldocs  |   17 ++---
 bin/ebuild-helpers/prepallinfo  |    7 +-
 bin/ebuild-helpers/prepallman   |    9 +-
 bin/ebuild-helpers/prepallstrip |    9 ++-
 bin/ebuild-helpers/prepinfo     |    9 +-
 bin/ebuild-helpers/preplib      |    7 +-
 bin/ebuild-helpers/prepman      |    9 +-
 bin/ebuild-helpers/prepstrip    |    5 +-
 bin/ebuild.sh                   |   32 +++-----
 bin/isolated-functions.sh       |   17 ++--
 bin/misc-functions.sh           |   43 ++++++-----
 bin/phase-functions.sh          |   53 +++++--------
 bin/phase-helpers.sh            |  155 ++++++++++++++++++---------------------
 bin/save-ebuild-env.sh          |    9 +-
 34 files changed, 386 insertions(+), 297 deletions(-)

diff --git a/bin/eapi.sh b/bin/eapi.sh
new file mode 100644
index 0000000..a561c1c
--- /dev/null
+++ b/bin/eapi.sh
@@ -0,0 +1,113 @@
+#!/bin/bash
+# Copyright 2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+# PHASES
+
+___eapi_has_pkg_pretend() {
+	[[ ! ${1-${EAPI}} =~ ^(0|1|2|3)$ ]]
+}
+
+___eapi_has_src_prepare() {
+	[[ ! ${1-${EAPI}} =~ ^(0|1)$ ]]
+}
+
+___eapi_has_src_configure() {
+	[[ ! ${1-${EAPI}} =~ ^(0|1)$ ]]
+}
+
+___eapi_default_src_test_disables_parallel_jobs() {
+	[[ ${1-${EAPI}} =~ ^(0|1|2|3|4|4-python|4-slot-abi)$ ]]
+}
+
+___eapi_has_S_WORKDIR_fallback() {
+	[[ ${1-${EAPI}} =~ ^(0|1|2|3)$ ]]
+}
+
+# VARIABLES
+
+___eapi_has_prefix_variables() {
+	[[ ! ${1-${EAPI}} =~ ^(0|1|2)$ || " ${FEATURES} " == *" force-prefix "* ]]
+}
+
+___eapi_has_HDEPEND() {
+	[[ ${1-${EAPI}} =~ ^(5-hdepend)$ ]]
+}
+
+___eapi_has_RDEPEND_DEPEND_fallback() {
+	[[ ${1-${EAPI}} =~ ^(0|1|2|3)$ ]]
+}
+
+# HELPERS PRESENCE
+
+___eapi_has_dohard() {
+	[[ ${1-${EAPI}} =~ ^(0|1|2|3)$ ]]
+}
+
+___eapi_has_dosed() {
+	[[ ${1-${EAPI}} =~ ^(0|1|2|3)$ ]]
+}
+
+___eapi_has_docompress() {
+	[[ ! ${1-${EAPI}} =~ ^(0|1|2|3)$ ]]
+}
+
+___eapi_has_nonfatal() {
+	[[ ! ${1-${EAPI}} =~ ^(0|1|2|3)$ ]]
+}
+
+___eapi_has_doheader() {
+	[[ ! ${1-${EAPI}} =~ ^(0|1|2|3|4|4-python|4-slot-abi)$ ]]
+}
+
+___eapi_has_usex() {
+	[[ ! ${1-${EAPI}} =~ ^(0|1|2|3|4|4-python|4-slot-abi)$ ]]
+}
+
+# HELPERS BEHAVIOR
+
+___eapi_best_version_and_has_version_support_--host-root() {
+	[[ ! ${1-${EAPI}} =~ ^(0|1|2|3|4|4-python|4-slot-abi)$ ]]
+}
+
+___eapi_unpack_supports_xz() {
+	[[ ! ${1-${EAPI}} =~ ^(0|1|2)$ ]]
+}
+
+___eapi_econf_passes_--disable-dependency-tracking() {
+	[[ ! ${1-${EAPI}} =~ ^(0|1|2|3)$ ]]
+}
+
+___eapi_econf_passes_--disable-silent-rules() {
+	[[ ! ${1-${EAPI}} =~ ^(0|1|2|3|4|4-python|4-slot-abi)$ ]]
+}
+
+___eapi_use_enable_and_use_with_support_empty_third_argument() {
+	[[ ! ${1-${EAPI}} =~ ^(0|1|2|3)$ ]]
+}
+
+___eapi_dodoc_supports_-r() {
+	[[ ! ${1-${EAPI}} =~ ^(0|1|2|3)$ ]]
+}
+
+___eapi_doins_and_newins_preserve_symlinks() {
+	[[ ! ${1-${EAPI}} =~ ^(0|1|2|3)$ ]]
+}
+
+___eapi_newins_supports_reading_from_standard_input() {
+	[[ ! ${1-${EAPI}} =~ ^(0|1|2|3|4|4-python|4-slot-abi)$ ]]
+}
+
+___eapi_helpers_can_die() {
+	[[ ! ${1-${EAPI}} =~ ^(0|1|2|3)$ ]]
+}
+
+___eapi_disallows_helpers_in_global_scope() {
+	[[ ${1-${EAPI}} =~ ^(4-python|5-progress)$ ]]
+}
+
+# OTHERS
+
+___eapi_enables_globstar() {
+	[[ ${1-${EAPI}} =~ ^(4-python|5-progress)$ ]]
+}

diff --git a/bin/ebuild-helpers/dobin b/bin/ebuild-helpers/dobin
index 06ae0c7..0ba1eb0 100755
--- a/bin/ebuild-helpers/dobin
+++ b/bin/ebuild-helpers/dobin
@@ -1,5 +1,5 @@
 #!/bin/bash
-# Copyright 1999-2011 Gentoo Foundation
+# 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
@@ -9,8 +9,9 @@ if [[ $# -lt 1 ]] ; then
 	exit 1
 fi
 
-[[ " ${FEATURES} " == *" force-prefix "* ]] || \
-	case "$EAPI" in 0|1|2) ED=${D} ;; esac
+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; }

diff --git a/bin/ebuild-helpers/dodir b/bin/ebuild-helpers/dodir
index c8f763d..e03ba9a 100755
--- a/bin/ebuild-helpers/dodir
+++ b/bin/ebuild-helpers/dodir
@@ -1,11 +1,12 @@
 #!/bin/bash
-# Copyright 1999-2011 Gentoo Foundation
+# 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
 
-[[ " ${FEATURES} " == *" force-prefix "* ]] || \
-	case "$EAPI" in 0|1|2) ED=${D} ;; esac
+if ! ___eapi_has_prefix_variables; then
+	ED=${D}
+fi
 
 install -d ${DIROPTIONS} "${@/#/${ED}/}"
 ret=$?

diff --git a/bin/ebuild-helpers/dodoc b/bin/ebuild-helpers/dodoc
index 2b0533f..bba7903 100755
--- a/bin/ebuild-helpers/dodoc
+++ b/bin/ebuild-helpers/dodoc
@@ -2,16 +2,12 @@
 # Copyright 1999-2012 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
-case "${EAPI}" in
-	0|1|2|3)
-		;;
-	*)
-		exec \
-		env \
-		__PORTAGE_HELPER="dodoc" \
-		doins "$@"
-		;;
-esac
+if ___eapi_dodoc_supports_-r; then
+	exec \
+	env \
+	__PORTAGE_HELPER="dodoc" \
+	doins "$@"
+fi
 
 source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
 
@@ -20,8 +16,9 @@ if [ $# -lt 1 ] ; then
 	exit 1 	
 fi
 
-[[ " ${FEATURES} " == *" force-prefix "* ]] || \
-	case "$EAPI" in 0|1|2) ED=${D} ;; esac
+if ! ___eapi_has_prefix_variables; then
+	ED=${D}
+fi
 
 dir="${ED}usr/share/doc/${PF}/${_E_DOCDESTTREE_}"
 if [ ! -d "${dir}" ] ; then

diff --git a/bin/ebuild-helpers/doexe b/bin/ebuild-helpers/doexe
index efbf638..aa050e9 100755
--- a/bin/ebuild-helpers/doexe
+++ b/bin/ebuild-helpers/doexe
@@ -1,5 +1,5 @@
 #!/bin/bash
-# Copyright 1999-2011 Gentoo Foundation
+# 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
@@ -9,8 +9,9 @@ if [[ $# -lt 1 ]] ; then
 	exit 1
 fi
 
-[[ " ${FEATURES} " == *" force-prefix "* ]] || \
-	case "$EAPI" in 0|1|2) ED=${D} ;; esac
+if ! ___eapi_has_prefix_variables; then
+	ED=${D}
+fi
 
 if [[ ! -d ${ED}${_E_EXEDESTTREE_} ]] ; then
 	install -d "${ED}${_E_EXEDESTTREE_}"

diff --git a/bin/ebuild-helpers/dohard b/bin/ebuild-helpers/dohard
index 6ae93d2..e0a44fa 100755
--- a/bin/ebuild-helpers/dohard
+++ b/bin/ebuild-helpers/dohard
@@ -2,22 +2,21 @@
 # Copyright 1999-2012 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
-case "${EAPI}" in
-	0|1|2|3)
-		;;
-	*)
-		die "'${0##*/}' has been banned for EAPI '$EAPI'"
-		exit 1
-		;;
-esac
+source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
+
+if ! ___eapi_has_dohard; then
+	die "'${0##*/}' has been banned for EAPI '$EAPI'"
+	exit 1
+fi
 
 if [[ $# -ne 2 ]] ; then
 	echo "$0: two arguments needed" 1>&2
 	exit 1
 fi
 
-[[ " ${FEATURES} " == *" force-prefix "* ]] || \
-	case "$EAPI" in 0|1|2) ED=${D} ;; esac
+if ! ___eapi_has_prefix_variables; then
+	ED=${D}
+fi
 
 destdir=${2%/*}
 [[ ! -d ${ED}${destdir} ]] && dodir "${destdir}"

diff --git a/bin/ebuild-helpers/doheader b/bin/ebuild-helpers/doheader
index db3a02d..3795365 100755
--- a/bin/ebuild-helpers/doheader
+++ b/bin/ebuild-helpers/doheader
@@ -4,11 +4,9 @@
 
 source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
 
-case "${EAPI}" in
-	0|1|2|3|4|4-python|4-slot-abi)
-		die "${0##*/} is not supported in EAPI ${EAPI}"
-		;;
-esac
+if ! ___eapi_has_doheader; then
+	die "${0##*/} is not supported in EAPI ${EAPI}"
+fi
 
 if [[ $# -lt 1 ]] || [[ $1 == -r && $# -lt 2 ]] ; then
 	__helpers_die "${0##*/}: at least one argument needed"

diff --git a/bin/ebuild-helpers/doinfo b/bin/ebuild-helpers/doinfo
index e4ccc90..355047f 100755
--- a/bin/ebuild-helpers/doinfo
+++ b/bin/ebuild-helpers/doinfo
@@ -1,5 +1,5 @@
 #!/bin/bash
-# Copyright 1999-2011 Gentoo Foundation
+# 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
@@ -9,8 +9,9 @@ if [[ -z $1 ]] ; then
 	exit 1 	
 fi
 
-[[ " ${FEATURES} " == *" force-prefix "* ]] || \
-	case "$EAPI" in 0|1|2) ED=${D} ;; esac
+if ! ___eapi_has_prefix_variables; then
+	ED=${D}
+fi
 
 if [[ ! -d ${ED}usr/share/info ]] ; then
 	install -d "${ED}usr/share/info" || { __helpers_die "${0##*/}: failed to install ${ED}usr/share/info"; exit 1; }

diff --git a/bin/ebuild-helpers/doins b/bin/ebuild-helpers/doins
index c534f3f..4679e83 100755
--- a/bin/ebuild-helpers/doins
+++ b/bin/ebuild-helpers/doins
@@ -29,8 +29,9 @@ else
 	DOINSRECUR=n
 fi
 
-[[ " ${FEATURES} " == *" force-prefix "* ]] || \
-	case "$EAPI" in 0|1|2) export ED="${D}" ;; esac
+if ! ___eapi_has_prefix_variables; then
+	export ED="${D}"
+fi
 
 if [[ ${INSDESTTREE#${ED}} != "${INSDESTTREE}" ]]; then
 	__vecho "-------------------------------------------------------" 1>&2
@@ -41,14 +42,11 @@ if [[ ${INSDESTTREE#${ED}} != "${INSDESTTREE}" ]]; then
 	exit 1
 fi
 
-case "$EAPI" in
-	0|1|2|3)
-		PRESERVE_SYMLINKS=n
-		;;
-	*)
-		PRESERVE_SYMLINKS=y
-		;;
-esac
+if ___eapi_doins_and_newins_preserve_symlinks; then
+	PRESERVE_SYMLINKS=y
+else
+	PRESERVE_SYMLINKS=n
+fi
 
 export TMP=$T/.doins_tmp
 # Use separate directories to avoid potential name collisions.

diff --git a/bin/ebuild-helpers/dolib b/bin/ebuild-helpers/dolib
index 402965d..fd92d7f 100755
--- a/bin/ebuild-helpers/dolib
+++ b/bin/ebuild-helpers/dolib
@@ -1,11 +1,12 @@
 #!/bin/bash
-# Copyright 1999-2011 Gentoo Foundation
+# 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
 
-[[ " ${FEATURES} " == *" force-prefix "* ]] || \
-	case "$EAPI" in 0|1|2) ED=${D} ;; esac
+if ! ___eapi_has_prefix_variables; then
+	ED=${D}
+fi
 
 # Setup ABI cruft
 LIBDIR_VAR="LIBDIR_${ABI}"

diff --git a/bin/ebuild-helpers/doman b/bin/ebuild-helpers/doman
index c10296b..d680859 100755
--- a/bin/ebuild-helpers/doman
+++ b/bin/ebuild-helpers/doman
@@ -1,5 +1,5 @@
 #!/bin/bash
-# Copyright 1999-2011 Gentoo Foundation
+# 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
@@ -9,8 +9,9 @@ if [[ $# -lt 1 ]] ; then
 	exit 1
 fi
 
-[[ " ${FEATURES} " == *" force-prefix "* ]] || \
-	case "$EAPI" in 0|1|2) ED=${D} ;; esac
+if ! ___eapi_has_prefix_variables; then
+	ED=${D}
+fi
 
 i18n=""
 

diff --git a/bin/ebuild-helpers/domo b/bin/ebuild-helpers/domo
index 840b2de..9a8dda3 100755
--- a/bin/ebuild-helpers/domo
+++ b/bin/ebuild-helpers/domo
@@ -1,5 +1,5 @@
 #!/bin/bash
-# Copyright 1999-2011 Gentoo Foundation
+# 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
@@ -10,8 +10,9 @@ if [ ${mynum} -lt 1 ] ; then
 	exit 1
 fi
 
-[[ " ${FEATURES} " == *" force-prefix "* ]] || \
-	case "$EAPI" in 0|1|2) ED=${D} ;; esac
+if ! ___eapi_has_prefix_variables; then
+	ED=${D}
+fi
 
 if [ ! -d "${ED}${DESTTREE}/share/locale" ] ; then
 	install -d "${ED}${DESTTREE}/share/locale/"

diff --git a/bin/ebuild-helpers/dosbin b/bin/ebuild-helpers/dosbin
index edc4584..361ca83 100755
--- a/bin/ebuild-helpers/dosbin
+++ b/bin/ebuild-helpers/dosbin
@@ -1,5 +1,5 @@
 #!/bin/bash
-# Copyright 1999-2011 Gentoo Foundation
+# 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
@@ -9,8 +9,9 @@ if [[ $# -lt 1 ]] ; then
 	exit 1
 fi
 
-[[ " ${FEATURES} " == *" force-prefix "* ]] || \
-	case "$EAPI" in 0|1|2) ED=${D} ;; esac
+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; }

diff --git a/bin/ebuild-helpers/dosed b/bin/ebuild-helpers/dosed
index 24ec205..7db0629 100755
--- a/bin/ebuild-helpers/dosed
+++ b/bin/ebuild-helpers/dosed
@@ -2,22 +2,21 @@
 # Copyright 1999-2012 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
-case "${EAPI}" in
-	0|1|2|3)
-		;;
-	*)
-		die "'${0##*/}' has been banned for EAPI '$EAPI'"
-		exit 1
-		;;
-esac
+source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
+
+if ! ___eapi_has_dosed; then
+	die "'${0##*/}' has been banned for EAPI '$EAPI'"
+	exit 1
+fi
 
 if [[ $# -lt 1 ]] ; then
 	echo "!!! ${0##*/}: at least one argument needed" >&2
 	exit 1
 fi
 
-[[ " ${FEATURES} " == *" force-prefix "* ]] || \
-	case "$EAPI" in 0|1|2) ED=${D} ;; esac
+if ! ___eapi_has_prefix_variables; then
+	ED=${D}
+fi
 
 ret=0
 file_found=0

diff --git a/bin/ebuild-helpers/dosym b/bin/ebuild-helpers/dosym
index 34637c2..649b100 100755
--- a/bin/ebuild-helpers/dosym
+++ b/bin/ebuild-helpers/dosym
@@ -9,8 +9,9 @@ if [[ $# -ne 2 ]] ; then
 	exit 1
 fi
 
-[[ " ${FEATURES} " == *" force-prefix "* ]] || \
-	case "$EAPI" in 0|1|2) ED=${D} ;; esac
+if ! ___eapi_has_prefix_variables; then
+	ED=${D}
+fi
 
 if [[ ${2} == */ ]] || \
 	[[ -d ${ED}${2} && ! -L ${ED}${2} ]] ; then

diff --git a/bin/ebuild-helpers/ecompressdir b/bin/ebuild-helpers/ecompressdir
index 097ade2..75f3e3a 100755
--- a/bin/ebuild-helpers/ecompressdir
+++ b/bin/ebuild-helpers/ecompressdir
@@ -1,5 +1,5 @@
 #!/bin/bash
-# Copyright 1999-2011 Gentoo Foundation
+# Copyright 1999-2012 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/helper-functions.sh
@@ -9,8 +9,9 @@ if [[ -z $1 ]] ; then
 	exit 1
 fi
 
-[[ " ${FEATURES} " == *" force-prefix "* ]] || \
-	case "$EAPI" in 0|1|2) ED=${D} EPREFIX= ;; esac
+if ! ___eapi_has_prefix_variables; then
+	ED=${D} EPREFIX=
+fi
 
 case $1 in
 	--ignore)

diff --git a/bin/ebuild-helpers/fowners b/bin/ebuild-helpers/fowners
index 5b93fd3..b664ec7 100755
--- a/bin/ebuild-helpers/fowners
+++ b/bin/ebuild-helpers/fowners
@@ -4,8 +4,9 @@
 
 source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
 
-[[ " ${FEATURES} " == *" force-prefix "* ]] || \
-	case "$EAPI" in 0|1|2) EPREFIX= ED=${D} ;; esac
+if ! ___eapi_has_prefix_variables; then
+	EPREFIX= ED=${D}
+fi
 
 # we can't prefix all arguments because
 # chown takes random options

diff --git a/bin/ebuild-helpers/fperms b/bin/ebuild-helpers/fperms
index 668e905..d854ebb 100755
--- a/bin/ebuild-helpers/fperms
+++ b/bin/ebuild-helpers/fperms
@@ -1,11 +1,12 @@
 #!/bin/bash
-# Copyright 1999-2011 Gentoo Foundation
+# 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
 
-[[ " ${FEATURES} " == *" force-prefix "* ]] || \
-	case "$EAPI" in 0|1|2) ED=${D} ;; esac
+if ! ___eapi_has_prefix_variables; then
+	ED=${D}
+fi
 
 # we can't prefix all arguments because
 # chmod takes random options

diff --git a/bin/ebuild-helpers/newins b/bin/ebuild-helpers/newins
index 20c68a1..3538f70 100755
--- a/bin/ebuild-helpers/newins
+++ b/bin/ebuild-helpers/newins
@@ -15,10 +15,9 @@ fi
 	eqawarn "QA Notice: ${helper} called with more than 2 arguments: ${@:3}"
 
 stdin=
-case "${EAPI}" in
-	0|1|2|3|4|4-python|4-slot-abi) ;;
-	*) [[ $1 = "-" ]] && stdin=yes ;;
-esac
+if ___eapi_newins_supports_reading_from_standard_input && [[ $1 == "-" ]]; then
+	stdin=yes
+fi
 
 rm -rf "${T}/$2"
 
@@ -37,13 +36,9 @@ else
 
 	cp_args="-f"
 	if [[ ${helper} == newins ]] ; then
-		case "${EAPI}" in
-			0|1|2|3)
-				;;
-			*)
-				cp_args+=" -P"
-				;;
-		esac
+		if ___eapi_doins_and_newins_preserve_symlinks; then
+			cp_args+=" -P"
+		fi
 	fi
 
 	cp ${cp_args} "$1" "${T}/$2"

diff --git a/bin/ebuild-helpers/prepall b/bin/ebuild-helpers/prepall
index 49e646c..fb5c2db 100755
--- a/bin/ebuild-helpers/prepall
+++ b/bin/ebuild-helpers/prepall
@@ -1,11 +1,12 @@
 #!/bin/bash
-# Copyright 1999-2011 Gentoo Foundation
+# 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
 
-[[ " ${FEATURES} " == *" force-prefix "* ]] || \
-	case "$EAPI" in 0|1|2) ED=${D} ;; esac
+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.

diff --git a/bin/ebuild-helpers/prepalldocs b/bin/ebuild-helpers/prepalldocs
index 50b0c70..b76f084 100755
--- a/bin/ebuild-helpers/prepalldocs
+++ b/bin/ebuild-helpers/prepalldocs
@@ -4,21 +4,18 @@
 
 source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
 
-case "${EAPI}" in
-	0|1|2|3)
-		;;
-	*)
-		die "'${0##*/}' has been banned for EAPI '$EAPI'"
-		exit 1
-		;;
-esac
+if ! ___eapi_has_docompress; then
+	die "'${0##*/}' has been banned for EAPI '$EAPI'"
+	exit 1
+fi
 
 if [[ -n $1 ]] ; then
 	__vecho "${0##*/}: invalid usage; takes no arguments" 1>&2
 fi
 
-[[ " ${FEATURES} " == *" force-prefix "* ]] || \
-	case "$EAPI" in 0|1|2) ED=${D} ;; esac
+if ! ___eapi_has_prefix_variables; then
+	ED=${D}
+fi
 
 [[ -d ${ED}usr/share/doc ]] || exit 0
 

diff --git a/bin/ebuild-helpers/prepallinfo b/bin/ebuild-helpers/prepallinfo
index db9bbfa..1a20275 100755
--- a/bin/ebuild-helpers/prepallinfo
+++ b/bin/ebuild-helpers/prepallinfo
@@ -1,11 +1,12 @@
 #!/bin/bash
-# Copyright 1999-2011 Gentoo Foundation
+# 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
 
-[[ " ${FEATURES} " == *" force-prefix "* ]] || \
-	case "$EAPI" in 0|1|2) ED=${D} ;; esac
+if ! ___eapi_has_prefix_variables; then
+	ED=${D}
+fi
 
 [[ -d ${ED}usr/share/info ]] || exit 0
 

diff --git a/bin/ebuild-helpers/prepallman b/bin/ebuild-helpers/prepallman
index dee1c72..7c78324 100755
--- a/bin/ebuild-helpers/prepallman
+++ b/bin/ebuild-helpers/prepallman
@@ -1,14 +1,15 @@
 #!/bin/bash
-# Copyright 1999-2011 Gentoo Foundation
+# 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
 
 # replaced by controllable compression in EAPI 4
-has "${EAPI}" 0 1 2 3 || exit 0
+___eapi_has_docompress && exit 0
 
-[[ " ${FEATURES} " == *" force-prefix "* ]] || \
-	case "$EAPI" in 0|1|2) ED=${D} ;; esac
+if ! ___eapi_has_prefix_variables; then
+	ED=${D}
+fi
 
 ret=0
 

diff --git a/bin/ebuild-helpers/prepallstrip b/bin/ebuild-helpers/prepallstrip
index 28320d9..1aa6686 100755
--- a/bin/ebuild-helpers/prepallstrip
+++ b/bin/ebuild-helpers/prepallstrip
@@ -1,8 +1,11 @@
 #!/bin/bash
-# Copyright 1999-2011 Gentoo Foundation
+# Copyright 1999-2012 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
-[[ " ${FEATURES} " == *" force-prefix "* ]] || \
-	case "$EAPI" in 0|1|2) ED=${D} ;; esac
+source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
+
+if ! ___eapi_has_prefix_variables; then
+	ED=${D}
+fi
 
 exec prepstrip "${ED}"

diff --git a/bin/ebuild-helpers/prepinfo b/bin/ebuild-helpers/prepinfo
index e213f32..5afc18a 100755
--- a/bin/ebuild-helpers/prepinfo
+++ b/bin/ebuild-helpers/prepinfo
@@ -1,11 +1,12 @@
 #!/bin/bash
-# Copyright 1999-2011 Gentoo Foundation
+# 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
 
-[[ " ${FEATURES} " == *" force-prefix "* ]] || \
-	case "$EAPI" in 0|1|2) ED=${D} ;; esac
+if ! ___eapi_has_prefix_variables; then
+	ED=${D}
+fi
 
 if [[ -z $1 ]] ; then
 	infodir="/usr/share/info"
@@ -33,5 +34,5 @@ find "${ED}${infodir}" -type d -print0 | while read -r -d $'\0' x ; do
 	rm -f "${x}"/dir{,.info}{,.gz,.bz2}
 done
 
-has "${EAPI}" 0 1 2 3 || exit 0
+___eapi_has_docompress && exit 0
 exec ecompressdir --queue "${infodir}"

diff --git a/bin/ebuild-helpers/preplib b/bin/ebuild-helpers/preplib
index 6e91cf3..764261d 100755
--- a/bin/ebuild-helpers/preplib
+++ b/bin/ebuild-helpers/preplib
@@ -1,13 +1,14 @@
 #!/bin/bash
-# Copyright 1999-2011 Gentoo Foundation
+# 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
 
 eqawarn "QA Notice: Deprecated call to 'preplib'"
 
-[[ " ${FEATURES} " == *" force-prefix "* ]] || \
-	case "$EAPI" in 0|1|2) ED=${D} ;; esac
+if ! ___eapi_has_prefix_variables; then
+	ED=${D}
+fi
 
 LIBDIR_VAR="LIBDIR_${ABI}"
 if [ -n "${ABI}" -a -n "${!LIBDIR_VAR}" ]; then

diff --git a/bin/ebuild-helpers/prepman b/bin/ebuild-helpers/prepman
index f96b641..142d404 100755
--- a/bin/ebuild-helpers/prepman
+++ b/bin/ebuild-helpers/prepman
@@ -1,11 +1,12 @@
 #!/bin/bash
-# Copyright 1999-2011 Gentoo Foundation
+# 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
 
-[[ " ${FEATURES} " == *" force-prefix "* ]] || \
-	case "$EAPI" in 0|1|2) ED=${D} ;; esac
+if ! ___eapi_has_prefix_variables; then
+	ED=${D}
+fi
 
 if [[ -z $1 ]] ; then 
 	mandir="${ED}usr/share/man"
@@ -19,7 +20,7 @@ if [[ ! -d ${mandir} ]] ; then
 fi
 
 # replaced by controllable compression in EAPI 4
-has "${EAPI}" 0 1 2 3 || exit 0
+___eapi_has_docompress && exit 0
 
 shopt -s nullglob
 

diff --git a/bin/ebuild-helpers/prepstrip b/bin/ebuild-helpers/prepstrip
index 802fdd8..0d1ce5a 100755
--- a/bin/ebuild-helpers/prepstrip
+++ b/bin/ebuild-helpers/prepstrip
@@ -18,8 +18,9 @@ exp_tf() {
 exp_tf FEATURES compressdebug installsources nostrip splitdebug
 exp_tf RESTRICT binchecks installsources strip
 
-[[ " ${FEATURES} " == *" force-prefix "* ]] || \
-	case "${EAPI}" in 0|1|2) EPREFIX= ED=${D} ;; esac
+if ! ___eapi_has_prefix_variables; then
+	EPREFIX= ED=${D}
+fi
 
 banner=false
 SKIP_STRIP=false

diff --git a/bin/ebuild.sh b/bin/ebuild.sh
index 06e2c66..aa3dcdd 100755
--- a/bin/ebuild.sh
+++ b/bin/ebuild.sh
@@ -26,16 +26,16 @@ else
 		__strip_duplicate_slashes \
 		use_with use_enable ; do
 		eval "${x}() {
-			if has \"\${EAPI:-0}\" 4-python 5-progress; then
+			if ___eapi_disallows_helpers_in_global_scope; then
 				die \"\${FUNCNAME}() calls are not allowed in global scope\"
 			fi
 		}"
 	done
-	# These dummy functions return false in older EAPIs, in order to ensure that
+	# These dummy functions return false in non-strict EAPIs, in order to ensure that
 	# `use multislot` is false for the "depend" phase.
 	for x in use useq usev usex ; do
 		eval "${x}() {
-			if has \"\${EAPI:-0}\" 4-python 5-progress; then
+			if ___eapi_disallows_helpers_in_global_scope; then
 				die \"\${FUNCNAME}() calls are not allowed in global scope\"
 			else
 				return 1
@@ -512,7 +512,7 @@ if ! has "$EBUILD_PHASE" clean cleanrm depend && \
 	[[ -n $EAPI ]] || EAPI=0
 fi
 
-if has "${EAPI:-0}" 4-python 5-progress; then
+if ___eapi_enables_globstar; then
 	shopt -s globstar
 fi
 
@@ -557,7 +557,7 @@ if ! has "$EBUILD_PHASE" clean cleanrm ; then
 		# export EAPI for helpers (especially since we unset it above)
 		export EAPI
 
-		if has "$EAPI" 0 1 2 3 ; then
+		if ___eapi_has_RDEPEND_DEPEND_fallback; then
 			export RDEPEND=${RDEPEND-${DEPEND}}
 			debug-print "RDEPEND: not set... Setting to: ${DEPEND}"
 		fi
@@ -675,13 +675,9 @@ if [[ $EBUILD_PHASE = depend ]] ; then
 		PROPERTIES DEFINED_PHASES HDEPEND UNUSED_04
 		UNUSED_03 UNUSED_02 UNUSED_01"
 
-	case ${EAPI} in
-		5-hdepend)
-			;;
-		*)
-			unset HDEPEND
-			;;
-	esac
+	if ! ___eapi_has_HDEPEND; then
+		unset HDEPEND
+	fi
 
 	# The extra $(echo) commands remove newlines.
 	if [ -n "${dbkey}" ] ; then
@@ -700,15 +696,9 @@ else
 	# Note: readonly variables interfere with __preprocess_ebuild_env(), so
 	# declare them only after it has already run.
 	declare -r $PORTAGE_READONLY_METADATA $PORTAGE_READONLY_VARS
-	case ${EAPI} in
-		0|1|2)
-			[[ " ${FEATURES} " == *" force-prefix "* ]] && \
-				declare -r ED EPREFIX EROOT
-			;;
-		*)
-			declare -r ED EPREFIX EROOT
-			;;
-	esac
+	if ___eapi_has_prefix_variables; then
+		declare -r ED EPREFIX EROOT
+	fi
 
 	if [[ -n $EBUILD_SH_ARGS ]] ; then
 		(

diff --git a/bin/isolated-functions.sh b/bin/isolated-functions.sh
index fa84c7e..f8e7862 100644
--- a/bin/isolated-functions.sh
+++ b/bin/isolated-functions.sh
@@ -2,6 +2,8 @@
 # Copyright 1999-2012 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
+source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}/eapi.sh"
+
 # We need this next line for "die" and "assert". It expands
 # It _must_ preceed all the calls to die and assert.
 shopt -s expand_aliases
@@ -86,7 +88,7 @@ __dump_trace() {
 }
 
 nonfatal() {
-	if has "${EAPI:-0}" 0 1 2 3 ; then
+	if ! ___eapi_has_nonfatal; then
 		die "$FUNCNAME() not supported in this EAPI"
 	fi
 	if [[ $# -lt 1 ]]; then
@@ -97,14 +99,11 @@ nonfatal() {
 }
 
 __helpers_die() {
-	case "${EAPI:-0}" in
-		0|1|2|3)
-			echo -e "$@" >&2
-			;;
-		*)
-			die "$@"
-			;;
-	esac
+	if ___eapi_helpers_can_die; then
+		die "$@"
+	else
+		echo -e "$@" >&2
+	fi
 }
 
 die() {

diff --git a/bin/misc-functions.sh b/bin/misc-functions.sh
index 55d37f2..986264e 100755
--- a/bin/misc-functions.sh
+++ b/bin/misc-functions.sh
@@ -17,8 +17,9 @@ shift $#
 source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}/ebuild.sh"
 
 install_symlink_html_docs() {
-	[[ " ${FEATURES} " == *" force-prefix "* ]] || \
-		case "$EAPI" in 0|1|2) local ED=${D} ;; esac
+	if ! ___eapi_has_prefix_variables; then
+		local ED=${D}
+	fi
 	cd "${ED}" || die "cd failed"
 	#symlink the html documentation (if DOC_SYMLINKS_DIR is set in make.conf)
 	if [ -n "${DOC_SYMLINKS_DIR}" ] ; then
@@ -79,8 +80,9 @@ canonicalize() {
 prepcompress() {
 	local -a include exclude incl_d incl_f
 	local f g i real_f real_d
-	[[ " ${FEATURES} " == *" force-prefix "* ]] || \
-		case "$EAPI" in 0|1|2) local ED=${D} ;; esac
+	if ! ___eapi_has_prefix_variables; then
+		local ED=${D}
+	fi
 
 	# Canonicalize path names and check for their existence.
 	real_d=$(canonicalize "${ED}")
@@ -162,8 +164,9 @@ prepcompress() {
 
 install_qa_check() {
 	local f i qa_var x
-	[[ " ${FEATURES} " == *" force-prefix "* ]] || \
-		case "$EAPI" in 0|1|2) local EPREFIX= ED=${D} ;; esac
+	if ! ___eapi_has_prefix_variables; then
+		local EPREFIX= ED=${D}
+	fi
 
 	cd "${ED}" || die "cd failed"
 
@@ -228,7 +231,7 @@ install_qa_check() {
 
 	export STRIP_MASK
 	prepall
-	has "${EAPI}" 0 1 2 3 || prepcompress
+	___eapi_has_docompress && prepcompress
 	ecompressdir --dequeue
 	ecompress --dequeue
 
@@ -958,8 +961,9 @@ preinst_mask() {
 		 return 1
 	fi
 
-	[[ " ${FEATURES} " == *" force-prefix "* ]] || \
-		case "$EAPI" in 0|1|2) local ED=${D} ;; esac
+	if ! ___eapi_has_prefix_variables; then
+		local ED=${D}
+	fi
 
 	# Make sure $PWD is not ${D} so that we don't leave gmon.out files
 	# in there in case any tools were built with -pg in CFLAGS.
@@ -987,8 +991,9 @@ preinst_sfperms() {
 		 return 1
 	fi
 
-	[[ " ${FEATURES} " == *" force-prefix "* ]] || \
-		case "$EAPI" in 0|1|2) local ED=${D} ;; esac
+	if ! ___eapi_has_prefix_variables; then
+		local ED=${D}
+	fi
 
 	# Smart FileSystem Permissions
 	if has sfperms $FEATURES; then
@@ -1026,8 +1031,9 @@ preinst_suid_scan() {
 		 return 1
 	fi
 
-	[[ " ${FEATURES} " == *" force-prefix "* ]] || \
-		case "$EAPI" in 0|1|2) local ED=${D} ;; esac
+	if ! ___eapi_has_prefix_variables; then
+		local ED=${D}
+	fi
 
 	# total suid control.
 	if has suidctl $FEATURES; then
@@ -1095,8 +1101,9 @@ preinst_selinux_labels() {
 __dyn_package() {
 	local PROOT
 
-	[[ " ${FEATURES} " == *" force-prefix "* ]] || \
-		case "$EAPI" in 0|1|2) local EPREFIX= ED=${D} ;; esac
+	if ! ___eapi_has_prefix_variables; then
+		local EPREFIX= ED=${D}
+	fi
 
 	# Make sure $PWD is not ${D} so that we don't leave gmon.out files
 	# in there in case any tools were built with -pg in CFLAGS.
@@ -1193,9 +1200,9 @@ __END1__
 }
 
 __dyn_rpm() {
-
-	[[ " ${FEATURES} " == *" force-prefix "* ]] || \
-		case "$EAPI" in 0|1|2) local EPREFIX= ;; esac
+	if ! ___eapi_has_prefix_variables; then
+		local EPREFIX=
+	fi
 
 	cd "${T}" || die "cd failed"
 	local machine_name=$(uname -m)

diff --git a/bin/phase-functions.sh b/bin/phase-functions.sh
index 97e762a..7a0baf4 100644
--- a/bin/phase-functions.sh
+++ b/bin/phase-functions.sh
@@ -100,15 +100,9 @@ __filter_readonly_variables() {
 
 	# Don't filter/interfere with prefix variables unless they are
 	# supported by the current EAPI.
-	case "${EAPI:-0}" in
-		0|1|2)
-			[[ " ${FEATURES} " == *" force-prefix "* ]] && \
-				filtered_vars+=" ED EPREFIX EROOT"
-			;;
-		*)
-			filtered_vars+=" ED EPREFIX EROOT"
-			;;
-	esac
+	if ___eapi_has_prefix_variables; then
+		filtered_vars+=" ED EPREFIX EROOT"
+	fi
 
 	if has --filter-sandbox $* ; then
 		filtered_vars="${filtered_vars} SANDBOX_.*"
@@ -364,7 +358,7 @@ __dyn_prepare() {
 
 	if [[ -d $S ]] ; then
 		cd "${S}"
-	elif has $EAPI 0 1 2 3 ; then
+	elif ___eapi_has_S_WORKDIR_fallback; then
 		cd "${WORKDIR}"
 	elif [[ -z ${A} ]] && ! __has_phase_defined_up_to prepare; then
 		cd "${WORKDIR}"
@@ -395,7 +389,7 @@ __dyn_configure() {
 
 	if [[ -d $S ]] ; then
 		cd "${S}"
-	elif has $EAPI 0 1 2 3 ; then
+	elif ___eapi_has_S_WORKDIR_fallback; then
 		cd "${WORKDIR}"
 	elif [[ -z ${A} ]] && ! __has_phase_defined_up_to configure; then
 		cd "${WORKDIR}"
@@ -428,7 +422,7 @@ __dyn_compile() {
 
 	if [[ -d $S ]] ; then
 		cd "${S}"
-	elif has $EAPI 0 1 2 3 ; then
+	elif ___eapi_has_S_WORKDIR_fallback; then
 		cd "${WORKDIR}"
 	elif [[ -z ${A} ]] && ! __has_phase_defined_up_to compile; then
 		cd "${WORKDIR}"
@@ -510,16 +504,18 @@ __dyn_install() {
 	trap "__abort_install" SIGINT SIGQUIT
 	__ebuild_phase pre_src_install
 
-	_x=${ED}
-	[[ " ${FEATURES} " == *" force-prefix "* ]] || \
-		case "$EAPI" in 0|1|2) _x=${D} ;; esac
+	if ___eapi_has_prefix_variables; then
+		_x=${ED}
+	else
+		_x=${D}
+	fi
 	rm -rf "${D}"
 	mkdir -p "${_x}"
 	unset _x
 
 	if [[ -d $S ]] ; then
 		cd "${S}"
-	elif has $EAPI 0 1 2 3 ; then
+	elif ___eapi_has_S_WORKDIR_fallback; then
 		cd "${WORKDIR}"
 	elif [[ -z ${A} ]] && ! __has_phase_defined_up_to install; then
 		cd "${WORKDIR}"
@@ -571,15 +567,9 @@ __dyn_install() {
 	# Save EPREFIX, since it makes it easy to use chpathtool to
 	# adjust the content of a binary package so that it will
 	# work in a different EPREFIX from the one is was built for.
-	case "${EAPI:-0}" in
-		0|1|2)
-			[[ " ${FEATURES} " == *" force-prefix "* ]] && \
-				[ -n "${EPREFIX}" ] && echo "${EPREFIX}" > EPREFIX
-			;;
-		*)
-			[ -n "${EPREFIX}" ] && echo "${EPREFIX}" > EPREFIX
-			;;
-	esac
+	if ___eapi_has_prefix_variables && [[ -n ${EPREFIX} ]]; then
+		echo "${EPREFIX}" > EPREFIX
+	fi
 
 	set +f
 
@@ -669,14 +659,13 @@ __dyn_help() {
 # Translate a known ebuild(1) argument into the precise
 # name of it's corresponding ebuild phase.
 __ebuild_arg_to_phase() {
-	[ $# -ne 2 ] && die "expected exactly 2 args, got $#: $*"
-	local eapi=$1
-	local arg=$2
+	[ $# -ne 1 ] && die "expected exactly 1 arg, got $#: $*"
+	local arg=$1
 	local phase_func=""
 
 	case "$arg" in
 		pretend)
-			! has $eapi 0 1 2 3 && \
+			___eapi_has_pkg_pretend && \
 				phase_func=pkg_pretend
 			;;
 		setup)
@@ -689,11 +678,11 @@ __ebuild_arg_to_phase() {
 			phase_func=src_unpack
 			;;
 		prepare)
-			! has $eapi 0 1 && \
+			___eapi_has_src_prepare && \
 				phase_func=src_prepare
 			;;
 		configure)
-			! has $eapi 0 1 && \
+			___eapi_has_src_configure && \
 				phase_func=src_configure
 			;;
 		compile)
@@ -853,7 +842,7 @@ __ebuild_main() {
 	# respect FEATURES="-ccache".
 	has ccache $FEATURES || export CCACHE_DISABLE=1
 
-	local phase_func=$(__ebuild_arg_to_phase "$EAPI" "$EBUILD_PHASE")
+	local phase_func=$(__ebuild_arg_to_phase "$EBUILD_PHASE")
 	[[ -n $phase_func ]] && __ebuild_phase_funcs "$EAPI" "$phase_func"
 	unset phase_func
 

diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
index 157725f..dc70de6 100644
--- a/bin/phase-helpers.sh
+++ b/bin/phase-helpers.sh
@@ -19,8 +19,9 @@ into() {
 		export DESTTREE=""
 	else
 		export DESTTREE=$1
-		[[ " ${FEATURES} " == *" force-prefix "* ]] || \
-			case "$EAPI" in 0|1|2) local ED=${D} ;; esac
+		if ! ___eapi_has_prefix_variables; then
+			local ED=${D}
+		fi
 		if [ ! -d "${ED}${DESTTREE}" ]; then
 			install -d "${ED}${DESTTREE}"
 			local ret=$?
@@ -37,8 +38,9 @@ insinto() {
 		export INSDESTTREE=""
 	else
 		export INSDESTTREE=$1
-		[[ " ${FEATURES} " == *" force-prefix "* ]] || \
-			case "$EAPI" in 0|1|2) local ED=${D} ;; esac
+		if ! ___eapi_has_prefix_variables; then
+			local ED=${D}
+		fi
 		if [ ! -d "${ED}${INSDESTTREE}" ]; then
 			install -d "${ED}${INSDESTTREE}"
 			local ret=$?
@@ -55,8 +57,9 @@ exeinto() {
 		export _E_EXEDESTTREE_=""
 	else
 		export _E_EXEDESTTREE_="$1"
-		[[ " ${FEATURES} " == *" force-prefix "* ]] || \
-			case "$EAPI" in 0|1|2) local ED=${D} ;; esac
+		if ! ___eapi_has_prefix_variables; then
+			local ED=${D}
+		fi
 		if [ ! -d "${ED}${_E_EXEDESTTREE_}" ]; then
 			install -d "${ED}${_E_EXEDESTTREE_}"
 			local ret=$?
@@ -73,8 +76,9 @@ docinto() {
 		export _E_DOCDESTTREE_=""
 	else
 		export _E_DOCDESTTREE_="$1"
-		[[ " ${FEATURES} " == *" force-prefix "* ]] || \
-			case "$EAPI" in 0|1|2) local ED=${D} ;; esac
+		if ! ___eapi_has_prefix_variables; then
+			local ED=${D}
+		fi
 		if [ ! -d "${ED}usr/share/doc/${PF}/${_E_DOCDESTTREE_}" ]; then
 			install -d "${ED}usr/share/doc/${PF}/${_E_DOCDESTTREE_}"
 			local ret=$?
@@ -112,7 +116,7 @@ libopts() {
 }
 
 docompress() {
-	has "${EAPI}" 0 1 2 3 && die "'docompress' not supported in this EAPI"
+	___eapi_has_docompress || die "'docompress' not supported in this EAPI"
 
 	local f g
 	if [[ $1 = "-x" ]]; then
@@ -141,8 +145,9 @@ docompress() {
 keepdir() {
 	dodir "$@"
 	local x
-	[[ " ${FEATURES} " == *" force-prefix "* ]] || \
-		case "$EAPI" in 0|1|2) local ED=${D} ;; esac
+	if ! ___eapi_has_prefix_variables; then
+		local ED=${D}
+	fi
 	if [ "$1" == "-R" ] || [ "$1" == "-r" ]; then
 		shift
 		find "$@" -type d -printf "${ED}%p/.keep_${CATEGORY}_${PN}-${SLOT}\n" \
@@ -174,19 +179,16 @@ usev() {
 	return 1
 }
 
-case "${EAPI}" in
-	0|1|2|3|4|4-python|4-slot-abi) ;;
-	*)
-		usex() {
-			if use "$1"; then
-				echo "${2-yes}$4"
-			else
-				echo "${3-no}$5"
-			fi
-			return 0
-		}
-		;;
-esac
+if ___eapi_has_usex; then
+	usex() {
+		if use "$1"; then
+			echo "${2-yes}$4"
+		else
+			echo "${3-no}$5"
+		fi
+		return 0
+	}
+fi
 
 use() {
 	local u=$1
@@ -233,7 +235,7 @@ use_with() {
 		return 1
 	fi
 
-	if ! has "${EAPI:-0}" 0 1 2 3 ; then
+	if ___eapi_use_enable_and_use_with_support_empty_third_argument; then
 		local UW_SUFFIX=${3+=$3}
 	else
 		local UW_SUFFIX=${3:+=$3}
@@ -255,7 +257,7 @@ use_enable() {
 		return 1
 	fi
 
-	if ! has "${EAPI:-0}" 0 1 2 3 ; then
+	if ___eapi_use_enable_and_use_with_support_empty_third_argument; then
 		local UE_SUFFIX=${3+=$3}
 	else
 		local UE_SUFFIX=${3:+=$3}
@@ -377,10 +379,10 @@ unpack() {
 				__unpack_tar "lzma -d"
 				;;
 			xz)
-				if has $eapi 0 1 2 ; then
-					__vecho "unpack ${x}: file format not recognized. Ignoring."
-				else
+				if ___eapi_unpack_supports_xz; then
 					__unpack_tar "xz -d"
+				else
+					__vecho "unpack ${x}: file format not recognized. Ignoring."
 				fi
 				;;
 			*)
@@ -397,8 +399,9 @@ unpack() {
 econf() {
 	local x
 
-	[[ " ${FEATURES} " == *" force-prefix "* ]] || \
-		case "$EAPI" in 0|1|2) local EPREFIX= ;; esac
+	if ! ___eapi_has_prefix_variables; then
+		local EPREFIX=
+	fi
 
 	__hasg() {
 		local x s=$1
@@ -409,9 +412,9 @@ econf() {
 
 	__hasgq() { __hasg "$@" >/dev/null ; }
 
-	local phase_func=$(__ebuild_arg_to_phase "$EAPI" "$EBUILD_PHASE")
+	local phase_func=$(__ebuild_arg_to_phase "$EBUILD_PHASE")
 	if [[ -n $phase_func ]] ; then
-		if has "$EAPI" 0 1 ; then
+		if ! ___eapi_has_src_configure; then
 			[[ $phase_func != src_compile ]] && \
 				eqawarn "QA Notice: econf called in" \
 					"$phase_func instead of src_compile"
@@ -438,30 +441,25 @@ econf() {
 			done
 		fi
 
-		# EAPI=4 adds --disable-dependency-tracking to econf
-		case "${EAPI}" in
-			0|1|2|3)
-				;;
-			*)
-				local conf_help=$("${ECONF_SOURCE}/configure" --help 2>/dev/null)
+		if ___eapi_econf_passes_--disable-dependency-tracking || ___eapi_econf_passes_--disable-silent-rules; then
+			local conf_help=$("${ECONF_SOURCE}/configure" --help 2>/dev/null)
+
+			if ___eapi_econf_passes_--disable-dependency-tracking; then
 				case "${conf_help}" in
 					*--disable-dependency-tracking*)
 						set -- --disable-dependency-tracking "$@"
 						;;
 				esac
-				case "${EAPI}" in
-					4|4-python|4-slot-abi)
-						;;
-					*)
-						case "${conf_help}" in
-							*--disable-silent-rules*)
-								set -- --disable-silent-rules "$@"
-								;;
-						esac
+			fi
+
+			if ___eapi_econf_passes_--disable-silent-rules; then
+				case "${conf_help}" in
+					*--disable-silent-rules*)
+						set -- --disable-silent-rules "$@"
 						;;
 				esac
-				;;
-		esac
+			fi
+		fi
 
 		# if the profile defines a location to install libs to aside from default, pass it on.
 		# if the ebuild passes in --libdir, they're responsible for the conf_libdir fun.
@@ -512,8 +510,9 @@ econf() {
 einstall() {
 	# CONF_PREFIX is only set if they didn't pass in libdir above.
 	local LOCAL_EXTRA_EINSTALL="${EXTRA_EINSTALL}"
-	[[ " ${FEATURES} " == *" force-prefix "* ]] || \
-		case "$EAPI" in 0|1|2) local ED=${D} ;; esac
+	if ! ___eapi_has_prefix_variables; then
+		local ED=${D}
+	fi
 	LIBDIR_VAR="LIBDIR_${ABI}"
 	if [ -n "${ABI}" -a -n "${!LIBDIR_VAR}" ]; then
 		CONF_LIBDIR="${!LIBDIR_VAR}"
@@ -581,11 +580,9 @@ __eapi0_src_test() {
 	# to emulate the desired parts of emake behavior.
 	local emake_cmd="${MAKE:-make} ${MAKEOPTS} ${EXTRA_EMAKE}"
 	local internal_opts=
-	case "$EAPI" in
-		0|1|2|3|4|4-python|4-slot-abi)
-			internal_opts+=" -j1"
-			;;
-	esac
+	if ___eapi_default_src_test_disables_parallel_jobs; then
+		internal_opts+=" -j1"
+	fi
 	if $emake_cmd ${internal_opts} check -n &> /dev/null; then
 		__vecho ">>> Test phase [check]: ${CATEGORY}/${PF}"
 		$emake_cmd ${internal_opts} check || \
@@ -652,23 +649,17 @@ has_version() {
 	[ $# -gt 0 ] && die "${FUNCNAME[0]}: unused argument(s): $*"
 
 	if ${host_root} ; then
-		case "${EAPI}" in
-			0|1|2|3|4|4-python|4-slot-abi)
-				die "${FUNCNAME[0]}: option --host-root is not supported with EAPI ${EAPI}"
-				;;
-		esac
+		if ! ___eapi_best_version_and_has_version_support_--host-root; then
+			die "${FUNCNAME[0]}: option --host-root is not supported with EAPI ${EAPI}"
+		fi
 		root=/
 	fi
 
-	case "$EAPI" in
-		0|1|2)
-			[[ " ${FEATURES} " == *" force-prefix "* ]] && \
-				eroot=${root%/}${EPREFIX}/ || eroot=${root}
-			;;
-		*)
-			eroot=${root%/}${EPREFIX}/
-			;;
-	esac
+	if ___eapi_has_prefix_variables; then
+		eroot=${root%/}${EPREFIX}/
+	else
+		eroot=${root}
+	fi
 	if [[ -n $PORTAGE_IPC_DAEMON ]] ; then
 		"$PORTAGE_BIN_PATH"/ebuild-ipc has_version "${eroot}" "${atom}"
 	else
@@ -704,23 +695,17 @@ best_version() {
 	[ $# -gt 0 ] && die "${FUNCNAME[0]}: unused argument(s): $*"
 
 	if ${host_root} ; then
-		case "${EAPI}" in
-			0|1|2|3|4|4-python|4-slot-abi)
-				die "${FUNCNAME[0]}: option --host-root is not supported with EAPI ${EAPI}"
-				;;
-		esac
+		if ! ___eapi_best_version_and_has_version_support_--host-root; then
+			die "${FUNCNAME[0]}: option --host-root is not supported with EAPI ${EAPI}"
+		fi
 		root=/
 	fi
 
-	case "$EAPI" in
-		0|1|2)
-			[[ " ${FEATURES} " == *" force-prefix "* ]] && \
-				eroot=${root%/}${EPREFIX}/ || eroot=${root}
-			;;
-		*)
-			eroot=${root%/}${EPREFIX}/
-			;;
-	esac
+	if ___eapi_has_prefix_variables; then
+		eroot=${root%/}${EPREFIX}/
+	else
+		eroot=${root}
+	fi
 	if [[ -n $PORTAGE_IPC_DAEMON ]] ; then
 		"$PORTAGE_BIN_PATH"/ebuild-ipc best_version "${eroot}" "${atom}"
 	else

diff --git a/bin/save-ebuild-env.sh b/bin/save-ebuild-env.sh
index 7ae3938..92cc692 100644
--- a/bin/save-ebuild-env.sh
+++ b/bin/save-ebuild-env.sh
@@ -76,10 +76,11 @@ __save_ebuild_env() {
 		__unpack_tar __unset_colors \
 		${QA_INTERCEPTORS}
 
-	case "${EAPI}" in
-		0|1|2|3|4|4-python|4-slot-abi) ;;
-		*) unset -f usex ;;
-	esac
+	if ___eapi_has_usex; then
+		unset -f usex
+	fi
+
+	unset -f $(compgen -A function ___eapi_)
 
 	# portage config variables and variables set directly by portage
 	unset ACCEPT_LICENSE BAD BRACKET BUILD_PREFIX COLS \


^ permalink raw reply related	[flat|nested] 20+ messages in thread
* [gentoo-commits] proj/portage:master commit in: bin/ebuild-helpers/, bin/
@ 2012-09-14  7:26 Zac Medico
  0 siblings, 0 replies; 20+ messages in thread
From: Zac Medico @ 2012-09-14  7:26 UTC (permalink / raw
  To: gentoo-commits

commit:     9b19ac5696c487dab58d7c10990fe07fd7f1f731
Author:     Brian Harring <ferringb <AT> gmail <DOT> com>
AuthorDate: Fri Sep 14 05:14:01 2012 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Fri Sep 14 06:55:44 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=9b19ac56

Convert funcs of isolated-functions.sh to __ prefixed namespace.

---
 bin/ebuild-helpers/dobin        |    6 +-
 bin/ebuild-helpers/doconfd      |    2 +-
 bin/ebuild-helpers/dodir        |    2 +-
 bin/ebuild-helpers/dodoc        |    4 +-
 bin/ebuild-helpers/doenvd       |    2 +-
 bin/ebuild-helpers/doexe        |    6 +-
 bin/ebuild-helpers/doheader     |    2 +-
 bin/ebuild-helpers/dohtml       |    2 +-
 bin/ebuild-helpers/doinfo       |    6 +-
 bin/ebuild-helpers/doinitd      |    2 +-
 bin/ebuild-helpers/doins        |   14 +++---
 bin/ebuild-helpers/dolib        |    6 +-
 bin/ebuild-helpers/doman        |    6 +-
 bin/ebuild-helpers/domo         |    4 +-
 bin/ebuild-helpers/dosbin       |    6 +-
 bin/ebuild-helpers/dosym        |    4 +-
 bin/ebuild-helpers/ecompress    |   14 +++---
 bin/ebuild-helpers/ecompressdir |   14 +++---
 bin/ebuild-helpers/emake        |    2 +-
 bin/ebuild-helpers/fowners      |    2 +-
 bin/ebuild-helpers/fperms       |    2 +-
 bin/ebuild-helpers/newins       |   10 ++--
 bin/ebuild-helpers/prepalldocs  |    2 +-
 bin/ebuild-helpers/prepinfo     |    2 +-
 bin/ebuild-helpers/prepstrip    |   10 ++--
 bin/emerge-webrsync             |   20 +++++-----
 bin/isolated-functions.sh       |   50 ++++++++++++------------
 bin/misc-functions.sh           |   78 +++++++++++++++++++-------------------
 bin/phase-functions.sh          |   58 ++++++++++++++--------------
 bin/phase-helpers.sh            |   28 +++++++-------
 bin/save-ebuild-env.sh          |   12 +++---
 31 files changed, 189 insertions(+), 189 deletions(-)

diff --git a/bin/ebuild-helpers/dobin b/bin/ebuild-helpers/dobin
index f90d893..06ae0c7 100755
--- a/bin/ebuild-helpers/dobin
+++ b/bin/ebuild-helpers/dobin
@@ -5,7 +5,7 @@
 source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
 
 if [[ $# -lt 1 ]] ; then
-	helpers_die "${0##*/}: at least one argument needed"
+	__helpers_die "${0##*/}: at least one argument needed"
 	exit 1
 fi
 
@@ -13,7 +13,7 @@ fi
 	case "$EAPI" in 0|1|2) ED=${D} ;; esac
 
 if [[ ! -d ${ED}${DESTTREE}/bin ]] ; then
-	install -d "${ED}${DESTTREE}/bin" || { helpers_die "${0##*/}: failed to install ${ED}${DESTTREE}/bin"; exit 2; }
+	install -d "${ED}${DESTTREE}/bin" || { __helpers_die "${0##*/}: failed to install ${ED}${DESTTREE}/bin"; exit 2; }
 fi
 
 ret=0
@@ -28,5 +28,5 @@ for x in "$@" ; do
 	((ret|=$?))
 done
 
-[[ $ret -ne 0 ]] && helpers_die "${0##*/} failed"
+[[ $ret -ne 0 ]] && __helpers_die "${0##*/} failed"
 exit ${ret}

diff --git a/bin/ebuild-helpers/doconfd b/bin/ebuild-helpers/doconfd
index e146000..a3c09a5 100755
--- a/bin/ebuild-helpers/doconfd
+++ b/bin/ebuild-helpers/doconfd
@@ -4,7 +4,7 @@
 
 if [[ $# -lt 1 ]] ; then
 	source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
-	helpers_die "${0##*/}: at least one argument needed"
+	__helpers_die "${0##*/}: at least one argument needed"
 	exit 1
 fi
 

diff --git a/bin/ebuild-helpers/dodir b/bin/ebuild-helpers/dodir
index 90a3efe..c8f763d 100755
--- a/bin/ebuild-helpers/dodir
+++ b/bin/ebuild-helpers/dodir
@@ -9,5 +9,5 @@ source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
 
 install -d ${DIROPTIONS} "${@/#/${ED}/}"
 ret=$?
-[[ $ret -ne 0 ]] && helpers_die "${0##*/} failed"
+[[ $ret -ne 0 ]] && __helpers_die "${0##*/} failed"
 exit $ret

diff --git a/bin/ebuild-helpers/dodoc b/bin/ebuild-helpers/dodoc
index d6ce679..2b0533f 100755
--- a/bin/ebuild-helpers/dodoc
+++ b/bin/ebuild-helpers/dodoc
@@ -16,7 +16,7 @@ esac
 source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
 
 if [ $# -lt 1 ] ; then
-	helpers_die "${0##*/}: at least one argument needed"
+	__helpers_die "${0##*/}: at least one argument needed"
 	exit 1 	
 fi
 
@@ -41,5 +41,5 @@ for x in "$@" ; do
 	fi
 done
 
-[[ $ret -ne 0 ]] && helpers_die "${0##*/} failed"
+[[ $ret -ne 0 ]] && __helpers_die "${0##*/} failed"
 exit ${ret}

diff --git a/bin/ebuild-helpers/doenvd b/bin/ebuild-helpers/doenvd
index 28ab5d2..9287933 100755
--- a/bin/ebuild-helpers/doenvd
+++ b/bin/ebuild-helpers/doenvd
@@ -4,7 +4,7 @@
 
 if [[ $# -lt 1 ]] ; then
 	source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
-	helpers_die "${0##*/}: at least one argument needed"
+	__helpers_die "${0##*/}: at least one argument needed"
 	exit 1
 fi
 

diff --git a/bin/ebuild-helpers/doexe b/bin/ebuild-helpers/doexe
index fb228f9..efbf638 100755
--- a/bin/ebuild-helpers/doexe
+++ b/bin/ebuild-helpers/doexe
@@ -5,7 +5,7 @@
 source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
 
 if [[ $# -lt 1 ]] ; then
-	helpers_die "${0##*/}: at least one argument needed"
+	__helpers_die "${0##*/}: at least one argument needed"
 	exit 1
 fi
 
@@ -26,7 +26,7 @@ for x in "$@" ; do
 		cp "$x" "$TMP"
 		mysrc=$TMP/${x##*/}
 	elif [ -d "${x}" ] ; then
-		vecho "doexe: warning, skipping directory ${x}"
+		__vecho "doexe: warning, skipping directory ${x}"
 		continue
 	else
 		mysrc="${x}"
@@ -42,5 +42,5 @@ done
 
 rm -rf "$TMP"
 
-[[ $ret -ne 0 ]] && helpers_die "${0##*/} failed"
+[[ $ret -ne 0 ]] && __helpers_die "${0##*/} failed"
 exit $ret

diff --git a/bin/ebuild-helpers/doheader b/bin/ebuild-helpers/doheader
index c51ec1e..fa11564 100755
--- a/bin/ebuild-helpers/doheader
+++ b/bin/ebuild-helpers/doheader
@@ -11,7 +11,7 @@ case "${EAPI}" in
 esac
 
 if [[ $# -lt 1 ]] ; then
-	helpers_die "${0##*/}: at least one argument needed"
+	__helpers_die "${0##*/}: at least one argument needed"
 	exit 1
 fi
 

diff --git a/bin/ebuild-helpers/dohtml b/bin/ebuild-helpers/dohtml
index 630629a..aec5e79 100755
--- a/bin/ebuild-helpers/dohtml
+++ b/bin/ebuild-helpers/dohtml
@@ -10,5 +10,5 @@ PYTHONPATH=$PORTAGE_PYM_PATH${PYTHONPATH:+:}$PYTHONPATH \
 	"${PORTAGE_PYTHON:-/usr/bin/python}" "$PORTAGE_BIN_PATH/dohtml.py" "$@"
 
 ret=$?
-[[ $ret -ne 0 ]] && helpers_die "${0##*/} failed"
+[[ $ret -ne 0 ]] && __helpers_die "${0##*/} failed"
 exit $ret

diff --git a/bin/ebuild-helpers/doinfo b/bin/ebuild-helpers/doinfo
index 8fd7d45..e4ccc90 100755
--- a/bin/ebuild-helpers/doinfo
+++ b/bin/ebuild-helpers/doinfo
@@ -5,7 +5,7 @@
 source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
 
 if [[ -z $1 ]] ; then
-	helpers_die "${0##*/}: at least one argument needed"
+	__helpers_die "${0##*/}: at least one argument needed"
 	exit 1 	
 fi
 
@@ -13,7 +13,7 @@ fi
 	case "$EAPI" in 0|1|2) ED=${D} ;; esac
 
 if [[ ! -d ${ED}usr/share/info ]] ; then
-	install -d "${ED}usr/share/info" || { helpers_die "${0##*/}: failed to install ${ED}usr/share/info"; exit 1; }
+	install -d "${ED}usr/share/info" || { __helpers_die "${0##*/}: failed to install ${ED}usr/share/info"; exit 1; }
 fi
 
 install -m0644 "$@" "${ED}usr/share/info"
@@ -22,6 +22,6 @@ if [ $rval -ne 0 ] ; then
 	for x in "$@" ; do
 		[ -e "$x" ] || echo "!!! ${0##*/}: $x does not exist" 1>&2
 	done
-	helpers_die "${0##*/} failed"
+	__helpers_die "${0##*/} failed"
 fi
 exit $rval

diff --git a/bin/ebuild-helpers/doinitd b/bin/ebuild-helpers/doinitd
index b711e19..476b858 100755
--- a/bin/ebuild-helpers/doinitd
+++ b/bin/ebuild-helpers/doinitd
@@ -4,7 +4,7 @@
 
 if [[ $# -lt 1 ]] ; then
 	source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
-	helpers_die "${0##*/}: at least one argument needed"
+	__helpers_die "${0##*/}: at least one argument needed"
 	exit 1
 fi
 

diff --git a/bin/ebuild-helpers/doins b/bin/ebuild-helpers/doins
index 26b11a8..c534f3f 100755
--- a/bin/ebuild-helpers/doins
+++ b/bin/ebuild-helpers/doins
@@ -18,7 +18,7 @@ if [[ ${helper} == dodoc ]] ; then
 fi
 
 if [ $# -lt 1 ] ; then
-	helpers_die "${helper}: at least one argument needed"
+	__helpers_die "${helper}: at least one argument needed"
 	exit 1
 fi
 
@@ -33,11 +33,11 @@ fi
 	case "$EAPI" in 0|1|2) export ED="${D}" ;; esac
 
 if [[ ${INSDESTTREE#${ED}} != "${INSDESTTREE}" ]]; then
-	vecho "-------------------------------------------------------" 1>&2
-	vecho "You should not use \${D} or \${ED} with helpers." 1>&2
-	vecho "  --> ${INSDESTTREE}" 1>&2
-	vecho "-------------------------------------------------------" 1>&2
-	helpers_die "${helper} used with \${D} or \${ED}"
+	__vecho "-------------------------------------------------------" 1>&2
+	__vecho "You should not use \${D} or \${ED} with helpers." 1>&2
+	__vecho "  --> ${INSDESTTREE}" 1>&2
+	__vecho "-------------------------------------------------------" 1>&2
+	__helpers_die "${helper} used with \${D} or \${ED}"
 	exit 1
 fi
 
@@ -157,4 +157,4 @@ for x in "$@" ; do
 	fi
 done
 rm -rf "$TMP"
-[[ $failed -ne 0 || $success -eq 0 ]] && { helpers_die "${helper} failed"; exit 1; } || exit 0
+[[ $failed -ne 0 || $success -eq 0 ]] && { __helpers_die "${helper} failed"; exit 1; } || exit 0

diff --git a/bin/ebuild-helpers/dolib b/bin/ebuild-helpers/dolib
index 9af5418..402965d 100755
--- a/bin/ebuild-helpers/dolib
+++ b/bin/ebuild-helpers/dolib
@@ -19,11 +19,11 @@ libdir="${ED}${DESTTREE}/${CONF_LIBDIR}"
 
 
 if [[ $# -lt 1 ]] ; then
-	helpers_die "${0##*/}: at least one argument needed"
+	__helpers_die "${0##*/}: at least one argument needed"
 	exit 1
 fi
 if [[ ! -d ${libdir} ]] ; then
-	install -d "${libdir}" || { helpers_die "${0##*/}: failed to install ${libdir}"; exit 1; }
+	install -d "${libdir}" || { __helpers_die "${0##*/}: failed to install ${libdir}"; exit 1; }
 fi
 
 ret=0
@@ -42,5 +42,5 @@ for x in "$@" ; do
 	((ret|=$?))
 done
 
-[[ $ret -ne 0 ]] && helpers_die "${0##*/} failed"
+[[ $ret -ne 0 ]] && __helpers_die "${0##*/} failed"
 exit ${ret}

diff --git a/bin/ebuild-helpers/doman b/bin/ebuild-helpers/doman
index b4047ce..c10296b 100755
--- a/bin/ebuild-helpers/doman
+++ b/bin/ebuild-helpers/doman
@@ -5,7 +5,7 @@
 source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
 
 if [[ $# -lt 1 ]] ; then
-	helpers_die "${0##*/}: at least one argument needed"
+	__helpers_die "${0##*/}: at least one argument needed"
 	exit 1
 fi
 
@@ -58,10 +58,10 @@ for x in "$@" ; do
 			((ret|=1))
 		fi
 	else
-		vecho "doman: '${x}' is probably not a man page; skipping" 1>&2
+		__vecho "doman: '${x}' is probably not a man page; skipping" 1>&2
 		((ret|=1))
 	fi
 done
 
-[[ $ret -ne 0 ]] && helpers_die "${0##*/} failed"
+[[ $ret -ne 0 ]] && __helpers_die "${0##*/} failed"
 exit ${ret}

diff --git a/bin/ebuild-helpers/domo b/bin/ebuild-helpers/domo
index d994343..840b2de 100755
--- a/bin/ebuild-helpers/domo
+++ b/bin/ebuild-helpers/domo
@@ -6,7 +6,7 @@ source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
 
 mynum=${#}
 if [ ${mynum} -lt 1 ] ; then
-	helpers_die "${0}: at least one argument needed"
+	__helpers_die "${0}: at least one argument needed"
 	exit 1
 fi
 
@@ -34,5 +34,5 @@ for x in "$@" ; do
 	((ret|=$?))
 done
 
-[[ $ret -ne 0 ]] && helpers_die "${0##*/} failed"
+[[ $ret -ne 0 ]] && __helpers_die "${0##*/} failed"
 exit $ret

diff --git a/bin/ebuild-helpers/dosbin b/bin/ebuild-helpers/dosbin
index d101c8a..edc4584 100755
--- a/bin/ebuild-helpers/dosbin
+++ b/bin/ebuild-helpers/dosbin
@@ -5,7 +5,7 @@
 source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
 
 if [[ $# -lt 1 ]] ; then
-	helpers_die "${0##*/}: at least one argument needed"
+	__helpers_die "${0##*/}: at least one argument needed"
 	exit 1
 fi
 
@@ -13,7 +13,7 @@ fi
 	case "$EAPI" in 0|1|2) ED=${D} ;; esac
 
 if [[ ! -d ${ED}${DESTTREE}/sbin ]] ; then
-	install -d "${ED}${DESTTREE}/sbin" || { helpers_die "${0##*/}: failed to install ${ED}${DESTTREE}/sbin"; exit 2; }
+	install -d "${ED}${DESTTREE}/sbin" || { __helpers_die "${0##*/}: failed to install ${ED}${DESTTREE}/sbin"; exit 2; }
 fi
 
 ret=0
@@ -28,5 +28,5 @@ for x in "$@" ; do
 	((ret|=$?))
 done
 
-[[ $ret -ne 0 ]] && helpers_die "${0##*/} failed"
+[[ $ret -ne 0 ]] && __helpers_die "${0##*/} failed"
 exit ${ret}

diff --git a/bin/ebuild-helpers/dosym b/bin/ebuild-helpers/dosym
index 2489e22..34637c2 100755
--- a/bin/ebuild-helpers/dosym
+++ b/bin/ebuild-helpers/dosym
@@ -5,7 +5,7 @@
 source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
 
 if [[ $# -ne 2 ]] ; then
-	helpers_die "${0##*/}: two arguments needed"
+	__helpers_die "${0##*/}: two arguments needed"
 	exit 1
 fi
 
@@ -26,5 +26,5 @@ target="${1}"
 ln -snf "${target}" "${ED}${2}"
 
 ret=$?
-[[ $ret -ne 0 ]] && helpers_die "${0##*/} failed"
+[[ $ret -ne 0 ]] && __helpers_die "${0##*/} failed"
 exit $ret

diff --git a/bin/ebuild-helpers/ecompress b/bin/ebuild-helpers/ecompress
index b61421b..71287b4 100755
--- a/bin/ebuild-helpers/ecompress
+++ b/bin/ebuild-helpers/ecompress
@@ -5,7 +5,7 @@
 source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
 
 if [[ -z $1 ]] ; then
-	helpers_die "${0##*/}: at least one argument needed"
+	__helpers_die "${0##*/}: at least one argument needed"
 	exit 1
 fi
 
@@ -68,7 +68,7 @@ decompress_args() {
 
 case $1 in
 	--suffix)
-		[[ -n $2 ]] && vecho "${0##*/}: --suffix takes no additional arguments" 1>&2
+		[[ -n $2 ]] && __vecho "${0##*/}: --suffix takes no additional arguments" 1>&2
 
 		if [[ ! -e ${T}/.ecompress.suffix ]] ; then
 			set -e
@@ -93,7 +93,7 @@ case $1 in
 		cat "${T}/.ecompress.suffix"
 		;;
 	--bin)
-		[[ -n $2 ]] && vecho "${0##*/}: --bin takes no additional arguments" 1>&2
+		[[ -n $2 ]] && __vecho "${0##*/}: --bin takes no additional arguments" 1>&2
 
 		echo "${PORTAGE_COMPRESS} ${PORTAGE_COMPRESS_FLAGS}"
 		;;
@@ -104,18 +104,18 @@ case $1 in
 			>> "$x"
 			((ret|=$?))
 		done
-		[[ $ret -ne 0 ]] && helpers_die "${0##*/} failed"
+		[[ $ret -ne 0 ]] && __helpers_die "${0##*/} failed"
 		exit $ret
 		;;
 	--dequeue)
-		[[ -n $2 ]] && vecho "${0##*/}: --dequeue takes no additional arguments" 1>&2
+		[[ -n $2 ]] && __vecho "${0##*/}: --dequeue takes no additional arguments" 1>&2
 		find "${D}" -name '*.ecompress.file' -print0 \
 			| sed -e 's:\.ecompress\.file::g' \
 			| ${XARGS} -0 ecompress
 		find "${D}" -name '*.ecompress.file' -print0 | ${XARGS} -0 rm -f
 		;;
 	--*)
-		helpers_die "${0##*/}: unknown arguments '$*'"
+		__helpers_die "${0##*/}: unknown arguments '$*'"
 		exit 1
 		;;
 	*)
@@ -155,7 +155,7 @@ case $1 in
 		# Finally, let's actually do some real work
 		"${PORTAGE_COMPRESS}" ${PORTAGE_COMPRESS_FLAGS} "$@"
 		ret=$?
-		[[ $ret -ne 0 ]] && helpers_die "${0##*/} failed"
+		[[ $ret -ne 0 ]] && __helpers_die "${0##*/} failed"
 		exit $ret
 		;;
 esac

diff --git a/bin/ebuild-helpers/ecompressdir b/bin/ebuild-helpers/ecompressdir
index 5ca0d3a..097ade2 100755
--- a/bin/ebuild-helpers/ecompressdir
+++ b/bin/ebuild-helpers/ecompressdir
@@ -5,7 +5,7 @@
 source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/helper-functions.sh
 
 if [[ -z $1 ]] ; then
-	helpers_die "${0##*/}: at least one argument needed"
+	__helpers_die "${0##*/}: at least one argument needed"
 	exit 1
 fi
 
@@ -30,11 +30,11 @@ case $1 in
 			>> "$x"
 			((ret|=$?))
 		done
-		[[ $ret -ne 0 ]] && helpers_die "${0##*/} failed"
+		[[ $ret -ne 0 ]] && __helpers_die "${0##*/} failed"
 		exit $ret
 		;;
 	--dequeue)
-		[[ -n $2 ]] && vecho "${0##*/}: --dequeue takes no additional arguments" 1>&2
+		[[ -n $2 ]] && __vecho "${0##*/}: --dequeue takes no additional arguments" 1>&2
 		find "${ED}" -name '*.ecompress.dir' -print0 \
 			| sed -e 's:\.ecompress\.dir::g' -e "s:${ED}:/:g" \
 			| ${XARGS} -0 ecompressdir
@@ -42,7 +42,7 @@ case $1 in
 		exit 0
 		;;
 	--*)
-		helpers_die "${0##*/}: unknown arguments '$*'"
+		__helpers_die "${0##*/}: unknown arguments '$*'"
 		exit 1
 		;;
 esac
@@ -139,7 +139,7 @@ for dir in "$@" ; do
 	dir=${dir#/}
 	dir="${ED}${dir}"
 	if [[ ! -d ${dir} ]] ; then
-		vecho "${0##*/}: /${dir#${ED}} does not exist!"
+		__vecho "${0##*/}: /${dir#${ED}} does not exist!"
 		continue
 	fi
 	cd "${dir}"
@@ -177,7 +177,7 @@ for dir in "$@" ; do
 
 	# now lets do our work
 	if [[ -n ${suffix} ]] ; then
-		vecho "${0##*/}: $(ecompress --bin) /${actual_dir#${ED}}"
+		__vecho "${0##*/}: $(ecompress --bin) /${actual_dir#${ED}}"
 		funk_up_dir "compress" "${suffix}" "ecompress"
 		: $(( ret |= $? ))
 	fi
@@ -186,5 +186,5 @@ for dir in "$@" ; do
 	restore_skip_dirs
 done
 
-[[ $ret -ne 0 ]] && helpers_die "${0##*/} failed"
+[[ $ret -ne 0 ]] && __helpers_die "${0##*/} failed"
 exit ${ret}

diff --git a/bin/ebuild-helpers/emake b/bin/ebuild-helpers/emake
index d842781..69d836f 100755
--- a/bin/ebuild-helpers/emake
+++ b/bin/ebuild-helpers/emake
@@ -24,5 +24,5 @@ fi
 
 ${MAKE:-make} ${MAKEOPTS} ${EXTRA_EMAKE} "$@"
 ret=$?
-[[ $ret -ne 0 ]] && helpers_die "${0##*/} failed"
+[[ $ret -ne 0 ]] && __helpers_die "${0##*/} failed"
 exit $ret

diff --git a/bin/ebuild-helpers/fowners b/bin/ebuild-helpers/fowners
index a213c9e..5b93fd3 100755
--- a/bin/ebuild-helpers/fowners
+++ b/bin/ebuild-helpers/fowners
@@ -18,5 +18,5 @@ if [[ ${ret} != 0 && -n ${EPREFIX} && ${EUID} != 0 ]] ; then
 	exit 0
 fi
 
-[[ $ret -ne 0 ]] && helpers_die "${0##*/} failed"
+[[ $ret -ne 0 ]] && __helpers_die "${0##*/} failed"
 exit $ret

diff --git a/bin/ebuild-helpers/fperms b/bin/ebuild-helpers/fperms
index a2f77ea..668e905 100755
--- a/bin/ebuild-helpers/fperms
+++ b/bin/ebuild-helpers/fperms
@@ -12,5 +12,5 @@ source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
 slash="/"
 chmod "${@/#${slash}/${ED}${slash}}"
 ret=$?
-[[ $ret -ne 0 ]] && helpers_die "${0##*/} failed"
+[[ $ret -ne 0 ]] && __helpers_die "${0##*/} failed"
 exit $ret

diff --git a/bin/ebuild-helpers/newins b/bin/ebuild-helpers/newins
index 54245f3..20c68a1 100755
--- a/bin/ebuild-helpers/newins
+++ b/bin/ebuild-helpers/newins
@@ -7,7 +7,7 @@ source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
 helper=${0##*/}
 
 if [[ -z ${T} ]] || [[ -z ${2} ]] ; then
-	helpers_die "${helper}: Need two arguments, old file and new file"
+	__helpers_die "${helper}: Need two arguments, old file and new file"
 	exit 1
 fi
 
@@ -24,14 +24,14 @@ rm -rf "${T}/$2"
 
 if [[ ${stdin} ]] ; then
 	if [[ -t 0 ]] ; then
-		helpers_die "!!! ${helper}: Input is from a terminal"
+		__helpers_die "!!! ${helper}: Input is from a terminal"
 		exit 1
 	fi
 	cat > "${T}/$2"
 	ret=$?
 else
 	if [[ ! -e $1 ]] ; then
-		helpers_die "!!! ${helper}: $1 does not exist"
+		__helpers_die "!!! ${helper}: $1 does not exist"
 		exit 1
 	fi
 
@@ -51,12 +51,12 @@ else
 fi
 
 if [[ ${ret} -ne 0 ]] ; then
-	helpers_die "${0##*/} failed"
+	__helpers_die "${0##*/} failed"
 	exit ${ret}
 fi
 
 do${helper#new} "${T}/$2"
 ret=$?
 rm -rf "${T}/${2}"
-[[ $ret -ne 0 ]] && helpers_die "${helper} failed"
+[[ $ret -ne 0 ]] && __helpers_die "${helper} failed"
 exit $ret

diff --git a/bin/ebuild-helpers/prepalldocs b/bin/ebuild-helpers/prepalldocs
index c9226d6..50b0c70 100755
--- a/bin/ebuild-helpers/prepalldocs
+++ b/bin/ebuild-helpers/prepalldocs
@@ -14,7 +14,7 @@ case "${EAPI}" in
 esac
 
 if [[ -n $1 ]] ; then
-	vecho "${0##*/}: invalid usage; takes no arguments" 1>&2
+	__vecho "${0##*/}: invalid usage; takes no arguments" 1>&2
 fi
 
 [[ " ${FEATURES} " == *" force-prefix "* ]] || \

diff --git a/bin/ebuild-helpers/prepinfo b/bin/ebuild-helpers/prepinfo
index ffe2ece..e213f32 100755
--- a/bin/ebuild-helpers/prepinfo
+++ b/bin/ebuild-helpers/prepinfo
@@ -19,7 +19,7 @@ fi
 
 if [[ ! -d ${ED}${infodir} ]] ; then
 	if [[ -n $1 ]] ; then
-		vecho "${0##*/}: '${infodir}' does not exist!"
+		__vecho "${0##*/}: '${infodir}' does not exist!"
 		exit 1
 	else
 		exit 0

diff --git a/bin/ebuild-helpers/prepstrip b/bin/ebuild-helpers/prepstrip
index 2556ee2..802fdd8 100755
--- a/bin/ebuild-helpers/prepstrip
+++ b/bin/ebuild-helpers/prepstrip
@@ -159,7 +159,7 @@ save_elf_debug() {
 process_elf() {
 	local x=$1 strip_flags=${*:2}
 
-	vecho "   ${x:${#ED}}"
+	__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.
@@ -221,7 +221,7 @@ if ! ${RESTRICT_binchecks} && ! ${RESTRICT_strip} ; then
 	fi
 	sed -e "/^\$/d" -e "s#^#/#" -i "${log}"
 	if [[ -s ${log} ]] ; then
-		vecho -e "\n"
+		__vecho -e "\n"
 		eqawarn "QA Notice: Pre-stripped files found:"
 		eqawarn "$(<"${log}")"
 	else
@@ -237,7 +237,7 @@ for x in \
 	$(find "$@" -type f -name '*.a')
 do
 	if ! ${banner} ; then
-		vecho "strip: ${STRIP} ${PORTAGE_STRIP_FLAGS}"
+		__vecho "strip: ${STRIP} ${PORTAGE_STRIP_FLAGS}"
 		banner=true
 	fi
 
@@ -277,7 +277,7 @@ do
 
 	buildid=
 	if [[ ${f} == *"current ar archive"* ]] ; then
-		vecho "   ${x:${#ED}}"
+		__vecho "   ${x:${#ED}}"
 		if ${strip_this} ; then
 			# hmm, can we split debug/sources for .a ?
 			${STRIP} -g "${x}"
@@ -305,7 +305,7 @@ if [[ -s ${tmpdir}/debug.sources ]] && \
    ! ${RESTRICT_installsources} && \
    ${debugedit_found}
 then
-	vecho "installsources: rsyncing source files"
+	__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 | \

diff --git a/bin/emerge-webrsync b/bin/emerge-webrsync
index a962ab5..09b7574 100755
--- a/bin/emerge-webrsync
+++ b/bin/emerge-webrsync
@@ -132,7 +132,7 @@ fetch_file() {
 		rm -f "${FILE}"
 	fi
 
-	vecho "Fetching file ${FILE} ..."
+	__vecho "Fetching file ${FILE} ..."
 	# already set DISTDIR=
 	eval "${FETCHCOMMAND}" ${opts}
 	[ -s "${DISTDIR}/${FILE}" ]
@@ -143,7 +143,7 @@ check_file_digest() {
 	local file="$2"
 	local r=1
 
-	vecho "Checking digest ..."
+	__vecho "Checking digest ..."
 
 	if type -P md5sum > /dev/null; then
 		local md5sum_output=$(md5sum "${file}")
@@ -165,7 +165,7 @@ check_file_signature() {
 
 	if [ ${WEBSYNC_VERIFY_SIGNATURE} != 0 ]; then
 
-		vecho "Checking signature ..."
+		__vecho "Checking signature ..."
 
 		if type -P gpg > /dev/null; then
 			gpg --homedir "${PORTAGE_GPG_DIR}" --verify "$signature" "$file" && r=0
@@ -189,7 +189,7 @@ get_snapshot_timestamp() {
 sync_local() {
 	local file="$1"
 
-	vecho "Syncing local tree ..."
+	__vecho "Syncing local tree ..."
 
 	local ownership="portage:portage"
 	if has usersync ${FEATURES} ; then
@@ -227,12 +227,12 @@ sync_local() {
 		rsync ${PORTAGE_RSYNC_OPTS} ${PORTAGE_RSYNC_EXTRA_OPTS} . "${PORTDIR%%/}"
 		cd ..
 
-		vecho "Cleaning up ..."
+		__vecho "Cleaning up ..."
 		rm -fr portage
 	fi
 
 	if has metadata-transfer ${FEATURES} ; then
-		vecho "Updating cache ..."
+		__vecho "Updating cache ..."
 		"${PORTAGE_BIN_PATH}/emerge" --metadata
 	fi
 	local post_sync=${PORTAGE_CONFIGROOT}etc/portage/bin/post_sync
@@ -269,7 +269,7 @@ do_snapshot() {
 	for mirror in ${GENTOO_MIRRORS} ; do
 
 		mirror=${mirror%/}
-		vecho "Trying to retrieve ${date} snapshot from ${mirror} ..."
+		__vecho "Trying to retrieve ${date} snapshot from ${mirror} ..."
 
 		for compression in ${compressions} ; do
 			local file="portage-${date}.tar.${compression}"
@@ -298,7 +298,7 @@ do_snapshot() {
 			#
 			if [ ${have_files} -eq 1 ]; then
 
-				vecho "Getting snapshot timestamp ..."
+				__vecho "Getting snapshot timestamp ..."
 				local snapshot_timestamp=$(get_snapshot_timestamp "${DISTDIR}/${file}")
 
 				if [ ${ignore_timestamp} == 0 ]; then
@@ -338,7 +338,7 @@ do_snapshot() {
 	if [ ${have_files} -eq 1 ]; then
 		sync_local "${DISTDIR}/${file}" && r=0
 	else
-		vecho "${date} snapshot was not found"
+		__vecho "${date} snapshot was not found"
 	fi
 
 	${keep} || rm -f "${DISTDIR}/${file}" "${DISTDIR}/${digest}" "${DISTDIR}/${signature}"
@@ -349,7 +349,7 @@ do_latest_snapshot() {
 	local attempts=0
 	local r=1
 
-	vecho "Fetching most recent snapshot ..."
+	__vecho "Fetching most recent snapshot ..."
 
 	# The snapshot for a given day is generated at 00:45 UTC on the following
 	# day, so the current day's snapshot (going by UTC time) hasn't been

diff --git a/bin/isolated-functions.sh b/bin/isolated-functions.sh
index 154506e..076e31f 100644
--- a/bin/isolated-functions.sh
+++ b/bin/isolated-functions.sh
@@ -15,7 +15,7 @@ assert() {
 	done
 }
 
-assert_sigpipe_ok() {
+__assert_sigpipe_ok() {
 	# When extracting a tar file like this:
 	#
 	#     bzip2 -dc foo.tar.bz2 | tar xof -
@@ -43,10 +43,10 @@ assert_sigpipe_ok() {
 
 shopt -s extdebug
 
-# dump_trace([number of funcs on stack to skip],
+# __dump_trace([number of funcs on stack to skip],
 #            [whitespacing for filenames],
 #            [whitespacing for line numbers])
-dump_trace() {
+__dump_trace() {
 	local funcname="" sourcefile="" lineno="" s="yes" n p
 	declare -i strip=${1:-1}
 	local filespacing=$2 linespacing=$3
@@ -96,7 +96,7 @@ nonfatal() {
 	PORTAGE_NONFATAL=1 "$@"
 }
 
-helpers_die() {
+__helpers_die() {
 	case "${EAPI:-0}" in
 		0|1|2|3)
 			echo -e "$@" >&2
@@ -143,11 +143,11 @@ die() {
 	eerror "ERROR: $CATEGORY/$PF failed${phase_str}:"
 	eerror "  ${*:-(no error message)}"
 	eerror
-	# dump_trace is useless when the main script is a helper binary
+	# __dump_trace is useless when the main script is a helper binary
 	local main_index
 	(( main_index = ${#BASH_SOURCE[@]} - 1 ))
 	if has ${BASH_SOURCE[$main_index]##*/} ebuild.sh misc-functions.sh ; then
-	dump_trace 2 ${filespacing} ${linespacing}
+	__dump_trace 2 ${filespacing} ${linespacing}
 	eerror "  $(printf "%${filespacing}s" "${BASH_SOURCE[1]##*/}"), line $(printf "%${linespacing}s" "${BASH_LINENO[0]}"):  Called die"
 	eerror "The specific snippet of code:"
 	# This scans the file that called die and prints out the logic that
@@ -205,7 +205,7 @@ die() {
 
 	# Only call die hooks here if we are executed via ebuild.sh or
 	# misc-functions.sh, since those are the only cases where the environment
-	# contains the hook functions. When necessary (like for helpers_die), die
+	# contains the hook functions. When necessary (like for __helpers_die), die
 	# hooks are automatically called later by a misc-functions.sh invocation.
 	if has ${BASH_SOURCE[$main_index]##*/} ebuild.sh misc-functions.sh && \
 		[[ ${EBUILD_PHASE} != depend ]] ; then
@@ -245,16 +245,16 @@ die() {
 	exit 1
 }
 
-quiet_mode() {
+__quiet_mode() {
 	[[ ${PORTAGE_QUIET} -eq 1 ]]
 }
 
-vecho() {
-	quiet_mode || echo "$@"
+__vecho() {
+	__quiet_mode || echo "$@"
 }
 
 # Internal logging function, don't use this in ebuilds
-elog_base() {
+__elog_base() {
 	local messagetype
 	[ -z "${1}" -o -z "${T}" -o ! -d "${T}/logging" ] && return 1
 	case "${1}" in
@@ -263,7 +263,7 @@ elog_base() {
 			shift
 			;;
 		*)
-			vecho -e " ${BAD}*${NORMAL} Invalid use of internal function elog_base(), next message will not be logged"
+			__vecho -e " ${BAD}*${NORMAL} Invalid use of internal function __elog_base(), next message will not be logged"
 			return 1
 			;;
 	esac
@@ -275,17 +275,17 @@ elog_base() {
 }
 
 eqawarn() {
-	elog_base QA "$*"
+	__elog_base QA "$*"
 	[[ ${RC_ENDCOL} != "yes" && ${LAST_E_CMD} == "ebegin" ]] && echo
 	echo -e "$@" | while read -r ; do
-		vecho " $WARN*$NORMAL $REPLY" >&2
+		__vecho " $WARN*$NORMAL $REPLY" >&2
 	done
 	LAST_E_CMD="eqawarn"
 	return 0
 }
 
 elog() {
-	elog_base LOG "$*"
+	__elog_base LOG "$*"
 	[[ ${RC_ENDCOL} != "yes" && ${LAST_E_CMD} == "ebegin" ]] && echo
 	echo -e "$@" | while read -r ; do
 		echo " $GOOD*$NORMAL $REPLY"
@@ -295,7 +295,7 @@ elog() {
 }
 
 einfo() {
-	elog_base INFO "$*"
+	__elog_base INFO "$*"
 	[[ ${RC_ENDCOL} != "yes" && ${LAST_E_CMD} == "ebegin" ]] && echo
 	echo -e "$@" | while read -r ; do
 		echo " $GOOD*$NORMAL $REPLY"
@@ -305,7 +305,7 @@ einfo() {
 }
 
 einfon() {
-	elog_base INFO "$*"
+	__elog_base INFO "$*"
 	[[ ${RC_ENDCOL} != "yes" && ${LAST_E_CMD} == "ebegin" ]] && echo
 	echo -ne " ${GOOD}*${NORMAL} $*"
 	LAST_E_CMD="einfon"
@@ -313,7 +313,7 @@ einfon() {
 }
 
 ewarn() {
-	elog_base WARN "$*"
+	__elog_base WARN "$*"
 	[[ ${RC_ENDCOL} != "yes" && ${LAST_E_CMD} == "ebegin" ]] && echo
 	echo -e "$@" | while read -r ; do
 		echo " $WARN*$NORMAL $RC_INDENTATION$REPLY" >&2
@@ -323,7 +323,7 @@ ewarn() {
 }
 
 eerror() {
-	elog_base ERROR "$*"
+	__elog_base ERROR "$*"
 	[[ ${RC_ENDCOL} != "yes" && ${LAST_E_CMD} == "ebegin" ]] && echo
 	echo -e "$@" | while read -r ; do
 		echo " $BAD*$NORMAL $RC_INDENTATION$REPLY" >&2
@@ -348,7 +348,7 @@ ebegin() {
 	return 0
 }
 
-_eend() {
+__eend() {
 	local retval=${1:-0} efunc=${2:-eerror} msg
 	shift 2
 
@@ -375,13 +375,13 @@ eend() {
 	local retval=${1:-0}
 	shift
 
-	_eend ${retval} eerror "$*"
+	__eend ${retval} eerror "$*"
 
 	LAST_E_CMD="eend"
 	return ${retval}
 }
 
-unset_colors() {
+__unset_colors() {
 	COLS=80
 	ENDCOL=
 
@@ -393,7 +393,7 @@ unset_colors() {
 	BRACKET=
 }
 
-set_colors() {
+__set_colors() {
 	COLS=${COLUMNS:-0}      # bash's internal COLUMNS variable
 	# Avoid wasteful stty calls during the "depend" phases.
 	# If stdout is a pipe, the parent process can export COLUMNS
@@ -426,10 +426,10 @@ RC_DOT_PATTERN=''
 
 case "${NOCOLOR:-false}" in
 	yes|true)
-		unset_colors
+		__unset_colors
 		;;
 	no|false)
-		set_colors
+		__set_colors
 		;;
 esac
 

diff --git a/bin/misc-functions.sh b/bin/misc-functions.sh
index 9eec8bb..5bc946f 100755
--- a/bin/misc-functions.sh
+++ b/bin/misc-functions.sh
@@ -226,11 +226,11 @@ install_qa_check() {
 				-i "${T}"/scanelf-ignored-CFLAGS.log
 			f=$(<"${T}"/scanelf-ignored-CFLAGS.log)
 			if [[ -n ${f} ]] ; then
-				vecho -ne '\n'
+				__vecho -ne '\n'
 				eqawarn "${BAD}QA Notice: Files built without respecting CFLAGS have been detected${NORMAL}"
 				eqawarn " Please include the following list of files in your report:"
 				eqawarn "${f}"
-				vecho -ne '\n'
+				__vecho -ne '\n'
 				sleep 1
 			else
 				rm -f "${T}"/scanelf-ignored-CFLAGS.log
@@ -273,10 +273,10 @@ install_qa_check() {
 	# Now we look for all world writable files.
 	local unsafe_files=$(find "${ED}" -type f -perm -2 | sed -e "s:^${ED}:- :")
 	if [[ -n ${unsafe_files} ]] ; then
-		vecho "QA Security Notice: world writable file(s):"
-		vecho "${unsafe_files}"
-		vecho "- This may or may not be a security problem, most of the time it is one."
-		vecho "- Please double check that $PF really needs a world writeable bit and file bugs accordingly."
+		__vecho "QA Security Notice: world writable file(s):"
+		__vecho "${unsafe_files}"
+		__vecho "- This may or may not be a security problem, most of the time it is one."
+		__vecho "- Please double check that $PF really needs a world writeable bit and file bugs accordingly."
 		sleep 1
 	fi
 
@@ -307,7 +307,7 @@ install_qa_check() {
 			for l in $(echo "${rpath_files}" | grep -E ":${dir}|::|: "); do
 				f+="  ${l%%:*}\n"
 				if ! has stricter ${FEATURES}; then
-					vecho "Auto fixing rpaths for ${l%%:*}"
+					__vecho "Auto fixing rpaths for ${l%%:*}"
 					TMPDIR="${dir}" scanelf -BXr "${l%%:*}" -o /dev/null
 				fi
 			done
@@ -321,12 +321,12 @@ install_qa_check() {
 
 		# Print QA notice.
 		if [[ -n ${f}${x} ]] ; then
-			vecho -ne '\n'
+			__vecho -ne '\n'
 			eqawarn "QA Notice: The following files contain insecure RUNPATHs"
 			eqawarn " Please file a bug about this at http://bugs.gentoo.org/"
 			eqawarn " with the maintaining herd of the package."
 			eqawarn "${f}${f:+${x:+\n}}${x}"
-			vecho -ne '\n'
+			__vecho -ne '\n'
 			if [[ -n ${x} ]] || has stricter ${FEATURES} ; then
 				insecure_rpath=1
 			fi
@@ -344,7 +344,7 @@ install_qa_check() {
 		f=$(scanelf -qyRF '%t %p' "${ED}" | grep -v 'usr/lib/debug/')
 		if [[ -n ${f} ]] ; then
 			scanelf -qyRAF '%T %p' "${PORTAGE_BUILDDIR}"/ &> "${T}"/scanelf-textrel.log
-			vecho -ne '\n'
+			__vecho -ne '\n'
 			eqawarn "QA Notice: The following files contain runtime text relocations"
 			eqawarn " Text relocations force the dynamic linker to perform extra"
 			eqawarn " work at startup, waste system resources, and may pose a security"
@@ -353,7 +353,7 @@ install_qa_check() {
 			eqawarn " For more information, see http://hardened.gentoo.org/pic-fix-guide.xml"
 			eqawarn " Please include the following list of files in your report:"
 			eqawarn "${f}"
-			vecho -ne '\n'
+			__vecho -ne '\n'
 			die_msg="${die_msg} textrels,"
 			sleep 1
 		fi
@@ -389,7 +389,7 @@ install_qa_check() {
 		if [[ -n ${f} ]] ; then
 			# One more pass to help devs track down the source
 			scanelf -qyRAF '%e %p' "${PORTAGE_BUILDDIR}"/ &> "${T}"/scanelf-execstack.log
-			vecho -ne '\n'
+			__vecho -ne '\n'
 			eqawarn "QA Notice: The following files contain writable and executable sections"
 			eqawarn " Files with such sections will not work properly (or at all!) on some"
 			eqawarn " architectures/operating systems.  A bug should be filed at"
@@ -399,7 +399,7 @@ install_qa_check() {
 			eqawarn " Note: Bugs should be filed for the respective maintainers"
 			eqawarn " of the package in question and not hardened@g.o."
 			eqawarn "${f}"
-			vecho -ne '\n'
+			__vecho -ne '\n'
 			die_msg="${die_msg} execstacks"
 			sleep 1
 		fi
@@ -421,11 +421,11 @@ install_qa_check() {
 					-i "${T}"/scanelf-ignored-LDFLAGS.log
 				f=$(<"${T}"/scanelf-ignored-LDFLAGS.log)
 				if [[ -n ${f} ]] ; then
-					vecho -ne '\n'
+					__vecho -ne '\n'
 					eqawarn "${BAD}QA Notice: Files built without respecting LDFLAGS have been detected${NORMAL}"
 					eqawarn " Please include the following list of files in your report:"
 					eqawarn "${f}"
-					vecho -ne '\n'
+					__vecho -ne '\n'
 					sleep 1
 				else
 					rm -f "${T}"/scanelf-ignored-LDFLAGS.log
@@ -463,10 +463,10 @@ install_qa_check() {
 			sed -e "/^\$/d" -i "${T}"/scanelf-missing-SONAME.log
 			f=$(<"${T}"/scanelf-missing-SONAME.log)
 			if [[ -n ${f} ]] ; then
-				vecho -ne '\n'
+				__vecho -ne '\n'
 				eqawarn "QA Notice: The following shared libraries lack a SONAME"
 				eqawarn "${f}"
-				vecho -ne '\n'
+				__vecho -ne '\n'
 				sleep 1
 			else
 				rm -f "${T}"/scanelf-missing-SONAME.log
@@ -497,10 +497,10 @@ install_qa_check() {
 			sed -e "/^\$/d" -i "${T}"/scanelf-missing-NEEDED.log
 			f=$(<"${T}"/scanelf-missing-NEEDED.log)
 			if [[ -n ${f} ]] ; then
-				vecho -ne '\n'
+				__vecho -ne '\n'
 				eqawarn "QA Notice: The following shared libraries lack NEEDED entries"
 				eqawarn "${f}"
-				vecho -ne '\n'
+				__vecho -ne '\n'
 				sleep 1
 			else
 				rm -f "${T}"/scanelf-missing-NEEDED.log
@@ -587,7 +587,7 @@ install_qa_check() {
 			[[ ! -e ${j} ]] && continue
 			[[ -L ${j} ]] && continue
 			[[ -x ${j} ]] && continue
-			vecho "making executable: ${j#${ED}}"
+			__vecho "making executable: ${j#${ED}}"
 			chmod +x "${j}"
 		done
 
@@ -595,7 +595,7 @@ install_qa_check() {
 			[[ ! -e ${j} ]] && continue
 			[[ -L ${j} ]] && continue
 			[[ ! -x ${j} ]] && continue
-			vecho "removing executable bit: ${j#${ED}}"
+			__vecho "removing executable bit: ${j#${ED}}"
 			chmod -x "${j}"
 		done
 
@@ -604,7 +604,7 @@ install_qa_check() {
 			[[ ! -L ${j} ]] && continue
 			linkdest=$(readlink "${j}")
 			if [[ ${linkdest} == /* ]] ; then
-				vecho -ne '\n'
+				__vecho -ne '\n'
 				eqawarn "QA Notice: Found an absolute symlink in a library directory:"
 				eqawarn "           ${j#${D}} -> ${linkdest}"
 				eqawarn "           It should be a relative symlink if in the same directory"
@@ -624,7 +624,7 @@ install_qa_check() {
 		if [[ ! -e ${s} ]] ; then
 			s=${s%usr/*}${s##*/usr/}
 			if [[ -e ${s} ]] ; then
-				vecho -ne '\n'
+				__vecho -ne '\n'
 				eqawarn "QA Notice: Missing gen_usr_ldscript for ${s##*/}"
 	 			abort="yes"
 			fi
@@ -635,10 +635,10 @@ install_qa_check() {
 	# Make sure people don't store libtool files or static libs in /lib
 	f=$(ls "${ED}"lib*/*.{a,la} 2>/dev/null)
 	if [[ -n ${f} ]] ; then
-		vecho -ne '\n'
+		__vecho -ne '\n'
 		eqawarn "QA Notice: Excessive files found in the / partition"
 		eqawarn "${f}"
-		vecho -ne '\n'
+		__vecho -ne '\n'
 		die "static archives (*.a) and libtool library files (*.la) do not belong in /"
 	fi
 
@@ -647,7 +647,7 @@ install_qa_check() {
 	for a in "${ED}"usr/lib*/*.la ; do
 		s=${a##*/}
 		if grep -qs "${ED}" "${a}" ; then
-			vecho -ne '\n'
+			__vecho -ne '\n'
 			eqawarn "QA Notice: ${s} appears to contain PORTAGE_TMPDIR paths"
 			abort="yes"
 		fi
@@ -726,11 +726,11 @@ install_qa_check() {
 					eerror " with the maintaining herd of the package."
 					eerror
 				else
-					vecho -ne '\n'
+					__vecho -ne '\n'
 					eqawarn "QA Notice: Package triggers severe warnings which indicate that it"
 					eqawarn "           may exhibit random runtime failures."
 					eqawarn "${f}"
-					vecho -ne '\n'
+					__vecho -ne '\n'
 				fi
 			fi
 		done
@@ -763,11 +763,11 @@ install_qa_check() {
 				eerror " with the maintaining herd of the package."
 				eerror
 			else
-				vecho -ne '\n'
+				__vecho -ne '\n'
 				eqawarn "QA Notice: Package triggers severe warnings which indicate that it"
 				eqawarn "           will almost certainly crash on 64bit architectures."
 				eqawarn "${f}"
-				vecho -ne '\n'
+				__vecho -ne '\n'
 			fi
 
 		fi
@@ -952,7 +952,7 @@ install_mask() {
 	local no_inst
 	for no_inst in ${install_mask}; do
 		set +o noglob
-		quiet_mode || einfo "Removing ${no_inst}"
+		__quiet_mode || einfo "Removing ${no_inst}"
 		# normal stuff
 		rm -Rf "${root}"/${no_inst} >&/dev/null
 
@@ -1050,19 +1050,19 @@ preinst_suid_scan() {
 		# to files outside of the sandbox, but this
 		# can easly be bypassed using the addwrite() function
 		addwrite "${sfconf}"
-		vecho ">>> Performing suid scan in ${ED}"
+		__vecho ">>> Performing suid scan in ${ED}"
 		for i in $(find "${ED}" -type f \( -perm -4000 -o -perm -2000 \) ); do
 			if [ -s "${sfconf}" ]; then
 				install_path=/${i#${ED}}
 				if grep -q "^${install_path}\$" "${sfconf}" ; then
-					vecho "- ${install_path} is an approved suid file"
+					__vecho "- ${install_path} is an approved suid file"
 				else
-					vecho ">>> Removing sbit on non registered ${install_path}"
+					__vecho ">>> Removing sbit on non registered ${install_path}"
 					for x in 5 4 3 2 1 0; do sleep 0.25 ; done
 					ls_ret=$(ls -ldh "${i}")
 					chmod ugo-s "${i}"
 					grep "^#${install_path}$" "${sfconf}" > /dev/null || {
-						vecho ">>> Appending commented out entry to ${sfconf} for ${PF}"
+						__vecho ">>> Appending commented out entry to ${sfconf} for ${PF}"
 						echo "## ${ls_ret%${ED}*}${install_path}" >> "${sfconf}"
 						echo "#${install_path}" >> "${sfconf}"
 						# no delwrite() eh?
@@ -1070,7 +1070,7 @@ preinst_suid_scan() {
 					}
 				fi
 			else
-				vecho "suidctl feature set but you are lacking a ${sfconf}"
+				__vecho "suidctl feature set but you are lacking a ${sfconf}"
 			fi
 		done
 	fi
@@ -1087,7 +1087,7 @@ preinst_selinux_labels() {
 		# and 'context' is available on selinuxfs.
 		if [ -f /selinux/context -o -f /sys/fs/selinux/context ] && \
 			[ -x /usr/sbin/setfiles -a -x /usr/sbin/selinuxconfig ]; then
-			vecho ">>> Setting SELinux security labels"
+			__vecho ">>> Setting SELinux security labels"
 			(
 				eval "$(/usr/sbin/selinuxconfig)" || \
 					die "Failed to determine SELinux policy paths.";
@@ -1100,7 +1100,7 @@ preinst_selinux_labels() {
 		else
 			# nonfatal, since merging can happen outside a SE kernel
 			# like during a recovery situation
-			vecho "!!! Unable to set SELinux security labels"
+			__vecho "!!! Unable to set SELinux security labels"
 		fi
 	fi
 }
@@ -1158,7 +1158,7 @@ dyn_package() {
 	fi
 	[ -n "${md5_hash}" ] && \
 		echo ${md5_hash} > "${PORTAGE_BUILDDIR}"/build-info/BINPKGMD5
-	vecho ">>> Done."
+	__vecho ">>> Done."
 
 	# cleanup our temp tree
 	[[ -n ${PKG_INSTALL_MASK} ]] && rm -rf "${PROOT}"

diff --git a/bin/phase-functions.sh b/bin/phase-functions.sh
index e50b340..34e9da1 100644
--- a/bin/phase-functions.sh
+++ b/bin/phase-functions.sh
@@ -210,8 +210,8 @@ ebuild_phase_with_hooks() {
 
 dyn_pretend() {
 	if [[ -e $PORTAGE_BUILDDIR/.pretended ]] ; then
-		vecho ">>> It appears that '$PF' is already pretended; skipping."
-		vecho ">>> Remove '$PORTAGE_BUILDDIR/.pretended' to force pretend."
+		__vecho ">>> It appears that '$PF' is already pretended; skipping."
+		__vecho ">>> Remove '$PORTAGE_BUILDDIR/.pretended' to force pretend."
 		return 0
 	fi
 	ebuild_phase pre_pkg_pretend
@@ -223,8 +223,8 @@ dyn_pretend() {
 
 dyn_setup() {
 	if [[ -e $PORTAGE_BUILDDIR/.setuped ]] ; then
-		vecho ">>> It appears that '$PF' is already setup; skipping."
-		vecho ">>> Remove '$PORTAGE_BUILDDIR/.setuped' to force setup."
+		__vecho ">>> It appears that '$PF' is already setup; skipping."
+		__vecho ">>> Remove '$PORTAGE_BUILDDIR/.setuped' to force setup."
 		return 0
 	fi
 	ebuild_phase pre_pkg_setup
@@ -236,7 +236,7 @@ dyn_setup() {
 
 dyn_unpack() {
 	if [[ -f ${PORTAGE_BUILDDIR}/.unpacked ]] ; then
-		vecho ">>> WORKDIR is up-to-date, keeping..."
+		__vecho ">>> WORKDIR is up-to-date, keeping..."
 		return 0
 	fi
 	if [ ! -d "${WORKDIR}" ]; then
@@ -244,11 +244,11 @@ dyn_unpack() {
 	fi
 	cd "${WORKDIR}" || die "Directory change failed: \`cd '${WORKDIR}'\`"
 	ebuild_phase pre_src_unpack
-	vecho ">>> Unpacking source..."
+	__vecho ">>> Unpacking source..."
 	ebuild_phase src_unpack
 	>> "$PORTAGE_BUILDDIR/.unpacked" || \
 		die "Failed to create $PORTAGE_BUILDDIR/.unpacked"
-	vecho ">>> Source unpacked in ${WORKDIR}"
+	__vecho ">>> Source unpacked in ${WORKDIR}"
 	ebuild_phase post_src_unpack
 }
 
@@ -357,8 +357,8 @@ has_phase_defined_up_to() {
 dyn_prepare() {
 
 	if [[ -e $PORTAGE_BUILDDIR/.prepared ]] ; then
-		vecho ">>> It appears that '$PF' is already prepared; skipping."
-		vecho ">>> Remove '$PORTAGE_BUILDDIR/.prepared' to force prepare."
+		__vecho ">>> It appears that '$PF' is already prepared; skipping."
+		__vecho ">>> Remove '$PORTAGE_BUILDDIR/.prepared' to force prepare."
 		return 0
 	fi
 
@@ -375,11 +375,11 @@ dyn_prepare() {
 	trap abort_prepare SIGINT SIGQUIT
 
 	ebuild_phase pre_src_prepare
-	vecho ">>> Preparing source in $PWD ..."
+	__vecho ">>> Preparing source in $PWD ..."
 	ebuild_phase src_prepare
 	>> "$PORTAGE_BUILDDIR/.prepared" || \
 		die "Failed to create $PORTAGE_BUILDDIR/.prepared"
-	vecho ">>> Source prepared."
+	__vecho ">>> Source prepared."
 	ebuild_phase post_src_prepare
 
 	trap - SIGINT SIGQUIT
@@ -388,8 +388,8 @@ dyn_prepare() {
 dyn_configure() {
 
 	if [[ -e $PORTAGE_BUILDDIR/.configured ]] ; then
-		vecho ">>> It appears that '$PF' is already configured; skipping."
-		vecho ">>> Remove '$PORTAGE_BUILDDIR/.configured' to force configuration."
+		__vecho ">>> It appears that '$PF' is already configured; skipping."
+		__vecho ">>> Remove '$PORTAGE_BUILDDIR/.configured' to force configuration."
 		return 0
 	fi
 
@@ -407,11 +407,11 @@ dyn_configure() {
 
 	ebuild_phase pre_src_configure
 
-	vecho ">>> Configuring source in $PWD ..."
+	__vecho ">>> Configuring source in $PWD ..."
 	ebuild_phase src_configure
 	>> "$PORTAGE_BUILDDIR/.configured" || \
 		die "Failed to create $PORTAGE_BUILDDIR/.configured"
-	vecho ">>> Source configured."
+	__vecho ">>> Source configured."
 
 	ebuild_phase post_src_configure
 
@@ -421,8 +421,8 @@ dyn_configure() {
 dyn_compile() {
 
 	if [[ -e $PORTAGE_BUILDDIR/.compiled ]] ; then
-		vecho ">>> It appears that '${PF}' is already compiled; skipping."
-		vecho ">>> Remove '$PORTAGE_BUILDDIR/.compiled' to force compilation."
+		__vecho ">>> It appears that '${PF}' is already compiled; skipping."
+		__vecho ">>> Remove '$PORTAGE_BUILDDIR/.compiled' to force compilation."
 		return 0
 	fi
 
@@ -447,11 +447,11 @@ dyn_compile() {
 
 	ebuild_phase pre_src_compile
 
-	vecho ">>> Compiling source in $PWD ..."
+	__vecho ">>> Compiling source in $PWD ..."
 	ebuild_phase src_compile
 	>> "$PORTAGE_BUILDDIR/.compiled" || \
 		die "Failed to create $PORTAGE_BUILDDIR/.compiled"
-	vecho ">>> Source compiled."
+	__vecho ">>> Source compiled."
 
 	ebuild_phase post_src_compile
 
@@ -461,8 +461,8 @@ dyn_compile() {
 dyn_test() {
 
 	if [[ -e $PORTAGE_BUILDDIR/.tested ]] ; then
-		vecho ">>> It appears that ${PN} has already been tested; skipping."
-		vecho ">>> Remove '${PORTAGE_BUILDDIR}/.tested' to force test."
+		__vecho ">>> It appears that ${PN} has already been tested; skipping."
+		__vecho ">>> Remove '${PORTAGE_BUILDDIR}/.tested' to force test."
 		return
 	fi
 
@@ -480,10 +480,10 @@ dyn_test() {
 	fi
 
 	if ! has test $FEATURES && [ "${EBUILD_FORCE_TEST}" != "1" ]; then
-		vecho ">>> Test phase [not enabled]: ${CATEGORY}/${PF}"
+		__vecho ">>> Test phase [not enabled]: ${CATEGORY}/${PF}"
 	elif has test $RESTRICT; then
 		einfo "Skipping make test/check due to ebuild restriction."
-		vecho ">>> Test phase [explicitly disabled]: ${CATEGORY}/${PF}"
+		__vecho ">>> Test phase [explicitly disabled]: ${CATEGORY}/${PF}"
 	else
 		local save_sp=${SANDBOX_PREDICT}
 		addpredict /
@@ -503,8 +503,8 @@ dyn_install() {
 	if has noauto $FEATURES ; then
 		rm -f "${PORTAGE_BUILDDIR}/.installed"
 	elif [[ -e $PORTAGE_BUILDDIR/.installed ]] ; then
-		vecho ">>> It appears that '${PF}' is already installed; skipping."
-		vecho ">>> Remove '${PORTAGE_BUILDDIR}/.installed' to force install."
+		__vecho ">>> It appears that '${PF}' is already installed; skipping."
+		__vecho ">>> Remove '${PORTAGE_BUILDDIR}/.installed' to force install."
 		return 0
 	fi
 	trap "abort_install" SIGINT SIGQUIT
@@ -527,8 +527,8 @@ dyn_install() {
 		die "The source directory '${S}' doesn't exist"
 	fi
 
-	vecho
-	vecho ">>> Install ${PF} into ${D} category ${CATEGORY}"
+	__vecho
+	__vecho ">>> Install ${PF} into ${D} category ${CATEGORY}"
 	#our custom version of libtool uses $S and $D to fix
 	#invalid paths in .la files
 	export S D
@@ -544,8 +544,8 @@ dyn_install() {
 	ebuild_phase src_install
 	>> "$PORTAGE_BUILDDIR/.installed" || \
 		die "Failed to create $PORTAGE_BUILDDIR/.installed"
-	vecho ">>> Completed installing ${PF} into ${D}"
-	vecho
+	__vecho ">>> Completed installing ${PF} into ${D}"
+	__vecho
 	ebuild_phase post_src_install
 
 	cd "${PORTAGE_BUILDDIR}"/build-info

diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
index 106e260..6363366 100644
--- a/bin/phase-helpers.sh
+++ b/bin/phase-helpers.sh
@@ -25,7 +25,7 @@ into() {
 			install -d "${ED}${DESTTREE}"
 			local ret=$?
 			if [[ $ret -ne 0 ]] ; then
-				helpers_die "${FUNCNAME[0]} failed"
+				__helpers_die "${FUNCNAME[0]} failed"
 				return $ret
 			fi
 		fi
@@ -43,7 +43,7 @@ insinto() {
 			install -d "${ED}${INSDESTTREE}"
 			local ret=$?
 			if [[ $ret -ne 0 ]] ; then
-				helpers_die "${FUNCNAME[0]} failed"
+				__helpers_die "${FUNCNAME[0]} failed"
 				return $ret
 			fi
 		fi
@@ -61,7 +61,7 @@ exeinto() {
 			install -d "${ED}${_E_EXEDESTTREE_}"
 			local ret=$?
 			if [[ $ret -ne 0 ]] ; then
-				helpers_die "${FUNCNAME[0]} failed"
+				__helpers_die "${FUNCNAME[0]} failed"
 				return $ret
 			fi
 		fi
@@ -79,7 +79,7 @@ docinto() {
 			install -d "${ED}usr/share/doc/${PF}/${_E_DOCDESTTREE_}"
 			local ret=$?
 			if [[ $ret -ne 0 ]] ; then
-				helpers_die "${FUNCNAME[0]} failed"
+				__helpers_die "${FUNCNAME[0]} failed"
 				return $ret
 			fi
 		fi
@@ -279,7 +279,7 @@ unpack() {
 	[ -z "$*" ] && die "Nothing passed to the 'unpack' command"
 
 	for x in "$@"; do
-		vecho ">>> Unpacking ${x} to ${PWD}"
+		__vecho ">>> Unpacking ${x} to ${PWD}"
 		y=${x%.*}
 		y=${y##*.}
 
@@ -297,7 +297,7 @@ unpack() {
 		_unpack_tar() {
 			if [ "${y}" == "tar" ]; then
 				$1 -c -- "$srcdir$x" | tar xof -
-				assert_sigpipe_ok "$myfail"
+				__assert_sigpipe_ok "$myfail"
 			else
 				local cwd_dest=${x##*/}
 				cwd_dest=${cwd_dest%.*}
@@ -315,7 +315,7 @@ unpack() {
 				;;
 			tbz|tbz2)
 				${PORTAGE_BUNZIP2_COMMAND:-${PORTAGE_BZIP2_COMMAND} -d} -c -- "$srcdir$x" | tar xof -
-				assert_sigpipe_ok "$myfail"
+				__assert_sigpipe_ok "$myfail"
 				;;
 			ZIP|zip|jar)
 				# unzip will interactively prompt under some error conditions,
@@ -378,13 +378,13 @@ unpack() {
 				;;
 			xz)
 				if has $eapi 0 1 2 ; then
-					vecho "unpack ${x}: file format not recognized. Ignoring."
+					__vecho "unpack ${x}: file format not recognized. Ignoring."
 				else
 					_unpack_tar "xz -d"
 				fi
 				;;
 			*)
-				vecho "unpack ${x}: file format not recognized. Ignoring."
+				__vecho "unpack ${x}: file format not recognized. Ignoring."
 				;;
 		esac
 	done
@@ -433,7 +433,7 @@ econf() {
 			find "${WORKDIR}" -type f '(' \
 			-name config.guess -o -name config.sub ')' -print0 | \
 			while read -r -d $'\0' x ; do
-				vecho " * econf: updating ${x/${WORKDIR}\/} with ${EPREFIX}/usr/share/gnuconfig/${x##*/}"
+				__vecho " * econf: updating ${x/${WORKDIR}\/} with ${EPREFIX}/usr/share/gnuconfig/${x##*/}"
 				cp -f "${EPREFIX}"/usr/share/gnuconfig/"${x##*/}" "${x}"
 			done
 		fi
@@ -491,7 +491,7 @@ econf() {
 			--localstatedir="${EPREFIX}"/var/lib \
 			"$@" \
 			${EXTRA_ECONF}
-		vecho "${ECONF_SOURCE}/configure" "$@"
+		__vecho "${ECONF_SOURCE}/configure" "$@"
 
 		if ! "${ECONF_SOURCE}/configure" "$@" ; then
 
@@ -587,15 +587,15 @@ _eapi0_src_test() {
 			;;
 	esac
 	if $emake_cmd ${internal_opts} check -n &> /dev/null; then
-		vecho ">>> Test phase [check]: ${CATEGORY}/${PF}"
+		__vecho ">>> Test phase [check]: ${CATEGORY}/${PF}"
 		$emake_cmd ${internal_opts} check || \
 			die "Make check failed. See above for details."
 	elif $emake_cmd ${internal_opts} test -n &> /dev/null; then
-		vecho ">>> Test phase [test]: ${CATEGORY}/${PF}"
+		__vecho ">>> Test phase [test]: ${CATEGORY}/${PF}"
 		$emake_cmd ${internal_opts} test || \
 			die "Make test failed. See above for details."
 	else
-		vecho ">>> Test phase [none]: ${CATEGORY}/${PF}"
+		__vecho ">>> Test phase [none]: ${CATEGORY}/${PF}"
 	fi
 }
 

diff --git a/bin/save-ebuild-env.sh b/bin/save-ebuild-env.sh
index c09ce5b..f2deda2 100644
--- a/bin/save-ebuild-env.sh
+++ b/bin/save-ebuild-env.sh
@@ -46,11 +46,11 @@ save_ebuild_env() {
 	done
 	unset x
 
-	unset -f assert assert_sigpipe_ok \
-		dump_trace die \
-		quiet_mode vecho elog_base eqawarn elog \
-		einfo einfon ewarn eerror ebegin _eend eend KV_major \
-		KV_minor KV_micro KV_to_int get_KV unset_colors set_colors has \
+	unset -f assert __assert_sigpipe_ok \
+		__dump_trace die \
+		__quiet_mode __vecho __elog_base eqawarn elog \
+		einfo einfon ewarn eerror ebegin __eend eend KV_major \
+		KV_minor KV_micro KV_to_int get_KV __1 __1 has \
 		has_phase_defined_up_to \
 		hasv hasq qa_source qa_call \
 		addread addwrite adddeny addpredict _sb_append_var \
@@ -63,7 +63,7 @@ save_ebuild_env() {
 		abort_test abort_install dyn_prepare dyn_configure \
 		dyn_compile dyn_test dyn_install \
 		dyn_preinst dyn_pretend dyn_help debug-print debug-print-function \
-		debug-print-section helpers_die inherit EXPORT_FUNCTIONS \
+		debug-print-section __helpers_die inherit EXPORT_FUNCTIONS \
 		nonfatal register_success_hook \
 		save_ebuild_env filter_readonly_variables preprocess_ebuild_env \
 		source_all_bashrcs \


^ permalink raw reply related	[flat|nested] 20+ messages in thread
* [gentoo-commits] proj/portage:master commit in: bin/ebuild-helpers/, bin/
@ 2012-09-14  7:26 Zac Medico
  0 siblings, 0 replies; 20+ messages in thread
From: Zac Medico @ 2012-09-14  7:26 UTC (permalink / raw
  To: gentoo-commits

commit:     a23d0f4432abcfd1ebe4f2a3961185ca653ff2e0
Author:     Brian Harring <ferringb <AT> gmail <DOT> com>
AuthorDate: Fri Sep 14 04:41:04 2012 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Fri Sep 14 06:55:44 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=a23d0f44

Convert funcs of bashrc-functions.sh to __ prefixed namespace.

---
 bin/bashrc-functions.sh         |    2 +-
 bin/ebuild-helpers/ecompressdir |    8 ++++----
 bin/ebuild-helpers/prepstrip    |   12 ++++++------
 bin/ebuild.sh                   |    2 +-
 bin/helper-functions.sh         |   26 +++++++++++++-------------
 bin/phase-helpers.sh            |    8 ++++----
 bin/save-ebuild-env.sh          |    2 +-
 7 files changed, 30 insertions(+), 30 deletions(-)

diff --git a/bin/bashrc-functions.sh b/bin/bashrc-functions.sh
index 9fdf999..30a7a8e 100644
--- a/bin/bashrc-functions.sh
+++ b/bin/bashrc-functions.sh
@@ -23,7 +23,7 @@ register_success_hook() {
 	done
 }
 
-strip_duplicate_slashes() {
+__strip_duplicate_slashes() {
 	if [[ -n $1 ]] ; then
 		local removed=$1
 		while [[ ${removed} == *//* ]] ; do

diff --git a/bin/ebuild-helpers/ecompressdir b/bin/ebuild-helpers/ecompressdir
index 6801a07..5ca0d3a 100755
--- a/bin/ebuild-helpers/ecompressdir
+++ b/bin/ebuild-helpers/ecompressdir
@@ -133,7 +133,7 @@ decompressors=(
 	".lzma" "unxz -f"
 )
 
-multijob_init
+__multijob_init
 
 for dir in "$@" ; do
 	dir=${dir#/}
@@ -161,14 +161,14 @@ for dir in "$@" ; do
 		# ends up launching less compressors overall, so the overhead
 		# of forking children ends up dominating.
 		(
-		multijob_child_init
+		__multijob_child_init
 		funk_up_dir "decompress" "${decompressors[i]}" "${decompressors[i+1]}"
 		) &
-		multijob_post_fork
+		__multijob_post_fork
 		: $(( ret |= $? ))
 	done
 
-	multijob_finish
+	__multijob_finish
 	: $(( ret |= $? ))
 
 	# forcibly break all hard links as some compressors whine about it

diff --git a/bin/ebuild-helpers/prepstrip b/bin/ebuild-helpers/prepstrip
index 5f87482..2556ee2 100755
--- a/bin/ebuild-helpers/prepstrip
+++ b/bin/ebuild-helpers/prepstrip
@@ -62,7 +62,7 @@ prepstrip_sources_dir=${EPREFIX}/usr/src/debug/${CATEGORY}/${PF}
 type -P debugedit >/dev/null && debugedit_found=true || debugedit_found=false
 debugedit_warned=false
 
-multijob_init
+__multijob_init
 
 # Setup $T filesystem layout that we care about.
 tmpdir="${T}/prepstrip"
@@ -206,7 +206,7 @@ if ! ${RESTRICT_binchecks} && ! ${RESTRICT_strip} ; then
 	log=${tmpdir}/scanelf-already-stripped.log
 	scanelf -yqRBF '#k%F' -k '!.symtab' "$@" | sed -e "s#^${ED}##" > "${log}"
 	(
-	multijob_child_init
+	__multijob_child_init
 	qa_var="QA_PRESTRIPPED_${ARCH/-/_}"
 	[[ -n ${!qa_var} ]] && QA_PRESTRIPPED="${!qa_var}"
 	if [[ -n ${QA_PRESTRIPPED} && -s ${log} && \
@@ -228,7 +228,7 @@ if ! ${RESTRICT_binchecks} && ! ${RESTRICT_strip} ; then
 		rm -f "${log}"
 	fi
 	) &
-	multijob_post_fork
+	__multijob_post_fork
 fi
 
 # Now we look for unstripped binaries.
@@ -242,7 +242,7 @@ do
 	fi
 
 	(
-	multijob_child_init
+	__multijob_child_init
 	f=$(file "${x}") || exit 0
 	[[ -z ${f} ]] && exit 0
 
@@ -292,12 +292,12 @@ do
 		chmod u-w "${x}"
 	fi
 	) &
-	multijob_post_fork
+	__multijob_post_fork
 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
+__multijob_finish
 
 cd "${tmpdir}"/sources/ && cat * > "${tmpdir}/debug.sources" 2>/dev/null
 if [[ -s ${tmpdir}/debug.sources ]] && \

diff --git a/bin/ebuild.sh b/bin/ebuild.sh
index 5178a37..c6f2676 100755
--- a/bin/ebuild.sh
+++ b/bin/ebuild.sh
@@ -23,7 +23,7 @@ else
 	for x in diropts docompress exeopts get_KV insopts \
 		keepdir KV_major KV_micro KV_minor KV_to_int \
 		libopts register_die_hook register_success_hook \
-		strip_duplicate_slashes \
+		__strip_duplicate_slashes \
 		use_with use_enable ; do
 		eval "${x}() {
 			if has \"\${EAPI:-0}\" 4-python; then

diff --git a/bin/helper-functions.sh b/bin/helper-functions.sh
index c7400fa..65f41f6 100644
--- a/bin/helper-functions.sh
+++ b/bin/helper-functions.sh
@@ -10,42 +10,42 @@ source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
 #
 # API functions for doing parallel processing
 #
-numjobs() {
+__numjobs() {
 	# Copied from eutils.eclass:makeopts_jobs()
 	local jobs=$(echo " ${MAKEOPTS} " | \
 		sed -r -n 's:.*[[:space:]](-j|--jobs[=[:space:]])[[:space:]]*([0-9]+).*:\2:p')
 	echo ${jobs:-1}
 }
 
-multijob_init() {
+__multijob_init() {
 	# Setup a pipe for children to write their pids to when they finish.
 	mj_control_pipe=$(mktemp -t multijob.XXXXXX)
 	rm "${mj_control_pipe}"
 	mkfifo "${mj_control_pipe}"
-	redirect_alloc_fd mj_control_fd "${mj_control_pipe}"
+	__redirect_alloc_fd mj_control_fd "${mj_control_pipe}"
 	rm -f "${mj_control_pipe}"
 
 	# See how many children we can fork based on the user's settings.
-	mj_max_jobs=$(numjobs)
+	mj_max_jobs=$(__numjobs)
 	mj_num_jobs=0
 }
 
-multijob_child_init() {
+__multijob_child_init() {
 	trap 'echo ${BASHPID} $? >&'${mj_control_fd} EXIT
 	trap 'exit 1' INT TERM
 }
 
-multijob_finish_one() {
+__multijob_finish_one() {
 	local pid ret
 	read -r -u ${mj_control_fd} pid ret
 	: $(( --mj_num_jobs ))
 	return ${ret}
 }
 
-multijob_finish() {
+__multijob_finish() {
 	local ret=0
 	while [[ ${mj_num_jobs} -gt 0 ]] ; do
-		multijob_finish_one
+		__multijob_finish_one
 		: $(( ret |= $? ))
 	done
 	# Let bash clean up its internal child tracking state.
@@ -53,21 +53,21 @@ multijob_finish() {
 	return ${ret}
 }
 
-multijob_post_fork() {
+__multijob_post_fork() {
 	: $(( ++mj_num_jobs ))
 	if [[ ${mj_num_jobs} -ge ${mj_max_jobs} ]] ; then
-		multijob_finish_one
+		__multijob_finish_one
 	fi
 	return $?
 }
 
-# @FUNCTION: redirect_alloc_fd
+# @FUNCTION: __redirect_alloc_fd
 # @USAGE: <var> <file> [redirection]
 # @DESCRIPTION:
 # Find a free fd and redirect the specified file via it.  Store the new
 # fd in the specified variable.  Useful for the cases where we don't care
 # about the exact fd #.
-redirect_alloc_fd() {
+__redirect_alloc_fd() {
 	local var=$1 file=$2 redir=${3:-"<>"}
 
 	if [[ $(( (BASH_VERSINFO[0] << 8) + BASH_VERSINFO[1] )) -ge $(( (4 << 8) + 1 )) ]] ; then
@@ -82,7 +82,7 @@ redirect_alloc_fd() {
 					if [[ ! -e /dev/fd/${fd} ]] && [[ ! -L /dev/fd/${fd} ]] ; then
 							eval "exec ${fd}${redir}'${file}'" && break
 					fi
-					[[ ${fd} -gt 1024 ]] && die "redirect_alloc_fd failed"
+					[[ ${fd} -gt 1024 ]] && die "__redirect_alloc_fd failed"
 					: $(( ++fd ))
 			done
 			: $(( ${var} = fd ))

diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
index 555b237..106e260 100644
--- a/bin/phase-helpers.sh
+++ b/bin/phase-helpers.sh
@@ -118,7 +118,7 @@ docompress() {
 	if [[ $1 = "-x" ]]; then
 		shift
 		for f; do
-			f=$(strip_duplicate_slashes "${f}"); f=${f%/}
+			f=$(__strip_duplicate_slashes "${f}"); f=${f%/}
 			[[ ${f:0:1} = / ]] || f="/${f}"
 			for g in "${PORTAGE_DOCOMPRESS_SKIP[@]}"; do
 				[[ ${f} = "${g}" ]] && continue 2
@@ -127,7 +127,7 @@ docompress() {
 		done
 	else
 		for f; do
-			f=$(strip_duplicate_slashes "${f}"); f=${f%/}
+			f=$(__strip_duplicate_slashes "${f}"); f=${f%/}
 			[[ ${f:0:1} = / ]] || f="/${f}"
 			for g in "${PORTAGE_DOCOMPRESS[@]}"; do
 				[[ ${f} = "${g}" ]] && continue 2
@@ -476,7 +476,7 @@ econf() {
 			CONF_PREFIX=${CONF_PREFIX#*=}
 			[[ ${CONF_PREFIX} != /* ]] && CONF_PREFIX="/${CONF_PREFIX}"
 			[[ ${CONF_LIBDIR} != /* ]] && CONF_LIBDIR="/${CONF_LIBDIR}"
-			set -- --libdir="$(strip_duplicate_slashes ${CONF_PREFIX}${CONF_LIBDIR})" "$@"
+			set -- --libdir="$(__strip_duplicate_slashes ${CONF_PREFIX}${CONF_LIBDIR})" "$@"
 		fi
 
 		set -- \
@@ -521,7 +521,7 @@ einstall() {
 	unset LIBDIR_VAR
 	if [ -n "${CONF_LIBDIR}" ] && [ "${CONF_PREFIX:+set}" = set ]; then
 		EI_DESTLIBDIR="${D}/${CONF_PREFIX}/${CONF_LIBDIR}"
-		EI_DESTLIBDIR="$(strip_duplicate_slashes ${EI_DESTLIBDIR})"
+		EI_DESTLIBDIR="$(__strip_duplicate_slashes ${EI_DESTLIBDIR})"
 		LOCAL_EXTRA_EINSTALL="libdir=${EI_DESTLIBDIR} ${LOCAL_EXTRA_EINSTALL}"
 		unset EI_DESTLIBDIR
 	fi

diff --git a/bin/save-ebuild-env.sh b/bin/save-ebuild-env.sh
index 6b38e5d..c09ce5b 100644
--- a/bin/save-ebuild-env.sh
+++ b/bin/save-ebuild-env.sh
@@ -56,7 +56,7 @@ save_ebuild_env() {
 		addread addwrite adddeny addpredict _sb_append_var \
 		use usev useq has_version portageq \
 		best_version use_with use_enable register_die_hook \
-		keepdir unpack strip_duplicate_slashes econf einstall \
+		keepdir unpack __strip_duplicate_slashes econf einstall \
 		dyn_setup dyn_unpack dyn_clean into insinto exeinto docinto \
 		insopts diropts exeopts libopts docompress \
 		abort_handler abort_prepare abort_configure abort_compile \


^ permalink raw reply related	[flat|nested] 20+ messages in thread
* [gentoo-commits] proj/portage:master commit in: bin/ebuild-helpers/, bin/
@ 2012-09-02 22:57 Zac Medico
  0 siblings, 0 replies; 20+ messages in thread
From: Zac Medico @ 2012-09-02 22:57 UTC (permalink / raw
  To: gentoo-commits

commit:     d184c0f32eba2eec3a8d28ae71be79aa635db147
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun Sep  2 22:56:46 2012 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun Sep  2 22:56:46 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=d184c0f3

Quote ${EAPI} more.

This will avoid a potential syntax error in save-ebuild-env.sh if a
saved environment containing corrupt EAPI is sourced.

---
 bin/ebuild-helpers/doheader |    2 +-
 bin/ebuild-helpers/newins   |    2 +-
 bin/phase-functions.sh      |    6 +++---
 bin/phase-helpers.sh        |    2 +-
 bin/save-ebuild-env.sh      |    2 +-
 5 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/bin/ebuild-helpers/doheader b/bin/ebuild-helpers/doheader
index 9bbe5bc..c51ec1e 100755
--- a/bin/ebuild-helpers/doheader
+++ b/bin/ebuild-helpers/doheader
@@ -4,7 +4,7 @@
 
 source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
 
-case ${EAPI} in
+case "${EAPI}" in
 	0|1|2|3|4|4-python|4-slot-abi)
 		die "${0##*/} is not supported in EAPI ${EAPI}"
 		;;

diff --git a/bin/ebuild-helpers/newins b/bin/ebuild-helpers/newins
index 2dc041d..54245f3 100755
--- a/bin/ebuild-helpers/newins
+++ b/bin/ebuild-helpers/newins
@@ -15,7 +15,7 @@ fi
 	eqawarn "QA Notice: ${helper} called with more than 2 arguments: ${@:3}"
 
 stdin=
-case ${EAPI} in
+case "${EAPI}" in
 	0|1|2|3|4|4-python|4-slot-abi) ;;
 	*) [[ $1 = "-" ]] && stdin=yes ;;
 esac

diff --git a/bin/phase-functions.sh b/bin/phase-functions.sh
index fd7fb25..68a33a8 100644
--- a/bin/phase-functions.sh
+++ b/bin/phase-functions.sh
@@ -755,12 +755,12 @@ _ebuild_phase_funcs() {
 			eval "$x() { _eapi0_$x \"\$@\" ; }"
 	done
 
-	case $eapi in
+	case "$eapi" in
 
 		0|1)
 
 			if ! declare -F src_compile >/dev/null ; then
-				case $eapi in
+				case "$eapi" in
 					0)
 						src_compile() { _eapi0_src_compile "$@" ; }
 						;;
@@ -807,7 +807,7 @@ _ebuild_phase_funcs() {
 
 				eval "default() { _eapi2_$phase_func \"\$@\" ; }"
 
-				case $eapi in
+				case "$eapi" in
 					2|3)
 						;;
 					*)

diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
index 46f7132..0587991 100644
--- a/bin/phase-helpers.sh
+++ b/bin/phase-helpers.sh
@@ -174,7 +174,7 @@ usev() {
 	return 1
 }
 
-case ${EAPI} in
+case "${EAPI}" in
 	0|1|2|3|4|4-python|4-slot-abi) ;;
 	*)
 		usex() {

diff --git a/bin/save-ebuild-env.sh b/bin/save-ebuild-env.sh
index 75e4843..6d6ed41 100644
--- a/bin/save-ebuild-env.sh
+++ b/bin/save-ebuild-env.sh
@@ -73,7 +73,7 @@ save_ebuild_env() {
 		_hasg _hasgq _unpack_tar \
 		${QA_INTERCEPTORS}
 
-	case ${EAPI} in
+	case "${EAPI}" in
 		0|1|2|3|4|4-python|4-slot-abi) ;;
 		*) unset -f usex ;;
 	esac


^ permalink raw reply related	[flat|nested] 20+ messages in thread
* [gentoo-commits] proj/portage:master commit in: bin/ebuild-helpers/, bin/
@ 2012-08-15 20:45 Ulrich Mueller
  0 siblings, 0 replies; 20+ messages in thread
From: Ulrich Mueller @ 2012-08-15 20:45 UTC (permalink / raw
  To: gentoo-commits

commit:     196192de5664df4cdd4b3d5221b4b34a00e392e3
Author:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
AuthorDate: Wed Aug 15 20:50:29 2012 +0000
Commit:     Ulrich Mueller <ulm <AT> gentoo <DOT> org>
CommitDate: Wed Aug 15 20:50:29 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=196192de

Remove tests for deprecated 3_pre2 EAPI.

---
 bin/ebuild-helpers/doins  |    4 ++--
 bin/ebuild-helpers/newins |    4 ++--
 bin/ebuild.sh             |    4 ++--
 bin/isolated-functions.sh |    4 ++--
 bin/phase-functions.sh    |   12 ++++++------
 bin/phase-helpers.sh      |    4 ++--
 6 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/bin/ebuild-helpers/doins b/bin/ebuild-helpers/doins
index 443bfdb..fd77934 100755
--- a/bin/ebuild-helpers/doins
+++ b/bin/ebuild-helpers/doins
@@ -1,5 +1,5 @@
 #!/bin/bash
-# Copyright 1999-2011 Gentoo Foundation
+# 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
@@ -40,7 +40,7 @@ if [[ ${INSDESTTREE#${ED}} != "${INSDESTTREE}" ]]; then
 fi
 
 case "$EAPI" in
-	0|1|2|3|3_pre2)
+	0|1|2|3)
 		PRESERVE_SYMLINKS=n
 		;;
 	*)

diff --git a/bin/ebuild-helpers/newins b/bin/ebuild-helpers/newins
index adf2d80..b5b3ff6 100755
--- a/bin/ebuild-helpers/newins
+++ b/bin/ebuild-helpers/newins
@@ -1,5 +1,5 @@
 #!/bin/bash
-# Copyright 1999-2011 Gentoo Foundation
+# 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
@@ -19,7 +19,7 @@ fi
 
 rm -rf "${T}/${2}" || exit $?
 case "$EAPI" in
-	0|1|2|3|3_pre2)
+	0|1|2|3)
 		cp "$1" "$T/$2" || exit $?
 		;;
 	*)

diff --git a/bin/ebuild.sh b/bin/ebuild.sh
index 9829f68..d3ca9d9 100755
--- a/bin/ebuild.sh
+++ b/bin/ebuild.sh
@@ -556,7 +556,7 @@ if ! has "$EBUILD_PHASE" clean cleanrm ; then
 		# export EAPI for helpers (especially since we unset it above)
 		export EAPI
 
-		if has "$EAPI" 0 1 2 3 3_pre2 ; then
+		if has "$EAPI" 0 1 2 3 ; then
 			export RDEPEND=${RDEPEND-${DEPEND}}
 			debug-print "RDEPEND: not set... Setting to: ${DEPEND}"
 		fi
@@ -578,7 +578,7 @@ if ! has "$EBUILD_PHASE" clean cleanrm ; then
 					pkg_nofetch pkg_postinst pkg_postrm pkg_preinst pkg_prerm
 					pkg_setup src_test src_unpack"
 				;;
-			2|3|3_pre2)
+			2|3)
 				_valid_phases="src_compile pkg_config src_configure pkg_info
 					src_install pkg_nofetch pkg_postinst pkg_postrm pkg_preinst
 					src_prepare pkg_prerm pkg_setup src_test src_unpack"

diff --git a/bin/isolated-functions.sh b/bin/isolated-functions.sh
index dbf988b..d33c0b6 100644
--- a/bin/isolated-functions.sh
+++ b/bin/isolated-functions.sh
@@ -1,5 +1,5 @@
 #!/bin/bash
-# Copyright 1999-2011 Gentoo Foundation
+# Copyright 1999-2012 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 # We need this next line for "die" and "assert". It expands
@@ -86,7 +86,7 @@ dump_trace() {
 }
 
 nonfatal() {
-	if has "${EAPI:-0}" 0 1 2 3 3_pre2 ; then
+	if has "${EAPI:-0}" 0 1 2 3 ; then
 		die "$FUNCNAME() not supported in this EAPI"
 	fi
 	if [[ $# -lt 1 ]]; then

diff --git a/bin/phase-functions.sh b/bin/phase-functions.sh
index ce251ce..3520199 100644
--- a/bin/phase-functions.sh
+++ b/bin/phase-functions.sh
@@ -364,7 +364,7 @@ dyn_prepare() {
 
 	if [[ -d $S ]] ; then
 		cd "${S}"
-	elif has $EAPI 0 1 2 3 3_pre2 ; then
+	elif has $EAPI 0 1 2 3 ; then
 		cd "${WORKDIR}"
 	elif [[ -z ${A} ]] && ! has_phase_defined_up_to prepare; then
 		cd "${WORKDIR}"
@@ -395,7 +395,7 @@ dyn_configure() {
 
 	if [[ -d $S ]] ; then
 		cd "${S}"
-	elif has $EAPI 0 1 2 3 3_pre2 ; then
+	elif has $EAPI 0 1 2 3 ; then
 		cd "${WORKDIR}"
 	elif [[ -z ${A} ]] && ! has_phase_defined_up_to configure; then
 		cd "${WORKDIR}"
@@ -428,7 +428,7 @@ dyn_compile() {
 
 	if [[ -d $S ]] ; then
 		cd "${S}"
-	elif has $EAPI 0 1 2 3 3_pre2 ; then
+	elif has $EAPI 0 1 2 3 ; then
 		cd "${WORKDIR}"
 	elif [[ -z ${A} ]] && ! has_phase_defined_up_to compile; then
 		cd "${WORKDIR}"
@@ -519,7 +519,7 @@ dyn_install() {
 
 	if [[ -d $S ]] ; then
 		cd "${S}"
-	elif has $EAPI 0 1 2 3 3_pre2 ; then
+	elif has $EAPI 0 1 2 3 ; then
 		cd "${WORKDIR}"
 	elif [[ -z ${A} ]] && ! has_phase_defined_up_to install; then
 		cd "${WORKDIR}"
@@ -684,7 +684,7 @@ _ebuild_arg_to_phase() {
 
 	case "$arg" in
 		pretend)
-			! has $eapi 0 1 2 3 3_pre2 && \
+			! has $eapi 0 1 2 3 && \
 				phase_func=pkg_pretend
 			;;
 		setup)
@@ -780,7 +780,7 @@ _ebuild_phase_funcs() {
 			declare -F src_compile >/dev/null || \
 				src_compile() { _eapi2_src_compile "$@" ; }
 
-			has $eapi 2 3 3_pre2 || declare -F src_install >/dev/null || \
+			has $eapi 2 3 || declare -F src_install >/dev/null || \
 				src_install() { _eapi4_src_install "$@" ; }
 
 			if has $phase_func $default_phases ; then

diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
index 946520b..a00475c 100644
--- a/bin/phase-helpers.sh
+++ b/bin/phase-helpers.sh
@@ -1,5 +1,5 @@
 #!/bin/bash
-# Copyright 1999-2011 Gentoo Foundation
+# Copyright 1999-2012 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 export DESTTREE=/usr
@@ -421,7 +421,7 @@ econf() {
 		fi
 
 		# EAPI=4 adds --disable-dependency-tracking to econf
-		if ! has "$EAPI" 0 1 2 3 3_pre2 && \
+		if ! has "$EAPI" 0 1 2 3 && \
 			"${ECONF_SOURCE}/configure" --help 2>/dev/null | \
 			grep -q disable-dependency-tracking ; then
 			set -- --disable-dependency-tracking "$@"


^ permalink raw reply related	[flat|nested] 20+ messages in thread
* [gentoo-commits] proj/portage:master commit in: bin/ebuild-helpers/, bin/
@ 2012-05-12  4:09 Mike Frysinger
  0 siblings, 0 replies; 20+ messages in thread
From: Mike Frysinger @ 2012-05-12  4:09 UTC (permalink / raw
  To: gentoo-commits

commit:     76939c46aa2817bdbcea703432c52e5aa04160f9
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Fri May 11 16:36:22 2012 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Sat May 12 04:09:34 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=76939c46

prepstrip/ecompressdir: parallelize operations

Stealing some ideas from ferringb, add a new API for doing parallel
processing in bash, and then deploy this with the stripping and
compressing stages.

For stripping coreutils which has about 100 ELFs, this brings time
to strip down from ~7 seconds to ~0.7 seconds on my system.

Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>

---
 bin/ebuild-helpers/ecompressdir |   30 ++++++++++++++++--
 bin/ebuild-helpers/prepstrip    |   20 ++++++++++--
 bin/helper-functions.sh         |   62 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 104 insertions(+), 8 deletions(-)

diff --git a/bin/ebuild-helpers/ecompressdir b/bin/ebuild-helpers/ecompressdir
index 17ecd80..a2c9e52 100755
--- a/bin/ebuild-helpers/ecompressdir
+++ b/bin/ebuild-helpers/ecompressdir
@@ -2,7 +2,7 @@
 # Copyright 1999-2011 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
-source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
+source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/helper-functions.sh
 
 if [[ -z $1 ]] ; then
 	helpers_die "${0##*/}: at least one argument needed"
@@ -116,6 +116,16 @@ ret=0
 
 rm -rf "${T}"/ecompress-skip
 
+decompressors=(
+	".Z"    "gunzip -f"
+	".gz"   "gunzip -f"
+	".bz2"  "bunzip2 -f"
+	".xz"   "unxz -f"
+	".lzma" "unxz -f"
+)
+
+multijob_init
+
 for dir in "$@" ; do
 	dir=${dir#/}
 	dir="${ED}${dir}"
@@ -136,14 +146,26 @@ for dir in "$@" ; do
 	find "${dir}" -type f -name '*.ecompress.file' -print0 | ${XARGS} -0 rm -f
 
 	# not uncommon for packages to compress doc files themselves
-	funk_up_dir "decompress" ".Z" "gunzip -f"
-	funk_up_dir "decompress" ".gz" "gunzip -f"
-	funk_up_dir "decompress" ".bz2" "bunzip2 -f"
+	for (( d = 0; d < ${#decompressors[@]}; d += 2 )) ; do
+		# It's faster to parallelize at this stage than to try to
+		# parallelize the compressors.  This is because the find|xargs
+		# ends up launching less compressors overall, so the overhead
+		# of forking children ends up dominating.
+		(
+		multijob_child_init
+		funk_up_dir "decompress" "${decompressors[i]}" "${decompressors[i+1]}"
+		) &
+		multijob_post_fork
+		: $(( ret |= $? ))
+	done
 
 	# forcibly break all hard links as some compressors whine about it
 	find "${dir}" -type f -links +1 -exec env file="{}" sh -c \
 		'cp -p "${file}" "${file}.ecompress.break" ; mv -f "${file}.ecompress.break" "${file}"' \;
 
+	multijob_finish
+	: $(( ret |= $? ))
+
 	# now lets do our work
 	if [[ -n ${suffix} ]] ; then
 		vecho "${0##*/}: $(ecompress --bin) /${actual_dir#${ED}}"

diff --git a/bin/ebuild-helpers/prepstrip b/bin/ebuild-helpers/prepstrip
index daaa252..09b0333 100755
--- a/bin/ebuild-helpers/prepstrip
+++ b/bin/ebuild-helpers/prepstrip
@@ -1,8 +1,8 @@
 #!/bin/bash
-# Copyright 1999-2011 Gentoo Foundation
+# 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
+source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/helper-functions.sh
 
 # avoid multiple calls to `has`.  this creates things like:
 #   FEATURES_foo=false
@@ -62,6 +62,8 @@ prepstrip_sources_dir=${EPREFIX}/usr/src/debug/${CATEGORY}/${PF}
 type -P debugedit >/dev/null && debugedit_found=true || debugedit_found=false
 debugedit_warned=false
 
+multijob_init
+
 unset ${!INODE_*}
 
 inode_var_name() {
@@ -171,6 +173,8 @@ process_elf() {
 # 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
+	(
+	multijob_child_init
 	log=$T/scanelf-already-stripped.log
 	qa_var="QA_PRESTRIPPED_${ARCH/-/_}"
 	[[ -n ${!qa_var} ]] && QA_PRESTRIPPED="${!qa_var}"
@@ -193,6 +197,8 @@ if ! ${RESTRICT_binchecks} && ! ${RESTRICT_strip} ; then
 	else
 		rm -f "$log"
 	fi
+	) &
+	multijob_post_fork
 fi
 
 # Now we look for unstripped binaries.
@@ -205,8 +211,10 @@ do
 		banner=true
 	fi
 
-	f=$(file "${x}") || continue
-	[[ -z ${f} ]] && continue
+	(
+	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
@@ -253,6 +261,8 @@ do
 	if ${was_not_writable} ; then
 		chmod u-w "${x}"
 	fi
+	) &
+	multijob_post_fork
 done
 
 if [[ -s ${T}/debug.sources ]] && \
@@ -274,3 +284,5 @@ then
 		>> "$emptydir"/.keepdir
 	done < <(find "${D}${prepstrip_sources_dir}/" -type d -empty -print0)
 fi
+
+multijob_finish

diff --git a/bin/helper-functions.sh b/bin/helper-functions.sh
new file mode 100644
index 0000000..1c355e2
--- /dev/null
+++ b/bin/helper-functions.sh
@@ -0,0 +1,62 @@
+#!/bin/bash
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+# 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
+
+#
+# API functions for doing parallel processing
+#
+numjobs() {
+	# Copied from eutils.eclass:makeopts_jobs()
+	local jobs=$(echo " ${MAKEOPTS} " | \
+		sed -r -n 's:.*[[:space:]](-j|--jobs[=[:space:]])[[:space:]]*([0-9]+).*:\2:p')
+	echo ${jobs:-1}
+}
+
+multijob_init() {
+	# Setup a pipe for children to write their pids to when they finish.
+	mj_control_pipe=$(mktemp -t multijob.XXXXXX)
+	rm "${mj_control_pipe}"
+	mkfifo "${mj_control_pipe}"
+	exec {mj_control_fd}<>${mj_control_pipe}
+	rm -f "${mj_control_pipe}"
+
+	# See how many children we can fork based on the user's settings.
+	mj_max_jobs=$(numjobs)
+	mj_num_jobs=0
+}
+
+multijob_child_init() {
+	trap 'echo ${BASHPID} $? >&'${mj_control_fd} EXIT
+	trap 'exit 1' INT TERM
+}
+
+multijob_finish_one() {
+	local pid ret
+	read -r -u ${mj_control_fd} pid ret
+	: $(( --mj_num_jobs ))
+	return ${ret}
+}
+
+multijob_finish() {
+	local ret=0
+	while [[ ${mj_num_jobs} -gt 0 ]] ; do
+		multijob_finish_one
+		: $(( ret |= $? ))
+	done
+	# Let bash clean up its internal child tracking state.
+	wait
+	return ${ret}
+}
+
+multijob_post_fork() {
+	: $(( ++mj_num_jobs ))
+	if [[ ${mj_num_jobs} -ge ${mj_max_jobs} ]] ; then
+		multijob_finish_one
+	fi
+	return 0
+}



^ permalink raw reply related	[flat|nested] 20+ messages in thread
* [gentoo-commits] proj/portage:master commit in: bin/ebuild-helpers/, bin/
@ 2011-07-08 17:15 Zac Medico
  0 siblings, 0 replies; 20+ messages in thread
From: Zac Medico @ 2011-07-08 17:15 UTC (permalink / raw
  To: gentoo-commits

commit:     08c279024c1e2f8924f7d68e278d0423415695ec
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Fri Jul  8 17:14:51 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Fri Jul  8 17:14:51 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=08c27902

Remove all hasq/useq calls for bug #199722.

---
 bin/ebuild-helpers/doman      |    6 +-
 bin/ebuild-helpers/prepall    |    4 +-
 bin/ebuild-helpers/prepallman |    2 +-
 bin/ebuild-helpers/prepinfo   |    2 +-
 bin/ebuild-helpers/prepman    |    2 +-
 bin/ebuild-helpers/prepstrip  |   22 ++++----
 bin/ebuild.sh                 |  118 ++++++++++++++++++++--------------------
 bin/emerge-webrsync           |    4 +-
 bin/isolated-functions.sh     |    4 +-
 bin/misc-functions.sh         |   22 ++++----
 10 files changed, 93 insertions(+), 93 deletions(-)

diff --git a/bin/ebuild-helpers/doman b/bin/ebuild-helpers/doman
index 11333be..51ca055 100755
--- a/bin/ebuild-helpers/doman
+++ b/bin/ebuild-helpers/doman
@@ -25,13 +25,13 @@ for x in "$@" ; do
 	suffix=${x##*.}
 
 	# These will be automatically decompressed by ecompressdir.
-	if hasq ${suffix} Z gz bz2 ; then
+	if has ${suffix} Z gz bz2 ; then
 		realname=${x%.*}
 		suffix=${realname##*.}
 	fi
 
-	if hasq "${EAPI:-0}" 2 3 || [[ -z ${i18n} ]] \
-		&& ! hasq "${EAPI:-0}" 0 1 \
+	if has "${EAPI:-0}" 2 3 || [[ -z ${i18n} ]] \
+		&& ! has "${EAPI:-0}" 0 1 \
 		&& [[ $x =~ (.*)\.([a-z][a-z](_[A-Z][A-Z])?)\.(.*) ]]
 	then
 		name=${BASH_REMATCH[1]##*/}.${BASH_REMATCH[4]}

diff --git a/bin/ebuild-helpers/prepall b/bin/ebuild-helpers/prepall
index 19db415..dbed57c 100755
--- a/bin/ebuild-helpers/prepall
+++ b/bin/ebuild-helpers/prepall
@@ -4,7 +4,7 @@
 
 source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
 
-if hasq chflags $FEATURES ; then
+if has chflags $FEATURES ; then
 	# Save all the file flags for restoration at the end of prepall.
 	mtree -c -p "${D}" -k flags > "${T}/bsdflags.mtree"
 	# Remove all the file flags so that prepall can do anything necessary.
@@ -17,7 +17,7 @@ prepallinfo
 
 prepallstrip
 
-if hasq chflags $FEATURES ; then
+if has chflags $FEATURES ; then
 	# Restore all the file flags that were saved at the beginning of prepall.
 	mtree -U -e -p "${D}" -k flags < "${T}/bsdflags.mtree" &> /dev/null
 fi

diff --git a/bin/ebuild-helpers/prepallman b/bin/ebuild-helpers/prepallman
index 574ab62..a543ecb 100755
--- a/bin/ebuild-helpers/prepallman
+++ b/bin/ebuild-helpers/prepallman
@@ -5,7 +5,7 @@
 source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
 
 # replaced by controllable compression in EAPI 4
-hasq "${EAPI}" 0 1 2 3 || exit 0
+has "${EAPI}" 0 1 2 3 || exit 0
 
 ret=0
 

diff --git a/bin/ebuild-helpers/prepinfo b/bin/ebuild-helpers/prepinfo
index 9552923..0d68cc8 100755
--- a/bin/ebuild-helpers/prepinfo
+++ b/bin/ebuild-helpers/prepinfo
@@ -30,5 +30,5 @@ find "${D}${infodir}" -type d -print0 | while read -r -d $'\0' x ; do
 	rm -f "${x}"/dir{,.info}{,.gz,.bz2}
 done
 
-hasq "${EAPI}" 0 1 2 3 || exit 0
+has "${EAPI}" 0 1 2 3 || exit 0
 exec ecompressdir --queue "${infodir}"

diff --git a/bin/ebuild-helpers/prepman b/bin/ebuild-helpers/prepman
index 3466402..5c0f9f0 100755
--- a/bin/ebuild-helpers/prepman
+++ b/bin/ebuild-helpers/prepman
@@ -16,7 +16,7 @@ if [[ ! -d ${mandir} ]] ; then
 fi
 
 # replaced by controllable compression in EAPI 4
-hasq "${EAPI}" 0 1 2 3 || exit 0
+has "${EAPI}" 0 1 2 3 || exit 0
 
 shopt -s nullglob
 

diff --git a/bin/ebuild-helpers/prepstrip b/bin/ebuild-helpers/prepstrip
index 8b18ac0..344d417 100755
--- a/bin/ebuild-helpers/prepstrip
+++ b/bin/ebuild-helpers/prepstrip
@@ -6,12 +6,12 @@ source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
 
 banner=false
 SKIP_STRIP=false
-if hasq nostrip ${FEATURES} || \
-   hasq strip ${RESTRICT}
+if has nostrip ${FEATURES} || \
+   has strip ${RESTRICT}
 then
 	SKIP_STRIP=true
 	banner=true
-	hasq installsources ${FEATURES} || exit 0
+	has installsources ${FEATURES} || exit 0
 fi
 
 STRIP=${STRIP:-${CHOST}-strip}
@@ -25,7 +25,7 @@ export SAFE_STRIP_FLAGS="--strip-unneeded"
 export PORTAGE_STRIP_FLAGS=${PORTAGE_STRIP_FLAGS-${SAFE_STRIP_FLAGS} -R .comment}
 prepstrip_sources_dir=/usr/src/debug/${CATEGORY}/${PF}
 
-if hasq installsources ${FEATURES} && ! type -P debugedit >/dev/null ; then
+if has installsources ${FEATURES} && ! type -P debugedit >/dev/null ; then
 	ewarn "FEATURES=installsources is enabled but the debugedit binary could not"
 	ewarn "be found. This feature will not work unless debugedit is installed!"
 fi
@@ -41,8 +41,8 @@ inode_var_name() {
 }
 
 save_elf_sources() {
-	hasq installsources ${FEATURES} || return 0
-	hasq installsources ${RESTRICT} && return 0
+	has installsources ${FEATURES} || return 0
+	has installsources ${RESTRICT} && return 0
 	type -P debugedit >/dev/null || return 0
 
 	local x=$1
@@ -53,7 +53,7 @@ save_elf_sources() {
 }
 
 save_elf_debug() {
-	hasq splitdebug ${FEATURES} || return 0
+	has splitdebug ${FEATURES} || return 0
 
 	local x=$1
 	local y="${D}usr/lib/debug/${x:${#D}}.debug"
@@ -90,8 +90,8 @@ save_elf_debug() {
 # 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 ! hasq binchecks ${RESTRICT} && \
-	! hasq strip ${RESTRICT} ; then
+if ! has binchecks ${RESTRICT} && \
+	! has strip ${RESTRICT} ; then
 	log=$T/scanelf-already-stripped.log
 	qa_var="QA_PRESTRIPPED_${ARCH/-/_}"
 	[[ -n ${!qa_var} ]] && QA_PRESTRIPPED="${!qa_var}"
@@ -173,8 +173,8 @@ do
 done
 
 if [[ -s ${T}/debug.sources ]] && \
-        hasq installsources ${FEATURES} && \
-        ! hasq installsources ${RESTRICT} && \
+        has installsources ${FEATURES} && \
+        ! has installsources ${RESTRICT} && \
         type -P debugedit >/dev/null
 then
 	vecho "installsources: rsyncing source files"

diff --git a/bin/ebuild.sh b/bin/ebuild.sh
index f9a87af..77a21f7 100755
--- a/bin/ebuild.sh
+++ b/bin/ebuild.sh
@@ -154,7 +154,7 @@ use() {
 		# any number of phase hooks, so that global scope eclass
 		# initialization can by migrated to phase hooks in new EAPIs.
 		# Example: add_phase_hook before pkg_setup $ECLASS_pre_pkg_setup
-		#if [[ -n $EAPI ]] && ! hasq "$EAPI" 0 1 2 3 ; then
+		#if [[ -n $EAPI ]] && ! has "$EAPI" 0 1 2 3 ; then
 		#	die "use() called during invalid phase: $EBUILD_PHASE"
 		#fi
 		true
@@ -166,7 +166,7 @@ use() {
 				"in IUSE for ${CATEGORY}/${PF}"
 	fi
 
-	if hasq ${u} ${USE} ; then
+	if has ${u} ${USE} ; then
 		return ${found}
 	else
 		return $((!found))
@@ -250,7 +250,7 @@ use_with() {
 	fi
 	local UWORD=${2:-$1}
 
-	if useq $1; then
+	if use $1; then
 		echo "--with-${UWORD}${UW_SUFFIX}"
 	else
 		echo "--without-${UWORD}"
@@ -272,7 +272,7 @@ use_enable() {
 	fi
 	local UWORD=${2:-$1}
 
-	if useq $1; then
+	if use $1; then
 		echo "--enable-${UWORD}${UE_SUFFIX}"
 	else
 		echo "--disable-${UWORD}"
@@ -283,7 +283,7 @@ use_enable() {
 register_die_hook() {
 	local x
 	for x in $* ; do
-		hasq $x $EBUILD_DEATH_HOOKS || \
+		has $x $EBUILD_DEATH_HOOKS || \
 			export EBUILD_DEATH_HOOKS="$EBUILD_DEATH_HOOKS $x"
 	done
 }
@@ -291,7 +291,7 @@ register_die_hook() {
 register_success_hook() {
 	local x
 	for x in $* ; do
-		hasq $x $EBUILD_SUCCESS_HOOKS || \
+		has $x $EBUILD_SUCCESS_HOOKS || \
 			export EBUILD_SUCCESS_HOOKS="$EBUILD_SUCCESS_HOOKS $x"
 	done
 }
@@ -299,7 +299,7 @@ register_success_hook() {
 # Ensure that $PWD is sane whenever possible, to protect against
 # exploitation of insecure search path for python -c in ebuilds.
 # See bug #239560.
-if ! hasq "$EBUILD_PHASE" clean cleanrm depend help ; then
+if ! has "$EBUILD_PHASE" clean cleanrm depend help ; then
 	cd "$PORTAGE_BUILDDIR" || \
 		die "PORTAGE_BUILDDIR does not exist: '$PORTAGE_BUILDDIR'"
 fi
@@ -444,7 +444,7 @@ unpack() {
 				_unpack_tar "lzma -d"
 				;;
 			xz)
-				if hasq $eapi 0 1 2 ; then
+				if has $eapi 0 1 2 ; then
 					vecho "unpack ${x}: file format not recognized. Ignoring."
 				else
 					_unpack_tar "xz -d"
@@ -483,7 +483,7 @@ econf() {
 
 	local phase_func=$(_ebuild_arg_to_phase "$EAPI" "$EBUILD_PHASE")
 	if [[ -n $phase_func ]] ; then
-		if hasq "$EAPI" 0 1 ; then
+		if has "$EAPI" 0 1 ; then
 			[[ $phase_func != src_compile ]] && \
 				eqawarn "QA Notice: econf called in" \
 					"$phase_func instead of src_compile"
@@ -511,7 +511,7 @@ econf() {
 		fi
 
 		# EAPI=4 adds --disable-dependency-tracking to econf
-		if ! hasq "$EAPI" 0 1 2 3 3_pre2 && \
+		if ! has "$EAPI" 0 1 2 3 3_pre2 && \
 			"${ECONF_SOURCE}/configure" --help 2>/dev/null | \
 			grep -q disable-dependency-tracking ; then
 			set -- --disable-dependency-tracking "$@"
@@ -635,14 +635,14 @@ _eapi0_src_test() {
 	if $emake_cmd -j1 check -n &> /dev/null; then
 		vecho ">>> Test phase [check]: ${CATEGORY}/${PF}"
 		if ! $emake_cmd -j1 check; then
-			hasq test $FEATURES && die "Make check failed. See above for details."
-			hasq test $FEATURES || eerror "Make check failed. See above for details."
+			has test $FEATURES && die "Make check failed. See above for details."
+			has test $FEATURES || eerror "Make check failed. See above for details."
 		fi
 	elif $emake_cmd -j1 test -n &> /dev/null; then
 		vecho ">>> Test phase [test]: ${CATEGORY}/${PF}"
 		if ! $emake_cmd -j1 test; then
-			hasq test $FEATURES && die "Make test failed. See above for details."
-			hasq test $FEATURES || eerror "Make test failed. See above for details."
+			has test $FEATURES && die "Make test failed. See above for details."
+			has test $FEATURES || eerror "Make test failed. See above for details."
 		fi
 	else
 		vecho ">>> Test phase [none]: ${CATEGORY}/${PF}"
@@ -742,11 +742,11 @@ dyn_unpack() {
 	if [ "${newstuff}" == "yes" ]; then
 		# We don't necessarily have privileges to do a full dyn_clean here.
 		rm -rf "${PORTAGE_BUILDDIR}"/{.setuped,.unpacked,.prepared,.configured,.compiled,.tested,.installed,.packaged,build-info}
-		if ! hasq keepwork $FEATURES ; then
+		if ! has keepwork $FEATURES ; then
 			rm -rf "${WORKDIR}"
 		fi
 		if [ -d "${T}" ] && \
-			! hasq keeptemp $FEATURES ; then
+			! has keeptemp $FEATURES ; then
 			rm -rf "${T}" && mkdir "${T}"
 		fi
 	fi
@@ -777,7 +777,7 @@ dyn_clean() {
 	elif [ ! -d "${PORTAGE_BUILDDIR}" ] ; then
 		return 0
 	fi
-	if hasq chflags $FEATURES ; then
+	if has chflags $FEATURES ; then
 		chflags -R noschg,nouchg,nosappnd,nouappnd "${PORTAGE_BUILDDIR}"
 		chflags -R nosunlnk,nouunlnk "${PORTAGE_BUILDDIR}" 2>/dev/null
 	fi
@@ -786,11 +786,11 @@ dyn_clean() {
 	rm -f "${PORTAGE_BUILDDIR}/.installed"
 
 	if [[ $EMERGE_FROM = binary ]] || \
-		! hasq keeptemp $FEATURES && ! hasq keepwork $FEATURES ; then
+		! has keeptemp $FEATURES && ! has keepwork $FEATURES ; then
 		rm -rf "${T}"
 	fi
 
-	if [[ $EMERGE_FROM = binary ]] || ! hasq keepwork $FEATURES; then
+	if [[ $EMERGE_FROM = binary ]] || ! has keepwork $FEATURES; then
 		rm -f "$PORTAGE_BUILDDIR"/.{ebuild_changed,logid,pretended,setuped,unpacked,prepared} \
 			"$PORTAGE_BUILDDIR"/.{configured,compiled,tested,packaged} \
 			"$PORTAGE_BUILDDIR"/.die_hooks \
@@ -885,7 +885,7 @@ insopts() {
 	export INSOPTIONS="$@"
 
 	# `install` should never be called with '-s' ...
-	hasq -s ${INSOPTIONS} && die "Never call insopts() with -s"
+	has -s ${INSOPTIONS} && die "Never call insopts() with -s"
 }
 
 diropts() {
@@ -896,18 +896,18 @@ exeopts() {
 	export EXEOPTIONS="$@"
 
 	# `install` should never be called with '-s' ...
-	hasq -s ${EXEOPTIONS} && die "Never call exeopts() with -s"
+	has -s ${EXEOPTIONS} && die "Never call exeopts() with -s"
 }
 
 libopts() {
 	export LIBOPTIONS="$@"
 
 	# `install` should never be called with '-s' ...
-	hasq -s ${LIBOPTIONS} && die "Never call libopts() with -s"
+	has -s ${LIBOPTIONS} && die "Never call libopts() with -s"
 }
 
 docompress() {
-	hasq "${EAPI}" 0 1 2 3 && die "'docompress' not supported in this EAPI"
+	has "${EAPI}" 0 1 2 3 && die "'docompress' not supported in this EAPI"
 
 	local f g
 	if [[ $1 = "-x" ]]; then
@@ -997,7 +997,7 @@ dyn_prepare() {
 
 	if [[ -d $S ]] ; then
 		cd "${S}"
-	elif hasq $EAPI 0 1 2 3 3_pre2 ; then
+	elif has $EAPI 0 1 2 3 3_pre2 ; then
 		cd "${WORKDIR}"
 	elif [[ -z ${A} ]] && ! has_phase_defined_up_to prepare; then
 		cd "${WORKDIR}"
@@ -1028,7 +1028,7 @@ dyn_configure() {
 
 	if [[ -d $S ]] ; then
 		cd "${S}"
-	elif hasq $EAPI 0 1 2 3 3_pre2 ; then
+	elif has $EAPI 0 1 2 3 3_pre2 ; then
 		cd "${WORKDIR}"
 	elif [[ -z ${A} ]] && ! has_phase_defined_up_to configure; then
 		cd "${WORKDIR}"
@@ -1061,7 +1061,7 @@ dyn_compile() {
 
 	if [[ -d $S ]] ; then
 		cd "${S}"
-	elif hasq $EAPI 0 1 2 3 3_pre2 ; then
+	elif has $EAPI 0 1 2 3 3_pre2 ; then
 		cd "${WORKDIR}"
 	elif [[ -z ${A} ]] && ! has_phase_defined_up_to compile; then
 		cd "${WORKDIR}"
@@ -1071,7 +1071,7 @@ dyn_compile() {
 
 	trap abort_compile SIGINT SIGQUIT
 
-	if hasq distcc $FEATURES && hasq distcc-pump $FEATURES ; then
+	if has distcc $FEATURES && has distcc-pump $FEATURES ; then
 		if [[ -z $INCLUDE_SERVER_PORT ]] || [[ ! -w $INCLUDE_SERVER_PORT ]] ; then
 			eval $(pump --startup)
 			trap "pump --shutdown" EXIT
@@ -1102,7 +1102,7 @@ dyn_test() {
 	if [ "${EBUILD_FORCE_TEST}" == "1" ] ; then
 		# If USE came from ${T}/environment then it might not have USE=test
 		# like it's supposed to here.
-		! hasq test ${USE} && export USE="${USE} test"
+		! has test ${USE} && export USE="${USE} test"
 	fi
 
 	trap "abort_test" SIGINT SIGQUIT
@@ -1112,9 +1112,9 @@ dyn_test() {
 		cd "${WORKDIR}"
 	fi
 
-	if ! hasq test $FEATURES && [ "${EBUILD_FORCE_TEST}" != "1" ]; then
+	if ! has test $FEATURES && [ "${EBUILD_FORCE_TEST}" != "1" ]; then
 		vecho ">>> Test phase [not enabled]: ${CATEGORY}/${PF}"
-	elif hasq test $RESTRICT; then
+	elif has test $RESTRICT; then
 		einfo "Skipping make test/check due to ebuild restriction."
 		vecho ">>> Test phase [explicitly disabled]: ${CATEGORY}/${PF}"
 	else
@@ -1133,7 +1133,7 @@ dyn_test() {
 
 dyn_install() {
 	[ -z "$PORTAGE_BUILDDIR" ] && die "${FUNCNAME}: PORTAGE_BUILDDIR is unset"
-	if hasq noauto $FEATURES ; then
+	if has noauto $FEATURES ; then
 		rm -f "${PORTAGE_BUILDDIR}/.installed"
 	elif [[ -e $PORTAGE_BUILDDIR/.installed ]] ; then
 		vecho ">>> It appears that '${PF}' is already installed; skipping."
@@ -1146,7 +1146,7 @@ dyn_install() {
 	mkdir "${PORTAGE_BUILDDIR}/image"
 	if [[ -d $S ]] ; then
 		cd "${S}"
-	elif hasq $EAPI 0 1 2 3 3_pre2 ; then
+	elif has $EAPI 0 1 2 3 3_pre2 ; then
 		cd "${WORKDIR}"
 	elif [[ -z ${A} ]] && ! has_phase_defined_up_to install; then
 		cd "${WORKDIR}"
@@ -1207,7 +1207,7 @@ dyn_install() {
 
 	cp "${EBUILD}" "${PF}.ebuild"
 	[ -n "${PORTAGE_REPO_NAME}" ]  && echo "${PORTAGE_REPO_NAME}" > repository
-	if hasq nostrip ${FEATURES} ${RESTRICT} || hasq strip ${RESTRICT}
+	if has nostrip ${FEATURES} ${RESTRICT} || has strip ${RESTRICT}
 	then
 		>> DEBUGBUILD
 	fi
@@ -1269,7 +1269,7 @@ dyn_help() {
 	echo "  c++ flags   : ${CXXFLAGS}"
 	echo "  make flags  : ${MAKEOPTS}"
 	echo -n "  build mode  : "
-	if hasq nostrip ${FEATURES} ${RESTRICT} || hasq strip ${RESTRICT} ;
+	if has nostrip ${FEATURES} ${RESTRICT} || has strip ${RESTRICT} ;
 	then
 		echo "debug (large)"
 	else
@@ -1366,7 +1366,7 @@ inherit() {
 			# This is disabled in the *rm phases because they frequently give
 			# false alarms due to INHERITED in /var/db/pkg being outdated
 			# in comparison the the eclasses from the portage tree.
-			if ! hasq $ECLASS $INHERITED $__INHERITED_QA_CACHE ; then
+			if ! has $ECLASS $INHERITED $__INHERITED_QA_CACHE ; then
 				eqawarn "QA Notice: ECLASS '$ECLASS' inherited illegally in $CATEGORY/$PF $EBUILD_PHASE"
 			fi
 		fi
@@ -1386,7 +1386,7 @@ inherit() {
 		[ ! -e "$location" ] && die "${1}.eclass could not be found by inherit()"
 
 		if [ "${location}" == "${olocation}" ] && \
-			! hasq "${location}" ${EBUILD_OVERLAY_ECLASSES} ; then
+			! has "${location}" ${EBUILD_OVERLAY_ECLASSES} ; then
 				EBUILD_OVERLAY_ECLASSES="${EBUILD_OVERLAY_ECLASSES} ${location}"
 		fi
 
@@ -1448,7 +1448,7 @@ inherit() {
 		fi
 		unset $__export_funcs_var
 
-		hasq $1 $INHERITED || export INHERITED="$INHERITED $1"
+		has $1 $INHERITED || export INHERITED="$INHERITED $1"
 
 		shift
 	done
@@ -1505,7 +1505,7 @@ _ebuild_arg_to_phase() {
 
 	case "$arg" in
 		pretend)
-			! hasq $eapi 0 1 2 3 3_pre2 && \
+			! has $eapi 0 1 2 3 3_pre2 && \
 				phase_func=pkg_pretend
 			;;
 		setup)
@@ -1518,11 +1518,11 @@ _ebuild_arg_to_phase() {
 			phase_func=src_unpack
 			;;
 		prepare)
-			! hasq $eapi 0 1 && \
+			! has $eapi 0 1 && \
 				phase_func=src_prepare
 			;;
 		configure)
-			! hasq $eapi 0 1 && \
+			! has $eapi 0 1 && \
 				phase_func=src_configure
 			;;
 		compile)
@@ -1604,7 +1604,7 @@ _ebuild_phase_funcs() {
 			has $eapi 2 3 3_pre2 || declare -F src_install >/dev/null || \
 				src_install() { _eapi4_src_install "$@" ; }
 
-			if hasq $phase_func $default_phases ; then
+			if has $phase_func $default_phases ; then
 
 				_eapi2_pkg_nofetch   () { _eapi0_pkg_nofetch          "$@" ; }
 				_eapi2_src_unpack    () { _eapi0_src_unpack           "$@" ; }
@@ -1833,23 +1833,23 @@ filter_readonly_variables() {
 			;;
 	esac
 
-	if hasq --filter-sandbox $* ; then
+	if has --filter-sandbox $* ; then
 		filtered_vars="${filtered_vars} SANDBOX_.*"
 	else
 		filtered_vars="${filtered_vars} ${filtered_sandbox_vars}"
 	fi
-	if hasq --filter-features $* ; then
+	if has --filter-features $* ; then
 		filtered_vars="${filtered_vars} FEATURES PORTAGE_FEATURES"
 	fi
-	if hasq --filter-path $* ; then
+	if has --filter-path $* ; then
 		filtered_vars+=" PATH"
 	fi
-	if hasq --filter-locale $* ; then
+	if has --filter-locale $* ; then
 		filtered_vars+=" LANG LC_ALL LC_COLLATE
 			LC_CTYPE LC_MESSAGES LC_MONETARY
 			LC_NUMERIC LC_PAPER LC_TIME"
 	fi
-	if ! hasq --allow-extra-vars $* ; then
+	if ! has --allow-extra-vars $* ; then
 		filtered_vars="
 			${filtered_vars}
 			${PORTAGE_SAVED_READONLY_VARS}
@@ -1958,9 +1958,9 @@ if [[ -n ${QA_INTERCEPTORS} ]] ; then
 				fi
 			${BODY}
 			}"
-		elif hasq ${BIN} autoconf automake aclocal libtoolize ; then
+		elif has ${BIN} autoconf automake aclocal libtoolize ; then
 			FUNC_SRC="${BIN}() {
-				if ! hasq \${FUNCNAME[1]} eautoreconf eaclocal _elibtoolize \\
+				if ! has \${FUNCNAME[1]} eautoreconf eaclocal _elibtoolize \\
 					eautoheader eautoconf eautomake autotools_run_tool \\
 					autotools_check_macro autotools_get_subdirs \\
 					autotools_get_auxdir ; then
@@ -1984,7 +1984,7 @@ fi
 export EBUILD_MASTER_PID=$BASHPID
 trap 'exit 1' SIGTERM
 
-if ! hasq "$EBUILD_PHASE" clean cleanrm depend && \
+if ! has "$EBUILD_PHASE" clean cleanrm depend && \
 	[ -f "${T}"/environment ] ; then
 	# The environment may have been extracted from environment.bz2 or
 	# may have come from another version of ebuild.sh or something.
@@ -2022,10 +2022,10 @@ if ! hasq "$EBUILD_PHASE" clean cleanrm depend && \
 	[[ -n $EAPI ]] || EAPI=0
 fi
 
-if ! hasq "$EBUILD_PHASE" clean cleanrm ; then
+if ! has "$EBUILD_PHASE" clean cleanrm ; then
 	if [[ $EBUILD_PHASE = depend || ! -f $T/environment || \
 		-f $PORTAGE_BUILDDIR/.ebuild_changed ]] || \
-		hasq noauto $FEATURES ; then
+		has noauto $FEATURES ; then
 		# The bashrcs get an opportunity here to set aliases that will be expanded
 		# during sourcing of ebuilds and eclasses.
 		source_all_bashrcs
@@ -2122,12 +2122,12 @@ if ! hasq "$EBUILD_PHASE" clean cleanrm ; then
 			x=LIBDIR_${DEFAULT_ABI}
 			[[ -n $DEFAULT_ABI && -n ${!x} ]] && x=${!x} || x=lib
 
-			if hasq distcc $FEATURES ; then
+			if has distcc $FEATURES ; then
 				PATH="/usr/$x/distcc/bin:$PATH"
 				[[ -n $DISTCC_LOG ]] && addwrite "${DISTCC_LOG%/*}"
 			fi
 
-			if hasq ccache $FEATURES ; then
+			if has ccache $FEATURES ; then
 				PATH="/usr/$x/ccache/bin:$PATH"
 
 				if [[ -n $CCACHE_DIR ]] ; then
@@ -2174,7 +2174,7 @@ for x in ${USE_EXPAND} ; do
 done
 unset x
 
-if hasq nostrip ${FEATURES} ${RESTRICT} || hasq strip ${RESTRICT}
+if has nostrip ${FEATURES} ${RESTRICT} || has strip ${RESTRICT}
 then
 	export DEBUGBUILD=1
 fi
@@ -2208,7 +2208,7 @@ ebuild_main() {
 	if [[ $EBUILD_PHASE != depend ]] ; then
 		# Force configure scripts that automatically detect ccache to
 		# respect FEATURES="-ccache".
-		hasq ccache $FEATURES || export CCACHE_DISABLE=1
+		has ccache $FEATURES || export CCACHE_DISABLE=1
 
 		local phase_func=$(_ebuild_arg_to_phase "$EAPI" "$EBUILD_PHASE")
 		[[ -n $phase_func ]] && _ebuild_phase_funcs "$EAPI" "$phase_func"
@@ -2222,7 +2222,7 @@ ebuild_main() {
 		ebuild_phase_with_hooks pkg_nofetch
 		;;
 	prerm|postrm|postinst|config|info)
-		if hasq "$EBUILD_SH_ARGS" config info && \
+		if has "$EBUILD_SH_ARGS" config info && \
 			! declare -F "pkg_$EBUILD_SH_ARGS" >/dev/null ; then
 			ewarn  "pkg_${EBUILD_SH_ARGS}() is not defined: '${EBUILD##*/}'"
 		fi
@@ -2261,7 +2261,7 @@ ebuild_main() {
 			done
 			unset x
 
-			hasq distcc $FEATURES && [[ -n $DISTCC_DIR ]] && \
+			has distcc $FEATURES && [[ -n $DISTCC_DIR ]] && \
 				[[ ${SANDBOX_WRITE/$DISTCC_DIR} = $SANDBOX_WRITE ]] && \
 				addwrite "$DISTCC_DIR"
 
@@ -2269,7 +2269,7 @@ ebuild_main() {
 			[ -z "$PKG_CONFIG_PATH" -a -n "$ABI" -a -n "${!x}" ] && \
 				export PKG_CONFIG_PATH=/usr/${!x}/pkgconfig
 
-			if hasq noauto $FEATURES && \
+			if has noauto $FEATURES && \
 				[[ ! -f $PORTAGE_BUILDDIR/.unpacked ]] ; then
 				echo
 				echo "!!! We apparently haven't unpacked..." \
@@ -2398,7 +2398,7 @@ elif [[ -n $EBUILD_SH_ARGS ]] ; then
 		ebuild_main
 
 		# Save the env only for relevant phases.
-		if ! hasq "$EBUILD_SH_ARGS" clean help info nofetch ; then
+		if ! has "$EBUILD_SH_ARGS" clean help info nofetch ; then
 			umask 002
 			save_ebuild_env | filter_readonly_variables \
 				--filter-features > "$T/environment"

diff --git a/bin/emerge-webrsync b/bin/emerge-webrsync
index 69cfc96..d933871 100755
--- a/bin/emerge-webrsync
+++ b/bin/emerge-webrsync
@@ -49,7 +49,7 @@ source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
 do_verbose=0
 do_debug=0
 
-if hasq webrsync-gpg ${FEATURES} ; then
+if has webrsync-gpg ${FEATURES} ; then
 	WEBSYNC_VERIFY_SIGNATURE=1
 else
 	WEBSYNC_VERIFY_SIGNATURE=0
@@ -206,7 +206,7 @@ sync_local() {
 		rm -fr portage
 	fi
 
-	if hasq metadata-transfer ${FEATURES} ; then
+	if has metadata-transfer ${FEATURES} ; then
 		vecho "Updating cache ..."
 		emerge --metadata
 	fi

diff --git a/bin/isolated-functions.sh b/bin/isolated-functions.sh
index a4bd0a9..5fbdd01 100644
--- a/bin/isolated-functions.sh
+++ b/bin/isolated-functions.sh
@@ -183,7 +183,7 @@ die() {
 		done
 	fi
 	if [ "${EMERGE_FROM}" != "binary" ] && \
-		! hasq ${EBUILD_PHASE} prerm postrm && \
+		! has ${EBUILD_PHASE} prerm postrm && \
 		[ "${EBUILD#${PORTDIR}/}" == "${EBUILD}" ] ; then
 		local overlay=${EBUILD%/*}
 		overlay=${overlay%/*}
@@ -538,7 +538,7 @@ has() {
 save_ebuild_env() {
 	(
 
-		if hasq --exclude-init-phases $* ; then
+		if has --exclude-init-phases $* ; then
 			unset S _E_DOCDESTTREE_ _E_EXEDESTTREE_
 			if [[ -n $PYTHONPATH ]] ; then
 				export PYTHONPATH=${PYTHONPATH/${PORTAGE_PYM_PATH}:}

diff --git a/bin/misc-functions.sh b/bin/misc-functions.sh
index d708c1d..a4f103d 100755
--- a/bin/misc-functions.sh
+++ b/bin/misc-functions.sh
@@ -150,7 +150,7 @@ install_qa_check() {
 
 	export STRIP_MASK
 	prepall
-	hasq "${EAPI}" 0 1 2 3 || prepcompress
+	has "${EAPI}" 0 1 2 3 || prepcompress
 	ecompressdir --dequeue
 	ecompress --dequeue
 
@@ -175,7 +175,7 @@ install_qa_check() {
 		sleep 1
 	done
 
-	if type -P scanelf > /dev/null && ! hasq binchecks ${RESTRICT}; then
+	if type -P scanelf > /dev/null && ! has binchecks ${RESTRICT}; then
 		local qa_var insecure_rpath=0 tmp_quiet=${PORTAGE_QUIET}
 		local x
 
@@ -685,7 +685,7 @@ install_qa_check() {
 				"developers of this software." | fmt -w 70 | \
 				while read -r line ; do eqawarn "${line}" ; done
 				eqawarn "Homepage: ${HOMEPAGE}"
-				hasq stricter ${FEATURES} && die "install aborted due to" \
+				has stricter ${FEATURES} && die "install aborted due to" \
 					"poor programming practices shown above"
 			fi
 		fi
@@ -694,7 +694,7 @@ install_qa_check() {
 	# Portage regenerates this on the installed system.
 	rm -f "${D}"/usr/share/info/dir{,.gz,.bz2}
 
-	if hasq multilib-strict ${FEATURES} && \
+	if has multilib-strict ${FEATURES} && \
 	   [[ -x /usr/bin/file && -x /usr/bin/find ]] && \
 	   [[ -n ${MULTILIB_STRICT_DIRS} && -n ${MULTILIB_STRICT_DENY} ]]
 	then
@@ -717,12 +717,12 @@ install_qa_check() {
 	fi
 
 	# ensure packages don't install systemd units automagically
-	if ! hasq systemd ${INHERITED} && \
+	if ! has systemd ${INHERITED} && \
 		[[ -d "${D}"/lib/systemd/system ]]
 	then
 		eqawarn "QA Notice: package installs systemd unit files (/lib/systemd/system)"
 		eqawarn "           but does not inherit systemd.eclass."
-		hasq stricter ${FEATURES} \
+		has stricter ${FEATURES} \
 			&& die "install aborted due to missing inherit of systemd.eclass"
 	fi
 }
@@ -765,7 +765,7 @@ preinst_mask() {
 	# remove man pages, info pages, docs if requested
 	local f
 	for f in man info doc; do
-		if hasq no${f} $FEATURES; then
+		if has no${f} $FEATURES; then
 			INSTALL_MASK="${INSTALL_MASK} /usr/share/${f}"
 		fi
 	done
@@ -773,7 +773,7 @@ preinst_mask() {
 	install_mask "${D}" "${INSTALL_MASK}"
 
 	# remove share dir if unnessesary
-	if hasq nodoc $FEATURES -o hasq noman $FEATURES -o hasq noinfo $FEATURES; then
+	if has nodoc $FEATURES -o has noman $FEATURES -o has noinfo $FEATURES; then
 		rmdir "${D}usr/share" &> /dev/null
 	fi
 }
@@ -784,7 +784,7 @@ preinst_sfperms() {
 		 return 1
 	fi
 	# Smart FileSystem Permissions
-	if hasq sfperms $FEATURES; then
+	if has sfperms $FEATURES; then
 		local i
 		find "${D}" -type f -perm -4000 -print0 | \
 		while read -r -d $'\0' i ; do
@@ -819,7 +819,7 @@ preinst_suid_scan() {
 		 return 1
 	fi
 	# total suid control.
-	if hasq suidctl $FEATURES; then
+	if has suidctl $FEATURES; then
 		local i sfconf x
 		sfconf=${PORTAGE_CONFIGROOT}etc/portage/suidctl.conf
 		# sandbox prevents us from writing directly
@@ -857,7 +857,7 @@ preinst_selinux_labels() {
 		 eerror "${FUNCNAME}: D is unset"
 		 return 1
 	fi
-	if hasq selinux ${FEATURES}; then
+	if has selinux ${FEATURES}; then
 		# SELinux file labeling (needs to always be last in dyn_preinst)
 		# only attempt to label if setfiles is executable
 		# and 'context' is available on selinuxfs.



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

end of thread, other threads:[~2024-06-01 11:14 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-28  5:19 [gentoo-commits] proj/portage:master commit in: bin/ebuild-helpers/, bin/ Zac Medico
  -- strict thread matches above, loose matches on Subject: below --
2024-06-01 11:14 Ulrich Müller
2023-10-21 19:23 Ulrich Müller
2021-05-24  4:55 Zac Medico
2018-09-20 18:49 Michał Górny
2018-03-04 21:05 Michał Górny
2014-12-04 14:01 Michał Górny
2014-08-19  7:01 Michał Górny
2014-08-10  0:10 Brian Dolbec
2013-05-12 20:47 Zac Medico
2013-05-12 11:16 Zac Medico
2012-12-11  9:01 Zac Medico
2012-11-22 22:06 Mike Frysinger
2012-09-26 20:33 Arfrever Frehtes Taifersar Arahesis
2012-09-14  7:26 Zac Medico
2012-09-14  7:26 Zac Medico
2012-09-02 22:57 Zac Medico
2012-08-15 20:45 Ulrich Mueller
2012-05-12  4:09 Mike Frysinger
2011-07-08 17:15 Zac Medico

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