aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Harder <radhermit@gmail.com>2015-07-07 22:47:11 -0400
committerTim Harder <radhermit@gmail.com>2015-07-07 22:52:58 -0400
commitea2da60f2bcc63afb551fccbdf99b65df830b1a5 (patch)
tree40b4181053b2e3e7deacd281f25404ce1d11abb9
parentbash: speed up unpack() by only doing chmods when needed (diff)
downloadpkgcore-ea2da60f2bcc63afb551fccbdf99b65df830b1a5.tar.gz
pkgcore-ea2da60f2bcc63afb551fccbdf99b65df830b1a5.tar.bz2
pkgcore-ea2da60f2bcc63afb551fccbdf99b65df830b1a5.zip
bash: generalize internal error messages
Makes it easier to copy them around or change function names later.
-rw-r--r--bash/ebuild-env-utils.lib8
-rw-r--r--bash/isolated-functions.lib6
2 files changed, 7 insertions, 7 deletions
diff --git a/bash/ebuild-env-utils.lib b/bash/ebuild-env-utils.lib
index d064e1654..db03f594a 100644
--- a/bash/ebuild-env-utils.lib
+++ b/bash/ebuild-env-utils.lib
@@ -49,7 +49,7 @@ __environ_list_funcs() {
declare() {
echo "$2"
}
- eval "${__content}" || die "__environ_list_funcs eval failed" >&2
+ eval "${__content}" || die "${FUNCNAME} eval failed" >&2
unset -f declare
:
}
@@ -60,7 +60,7 @@ __environ_list_vars() {
[[ $2 != ${__ret} ]] && echo "${__ret}"
:
}
- eval "$(builtin declare -p)" || die "__environ_list_vars eval failed" >&2
+ eval "$(builtin declare -p)" || die "${FUNCNAME} eval failed" >&2
unset -f declare
:
}
@@ -98,7 +98,7 @@ __environ_dump() {
# dump environ to $1, optionally piping it through $2 and redirecting $2's output to $1.
__environ_save_to_file() {
if [[ $# -ne 1 && $# -ne 2 ]]; then
- die "__environ_save_to_file requires at least one argument, two max; given $@"
+ die "${FUNCNAME} requires at least one argument, two max; given $@"
fi
# the spaces on both sides are important- otherwise, the later ${DONT_EXPORT_VARS/ temp_umask /} won't match.
@@ -132,7 +132,7 @@ __environ_sanitize_saved_env() {
die "scrub_environ called with wrong args, only one can be given: $@"
fi
- [[ ! -f $1 ]] && die "__environ_sanitize_saved_env called with a nonexist env: $1"
+ [[ ! -f $1 ]] && die "${FUNCNAME} called with a nonexist env: $1"
src=$1
diff --git a/bash/isolated-functions.lib b/bash/isolated-functions.lib
index cc640d0c5..6152a6897 100644
--- a/bash/isolated-functions.lib
+++ b/bash/isolated-functions.lib
@@ -155,9 +155,9 @@ __shopt_push() {
} &> /dev/null
__shopt_pop() {
- [[ $# -ne 0 ]] && die "bad invocation of __shopt_pop; no args should be supplied, got $@"
+ [[ $# -ne 0 ]] && die "${FUNCNAME} accepts no args, got $@"
local count=$(( ${#PKGCORE_SHOPT_STACK[@]} - 1 ))
- [[ ${count} -le 0 ]] && die "bad __shopt_pop invocation; no matching push, stack was empty"
+ [[ ${count} -le 0 ]] && die "${FUNCNAME} invoked with nothing on the stack"
local set_val=${PKGCORE_SHOPT_STACK[${count}]}
if [[ $- != ${set_val} ]]; then
@@ -196,7 +196,7 @@ __IFS_push() {
__IFS_pop() {
if [[ ${#PKGCORE_SAVED_IFS[@]} -eq 0 ]]; then
- die "__IFS_pop invoked with nothing on the stack..."
+ die "${FUNCNAME} invoked with nothing on the stack"
fi
IFS=${PKGCORE_SAVED_IFS[$(( ${#PKGCORE_SAVED_IFS[@]} - 1 ))]}
[[ ${IFS} == unset ]] && unset IFS