Make utilities die on failure in EAPI 4, bug 273651
authorDror Levin <spatz@gentoo.org>
Wed, 26 May 2010 20:23:38 +0000 (23:23 +0300)
committerZac Medico <zmedico@gentoo.org>
Thu, 12 Aug 2010 08:39:43 +0000 (01:39 -0700)
34 files changed:
bin/ebuild-helpers/4/dodoc
bin/ebuild-helpers/dobin
bin/ebuild-helpers/doconfd
bin/ebuild-helpers/dodir
bin/ebuild-helpers/dodoc
bin/ebuild-helpers/doenvd
bin/ebuild-helpers/doexe
bin/ebuild-helpers/dohtml
bin/ebuild-helpers/doinfo
bin/ebuild-helpers/doinitd
bin/ebuild-helpers/doins
bin/ebuild-helpers/dolib
bin/ebuild-helpers/doman
bin/ebuild-helpers/domo
bin/ebuild-helpers/dosbin
bin/ebuild-helpers/dosym
bin/ebuild-helpers/ecompress
bin/ebuild-helpers/ecompressdir
bin/ebuild-helpers/emake
bin/ebuild-helpers/fowners
bin/ebuild-helpers/fperms
bin/ebuild-helpers/newbin
bin/ebuild-helpers/newconfd
bin/ebuild-helpers/newdoc
bin/ebuild-helpers/newenvd
bin/ebuild-helpers/newexe
bin/ebuild-helpers/newinitd
bin/ebuild-helpers/newins
bin/ebuild-helpers/newlib.a
bin/ebuild-helpers/newlib.so
bin/ebuild-helpers/newman
bin/ebuild-helpers/newsbin
bin/ebuild.sh
bin/isolated-functions.sh

index 0539de11072bd57ae65e8f30e0e8ac14481fe40b..c9068a8b5d07b1cdf5ed7d1eb913f5a8abb69eb5 100755 (executable)
@@ -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}
index 821ce07c36c7c43e2d89aeae0e0d1c73e53bd1c1..fc0b0359f1998c803527292d4f3557ae9c06405e 100755 (executable)
@@ -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}
index 718c21ecefef1348de699f67beecf901470e5481..749372a4a7a83f104fa4ab63942bc7ebc19754f8 100755 (executable)
@@ -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
 
index 50e10f45ac9e2462fc8df8876312a185a669f137..58303b2fcc30bf3083dd45a17322055d3d243108 100755 (executable)
@@ -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
index 796e96c65ec5e88ab4bd8420d523c4e58579d501..6d750c9392d808b1c51fe516ca8f93bd251c1b55 100755 (executable)
@@ -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}
index cfc70e2a543d51e8ec0cbc03672d8caff142e6ff..bd21f5aead84a8db75d890c59d536d675d0dd51c 100755 (executable)
@@ -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
 
index fb1c5668bbeff0b7071831a7cc351de3254a5f3d..191e7f91898c8decbf44c741665f40cc289bc68e 100755 (executable)
@@ -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
index cfcab2af026f707e2c25426e03ce2eaa4fd58806..c5bfd0637f852bdbd22d0cd56ac4ca1adc422dab 100755 (executable)
@@ -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
index 96413aa6a9c7801d83ad56cea4f7fafd9745b6a6..2c3d1e0718aaecf2e645ca69239cde0a9fd38968 100755 (executable)
@@ -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
index 56c8396c834f6f009c92607f071c53e7e94884da..8ea51f1ee1a7050d6ea349917002a4021d384381 100755 (executable)
@@ -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
 
index 64d2af23cf08f8add70e1b022fbc434d6d88eabb..c59b9bcfdff83e9daa11b8230d369ea136c51ef4 100755 (executable)
@@ -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
index 794fdb64fa6cc390e9920f0e4b674141b9f93443..821e1321e2acd3dbca76496a55a74130d962a840 100755 (executable)
@@ -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}
index e428b7292e1826ac45e2eeb121284181f9ab0694..0d95c18baeb964a063516d4bfbc594f7c0e06175 100755 (executable)
@@ -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}
index 5a1e808e71f9698fc5d6b3c47779f235dda8bd9e..43f78d010bafee8fade038d7ba690eb9a6358f4c 100755 (executable)
@@ -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
index 8920d37e8418ffc4cff16dd2287af71dc2fbe998..a16015ed6e871e0651ab507e44b2420cbc8c768d 100755 (executable)
@@ -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}
index 52defbe8579910f81f47b4e5f13438ae39bef6ba..1015a28e577a212f2aefb7ff1de9b294dccfb2d0 100755 (executable)
@@ -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
index c6817ec3a02f91a10d54227ad40f89c17ecd5ba0..8e6fc9c8d86b2ca844231fbef17891d2cdd69d38 100755 (executable)
@@ -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
index 5d7fdf04ba413734c8683f3a7ab2851b03d200c8..fdecaf0a23b36cc8168c92f382179f7552ea2385 100755 (executable)
@@ -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}
index 97ea13660d8db9d3947b817920f371cf2c4b0f42..7103585ce3bd9078aafc427e42a2b2b5b215007e 100755 (executable)
@@ -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
index 1097296da25994407679992b6c00b44bff0dff75..95a49fdad0d1ee7b2986f59df833f24e83c51ba2 100755 (executable)
@@ -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
index 6c236ab687fbf331d970fc1a6a6be2f25473ba15..cdd409a057aba40c54b9df34db46aaec1976f234 100755 (executable)
@@ -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
index fb2752a1027511d1555090dc9f9170c78947f773..7bfb19407b34a4919bc0a6a54f42a43bbe94c5d1 100755 (executable)
@@ -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
 
index 94497d18d047bd1bc3310f748de74fa25ce99829..68a7ed76bcce1316e7fed07ebd7b6f296d389dfc 100755 (executable)
@@ -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
 
index 1bc6a05f81c8bf2d7e2f6145a07aa9e765414f55..1a353784d22719552a8153fc544d82928c335a90 100755 (executable)
@@ -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
 
index 06b44050a9ed38e8b6206ef4c62f41fb17f4904b..c7a073202cd0cd20db689c2a62e1463ab2a4c1b2 100755 (executable)
@@ -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
 
index 63dff5002631d8392444554f87ba6f93bcb06701..b2173fbfb413245c800984dcbae920e6f45a98b1 100755 (executable)
@@ -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
 
index e74a6aaf62f90d9f8a98f1503a0db0f74221cef3..384942604bbef10fe5f9101ea4243e7250fab36d 100755 (executable)
@@ -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
 
index 1e11b432e4113ae48e117d5ba6b36268653ba81c..3d4870f8d703f028ab5bbd3bb66101491fe927f2 100755 (executable)
@@ -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
index 120e8a25758801b2edba5ee038c705067a2770ba..cdc908245eb450c83182c0654384ef6bc7f25533 100755 (executable)
@@ -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
 
index 2fbe59a1fafc8b910883a9e4601b10290ee45241..cd14693257be3aa8b7cbca82ed64e7e7653b2379 100755 (executable)
@@ -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
 
index 758112c3df2b5d0ba0125e5262a2d302e81e4e01..fdc2fe629290bf4084c61cc762775d0a58832945 100755 (executable)
@@ -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
 
index bf1fbc8e696c8ccbedac17caa2048c13c66a3580..4d21549af521ba9e38ade6747b62ad90573122a5 100755 (executable)
@@ -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
 
index ee565b1f79c6194de63db342dce9d70192a33fac..01fa462175b655e56700d1c4a257937242e08980 100755 (executable)
@@ -779,7 +779,11 @@ into() {
        else
                export DESTTREE=$1
                if [ ! -d "${D}${DESTTREE}" ]; then
-                       install -d "${D}${DESTTREE}"
+                       if ! install -d "${D}${DESTTREE}"; then
+                               ret=$?
+                               [[ $ret -ne 0 ]] && helpers_die "$0 failed"
+                               return $ret
+                       fi
                fi
        fi
 }
@@ -790,7 +794,11 @@ insinto() {
        else
                export INSDESTTREE=$1
                if [ ! -d "${D}${INSDESTTREE}" ]; then
-                       install -d "${D}${INSDESTTREE}"
+                       if ! install -d "${D}${INSDESTTREE}"; then
+                               ret=$?
+                               [[ $ret -ne 0 ]] && helpers_die "$0 failed"
+                               return $ret
+                       fi
                fi
        fi
 }
@@ -801,7 +809,11 @@ exeinto() {
        else
                export _E_EXEDESTTREE_="$1"
                if [ ! -d "${D}${_E_EXEDESTTREE_}" ]; then
-                       install -d "${D}${_E_EXEDESTTREE_}"
+                       if ! install -d "${D}${_E_EXEDESTTREE_}"; then
+                               ret=$?
+                               [[ $ret -ne 0 ]] && helpers_die "$0 failed"
+                               return $ret
+                       fi
                fi
        fi
 }
@@ -812,7 +824,11 @@ docinto() {
        else
                export _E_DOCDESTTREE_="$1"
                if [ ! -d "${D}usr/share/doc/${PF}/${_E_DOCDESTTREE_}" ]; then
-                       install -d "${D}usr/share/doc/${PF}/${_E_DOCDESTTREE_}"
+                       if ! install -d "${D}usr/share/doc/${PF}/${_E_DOCDESTTREE_}"; then
+                               ret=$?
+                               [[ $ret -ne 0 ]] && helpers_die "$0 failed"
+                               return $ret
+                       fi
                fi
        fi
 }
index fb6ad64ff5075ded8f2490647bd7106e5be93ac6..ddcf8f0d7bc82df3c5978a030f48a23a2f179798 100644 (file)
@@ -70,6 +70,17 @@ nonfatal() {
        PORTAGE_NONFATAL=1 "$@"
 }
 
+helpers_die() {
+       case "${EAPI:-0}" in
+               0|1|2|3)
+                       echo -e "$@" >&2
+                       ;;
+               *)
+                       die "$@"
+                       ;;
+       esac
+}
+
 die() {
        if [[ $PORTAGE_NONFATAL -eq 1 ]]; then
                echo -e " $WARN*$NORMAL ${FUNCNAME[1]}: WARNING: $@" >&2