summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDror Levin <spatz@gentoo.org>2010-05-26 23:23:38 +0300
committerZac Medico <zmedico@gentoo.org>2010-08-12 01:39:43 -0700
commit65c1a6e0dddf0d99af7adbd41484150d5fc6ef9c (patch)
treef7f1bd8c5215758ec7e21c8ec8eb0ba725688c63
parentef30f84cc7e91bf777f505384dd9869606d4dc5f (diff)
downloadportage-65c1a6e0dddf0d99af7adbd41484150d5fc6ef9c.tar.gz
portage-65c1a6e0dddf0d99af7adbd41484150d5fc6ef9c.tar.bz2
portage-65c1a6e0dddf0d99af7adbd41484150d5fc6ef9c.zip
Make utilities die on failure in EAPI 4, bug 273651
-rwxr-xr-xbin/ebuild-helpers/4/dodoc3
-rwxr-xr-xbin/ebuild-helpers/dobin5
-rwxr-xr-xbin/ebuild-helpers/doconfd3
-rwxr-xr-xbin/ebuild-helpers/dodir7
-rwxr-xr-xbin/ebuild-helpers/dodoc6
-rwxr-xr-xbin/ebuild-helpers/doenvd3
-rwxr-xr-xbin/ebuild-helpers/doexe3
-rwxr-xr-xbin/ebuild-helpers/dohtml8
-rwxr-xr-xbin/ebuild-helpers/doinfo5
-rwxr-xr-xbin/ebuild-helpers/doinitd3
-rwxr-xr-xbin/ebuild-helpers/doins5
-rwxr-xr-xbin/ebuild-helpers/dolib7
-rwxr-xr-xbin/ebuild-helpers/doman3
-rwxr-xr-xbin/ebuild-helpers/domo5
-rwxr-xr-xbin/ebuild-helpers/dosbin7
-rwxr-xr-xbin/ebuild-helpers/dosym9
-rwxr-xr-xbin/ebuild-helpers/ecompress14
-rwxr-xr-xbin/ebuild-helpers/ecompressdir10
-rwxr-xr-xbin/ebuild-helpers/emake5
-rwxr-xr-xbin/ebuild-helpers/fowners7
-rwxr-xr-xbin/ebuild-helpers/fperms7
-rwxr-xr-xbin/ebuild-helpers/newbin6
-rwxr-xr-xbin/ebuild-helpers/newconfd6
-rwxr-xr-xbin/ebuild-helpers/newdoc6
-rwxr-xr-xbin/ebuild-helpers/newenvd6
-rwxr-xr-xbin/ebuild-helpers/newexe6
-rwxr-xr-xbin/ebuild-helpers/newinitd6
-rwxr-xr-xbin/ebuild-helpers/newins12
-rwxr-xr-xbin/ebuild-helpers/newlib.a6
-rwxr-xr-xbin/ebuild-helpers/newlib.so6
-rwxr-xr-xbin/ebuild-helpers/newman6
-rwxr-xr-xbin/ebuild-helpers/newsbin6
-rwxr-xr-xbin/ebuild.sh24
-rw-r--r--bin/isolated-functions.sh11
34 files changed, 172 insertions, 60 deletions
diff --git a/bin/ebuild-helpers/4/dodoc b/bin/ebuild-helpers/4/dodoc
index 0539de110..c9068a8b5 100755
--- a/bin/ebuild-helpers/4/dodoc
+++ b/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}
diff --git a/bin/ebuild-helpers/dobin b/bin/ebuild-helpers/dobin
index 821ce07c3..fc0b0359f 100755
--- a/bin/ebuild-helpers/dobin
+++ b/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}
diff --git a/bin/ebuild-helpers/doconfd b/bin/ebuild-helpers/doconfd
index 718c21ece..749372a4a 100755
--- a/bin/ebuild-helpers/doconfd
+++ b/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
diff --git a/bin/ebuild-helpers/dodir b/bin/ebuild-helpers/dodir
index 50e10f45a..58303b2fc 100755
--- a/bin/ebuild-helpers/dodir
+++ b/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
diff --git a/bin/ebuild-helpers/dodoc b/bin/ebuild-helpers/dodoc
index 796e96c65..6d750c939 100755
--- a/bin/ebuild-helpers/dodoc
+++ b/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}
diff --git a/bin/ebuild-helpers/doenvd b/bin/ebuild-helpers/doenvd
index cfc70e2a5..bd21f5aea 100755
--- a/bin/ebuild-helpers/doenvd
+++ b/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
diff --git a/bin/ebuild-helpers/doexe b/bin/ebuild-helpers/doexe
index fb1c5668b..191e7f918 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
- 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
diff --git a/bin/ebuild-helpers/dohtml b/bin/ebuild-helpers/dohtml
index cfcab2af0..c5bfd0637 100755
--- a/bin/ebuild-helpers/dohtml
+++ b/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
diff --git a/bin/ebuild-helpers/doinfo b/bin/ebuild-helpers/doinfo
index 96413aa6a..2c3d1e071 100755
--- a/bin/ebuild-helpers/doinfo
+++ b/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
diff --git a/bin/ebuild-helpers/doinitd b/bin/ebuild-helpers/doinitd
index 56c8396c8..8ea51f1ee 100755
--- a/bin/ebuild-helpers/doinitd
+++ b/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
diff --git a/bin/ebuild-helpers/doins b/bin/ebuild-helpers/doins
index 64d2af23c..c59b9bcfd 100755
--- a/bin/ebuild-helpers/doins
+++ b/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
diff --git a/bin/ebuild-helpers/dolib b/bin/ebuild-helpers/dolib
index 794fdb64f..821e1321e 100755
--- a/bin/ebuild-helpers/dolib
+++ b/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}
diff --git a/bin/ebuild-helpers/doman b/bin/ebuild-helpers/doman
index e428b7292..0d95c18ba 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
- 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}
diff --git a/bin/ebuild-helpers/domo b/bin/ebuild-helpers/domo
index 5a1e808e7..43f78d010 100755
--- a/bin/ebuild-helpers/domo
+++ b/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
diff --git a/bin/ebuild-helpers/dosbin b/bin/ebuild-helpers/dosbin
index 8920d37e8..a16015ed6 100755
--- a/bin/ebuild-helpers/dosbin
+++ b/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}
diff --git a/bin/ebuild-helpers/dosym b/bin/ebuild-helpers/dosym
index 52defbe85..1015a28e5 100755
--- a/bin/ebuild-helpers/dosym
+++ b/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
diff --git a/bin/ebuild-helpers/ecompress b/bin/ebuild-helpers/ecompress
index c6817ec3a..8e6fc9c8d 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
- 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
diff --git a/bin/ebuild-helpers/ecompressdir b/bin/ebuild-helpers/ecompressdir
index 5d7fdf04b..fdecaf0a2 100755
--- a/bin/ebuild-helpers/ecompressdir
+++ b/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}
diff --git a/bin/ebuild-helpers/emake b/bin/ebuild-helpers/emake
index 97ea13660..7103585ce 100755
--- a/bin/ebuild-helpers/emake
+++ b/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
diff --git a/bin/ebuild-helpers/fowners b/bin/ebuild-helpers/fowners
index 1097296da..95a49fdad 100755
--- a/bin/ebuild-helpers/fowners
+++ b/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
diff --git a/bin/ebuild-helpers/fperms b/bin/ebuild-helpers/fperms
index 6c236ab68..cdd409a05 100755
--- a/bin/ebuild-helpers/fperms
+++ b/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
diff --git a/bin/ebuild-helpers/newbin b/bin/ebuild-helpers/newbin
index fb2752a10..7bfb19407 100755
--- a/bin/ebuild-helpers/newbin
+++ b/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
diff --git a/bin/ebuild-helpers/newconfd b/bin/ebuild-helpers/newconfd
index 94497d18d..68a7ed76b 100755
--- a/bin/ebuild-helpers/newconfd
+++ b/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
diff --git a/bin/ebuild-helpers/newdoc b/bin/ebuild-helpers/newdoc
index 1bc6a05f8..1a353784d 100755
--- a/bin/ebuild-helpers/newdoc
+++ b/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
diff --git a/bin/ebuild-helpers/newenvd b/bin/ebuild-helpers/newenvd
index 06b44050a..c7a073202 100755
--- a/bin/ebuild-helpers/newenvd
+++ b/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
diff --git a/bin/ebuild-helpers/newexe b/bin/ebuild-helpers/newexe
index 63dff5002..b2173fbfb 100755
--- a/bin/ebuild-helpers/newexe
+++ b/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
diff --git a/bin/ebuild-helpers/newinitd b/bin/ebuild-helpers/newinitd
index e74a6aaf6..384942604 100755
--- a/bin/ebuild-helpers/newinitd
+++ b/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
diff --git a/bin/ebuild-helpers/newins b/bin/ebuild-helpers/newins
index 1e11b432e..3d4870f8d 100755
--- a/bin/ebuild-helpers/newins
+++ b/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
diff --git a/bin/ebuild-helpers/newlib.a b/bin/ebuild-helpers/newlib.a
index 120e8a257..cdc908245 100755
--- a/bin/ebuild-helpers/newlib.a
+++ b/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
diff --git a/bin/ebuild-helpers/newlib.so b/bin/ebuild-helpers/newlib.so
index 2fbe59a1f..cd1469325 100755
--- a/bin/ebuild-helpers/newlib.so
+++ b/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
diff --git a/bin/ebuild-helpers/newman b/bin/ebuild-helpers/newman
index 758112c3d..fdc2fe629 100755
--- a/bin/ebuild-helpers/newman
+++ b/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
diff --git a/bin/ebuild-helpers/newsbin b/bin/ebuild-helpers/newsbin
index bf1fbc8e6..4d21549af 100755
--- a/bin/ebuild-helpers/newsbin
+++ b/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
diff --git a/bin/ebuild.sh b/bin/ebuild.sh
index ee565b1f7..01fa46217 100755
--- a/bin/ebuild.sh
+++ b/bin/ebuild.sh
@@ -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
}
diff --git a/bin/isolated-functions.sh b/bin/isolated-functions.sh
index fb6ad64ff..ddcf8f0d7 100644
--- a/bin/isolated-functions.sh
+++ b/bin/isolated-functions.sh
@@ -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