@@ -, +, @@ --- bin/ebuild-helpers/4/dodoc | 3 ++- bin/ebuild-helpers/dobin | 5 +++-- bin/ebuild-helpers/doconfd | 3 ++- bin/ebuild-helpers/dodir | 7 ++++++- bin/ebuild-helpers/dodoc | 6 ++++-- bin/ebuild-helpers/doenvd | 3 ++- bin/ebuild-helpers/doexe | 3 ++- bin/ebuild-helpers/dohtml | 8 +++++++- bin/ebuild-helpers/doinfo | 5 +++-- bin/ebuild-helpers/doinitd | 3 ++- bin/ebuild-helpers/doins | 5 +++-- bin/ebuild-helpers/dolib | 7 +++++-- bin/ebuild-helpers/doman | 3 ++- bin/ebuild-helpers/domo | 5 ++++- bin/ebuild-helpers/dosbin | 7 +++++-- bin/ebuild-helpers/dosym | 9 +++++++-- bin/ebuild-helpers/ecompress | 14 ++++++++++---- bin/ebuild-helpers/ecompressdir | 10 +++++++--- bin/ebuild-helpers/emake | 5 ++++- bin/ebuild-helpers/fowners | 7 ++++++- bin/ebuild-helpers/fperms | 7 ++++++- bin/ebuild-helpers/newbin | 6 ++++-- bin/ebuild-helpers/newconfd | 6 ++++-- bin/ebuild-helpers/newdoc | 6 ++++-- bin/ebuild-helpers/newenvd | 6 ++++-- bin/ebuild-helpers/newexe | 6 ++++-- bin/ebuild-helpers/newinitd | 6 ++++-- bin/ebuild-helpers/newins | 12 +++++++++--- bin/ebuild-helpers/newlib.a | 6 ++++-- bin/ebuild-helpers/newlib.so | 6 ++++-- bin/ebuild-helpers/newman | 6 ++++-- bin/ebuild-helpers/newsbin | 6 ++++-- bin/isolated-functions.sh | 11 +++++++++++ 33 files changed, 152 insertions(+), 56 deletions(-) --- a/bin/ebuild-helpers/4/dodoc +++ a/bin/ebuild-helpers/4/dodoc @@ -5,7 +5,7 @@ source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh if [ $# -lt 1 ] ; then - vecho "${0##*/}: at least one argument needed" 1>&2 + die "${0##*/}: at least one argument needed" exit 1 fi @@ -46,4 +46,5 @@ for x in "$@" ; do done +[[ $ret -ne 0 ]] && die "$0 failed" exit ${ret} --- a/bin/ebuild-helpers/dobin +++ a/bin/ebuild-helpers/dobin @@ -5,12 +5,12 @@ source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh if [[ $# -lt 1 ]] ; then - vecho "$0: at least one argument needed" 1>&2 + helpers_die "$0: at least one argument needed" exit 1 fi if [[ ! -d ${D}${DESTTREE}/bin ]] ; then - install -d "${D}${DESTTREE}/bin" || exit 2 + install -d "${D}${DESTTREE}/bin" || { helpers_die "$0: failed to install ${D}${DESTTREE}/bin"; exit 2; } fi ret=0 @@ -25,4 +25,5 @@ for x in "$@" ; do ((ret|=$?)) done +[[ $ret -ne 0 ]] && helpers_die "$0 failed" exit ${ret} --- a/bin/ebuild-helpers/doconfd +++ a/bin/ebuild-helpers/doconfd @@ -3,7 +3,8 @@ # Distributed under the terms of the GNU General Public License v2 if [[ $# -lt 1 ]] ; then - echo "$0: at least one argument needed" 1>&2 + source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh + helpers_die "$0: at least one argument needed" exit 1 fi --- a/bin/ebuild-helpers/dodir +++ a/bin/ebuild-helpers/dodir @@ -2,4 +2,9 @@ # Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -exec install -d ${DIROPTIONS} "${@/#/${D}/}" +source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh + +install -d ${DIROPTIONS} "${@/#/${D}/}" +ret=$? +[[ $ret -ne 0 ]] && helpers_die "$0 failed" +exit $ret --- a/bin/ebuild-helpers/dodoc +++ a/bin/ebuild-helpers/dodoc @@ -2,9 +2,10 @@ # Copyright 1999-2007 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 +source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh + if [ $# -lt 1 ] ; then - source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh - vecho "${0##*/}: at least one argument needed" 1>&2 + helpers_die "${0##*/}: at least one argument needed" exit 1 fi @@ -24,4 +25,5 @@ for x in "$@" ; do fi done +[[ $ret -ne 0 ]] && helpers_die "$0 failed" exit ${ret} --- a/bin/ebuild-helpers/doenvd +++ a/bin/ebuild-helpers/doenvd @@ -3,7 +3,8 @@ # Distributed under the terms of the GNU General Public License v2 if [[ $# -lt 1 ]] ; then - echo "$0: at least one argument needed" 1>&2 + source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh + helpers_die "$0: at least one argument needed" exit 1 fi --- a/bin/ebuild-helpers/doexe +++ a/bin/ebuild-helpers/doexe @@ -5,7 +5,7 @@ source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh if [[ $# -lt 1 ]] ; then - echo "$0: at least one argument needed" 1>&2 + helpers_die "$0: at least one argument needed" exit 1 fi @@ -39,4 +39,5 @@ done rm -rf "$TMP" +[[ $ret -ne 0 ]] && helpers_die "$0 failed" exit $ret --- a/bin/ebuild-helpers/dohtml +++ a/bin/ebuild-helpers/dohtml @@ -2,9 +2,15 @@ # Copyright 2009 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 +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} # Set EPYTHON variable as empty so that dohtml doesn't try # to use potentially unsupported version of Python. EPYTHON= PYTHONPATH=$PORTAGE_PYM_PATH${PYTHONPATH:+:}$PYTHONPATH \ - exec "$PORTAGE_BIN_PATH/dohtml.py" "$@" + "$PORTAGE_BIN_PATH/dohtml.py" "$@" + +ret=$? +[[ $ret -ne 0 ]] && helpers_die "$0 failed" +exit $ret --- a/bin/ebuild-helpers/doinfo +++ a/bin/ebuild-helpers/doinfo @@ -5,12 +5,12 @@ source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh if [[ -z $1 ]] ; then - vecho "${0##*/}: at least one argument needed" + helpers_die "${0##*/}: at least one argument needed" exit 1 fi if [[ ! -d ${D}usr/share/info ]] ; then - install -d "${D}usr/share/info" || exit 1 + install -d "${D}usr/share/info" || { helpers_die "$0: failed to install ${D}usr/share/info"; exit 1; } fi install -m0644 "$@" "${D}usr/share/info" @@ -19,5 +19,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" fi exit $rval --- a/bin/ebuild-helpers/doinitd +++ a/bin/ebuild-helpers/doinitd @@ -3,7 +3,8 @@ # Distributed under the terms of the GNU General Public License v2 if [[ $# -lt 1 ]] ; then - echo "$0: at least one argument needed" 1>&2 + source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh + helpers_die "$0: at least one argument needed" exit 1 fi --- a/bin/ebuild-helpers/doins +++ a/bin/ebuild-helpers/doins @@ -5,7 +5,7 @@ source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh if [ $# -lt 1 ] ; then - echo "${0##*/}: at least one argument needed" 1>&2 + helpers_die "${0##*/}: at least one argument needed" exit 1 fi @@ -21,6 +21,7 @@ if [[ ${INSDESTTREE#${D}} != "${INSDESTTREE}" ]]; then vecho "You should not use \${D} with helpers." 1>&2 vecho " --> ${INSDESTTREE}" 1>&2 vecho "-------------------------------------------------------" 1>&2 + helpers_die "$0 used with \${D}" exit 1 fi @@ -126,4 +127,4 @@ for x in "$@" ; do fi done rm -rf "$TMP" -[[ $failed -ne 0 || $success -eq 0 ]] && exit 1 || exit 0 +[[ $failed -ne 0 || $success -eq 0 ]] && { helpers_die "$0 failed"; exit 1; } || exit 0 --- a/bin/ebuild-helpers/dolib +++ a/bin/ebuild-helpers/dolib @@ -2,6 +2,8 @@ # Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 +source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh + # Setup ABI cruft LIBDIR_VAR="LIBDIR_${ABI}" if [[ -n ${ABI} && -n ${!LIBDIR_VAR} ]] ; then @@ -14,11 +16,11 @@ libdir="${D}${DESTTREE}/${CONF_LIBDIR}" if [[ $# -lt 1 ]] ; then - echo "$0: at least one argument needed" 1>&2 + helpers_die "$0: at least one argument needed" exit 1 fi if [[ ! -d ${libdir} ]] ; then - install -d "${libdir}" || exit 1 + install -d "${libdir}" || { helpers_die "$0: failed to install ${libdir}"; exit 1; } fi ret=0 @@ -37,4 +39,5 @@ for x in "$@" ; do ((ret|=$?)) done +[[ $ret -ne 0 ]] && helpers_die "$0 failed" exit ${ret} --- a/bin/ebuild-helpers/doman +++ a/bin/ebuild-helpers/doman @@ -5,7 +5,7 @@ source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh if [[ $# -lt 1 ]] ; then - echo "$0: at least one argument needed" 1>&2 + helpers_die "$0: at least one argument needed" exit 1 fi @@ -60,4 +60,5 @@ for x in "$@" ; do fi done +[[ $ret -ne 0 ]] && helpers_die "$0 failed" exit ${ret} --- a/bin/ebuild-helpers/domo +++ a/bin/ebuild-helpers/domo @@ -2,9 +2,11 @@ # Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 +source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh + mynum=${#} if [ ${mynum} -lt 1 ] ; then - echo "${0}: at least one argument needed" + helpers_die "${0}: at least one argument needed" exit 1 fi if [ ! -d "${D}${DESTTREE}/share/locale" ] ; then @@ -28,4 +30,5 @@ for x in "$@" ; do ((ret|=$?)) done +[[ $ret -ne 0 ]] && helpers_die "$0 failed" exit $ret --- a/bin/ebuild-helpers/dosbin +++ a/bin/ebuild-helpers/dosbin @@ -2,13 +2,15 @@ # Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 +source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh + if [[ $# -lt 1 ]] ; then - echo "$0: at least one argument needed" 1>&2 + helpers_die "$0: at least one argument needed" exit 1 fi if [[ ! -d ${D}${DESTTREE}/sbin ]] ; then - install -d "${D}${DESTTREE}/sbin" || exit 2 + install -d "${D}${DESTTREE}/sbin" || { helpers_die "$0: failed to install ${D}${DESTTREE}/sbin"; exit 2; } fi ret=0 @@ -23,4 +25,5 @@ for x in "$@" ; do ((ret|=$?)) done +[[ $ret -ne 0 ]] && helpers_die "$0 failed" exit ${ret} --- a/bin/ebuild-helpers/dosym +++ a/bin/ebuild-helpers/dosym @@ -2,12 +2,17 @@ # Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 +source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh + if [[ $# -ne 2 ]] ; then - echo "$0: two arguments needed" 1>&2 + helpers_die "$0: two arguments needed" exit 1 fi destdir=${2%/*} [[ ! -d ${D}${destdir} ]] && dodir "${destdir}" -exec ln -snf "$1" "${D}$2" +ln -snf "$1" "${D}$2" +ret=$? +[[ $ret -ne 0 ]] && helpers_die "$0 failed" +exit $ret --- a/bin/ebuild-helpers/ecompress +++ a/bin/ebuild-helpers/ecompress @@ -5,7 +5,7 @@ source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh if [[ -z $1 ]] ; then - vecho "${0##*/}: at least one argument needed" 1>&2 + helpers_die "${0##*/}: at least one argument needed" exit 1 fi @@ -95,7 +95,10 @@ case $1 in ;; --queue) shift - exec touch "${@/%/.ecompress.file}" + touch "${@/%/.ecompress.file}" + ret=$? + [[ $ret -ne 0 ]] && helpers_die "$0 failed" + exit $ret ;; --dequeue) [[ -n $2 ]] && vecho "${0##*/}: --dequeue takes no additional arguments" 1>&2 @@ -105,7 +108,7 @@ case $1 in find "${D}" -name '*.ecompress.file' -print0 | ${XARGS} -0 rm -f ;; --*) - vecho "${0##*/}: unknown arguments '$*'" 1>&2 + helpers_die "${0##*/}: unknown arguments '$*'" exit 1 ;; *) @@ -142,6 +145,9 @@ case $1 in [[ -n ${suffix} ]] && echo -n "${@/%/${suffix}$'\001'}" | \ tr '\001' '\000' | ${XARGS} -0 rm -f # Finally, let's actually do some real work - exec "${PORTAGE_COMPRESS}" ${PORTAGE_COMPRESS_FLAGS} "$@" + "${PORTAGE_COMPRESS}" ${PORTAGE_COMPRESS_FLAGS} "$@" + ret=$? + [[ $ret -ne 0 ]] && helpers_die "$0 failed" + exit $ret ;; esac --- a/bin/ebuild-helpers/ecompressdir +++ a/bin/ebuild-helpers/ecompressdir @@ -5,7 +5,7 @@ source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh if [[ -z $1 ]] ; then - vecho "${0##*/}: at least one argument needed" 1>&2 + helpers_die "${0##*/}: at least one argument needed" exit 1 fi @@ -21,7 +21,10 @@ case $1 in shift set -- "${@/%/.ecompress.dir}" set -- "${@/#/${D}}" - exec touch "$@" + touch "$@" + ret=$? + [[ $ret -ne 0 ]] && helpers_die "$0 failed" + exit $? ;; --dequeue) [[ -n $2 ]] && vecho "${0##*/}: --dequeue takes no additional arguments" 1>&2 @@ -32,7 +35,7 @@ case $1 in exit 0 ;; --*) - vecho "${0##*/}: unknown arguments '$*'" + helpers_die "${0##*/}: unknown arguments '$*'" exit 1 ;; esac @@ -132,4 +135,5 @@ for dir in "$@" ; do restore_skip_dirs done +[[ $ret -ne 0 ]] && helpers_die "$0 failed" exit ${ret} --- a/bin/ebuild-helpers/emake +++ a/bin/ebuild-helpers/emake @@ -21,4 +21,7 @@ if [[ $PORTAGE_QUIET != 1 ]] ; then ) >&2 fi -exec ${MAKE:-make} ${MAKEOPTS} ${EXTRA_EMAKE} "$@" +${MAKE:-make} ${MAKEOPTS} ${EXTRA_EMAKE} "$@" +ret=$? +[[ $ret -ne 0 ]] && helpers_die "$0 failed" +exit $ret --- a/bin/ebuild-helpers/fowners +++ a/bin/ebuild-helpers/fowners @@ -2,7 +2,12 @@ # Copyright 1999-2007 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 +source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh + # we can't prefix all arguments because # chown takes random options slash="/" -exec chown "${@/#${slash}/${D}${slash}}" +chown "${@/#${slash}/${D}${slash}}" +ret=$? +[[ $ret -ne 0 ]] && helpers_die "$0 failed" +exit $ret --- a/bin/ebuild-helpers/fperms +++ a/bin/ebuild-helpers/fperms @@ -2,7 +2,12 @@ # Copyright 1999-2007 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 +source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh + # we can't prefix all arguments because # chmod takes random options slash="/" -exec chmod "${@/#${slash}/${D}${slash}}" +chmod "${@/#${slash}/${D}${slash}}" +ret=$? +[[ $ret -ne 0 ]] && helpers_die "$0 failed" +exit $ret --- a/bin/ebuild-helpers/newbin +++ a/bin/ebuild-helpers/newbin @@ -2,13 +2,15 @@ # Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 +source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh + if [[ -z ${T} ]] || [[ -z ${2} ]] ; then - echo "$0: Need two arguments, old file and new file" 1>&2 + helpers_die "$0: Need two arguments, old file and new file" exit 1 fi if [ ! -e "$1" ] ; then - echo "!!! ${0##*/}: $1 does not exist" 1>&2 + helpers_die "!!! ${0##*/}: $1 does not exist" exit 1 fi --- a/bin/ebuild-helpers/newconfd +++ a/bin/ebuild-helpers/newconfd @@ -2,13 +2,15 @@ # Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 +source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh + if [[ -z ${T} ]] || [[ -z ${2} ]] ; then - echo "$0: Need two arguments, old file and new file" 1>&2 + helpers_die "$0: Need two arguments, old file and new file" exit 1 fi if [ ! -e "$1" ] ; then - echo "!!! ${0##*/}: $1 does not exist" 1>&2 + helpers_die "!!! ${0##*/}: $1 does not exist" exit 1 fi --- a/bin/ebuild-helpers/newdoc +++ a/bin/ebuild-helpers/newdoc @@ -2,13 +2,15 @@ # Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 +source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh + if [[ -z ${T} ]] || [[ -z ${2} ]] ; then - echo "$0: Need two arguments, old file and new file" 1>&2 + helpers_die "$0: Need two arguments, old file and new file" exit 1 fi if [ ! -e "$1" ] ; then - echo "!!! ${0##*/}: $1 does not exist" 1>&2 + helpers_die "!!! ${0##*/}: $1 does not exist" exit 1 fi --- a/bin/ebuild-helpers/newenvd +++ a/bin/ebuild-helpers/newenvd @@ -2,13 +2,15 @@ # Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 +source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh + if [[ -z ${T} ]] || [[ -z ${2} ]] ; then - echo "$0: Need two arguments, old file and new file" 1>&2 + helpers_die "$0: Need two arguments, old file and new file" exit 1 fi if [ ! -e "$1" ] ; then - echo "!!! ${0##*/}: $1 does not exist" 1>&2 + helpers_die "!!! ${0##*/}: $1 does not exist" exit 1 fi --- a/bin/ebuild-helpers/newexe +++ a/bin/ebuild-helpers/newexe @@ -2,13 +2,15 @@ # Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 +source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh + if [[ -z ${T} ]] || [[ -z ${2} ]] ; then - echo "$0: Need two arguments, old file and new file" 1>&2 + helpers_die "$0: Need two arguments, old file and new file" exit 1 fi if [ ! -e "$1" ] ; then - echo "!!! ${0##*/}: $1 does not exist" 1>&2 + helpers_die "!!! ${0##*/}: $1 does not exist" exit 1 fi --- a/bin/ebuild-helpers/newinitd +++ a/bin/ebuild-helpers/newinitd @@ -2,13 +2,15 @@ # Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 +source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh + if [[ -z ${T} ]] || [[ -z ${2} ]] ; then - echo "$0: Need two arguments, old file and new file" 1>&2 + helpers_die "$0: Need two arguments, old file and new file" exit 1 fi if [ ! -e "$1" ] ; then - echo "!!! ${0##*/}: $1 does not exist" 1>&2 + helpers_die "!!! ${0##*/}: $1 does not exist" exit 1 fi --- a/bin/ebuild-helpers/newins +++ a/bin/ebuild-helpers/newins @@ -2,13 +2,15 @@ # Copyright 1999-2009 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 +source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh + if [[ -z ${T} ]] || [[ -z ${2} ]] ; then - echo "$0: Need two arguments, old file and new file" 1>&2 + helpers_die "$0: Need two arguments, old file and new file" exit 1 fi if [ ! -e "$1" ] ; then - echo "!!! ${0##*/}: $1 does not exist" 1>&2 + helpers_die "!!! ${0##*/}: $1 does not exist" exit 1 fi @@ -18,10 +20,14 @@ case "$EAPI" in cp "$1" "$T/$2" || exit $? ;; *) - cp -P "$1" "$T/$2" || exit $? + cp -P "$1" "$T/$2" + ret=$? + [[ $ret -ne 0 ]] && helpers_die "$0 failed" + exit $ret ;; esac doins "${T}/${2}" ret=$? rm -rf "${T}/${2}" +[[ $ret -ne 0 ]] && helpers_die "$0 failed" exit $ret --- a/bin/ebuild-helpers/newlib.a +++ a/bin/ebuild-helpers/newlib.a @@ -2,13 +2,15 @@ # Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 +source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh + if [[ -z ${T} ]] || [[ -z ${2} ]] ; then - echo "$0: Need two arguments, old file and new file" 1>&2 + helpers_die "$0: Need two arguments, old file and new file" exit 1 fi if [ ! -e "$1" ] ; then - echo "!!! ${0##*/}: $1 does not exist" 1>&2 + helpers_die "!!! ${0##*/}: $1 does not exist" exit 1 fi --- a/bin/ebuild-helpers/newlib.so +++ a/bin/ebuild-helpers/newlib.so @@ -2,13 +2,15 @@ # Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 +source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh + if [[ -z ${T} ]] || [[ -z ${2} ]] ; then - echo "$0: Need two arguments, old file and new file" 1>&2 + helpers_die "$0: Need two arguments, old file and new file" exit 1 fi if [ ! -e "$1" ] ; then - echo "!!! ${0##*/}: $1 does not exist" 1>&2 + helpers_die "!!! ${0##*/}: $1 does not exist" exit 1 fi --- a/bin/ebuild-helpers/newman +++ a/bin/ebuild-helpers/newman @@ -2,13 +2,15 @@ # Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 +source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh + if [[ -z ${T} ]] || [[ -z ${2} ]] ; then - echo "$0: Need two arguments, old file and new file" 1>&2 + helpers_die "$0: Need two arguments, old file and new file" exit 1 fi if [ ! -e "$1" ] ; then - echo "!!! ${0##*/}: $1 does not exist" 1>&2 + helpers_die "!!! ${0##*/}: $1 does not exist" exit 1 fi --- a/bin/ebuild-helpers/newsbin +++ a/bin/ebuild-helpers/newsbin @@ -2,13 +2,15 @@ # Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 +source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh + if [[ -z ${T} ]] || [[ -z ${2} ]] ; then - echo "$0: Need two arguments, old file and new file" 1>&2 + helpers_die "$0: Need two arguments, old file and new file" exit 1 fi if [ ! -e "$1" ] ; then - echo "!!! ${0##*/}: $1 does not exist" 1>&2 + helpers_die "!!! ${0##*/}: $1 does not exist" exit 1 fi --- a/bin/isolated-functions.sh +++ a/bin/isolated-functions.sh @@ -70,6 +70,17 @@ nonfatal() { PORTAGE_NONFATAL=1 "$@" } +helpers_die() { + case "${EAPI:-0}" in + 4) + die "$@" + ;; + *) + echo -e "$@" >&2 + ;; + esac +} + die() { if [[ $PORTAGE_NONFATAL -eq 1 ]]; then echo -e " $WARN*$NORMAL ${FUNCNAME[1]}: WARNING: $@" >&2 --