summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorP. J. McDermott <pjm@nac.net>2012-09-09 17:10:13 (EDT)
committer P. J. McDermott <pjm@nac.net>2012-09-09 17:10:13 (EDT)
commit01cd33a44eaf9f92d748a3b92ff3cd84e8b45454 (patch)
treed63204bd97dadb5c8a71d9eafc3e946ba9166668 /lib
parent714f7e1115e937f1f1bb0618aee358af86be0a78 (diff)
Return rather than print value in _ob_return.
Don't use _ob_return in command substitutions. Doing so unsets stack variables only in a subshell environment.
Diffstat (limited to 'lib')
-rw-r--r--lib/changelog.sh15
-rw-r--r--lib/common.sh4
-rw-r--r--lib/control.sh12
-rw-r--r--lib/deps.sh21
-rw-r--r--lib/load.sh9
-rw-r--r--lib/locale.sh33
6 files changed, 61 insertions, 33 deletions
diff --git a/lib/changelog.sh b/lib/changelog.sh
index dc9ace2..6fcf79e 100644
--- a/lib/changelog.sh
+++ b/lib/changelog.sh
@@ -53,7 +53,8 @@ oh_parse_changelog()
_obpch_file="${1}"
_obpch_entry_cb="${2}"
else
- return $(_ob_return 125)
+ _ob_return 125
+ return ${?}
fi
# Parsing logic based on that of dpkg.
@@ -140,7 +141,8 @@ ${_obpch_line}"
_obpch_entries=$(($_obpch_entries + 1))
"${_obpch_entry_cb}"
if [ ${?} -ne 0 ]; then
- return $(_ob_return ${_obpch_entries})
+ _ob_return ${_obpch_entries}
+ return ${?}
fi
fi
_obpch_expect=next_or_eof
@@ -172,7 +174,8 @@ ${_obpch_blank_lines}${_obpch_line}"
"$(_ob_get_changelog_expect_str "${_obpch_expect}")"
fi
- return $(_ob_return ${_obpch_entries})
+ _ob_return ${_obpch_entries}
+ return ${?}
}
_ob_parse_changelog_error()
@@ -195,7 +198,8 @@ _ob_parse_changelog_error()
ob_set_text_domain "${_obpche_orig_text_domain}"
- return $(_ob_return 0)
+ _ob_return 0
+ return ${?}
}
_ob_get_changelog_expect_str()
@@ -209,5 +213,6 @@ _ob_get_changelog_expect_str()
ob_set_text_domain "${_obgces_orig_text_domain}"
- return $(_ob_return 0)
+ _ob_return 0
+ return ${?}
}
diff --git a/lib/common.sh b/lib/common.sh
index 73293d7..22b017c 100644
--- a/lib/common.sh
+++ b/lib/common.sh
@@ -36,7 +36,5 @@ _ob_return()
# Pop the variable list from the top of the stack.
_OB_STACK_VARS="${_OB_STACK_VARS%|*}"
- # Print the return value.
- echo ${1}
- return 0
+ return ${1}
}
diff --git a/lib/control.sh b/lib/control.sh
index 99bf2c5..5286a88 100644
--- a/lib/control.sh
+++ b/lib/control.sh
@@ -39,7 +39,8 @@ ob_parse_control()
_obpco_req_fields="${3}"
_obpco_opt_fields="${4}"
else
- return $(_ob_return 125)
+ _ob_return 125
+ return ${?}
fi
_obpco_all_fields=" ${_obpco_req_fields} ${_obpco_opt_fields} "
@@ -85,7 +86,8 @@ ob_parse_control()
OB_CONTROL_VALUE="${_obpco_value}"
"${_obpco_field_cb}"
if [ ${?} -ne 0 ]; then
- return $(_ob_return 0)
+ _ob_return 0
+ return ${?}
fi
else
# Continuation line.
@@ -111,7 +113,8 @@ ${_line# }"
"${_obpco_req_fields}"
fi
- return $(_ob_return 0)
+ _ob_return 0
+ return ${?}
}
_ob_parse_control_error()
@@ -138,5 +141,6 @@ _ob_parse_control_error()
ob_set_text_domain "${_obpcoe_orig_text_domain}"
- return $(_ob_return 0)
+ _ob_return 0
+ return ${?}
}
diff --git a/lib/deps.sh b/lib/deps.sh
index 3dc3460..1820940 100644
--- a/lib/deps.sh
+++ b/lib/deps.sh
@@ -49,7 +49,8 @@ ob_parse_dep()
_obpd_host_arch="${OPTARG}"
;;
?)
- return $(_ob_return 125)
+ _ob_return 125
+ return ${?}
;;
esac
done
@@ -62,7 +63,8 @@ ob_parse_dep()
# Remove leading, trailing, and duplicate spaces.
_obpd_dep="$(IFS=' ' echo ${_obpd_dep})"
else
- return $(_ob_return 125)
+ _ob_return 125
+ return ${?}
fi
# <pkg>[:<archqual>] [(<rel> <ver>)] [\[<arches>\]]
@@ -93,7 +95,8 @@ ob_parse_dep()
eval ${_obpd_comp_var}=\"\$\{_obpd_${_obpd_comp}\}\"
done
- return $(_ob_return 0)
+ _ob_return 0
+ return ${?}
}
ob_reduce_deps()
@@ -112,7 +115,8 @@ ob_reduce_deps()
_obrd_union=true
;;
?)
- return $(_ob_return 125)
+ _ob_return 125
+ return ${?}
;;
esac
done
@@ -121,7 +125,8 @@ ob_reduce_deps()
if [ "${#}" -eq 1 ]; then
_obrd_deps="${1}"
else
- return $(_ob_return 125)
+ _ob_return 125
+ return ${?}
fi
_obrd_orig_ifs="${IFS}"
@@ -137,7 +142,8 @@ ob_reduce_deps()
fi
done
- return $(_ob_return 0)
+ _ob_return 0
+ return ${?}
}
_ob_dep_arch_is_concerned()
@@ -164,5 +170,6 @@ _ob_dep_arch_is_concerned()
fi
done
- return $(_ob_return ${_obdaic_seen_arch})
+ _ob_return ${_obdaic_seen_arch}
+ return ${?}
}
diff --git a/lib/load.sh b/lib/load.sh
index f22e128..ee32e9b 100644
--- a/lib/load.sh
+++ b/lib/load.sh
@@ -31,15 +31,18 @@ ob_use()
if [ "${#}" -eq 1 ]; then
_obu_module="${1}"
else
- return $(_ob_return 125)
+ _ob_return 125
+ return ${?}
fi
_obu_module='@@LIBOPKBUILD@@'"/${_obu_module}.sm"
if [ -r "${_obu_module}" ]; then
. "${_obu_module}"
else
- return $(_ob_return 1)
+ _ob_return 1
+ return ${?}
fi
- return $(_ob_return 0)
+ _ob_return 0
+ return ${?}
}
diff --git a/lib/locale.sh b/lib/locale.sh
index 2bde6e0..53baa42 100644
--- a/lib/locale.sh
+++ b/lib/locale.sh
@@ -31,11 +31,13 @@ ob_get_text_domain()
_ob_local
if [ ${#} -ne 0 ]; then
- return $(_ob_return 125)
+ _ob_return 125
+ return ${?}
fi
echo "${_OB_TEXT_DOMAIN}"
- return $(_ob_return 0)
+ _ob_return 0
+ return ${?}
}
ob_set_text_domain()
@@ -45,7 +47,8 @@ ob_set_text_domain()
if [ ${#} -eq 1 ]; then
_OB_TEXT_DOMAIN="${1}"
else
- return $(_ob_return 125)
+ _ob_return 125
+ return ${?}
fi
# Make sure LC_MESSAGES is set.
@@ -67,12 +70,14 @@ ob_set_text_domain()
if ! _ob_try_load_messages "${_OB_DEFAULT_LOCALE}"; then
ob_warn 'Cannot load messages in "%s" domain.' \
"${_OB_TEXT_DOMAIN}"
- return $(_ob_return 1)
+ _ob_return 1
+ return ${?}
fi
fi
fi
- return $(_ob_return 0)
+ _ob_return 0
+ return ${?}
}
ob_set_locale_path()
@@ -82,12 +87,14 @@ ob_set_locale_path()
if [ ${#} -eq 1 ]; then
_obslp_format="${1}"
else
- return $(_ob_return 125)
+ _ob_return 125
+ return ${?}
fi
_OB_LOCALE_PATH="${_obslp_format}"
- return $(_ob_return 0)
+ _ob_return 0
+ return ${?}
}
ob_get_msg()
@@ -97,12 +104,14 @@ ob_get_msg()
if [ ${#} -eq 1 ]; then
_obgm_msgid="${1}"
else
- return $(_ob_return 125)
+ _ob_return 125
+ return ${?}
fi
IFS= eval echo "\$\{msg_${_OB_TEXT_DOMAIN}_${_obgm_msgid}\}"
- return $(_ob_return 0)
+ _ob_return 0
+ return ${?}
}
_ob_try_load_messages()
@@ -116,8 +125,10 @@ _ob_try_load_messages()
if [ -f "${_obtlm_ms}" ]; then
. "${_obtlm_ms}"
else
- return $(_ob_return 1)
+ _ob_return 1
+ return ${?}
fi
- return $(_ob_return 0)
+ _ob_return 0
+ return ${?}
}