summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorP. J. McDermott <pjm@nac.net>2013-08-18 11:25:47 (EDT)
committer P. J. McDermott <pjm@nac.net>2013-08-18 11:25:47 (EDT)
commit0af9f60c7260aff16aa81c4d132b6a42b09e1c1d (patch)
tree46aa4a5d5a2804511b4c0d58936a8b7424fe7f36 /lib
parent911060e139ab24c01cb0f0bdaf89f01a37e3effe (diff)
parent6b82e03934750ce1bc2d8c4d4f8ac6f3f4dbff82 (diff)
Merge branch 'feature/remove-_ob_local'.
Diffstat (limited to 'lib')
-rw-r--r--lib/changelog.sh204
-rw-r--r--lib/common.sh29
-rw-r--r--lib/control.sh245
-rw-r--r--lib/deps.sh243
-rw-r--r--lib/load.sh19
-rw-r--r--lib/locale.sh62
-rw-r--r--lib/metadata.sh243
-rw-r--r--lib/metadata/proteanos.sh101
-rw-r--r--lib/package.sh327
-rw-r--r--lib/package/2.sh99
10 files changed, 730 insertions, 842 deletions
diff --git a/lib/changelog.sh b/lib/changelog.sh
index 2f1515f..9aaa0b9 100644
--- a/lib/changelog.sh
+++ b/lib/changelog.sh
@@ -33,174 +33,178 @@ OB_CHANGELOG_DATE=
ob_parse_changelog()
{
- _ob_local _obpch_file _obpch_entry_cb \
- _obpch_line_nr _obpch_line _obpch_line_ \
- _obpch_expect _obpch_blank_lines \
- _obpch_source _obpch_distribution _obpch_version \
- _obpch_maintainer _obpch_date
+ local file=
+ local entry_cb=
+ local line_nr=
+ local line=
+ local line_=
+ local expect=
+ local blank_lines=
+ local source=
+ local distribution=
+ local version=
+ local maintainer=
+ local date=
if [ ${#} -eq 2 ]; then
- _obpch_file="${1}"
- _obpch_entry_cb="${2}"
+ file="${1}"
+ entry_cb="${2}"
else
- _ob_return 125
- return ${?}
+ return 125
fi
# Parsing logic based on that of dpkg.
- _obpch_line_nr=0
- _obpch_expect='first_heading'
+ line_nr=0
+ expect='first_heading'
- while IFS= read _obpch_line; do
- _obpch_line_nr=$(($_obpch_line_nr + 1))
- if [ -z "${_obpch_line}" ]; then
- if [ "${_obpch_expect}" = 'start_changes' ]; then
+ while IFS= read line; do
+ line_nr=$(($line_nr + 1))
+ if [ -z "${line}" ]; then
+ if [ "${expect}" = 'start_changes' ]; then
OB_CHANGELOG_CHANGES="${OB_CHANGELOG_CHANGES}
-${_obpch_line}"
- elif [ "${_obpch_expect}" = 'next_or_eof' ]; then
+${line}"
+ elif [ "${expect}" = 'next_or_eof' ]; then
:
- elif [ "${_obpch_expect}" != 'changes_or_trailer' ]; then
- _ob_parse_changelog_error "${_obpch_file}" "${_obpch_line_nr}" \
+ elif [ "${expect}" != 'changes_or_trailer' ]; then
+ _ob_parse_changelog_error "${file}" "${line_nr}" \
'changelog_found_blank_line' \
- "$(_ob_get_changelog_expect_str "${_obpch_expect}")"
+ "$(_ob_get_changelog_expect_str "${expect}")"
else
- _obpch_blank_lines="${_obpch_blank_lines}
-${_obpch_line}"
+ blank_lines="${blank_lines}
+${line}"
fi
- elif [ "${_obpch_line# }" = "${_obpch_line}" ]; then
- if [ "${_obpch_expect}" != 'first_heading' -a \
- "${_obpch_expect}" != 'next_or_eof' ]; then
- _ob_parse_changelog_error "${_obpch_file}" "${_obpch_line_nr}" \
+ elif [ "${line# }" = "${line}" ]; then
+ if [ "${expect}" != 'first_heading' -a \
+ "${expect}" != 'next_or_eof' ]; then
+ _ob_parse_changelog_error "${file}" "${line_nr}" \
'changelog_found_heading' \
- "$(_ob_get_changelog_expect_str "${_obpch_expect}")"
+ "$(_ob_get_changelog_expect_str "${expect}")"
fi
- _obpch_source="${_obpch_line%% (*}"
- _obpch_line_="${_obpch_line#* (}"
- _obpch_distribution="${_obpch_line_##*) }"
- _obpch_line_="${_obpch_line_%) *}"
- _obpch_version="${_obpch_line_}"
- if [ -z "${_obpch_source}" -o -z "${_obpch_distribution}" -o \
- -z "${_obpch_version}" -o \
- "${_obpch_version% *}" != "${_obpch_version}" ]; then
- _ob_parse_changelog_error "${_obpch_file}" "${_obpch_line_nr}" \
+ source="${line%% (*}"
+ line_="${line#* (}"
+ distribution="${line_##*) }"
+ line_="${line_%) *}"
+ version="${line_}"
+ if [ -z "${source}" -o -z "${distribution}" -o \
+ -z "${version}" -o \
+ "${version% *}" != "${version}" ]; then
+ _ob_parse_changelog_error "${file}" "${line_nr}" \
'changelog_bad_heading'
OB_CHANGELOG_SOURCE=
OB_CHANGELOG_VERSION=
OB_CHANGELOG_DISTRIBUTION=
OB_CHANGELOG_CHANGES=
else
- if ! ob_validate_source_name "${_obpch_source}"; then
+ if ! ob_validate_source_name "${source}"; then
_ob_parse_changelog_error \
- "${_obpch_file}" "${_obpch_line_nr}" \
+ "${file}" "${line_nr}" \
'changelog_bad_source' "${source}"
fi
- if ! ob_parse_version "${_obpch_version}"; then
+ if ! ob_parse_version "${version}"; then
_ob_parse_changelog_error \
- "${_obpch_file}" "${_obpch_line_nr}" \
- 'changelog_bad_source_version' "${_obpch_version}"
+ "${file}" "${line_nr}" \
+ 'changelog_bad_source_version' "${version}"
fi
- OB_CHANGELOG_SOURCE="${_obpch_source}"
- OB_CHANGELOG_VERSION="${_obpch_version}"
- OB_CHANGELOG_DISTRIBUTION="${_obpch_distribution}"
- OB_CHANGELOG_CHANGES="${_obpch_line}"
+ OB_CHANGELOG_SOURCE="${source}"
+ OB_CHANGELOG_VERSION="${version}"
+ OB_CHANGELOG_DISTRIBUTION="${distribution}"
+ OB_CHANGELOG_CHANGES="${line}"
fi
- _obpch_expect='start_changes'
- _obpch_blank_lines=
- elif [ "${_obpch_line# -- }" != "${_obpch_line}" ]; then
- if [ "${_obpch_expect}" != 'changes_or_trailer' ]; then
- _ob_parse_changelog_error "${_obpch_file}" "${_obpch_line_nr}" \
+ expect='start_changes'
+ blank_lines=
+ elif [ "${line# -- }" != "${line}" ]; then
+ if [ "${expect}" != 'changes_or_trailer' ]; then
+ _ob_parse_changelog_error "${file}" "${line_nr}" \
'changelog_found_trailer' \
- "$(_ob_get_changelog_expect_str "${_obpch_expect}")"
+ "$(_ob_get_changelog_expect_str "${expect}")"
fi
- _obpch_line="${_obpch_line# -- }"
- _obpch_maintainer="${_obpch_line%% *}"
- _obpch_date="${_obpch_line#* }"
- if [ -z "${_obpch_maintainer}" -o -z "${_obpch_date}" -o \
- "${_obpch_maintainer}" = "${_obpch_date}" ]; then
- _ob_parse_changelog_error "${_obpch_file}" "${_obpch_line_nr}" \
+ line="${line# -- }"
+ maintainer="${line%% *}"
+ date="${line#* }"
+ if [ -z "${maintainer}" -o -z "${date}" -o \
+ "${maintainer}" = "${date}" ]; then
+ _ob_parse_changelog_error "${file}" "${line_nr}" \
'changelog_bad_trailer'
OB_CHANGELOG_MAINTAINER=
OB_CHANGELOG_DATE=
elif [ -n "${OB_CHANGELOG_SOURCE}" ]; then
- OB_CHANGELOG_MAINTAINER="${_obpch_maintainer}"
- OB_CHANGELOG_DATE="${_obpch_date}"
- "${_obpch_entry_cb}"
+ OB_CHANGELOG_MAINTAINER="${maintainer}"
+ OB_CHANGELOG_DATE="${date}"
+ "${entry_cb}"
if [ ${?} -ne 0 ]; then
- _ob_return 0
- return ${?}
+ return 0
fi
fi
- _obpch_expect='next_or_eof'
- _obpch_blank_lines=
- elif [ "${_obpch_line# --}" != "${_obpch_line}" ]; then
- _ob_parse_changelog_error "${_obpch_file}" "${_obpch_line_nr}" \
+ expect='next_or_eof'
+ blank_lines=
+ elif [ "${line# --}" != "${line}" ]; then
+ _ob_parse_changelog_error "${file}" "${line_nr}" \
'changelog_bad_trailer'
- elif [ "${_obpch_line## }" != "${_obpch_line}" ]; then
- if [ "${_obpch_expect}" != 'start_changes' -a \
- "${_obpch_expect}" != 'changes_or_trailer' ]; then
- _ob_parse_changelog_error "${_obpch_file}" "${_obpch_line_nr}" \
+ elif [ "${line## }" != "${line}" ]; then
+ if [ "${expect}" != 'start_changes' -a \
+ "${expect}" != 'changes_or_trailer' ]; then
+ _ob_parse_changelog_error "${file}" "${line_nr}" \
'changelog_found_change' \
- "$(_ob_get_changelog_expect_str "${_obpch_expect}")"
+ "$(_ob_get_changelog_expect_str "${expect}")"
fi
OB_CHANGELOG_CHANGES="${OB_CHANGELOG_CHANGES}
-${_obpch_blank_lines}${_obpch_line}"
- _obpch_expect='changes_or_trailer'
- _obpch_blank_lines=
+${blank_lines}${line}"
+ expect='changes_or_trailer'
+ blank_lines=
else
- _ob_parse_changelog_error "${_obpch_file}" "${_obpch_line_nr}" \
+ _ob_parse_changelog_error "${file}" "${line_nr}" \
'changelog_bad_line'
- _obpch_blank_lines=
+ blank_lines=
fi
done <<-EOF
- $(cat "${_obpch_file}")
+ $(cat "${file}")
EOF
- if [ "${_obpch_expect}" != 'next_or_eof' ]; then
- _ob_parse_changelog_error "${_obpch_file}" "${_obpch_line_nr}" \
+ if [ "${expect}" != 'next_or_eof' ]; then
+ _ob_parse_changelog_error "${file}" "${line_nr}" \
'changelog_found_eof' \
- "$(_ob_get_changelog_expect_str "${_obpch_expect}")"
+ "$(_ob_get_changelog_expect_str "${expect}")"
fi
- _ob_return 0
- return ${?}
+ return 0
}
_ob_parse_changelog_error()
{
- _ob_local _obpche_file _obpche_line_nr _obpche_msg_id \
- _obpche_file_info _obpche_orig_text_domain
-
- _obpche_file="${1}"
- _obpche_line_nr="${2}"
- _obpche_msg_id="${3}"
+ local file=
+ local line_nr=
+ local msg_id=
+ local file_info=
+ local orig_text_domain=
+
+ file="${1}"
+ line_nr="${2}"
+ msg_id="${3}"
shift 3
- _obpche_file_info="$(printf '%20s(l%d):' "${_obpche_file}" \
- "${_obpche_line_nr}")"
+ file_info="$(printf '%20s(l%d):' "${file}" "${line_nr}")"
- _obpche_orig_text_domain="$(ob_get_text_domain)"
+ orig_text_domain="$(ob_get_text_domain)"
ob_set_text_domain "${_OB_INTERNAL_TEXT_DOMAIN}"
- ob_warn "${_obpche_file_info} $(ob_get_msg "${_obpche_msg_id}")" "${@}"
+ ob_warn "${file_info} $(ob_get_msg "${msg_id}")" "${@}"
- ob_set_text_domain "${_obpche_orig_text_domain}"
+ ob_set_text_domain "${orig_text_domain}"
- _ob_return 0
- return ${?}
+ return 0
}
_ob_get_changelog_expect_str()
{
- _ob_local _obgces_orig_text_domain
+ local orig_text_domain=
- _obgces_orig_text_domain="$(ob_get_text_domain)"
+ orig_text_domain="$(ob_get_text_domain)"
ob_set_text_domain "${_OB_INTERNAL_TEXT_DOMAIN}"
echo "$(ob_get_msg "changelog_expect_${1}")"
- ob_set_text_domain "${_obgces_orig_text_domain}"
+ ob_set_text_domain "${orig_text_domain}"
- _ob_return 0
- return ${?}
+ return 0
}
diff --git a/lib/common.sh b/lib/common.sh
index 174f3ab..3fd3cc5 100644
--- a/lib/common.sh
+++ b/lib/common.sh
@@ -20,35 +20,6 @@
[ -n "${_OB_COMMON_SM}" ] && return 0
_OB_COMMON_SM='true'
-_OB_STACK_VARS=
-_OB_SAVED_IFS=
-
-_ob_local()
-{
- # Push the variable list onto the stack.
- _OB_STACK_VARS="${_OB_STACK_VARS}|${*}"
-
- # Save the old IFS value, if any, and set it to its default.
- _OB_SAVED_IFS="${IFS}"
- IFS='
-'
-}
-
-_ob_return()
-{
- # Unset the variables at the top of the stack.
- IFS=' '
- unset -v ${_OB_STACK_VARS##*|}
-
- # Pop the variable list from the top of the stack.
- _OB_STACK_VARS="${_OB_STACK_VARS%|*}"
-
- # Restore the saved IFS.
- IFS="${_OB_SAVED_IFS}"
-
- return ${1}
-}
-
_ob_validate_var_name()
{
case "${1}" in
diff --git a/lib/control.sh b/lib/control.sh
index 4c38583..f3f3a4f 100644
--- a/lib/control.sh
+++ b/lib/control.sh
@@ -30,146 +30,147 @@ OB_CONTROL_VALUE=
ob_parse_control()
{
- _ob_local _obpco_file _obpco_field_cb _obpco_req_fields _obpco_opt_fields \
- _obpco_check_fields _obpco_all_fields _obpco_got_fields \
- _obpco_line_nr _obpco_line _obpco_name _obpco_value
+ local file=
+ local field_cb=
+ local req_fields=
+ local opt_fields=
+ local check_fields=
+ local all_fields=
+ local got_fields=
+ local line_nr=
+ local line=
+ local name=
+ local value=
if [ ${#} -eq 2 ]; then
- _obpco_file="${1}"
- _obpco_field_cb="${2}"
- _obpco_check_fields='false'
+ file="${1}"
+ field_cb="${2}"
+ check_fields='false'
elif [ ${#} -eq 4 ]; then
- _obpco_file="${1}"
- _obpco_field_cb="${2}"
- _obpco_req_fields="${3}"
- _obpco_opt_fields="${4}"
- _obpco_check_fields='true'
- _obpco_all_fields=" ${_obpco_req_fields} ${_obpco_opt_fields} "
+ file="${1}"
+ field_cb="${2}"
+ req_fields="${3}"
+ opt_fields="${4}"
+ check_fields='true'
+ all_fields=" ${req_fields} ${opt_fields} "
else
- _ob_return 125
- return ${?}
+ return 125
fi
- _obpco_got_fields=' '
+ got_fields=' '
- _obpco_line_nr=0
+ line_nr=0
- while IFS= read -r _obpco_line; do
- _obpco_line_nr=$(($_obpco_line_nr + 1))
- if [ -z "$(echo ${_obpco_line})" ]; then
- _ob_parse_control_error "${_obpco_file}" "${_obpco_line_nr}" \
+ while IFS= read -r line; do
+ line_nr=$(($line_nr + 1))
+ if [ -z "$(echo ${line})" ]; then
+ _ob_parse_control_error "${file}" "${line_nr}" \
'control_empty_line'
- elif [ "${_obpco_line#\#}" != "${_obpco_line}" ]; then
+ elif [ "${line#\#}" != "${line}" ]; then
# Comment.
:
- elif [ "${_obpco_line# }" = "${_obpco_line}" ]; then
+ elif [ "${line# }" = "${line}" ]; then
# "Name: Value" line.
- if [ -n "${_obpco_name}" ]; then
- OB_CONTROL_NAME="${_obpco_name}"
- OB_CONTROL_VALUE="${_obpco_value}"
- "${_obpco_field_cb}"
+ if [ -n "${name}" ]; then
+ OB_CONTROL_NAME="${name}"
+ OB_CONTROL_VALUE="${value}"
+ "${field_cb}"
if [ ${?} -ne 0 ]; then
- _ob_return 0
- return ${?}
+ return 0
fi
fi
- _obpco_name="${_obpco_line%%:*}"
- _obpco_value="${_obpco_line#*:}"
- _obpco_value="${_obpco_value# }"
- if [ -z "${_obpco_name}" \
- -o "${_obpco_name}" = "${_obpco_line}" ]; then
+ name="${line%%:*}"
+ value="${line#*:}"
+ value="${value# }"
+ if [ -z "${name}" \
+ -o "${name}" = "${line}" ]; then
# Badly formatted control field.
- _ob_parse_control_error "${_obpco_file}" "${_obpco_line_nr}" \
+ _ob_parse_control_error "${file}" "${line_nr}" \
'control_bad_nv'
continue
fi
- if ${_obpco_check_fields}; then
- if [ "${_obpco_all_fields% ${_obpco_name} *}" = \
- "${_obpco_all_fields}" ]; then
+ if ${check_fields}; then
+ if [ "${all_fields% ${name} *}" = \
+ "${all_fields}" ]; then
# Unknown field.
_ob_parse_control_error \
- "${_obpco_file}" "${_obpco_line_nr}" \
- 'control_unknown_field' "${_obpco_name}"
+ "${file}" "${line_nr}" \
+ 'control_unknown_field' "${name}"
else
# Remove field from list of required fields.
- _obpco_req_fields="$(echo "${_obpco_req_fields}" | \
- sed "s/${_obpco_name}//")"
+ req_fields="$(echo "${req_fields}" | \
+ sed "s/${name}//")"
fi
fi
- if [ "${_obpco_got_fields% ${_obpco_name} *}" != \
- "${_obpco_got_fields}" ]; then
+ if [ "${got_fields% ${name} *}" != \
+ "${got_fields}" ]; then
# Duplicate field.
- _ob_parse_control_error "${_obpco_file}" "${_obpco_line_nr}" \
- 'control_duplicate_field' "${_obpco_name}"
+ _ob_parse_control_error "${file}" "${line_nr}" \
+ 'control_duplicate_field' "${name}"
else
- _obpco_got_fields="${_obpco_got_fields}${_obpco_name} "
+ got_fields="${got_fields}${name} "
fi
else
# Continuation line.
- if [ -z "${_obpco_name}" ]; then
+ if [ -z "${name}" ]; then
# Expecting a "Name: Value" line.
- _ob_parse_control_error "${_obpco_file}" "${_obpco_line_nr}" \
+ _ob_parse_control_error "${file}" "${line_nr}" \
'control_found_continuation'
continue
fi
- _obpco_value="${_obpco_value}
-${_obpco_line# }"
+ value="${value}
+${line# }"
fi
done <<-EOF
- $(cat "${_obpco_file}")
+ $(cat "${file}")
EOF
- if [ -n "${_obpco_name}" ]; then
- OB_CONTROL_NAME="${_obpco_name}"
- OB_CONTROL_VALUE="${_obpco_value}"
- "${_obpco_field_cb}"
+ if [ -n "${name}" ]; then
+ OB_CONTROL_NAME="${name}"
+ OB_CONTROL_VALUE="${value}"
+ "${field_cb}"
if [ ${?} -ne 0 ]; then
- _ob_return 0
- return ${?}
+ return 0
fi
fi
- if ${_obpco_check_fields}; then
- _obpco_req_fields="${_obpco_req_fields## }"
- _obpco_req_fields="${_obpco_req_fields%% }"
- if [ -n "${_obpco_req_fields}" ]; then
+ if ${check_fields}; then
+ req_fields="${req_fields## }"
+ req_fields="${req_fields%% }"
+ if [ -n "${req_fields}" ]; then
# Missing required control fields.
- _obpco_req_fields="$(echo "${_obpco_req_fields}" | \
- sed 's/ / /g' | \
+ req_fields="$(echo "${req_fields}" | sed 's/ / /g' | \
sed "s/ /$(ob_get_msg 'list_item_separator')/g")"
- _ob_parse_control_error "${_obpco_file}" '0' \
- 'control_missing_fields' \
- "${_obpco_req_fields}"
+ _ob_parse_control_error "${file}" '0' \
+ 'control_missing_fields' "${req_fields}"
fi
fi
- _ob_return 0
- return ${?}
+ return 0
}
ob_set_substvar()
{
- _ob_local _obssv_name _obssv_value
+ local name=
+ local value=
if [ ${#} -eq 2 ]; then
- _obssv_name="${1}"
- _obssv_value="${2}"
+ name="${1}"
+ value="${2}"
else
- _ob_return 125
- return ${?}
+ return 125
fi
# Convert variable name to uppercase and validate.
- _obssv_name="$(echo "${_obssv_name}" | tr 'a-z-' 'A-Z_')"
- case "${_obssv_name:- }" in
+ name="$(echo "${name}" | tr 'a-z-' 'A-Z_')"
+ case "${name:- }" in
*[!A-Z0-9_]*)
- _ob_return 125
- return ${?}
+ return 125
;;
esac
# Trim leading and trailing whitespace from value.
- _obssv_value="$(echo "${_obssv_value}" | sed -n '
+ value="$(echo "${value}" | sed -n '
H; # Store each input line in the hold space.
${ # At the last line of input, …
g; # … restore the hold space into the pattern space, …
@@ -180,90 +181,92 @@ ob_set_substvar()
')"
# Escape single quotes in value.
- _obssv_value="$(printf '%s\n' "${_obssv_value}" | sed "s/'/'\\\\''/g")"
+ value="$(printf '%s\n' "${value}" | sed "s/'/'\\\\''/g")"
- eval "_OB_SUBSTVAR_${_obssv_name}='${_obssv_value}'"
+ eval "_OB_SUBSTVAR_${name}='${value}'"
- _ob_return 125
- return ${?}
+ return 125
}
ob_substvars()
{
- _ob_local _obsv_string _obsv_depth \
- _obsv_lhs _obsv_name _obsv_rhs _obsv_old_rhs _obsv_value
+ local string=
+ local depth=
+ local lhs=
+ local name=
+ local rhs=
+ local old_rhs=
+ local value=
if [ ${#} -eq 1 ]; then
- _obsv_string="${1}"
+ string="${1}"
else
- _ob_return 125
- return ${?}
+ return 125
fi
# Logic inspired by that of dpkg's Dpkg::Substvars::substvars() subroutine.
- _obsv_depth=0
+ depth=0
while true; do
- _obsv_lhs="${_obsv_string%%\$\{*}"
- if [ ${#_obsv_lhs} -eq ${#_obsv_string} ]; then
+ lhs="${string%%\$\{*}"
+ if [ ${#lhs} -eq ${#string} ]; then
# No "${" was found.
break
fi
- _obsv_string="${_obsv_string#*\$\{}"
- _obsv_name="${_obsv_string%%\}*}"
- _obsv_rhs="${_obsv_string#*\}}"
+ string="${string#*\$\{}"
+ name="${string%%\}*}"
+ rhs="${string#*\}}"
- if [ ${#_obsv_rhs} -lt ${#_obsv_old_rhs} ]; then
+ if [ ${#rhs} -lt ${#old_rhs} ]; then
# Reset the nesting counter if we've advanced the right side of the
# matched space.
- _obsv_depth=0
+ depth=0
fi
- if [ ${_obsv_depth} -ge ${_OB_SUBSTVARS_MAX_DEPTH} ]; then
+ if [ ${depth} -ge ${_OB_SUBSTVARS_MAX_DEPTH} ]; then
# Warn of possible recursion.
ob_warn "$(ob_get_msg 'substvar_deep_nesting')"
- _ob_return 1
- return ${?}
+ return 1
fi
- _obsv_old_rhs="${_obsv_rhs}"
+ old_rhs="${rhs}"
# Perform the substitution.
- _obsv_name="$(echo "${_obsv_name}" | tr 'a-z-' 'A-Z_')"
- _obsv_value="$(eval echo \"\$\{"_OB_SUBSTVAR_${_obsv_name}"\}\")"
- _obsv_string="${_obsv_lhs}${_obsv_value}${_obsv_rhs}"
- _obsv_depth=$(($_obsv_depth + 1))
+ name="$(echo "${name}" | tr 'a-z-' 'A-Z_')"
+ value="$(eval echo \"\$\{"_OB_SUBSTVAR_${name}"\}\")"
+ string="${lhs}${value}${rhs}"
+ depth=$(($depth + 1))
done
- printf '%s\n' "${_obsv_string}"
+ printf '%s\n' "${string}"
- _ob_return 0
- return ${?}
+ return 0
}
_ob_parse_control_error()
{
- _ob_local _obpcoe_file _obpcoe_line_nr _obpcoe_msg_id \
- _obpcoe_file_info _obpcoe_orig_text_domain
-
- _obpcoe_file="${1}"
- _obpcoe_line_nr="${2}"
- _obpcoe_msg_id="${3}"
+ local file=
+ local line_nr=
+ local msg_id=
+ local file_info=
+ local orig_text_domain=
+
+ file="${1}"
+ line_nr="${2}"
+ msg_id="${3}"
shift 3
- if [ "${_obpcoe_line_nr}" -eq 0 ]; then
- _obpcoe_file_info="$(printf '%20s:' "${_obpcoe_file}")"
+ if [ "${line_nr}" -eq 0 ]; then
+ file_info="$(printf '%20s:' "${file}")"
else
- _obpcoe_file_info="$(printf '%20s(l%d):' "${_obpcoe_file}" \
- "${_obpcoe_line_nr}")"
+ file_info="$(printf '%20s(l%d):' "${file}" "${line_nr}")"
fi
- _obpcoe_orig_text_domain="$(ob_get_text_domain)"
+ orig_text_domain="$(ob_get_text_domain)"
ob_set_text_domain "${_OB_INTERNAL_TEXT_DOMAIN}"
- ob_warn "${_obpcoe_file_info} $(ob_get_msg "${_obpcoe_msg_id}")" "${@}"
+ ob_warn "${file_info} $(ob_get_msg "${msg_id}")" "${@}"
- ob_set_text_domain "${_obpcoe_orig_text_domain}"
+ ob_set_text_domain "${orig_text_domain}"
- _ob_return 0
- return ${?}
+ return 0
}
diff --git a/lib/deps.sh b/lib/deps.sh
index e38680a..8ac3133 100644
--- a/lib/deps.sh
+++ b/lib/deps.sh
@@ -24,73 +24,80 @@ ob_use metadata
ob_parse_dep()
{
- _ob_local _obpd_opt _obpd_pkg_var _obpd_archqual_var _obpd_rel_var \
- _obpd_ver_var _obpd_arches_var _obpd_plats_var \
- _obpd_host_arch _obpd_host_plat _obpd_dep \
- _obpd_pkgarchqual _obpd_pkg _obpd_archqual \
- _obpd_relver _obpd_rel _obpd_ver _obpd_arches _obpd_plats \
- _obpd_comp _obpd_comp_var
-
- while getopts 'p:q:r:v:A:l:a:P:' _obpd_opt; do
- case "${_obpd_opt}" in
+ local opt=
+ local pkg_var=
+ local archqual_var=
+ local rel_var=
+ local ver_var=
+ local arches_var=
+ local plats_var=
+ local host_arch=
+ local host_plat=
+ local dep=
+ local pkgarchqual=
+ local pkg=
+ local archqual=
+ local relver=
+ local rel=
+ local ver=
+ local arches=
+ local plats=
+ local comp=
+ local comp_var=
+
+ while getopts 'p:q:r:v:A:l:a:P:' opt; do
+ case "${opt}" in
p)
- _obpd_pkg_var="${OPTARG}"
- if ! _ob_validate_var_name "${_obpd_pkg_var}"; then
- _ob_return 125
- return ${?}
+ pkg_var="${OPTARG}"
+ if ! _ob_validate_var_name "${pkg_var}"; then
+ return 125
fi
;;
q)
- _obpd_archqual_var="${OPTARG}"
- if ! _ob_validate_var_name "${_obpd_archqual_var}"; then
- _ob_return 125
- return ${?}
+ archqual_var="${OPTARG}"
+ if ! _ob_validate_var_name "${archqual_var}"; then
+ return 125
fi
;;
r)
- _obpd_rel_var="${OPTARG}"
- if ! _ob_validate_var_name "${_obpd_rel_var}"; then
- _ob_return 125
- return ${?}
+ rel_var="${OPTARG}"
+ if ! _ob_validate_var_name "${rel_var}"; then
+ return 125
fi
;;
v)
- _obpd_ver_var="${OPTARG}"
- if ! _ob_validate_var_name "${_obpd_ver_var}"; then
- _ob_return 125
- return ${?}
+ ver_var="${OPTARG}"
+ if ! _ob_validate_var_name "${ver_var}"; then
+ return 125
fi
;;
A)
- _obpd_arches_var="${OPTARG}"
- if ! _ob_validate_var_name "${_obpd_arches_var}"; then
- _ob_return 125
- return ${?}
+ arches_var="${OPTARG}"
+ if ! _ob_validate_var_name "${arches_var}"; then
+ return 125
fi
;;
l)
- _obpd_plats_var="${OPTARG}"
- if ! _ob_validate_var_name "${_obpd_plats_var}"; then
- _ob_return 125
- return ${?}
+ plats_var="${OPTARG}"
+ if ! _ob_validate_var_name "${plats_var}"; then
+ return 125
fi
;;
a)
- _obpd_host_arch="${OPTARG}"
+ host_arch="${OPTARG}"
;;
P)
- _obpd_host_plat="${OPTARG}"
+ host_plat="${OPTARG}"
;;
?)
- _ob_return 125
- return ${?}
+ return 125
;;
esac
done
shift $(($OPTIND - 1))
if [ ${#} -eq 1 ]; then
- _obpd_dep="$(printf '%s\n' "${1}" | sed -n '
+ dep="$(printf '%s\n' "${1}" | sed -n '
H; # Store each input line in the hold space.
${
g; # Restore everything to the pattern space.
@@ -107,141 +114,141 @@ ob_parse_dep()
};
')"
else
- _ob_return 125
- return ${?}
+ return 125
fi
# pkg[:archqual] [(rel ver)] [\[arches\]] [<plats>]
- _obpd_pkgarchqual="${_obpd_dep%% *}"
- _obpd_dep=" ${_obpd_dep#* }"
- _obpd_pkg="${_obpd_pkgarchqual%:*}"
- if [ "${_obpd_pkg}" != "${_obpd_pkgarchqual}" ]; then
- _obpd_archqual="${_obpd_pkgarchqual##*:}"
+ pkgarchqual="${dep%% *}"
+ dep=" ${dep#* }"
+ pkg="${pkgarchqual%:*}"
+ if [ "${pkg}" != "${pkgarchqual}" ]; then
+ archqual="${pkgarchqual##*:}"
fi
- if [ "${_obpd_dep# (*)}" != "${_obpd_dep}" ]; then
- _obpd_relver="${_obpd_dep# (}"
- _obpd_relver="${_obpd_relver%%)*}"
- _obpd_dep="${_obpd_dep# (*)}"
- _obpd_rel="${_obpd_relver% *}"
- _obpd_ver="${_obpd_relver##* }"
+ if [ "${dep# (*)}" != "${dep}" ]; then
+ relver="${dep# (}"
+ relver="${relver%%)*}"
+ dep="${dep# (*)}"
+ rel="${relver% *}"
+ ver="${relver##* }"
fi
- if [ "${_obpd_dep# \[*\]}" != "${_obpd_dep}" ]; then
- _obpd_arches="${_obpd_dep# \[}"
- _obpd_arches="${_obpd_arches%%\]*}"
- _obpd_dep="${_obpd_dep# \[*\]}"
+ if [ "${dep# \[*\]}" != "${dep}" ]; then
+ arches="${dep# \[}"
+ arches="${arches%%\]*}"
+ dep="${dep# \[*\]}"
fi
- if [ "${_obpd_dep# <*>}" != "${_obpd_dep}" ]; then
- _obpd_plats="${_obpd_dep# <}"
- _obpd_plats="${_obpd_plats%%>*}"
- _obpd_dep="${_obpd_dep# <*>}"
+ if [ "${dep# <*>}" != "${dep}" ]; then
+ plats="${dep# <}"
+ plats="${plats%%>*}"
+ dep="${dep# <*>}"
fi
# Set the specified variables.
- for _obpd_comp in pkg archqual rel ver arches plats; do
- _obpd_comp_var="$(eval echo \"\$\{_obpd_${_obpd_comp}_var\}\")"
- [ -z "${_obpd_comp_var}" ] && continue
- eval ${_obpd_comp_var}=\"\$\{_obpd_${_obpd_comp}\}\"
+ for comp in pkg archqual rel ver arches plats; do
+ comp_var="$(eval echo \"\$\{${comp}_var\}\")"
+ [ -z "${comp_var}" ] && continue
+ eval ${comp_var}=\"\$\{${comp}\}\"
done
- if [ -n "${_obpd_host_arch}" ] && ! ob_arch_is_concerned \
- "${_obpd_host_arch}" "${_obpd_arches}"; then
- _ob_return 0
- return ${?}
+ if [ -n "${host_arch}" ] && ! ob_arch_is_concerned \
+ "${host_arch}" "${arches}"; then
+ return 0
fi
- if [ -n "${_obpd_host_plat}" ] && ! ob_plat_is_concerned \
- "${_obpd_host_plat}" "${_obpd_plats}"; then
- _ob_return 0
- return ${?}
+ if [ -n "${host_plat}" ] && ! ob_plat_is_concerned \
+ "${host_plat}" "${plats}"; then
+ return 0
fi
- printf '%s' "${_obpd_pkg}"
- [ -n "${_obpd_archqual}" ] && printf ':%s' "${_obpd_archqual}"
- [ -n "${_obpd_ver}" ] && printf ' (%s %s)' "${_obpd_rel}" "${_obpd_ver}"
- [ -z "${_obpd_host_arch}" -a -n "${_obpd_arches}" ] && \
- printf ' [%s]' "${_obpd_arches}"
- [ -z "${_obpd_host_plat}" -a -n "${_obpd_plats}" ] && \
- printf ' [%s]' "${_obpd_plats}"
+ printf '%s' "${pkg}"
+ [ -n "${archqual}" ] && printf ':%s' "${archqual}"
+ [ -n "${ver}" ] && printf ' (%s %s)' "${rel}" "${ver}"
+ [ -z "${host_arch}" -a -n "${arches}" ] && \
+ printf ' [%s]' "${arches}"
+ [ -z "${host_plat}" -a -n "${plats}" ] && \
+ printf ' [%s]' "${plats}"
printf '\n'
- _ob_return 0
- return ${?}
+ return 0
}
ob_reduce_deps()
{
- _ob_local _obrd_opt _obrd_host_arch _obrd_host_plat _obrd_deps \
- _obrd_dep_and _obrd_dep_or _obrd_dep_list _obrd_dep_or_list _obrd_dep
-
- _obrd_union='false'
-
- while getopts 'a:P:u' _obrd_opt; do
- case "${_obrd_opt}" in
+ local opt=
+ local host_arch=
+ local host_plat=
+ local deps=
+ local dep_and=
+ local dep_or=
+ local dep_list=
+ local dep_or_list=
+ local dep=
+
+ union='false'
+
+ while getopts 'a:P:u' opt; do
+ case "${opt}" in
a)
- _obrd_host_arch="${OPTARG}"
+ host_arch="${OPTARG}"
;;
P)
- _obrd_host_plat="${OPTARG}"
+ host_plat="${OPTARG}"
;;
u)
- _obrd_union='true'
+ union='true'
;;
?)
- _ob_return 125
- return ${?}
+ return 125
;;
esac
done
shift $(($OPTIND - 1))
if [ ${#} -eq 1 ]; then
- _obrd_deps="${1}"
+ deps="${1}"
else
- _ob_return 125
- return ${?}
+ return 125
fi
IFS=','
- for _obrd_dep_and in ${_obrd_deps}; do
+ for dep_and in ${deps}; do
unset IFS
- if ! ${_obrd_union}; then
+ if ! ${union}; then
IFS='|'
- _obrd_dep_or_list=
- for _obrd_dep_or in ${_obrd_dep_and}; do
+ dep_or_list=
+ for dep_or in ${dep_and}; do
unset IFS
- _obrd_dep="$(ob_parse_dep -a "${_obrd_host_arch}" \
- -P "${_obrd_host_plat}" "${_obrd_dep_or}")"
- if [ -n "${_obrd_dep}" ]; then
- if [ -n "${_obrd_dep_or_list}" ]; then
- _obrd_dep_or_list="${_obrd_dep_or_list} | "
+ dep="$(ob_parse_dep -a "${host_arch}" \
+ -P "${host_plat}" "${dep_or}")"
+ if [ -n "${dep}" ]; then
+ if [ -n "${dep_or_list}" ]; then
+ dep_or_list="${dep_or_list} | "
fi
- _obrd_dep_or_list="${_obrd_dep_or_list}${_obrd_dep}"
+ dep_or_list="${dep_or_list}${dep}"
fi
done
- if [ -n "${_obrd_dep_or_list}" ]; then
- if [ -n "${_obrd_dep_list}" ]; then
- _obrd_dep_list="${_obrd_dep_list}, "
+ if [ -n "${dep_or_list}" ]; then
+ if [ -n "${dep_list}" ]; then
+ dep_list="${dep_list}, "
fi
- _obrd_dep_list="${_obrd_dep_list}${_obrd_dep_or_list}"
+ dep_list="${dep_list}${dep_or_list}"
fi
else
- _obrd_dep="$(ob_parse_dep -a "${_obrd_host_arch}" \
- -P "${_obrd_host_plat}" "${_obrd_dep_and}")"
- if [ -n "${_obrd_dep}" ]; then
- if [ -n "${_obrd_dep_list}" ]; then
- _obrd_dep_list="${_obrd_dep_list}, "
+ dep="$(ob_parse_dep -a "${host_arch}" \
+ -P "${host_plat}" "${dep_and}")"
+ if [ -n "${dep}" ]; then
+ if [ -n "${dep_list}" ]; then
+ dep_list="${dep_list}, "
fi
- _obrd_dep_list="${_obrd_dep_list}${_obrd_dep}"
+ dep_list="${dep_list}${dep}"
fi
fi
done
unset IFS
- echo "${_obrd_dep_list}"
+ echo "${dep_list}"
- _ob_return 0
- return ${?}
+ return 0
}
diff --git a/lib/load.sh b/lib/load.sh
index ac38dbc..685f414 100644
--- a/lib/load.sh
+++ b/lib/load.sh
@@ -26,23 +26,20 @@ _OB_LOAD_SM='true'
ob_use()
{
- _ob_local _obu_module
+ local module
if [ ${#} -eq 1 ]; then
- _obu_module="${1}"
+ module="${1}"
else
- _ob_return 125
- return ${?}
+ return 125
fi
- _obu_module='@@PKGLIBDIR@@'"/${_obu_module}.sm"
- if [ -r "${_obu_module}" ]; then
- . "${_obu_module}"
+ module='@@PKGLIBDIR@@'"/${module}.sm"
+ if [ -r "${module}" ]; then
+ . "${module}"
else
- _ob_return 1
- return ${?}
+ return 1
fi
- _ob_return 0
- return ${?}
+ return 0
}
diff --git a/lib/locale.sh b/lib/locale.sh
index 1cb1111..4d519a3 100644
--- a/lib/locale.sh
+++ b/lib/locale.sh
@@ -29,27 +29,20 @@ _OB_LOCALE_PATH='@@LOCALEDIR@@/%s/LC_MESSAGES/%s.ms'
ob_get_text_domain()
{
- _ob_local
-
if [ ${#} -ne 0 ]; then
- _ob_return 125
- return ${?}
+ return 125
fi
echo "${_OB_TEXT_DOMAIN}"
- _ob_return 0
- return ${?}
+ return 0
}
ob_set_text_domain()
{
- _ob_local
-
if [ ${#} -eq 1 ]; then
_OB_TEXT_DOMAIN="${1}"
else
- _ob_return 125
- return ${?}
+ return 125
fi
# Make sure LC_MESSAGES is set.
@@ -71,65 +64,58 @@ ob_set_text_domain()
if ! _ob_try_load_messages "${_OB_DEFAULT_LOCALE}"; then
ob_warn 'Cannot load messages in "%s" domain.' \
"${_OB_TEXT_DOMAIN}"
- _ob_return 1
- return ${?}
+ return 1
fi
fi
fi
- _ob_return 0
- return ${?}
+ return 0
}
ob_set_locale_path()
{
- _ob_local _obslp_format
+ local format=
if [ ${#} -eq 1 ]; then
- _obslp_format="${1}"
+ format="${1}"
else
- _ob_return 125
- return ${?}
+ return 125
fi
- _OB_LOCALE_PATH="${_obslp_format}"
+ _OB_LOCALE_PATH="${format}"
- _ob_return 0
- return ${?}
+ return 0
}
ob_get_msg()
{
- _ob_local _obgm_msgid
+ local msgid=
if [ ${#} -eq 1 ]; then
- _obgm_msgid="${1}"
+ msgid="${1}"
else
- _ob_return 125
- return ${?}
+ return 125
fi
- IFS= eval echo \$\{"msg_${_OB_TEXT_DOMAIN}_${_obgm_msgid}"\}
+ IFS= eval echo \$\{"msg_${_OB_TEXT_DOMAIN}_${msgid}"\}
- _ob_return 0
- return ${?}
+ return 0
}
_ob_try_load_messages()
{
- _ob_local _obtlm_locale _obtlm_ms
+ local locale=
+ local ms=
- _obtlm_locale="${1}"
- _obtlm_ms="$(printf "${_OB_LOCALE_PATH}" \
- "${_obtlm_locale}" "${_OB_TEXT_DOMAIN}")"
+ locale="${1}"
+ ms="$(printf "${_OB_LOCALE_PATH}" \
+ "${locale}" "${_OB_TEXT_DOMAIN}")"
- if [ -f "${_obtlm_ms}" ]; then
- . "${_obtlm_ms}"
+ if [ -f "${ms}" ]; then
+ . "${ms}"
else
- _ob_return 1
- return ${?}
+ return 1
fi
- _ob_return 0
- return ${?}
+ return 0
}
diff --git a/lib/metadata.sh b/lib/metadata.sh
index c2ad84a..e25abd5 100644
--- a/lib/metadata.sh
+++ b/lib/metadata.sh
@@ -24,301 +24,280 @@ ob_use 'metadata/@@METADATA@@'
ob_validate_source_name()
{
- _ob_local _obvsn_name
+ local name=
if [ ${#} -eq 1 ]; then
- _obvsn_name="${1}"
+ name="${1}"
else
- _ob_return 125
- return ${?}
+ return 125
fi
- _ob_metadata_do 'validate_source_name' "${_obvsn_name}"
+ _ob_metadata_do 'validate_source_name' "${name}"
- _ob_return ${?}
return ${?}
}
ob_validate_binary_name()
{
- _ob_local _obvbn_name
+ local name=
if [ ${#} -eq 1 ]; then
- _obvbn_name="${1}"
+ name="${1}"
else
- _ob_return 125
- return ${?}
+ return 125
fi
- _ob_metadata_do 'validate_binary_name' "${_obvbn_name}"
+ _ob_metadata_do 'validate_binary_name' "${name}"
- _ob_return ${?}
return ${?}
}
ob_parse_version()
{
- _ob_local _obpv_opt _obpv_upstreamver_var _obpv_distrev_var _obpv_version
+ local opt=
+ local upstreamver_var=
+ local distrev_var=
+ local version=
- while getopts 'u:d:' _obpv_opt; do
- case "${_obpv_opt}" in
+ while getopts 'u:d:' opt; do
+ case "${opt}" in
u)
- _obpv_upstreamver_var="${OPTARG}"
- if ! _ob_validate_var_name "${_obpv_upstreamver_var}"; then
- _ob_return 125
- return ${?}
+ upstreamver_var="${OPTARG}"
+ if ! _ob_validate_var_name "${upstreamver_var}"; then
+ return 125
fi
;;
d)
- _obpv_distrev_var="${OPTARG}"
- if ! _ob_validate_var_name "${_obpv_distrev_var}"; then
- _ob_return 125
- return ${?}
+ distrev_var="${OPTARG}"
+ if ! _ob_validate_var_name "${distrev_var}"; then
+ return 125
fi
;;
?)
- _ob_return 125
- return ${?}
+ return 125
;;
esac
done
shift $(($OPTIND - 1))
if [ ${#} -eq 1 ]; then
- _obpv_version="${1}"
+ version="${1}"
else
- _ob_return 125
- return ${?}
+ return 125
fi
- if ! _ob_metadata_do 'validate_version' "${_obpv_version}"; then
- _ob_return 1
- return ${?}
+ if ! _ob_metadata_do 'validate_version' "${version}"; then
+ return 1
fi
- if [ -n "${_obpv_upstreamver_var}" ]; then
- eval ${_obpv_upstreamver_var}="$(_ob_metadata_do 'get_upstreamver' \
- "${_obpv_version}")"
+ if [ -n "${upstreamver_var}" ]; then
+ eval ${upstreamver_var}="$(_ob_metadata_do 'get_upstreamver' \
+ "${version}")"
fi
- if [ -n "${_obpv_distrev_var}" ]; then
- eval ${_obpv_distrev_var}="$(_ob_metadata_do 'get_distrev' \
- "${_obpv_version}")"
+ if [ -n "${distrev_var}" ]; then
+ eval ${distrev_var}="$(_ob_metadata_do 'get_distrev' \
+ "${version}")"
fi
- _ob_return 0
- return ${?}
+ return 0
}
ob_get_system_arch()
{
- _ob_local
-
if [ ${#} -gt 0 ]; then
- _ob_return 125
- return ${?}
+ return 125
fi
_ob_metadata_do 'get_system_arch'
- _ob_return ${?}
return ${?}
}
ob_get_system_plat()
{
- _ob_local
-
if [ ${#} -gt 0 ]; then
- _ob_return 125
- return ${?}
+ return 125
fi
_ob_metadata_do 'get_system_plat'
- _ob_return ${?}
return ${?}
}
ob_match_arch()
{
- _ob_local _obma_arch _obma_arch_field _obma_a \
- _obma_a_pat_norm _obma_a_pat_hyph
+ local arch=
+ local arch_field=
+ local a=
+ local a_ere=
if [ ${#} -eq 2 ]; then
- _obma_arch="${1}"
- _obma_arch_field="${2}"
+ arch="${1}"
+ arch_field="${2}"
else
- _ob_return 125
- return ${?}
+ return 125
fi
- for _obma_a in ${_obma_arch_field}; do
+ for a in ${arch_field}; do
# "all" == "all"
- if [ "${_obma_arch}" = 'all' ]; then
- if [ "${_obma_a}" = 'all' ]; then
- _ob_return 0
- return ${?}
+ if [ "${arch}" = 'all' ]; then
+ if [ "${a}" = 'all' ]; then
+ return 0
else
continue
fi
fi
# "foo-bar-baz" == "any"
- if [ "${_obma_a}" = 'any' ]; then
- _ob_return 0
- return ${?}
+ if [ "${a}" = 'any' ]; then
+ return 0
fi
# Generate an ERE to match hyphenated architectures.
- _obma_a_ere="$(echo "${_obma_a}" | \
+ a_ere="$(echo "${a}" | \
sed 's/^any-/[^-]+-/;s/-any-/-[^-]+-/g;s/-any$/-[^-]+/g')"
# "foo-bar-baz" == "foo-any-any"
- if echo "${_obma_arch}" | grep -E "${_obma_a_ere}" >/dev/null 2>&1; then
- _ob_return 0
- return ${?}
+ if echo "${arch}" | grep -E "${a_ere}" >/dev/null 2>&1; then
+ return 0
fi
done
# Nothing matched.
- _ob_return 1
- return ${?}
+ return 1
}
ob_match_plat()
{
- _ob_local _obmp_plat _obmp_plat_field _obmp_p
+ local plat=
+ local plat_field=
+ local p=
if [ ${#} -eq 2 ]; then
- _obmp_plat="${1}"
- _obmp_plat_field="${2}"
+ plat="${1}"
+ plat_field="${2}"
else
- _ob_return 125
- return ${?}
+ return 125
fi
- for _obmp_p in ${_obmp_plat_field}; do
- if [ "${_obmp_plat}" = 'all' ]; then
- if [ "${_obmp_p}" = 'all' ]; then
- _ob_return 0
- return ${?}
+ for p in ${plat_field}; do
+ if [ "${plat}" = 'all' ]; then
+ if [ "${p}" = 'all' ]; then
+ return 0
else
continue
fi
fi
- if [ "${_obmp_p}" = 'any' ]; then
- _ob_return 0
- return ${?}
+ if [ "${p}" = 'any' ]; then
+ return 0
fi
done
- _ob_return 1
- return ${?}
+ return 1
}
ob_arch_is_concerned()
{
- _ob_local _obaic_host_arch _obaic_arches \
- _obaic_arch _obaic_not_arch _obaic_seen_arch
+ local host_arch=
+ local arches=
+ local arch=
+ local not_arch=
+ local seen_arch=
if [ ${#} -eq 2 ]; then
- _obaic_host_arch="${1}"
- _obaic_arches="${2}"
+ host_arch="${1}"
+ arches="${2}"
else
- _ob_return 125
- return ${?}
+ return 125
fi
- _obaic_seen_arch=1
- if [ -z "${_obaic_arches}" ]; then
- _obaic_seen_arch=0
+ seen_arch=1
+ if [ -z "${arches}" ]; then
+ seen_arch=0
fi
- for _obaic_arch in ${_obaic_arches}; do
- _obaic_not_arch="${_obaic_arch#!}"
- if [ "${_obaic_not_arch}" != "${_obaic_arch}" ]; then
- if ob_match_arch "${_obaic_host_arch}" "${_obaic_not_arch}"; then
- _obaic_seen_arch=1
+ for arch in ${arches}; do
+ not_arch="${arch#!}"
+ if [ "${not_arch}" != "${arch}" ]; then
+ if ob_match_arch "${host_arch}" "${not_arch}"; then
+ seen_arch=1
break
else
- _obaic_seen_arch=0
+ seen_arch=0
fi
- elif ob_match_arch "${_obaic_host_arch}" "${_obaic_arch}"; then
- _obaic_seen_arch=0
+ elif ob_match_arch "${host_arch}" "${arch}"; then
+ seen_arch=0
break
fi
done
- _ob_return ${_obaic_seen_arch}
- return ${?}
+ return ${seen_arch}
}
ob_plat_is_concerned()
{
- _ob_local _obpic_host_plat _obpic_plats \
- _obpic_plat _obpic_not_plat _obpic_seen_plat
+ local host_plat=
+ local plats=
+ local plat=
+ local not_plat=
+ local seen_plat=
if [ ${#} -eq 2 ]; then
- _obpic_host_plat="${1}"
- _obpic_plats="${2}"
+ host_plat="${1}"
+ plats="${2}"
else
- _ob_return 125
- return ${?}
+ return 125
fi
- _obpic_seen_plat=1
- if [ -z "${_obpic_plats}" ]; then
- _obpic_seen_plat=0
+ seen_plat=1
+ if [ -z "${plats}" ]; then
+ seen_plat=0
fi
- for _obpic_plat in ${_obpic_plats}; do
- _obpic_not_plat="${_obpic_plat#!}"
- if [ "${_obpic_not_plat}" != "${_obpic_plat}" ]; then
- if ob_match_plat "${_obpic_host_plat}" "${_obpic_not_plat}"; then
- _obpic_seen_plat=1
+ for plat in ${plats}; do
+ not_plat="${plat#!}"
+ if [ "${not_plat}" != "${plat}" ]; then
+ if ob_match_plat "${host_plat}" "${not_plat}"; then
+ seen_plat=1
break
else
- _obpic_seen_plat=0
+ seen_plat=0
fi
- elif ob_match_plat "${_obpic_host_plat}" "${_obpic_plat}"; then
- _obpic_seen_plat=0
+ elif ob_match_plat "${host_plat}" "${plat}"; then
+ seen_plat=0
break
fi
done
- _ob_return ${_obpic_seen_plat}
- return ${?}
+ return ${seen_plat}
}
ob_get_system_path()
{
- _ob_local _obgsp_path_id
+ local path_id=
if [ ${#} -ge 1 ]; then
- _obgsp_path_id="${1}"
+ path_id="${1}"
shift 1
else
- _ob_return 125
- return ${?}
+ return 125
fi
- _ob_metadata_do 'get_system_path' "${_obgsp_path_id}" "${@}"
+ _ob_metadata_do 'get_system_path' "${path_id}" "${@}"
- _ob_return ${?}
return ${?}
}
_ob_metadata_do()
{
- _ob_local _obmd_func
+ local func=
- _obmd_func="${1}"
+ func="${1}"
shift 1
- "_ob_${_obmd_func}_@@METADATA@@" "${@}"
+ "_ob_${func}_@@METADATA@@" "${@}"
- _ob_return ${?}
return ${?}
}
diff --git a/lib/metadata/proteanos.sh b/lib/metadata/proteanos.sh
index c5774a5..493f30a 100644
--- a/lib/metadata/proteanos.sh
+++ b/lib/metadata/proteanos.sh
@@ -30,122 +30,107 @@ _OB_VERSION_RE_PROTEANOS=${_OB_VERSION_RE_PROTEANOS}'$'
_ob_validate_source_name_proteanos()
{
- _ob_local _obvsnpro_name
+ local name=
- _obvsnpro_name="${1}"
+ name="${1}"
- if echo "${_obvsnpro_name}" | grep -E "${_OB_NAME_RE_PROTEANOS}" \
+ if echo "${name}" | grep -E "${_OB_NAME_RE_PROTEANOS}" \
>/dev/null 2>&1; then
- case "${_obvsnpro_name}" in
+ case "${name}" in
src-*)
- _ob_return 1
- return ${?}
+ return 1
;;
esac
else
- _ob_return 1
- return ${?}
+ return 1
fi
- _ob_return 0
- return ${?}
+ return 0
}
_ob_validate_binary_name_proteanos()
{
- _ob_local _obvbnpro_name
+ local name=
- _obvbnpro_name="${1}"
+ name="${1}"
- if echo "${_obvbnpro_name}" | grep -E "${_OB_NAME_RE_PROTEANOS}" \
+ if echo "${name}" | grep -E "${_OB_NAME_RE_PROTEANOS}" \
>/dev/null 2>&1; then
- case "${_obvbnpro_name}" in
+ case "${name}" in
src-*)
- _ob_return 1
- return ${?}
+ return 1
;;
esac
else
- _ob_return 1
- return ${?}
+ return 1
fi
- _ob_return 0
- return ${?}
+ return 0
}
_ob_validate_version_proteanos()
{
- _ob_local _obvvpro_version
+ local version=
- _obvvpro_version="${1}"
+ version="${1}"
- echo "${_obvvpro_version}" | grep -E "${_OB_VERSION_RE_PROTEANOS}" \
+ echo "${version}" | grep -E "${_OB_VERSION_RE_PROTEANOS}" \
>/dev/null 2>&1
- _ob_return ${?}
return ${?}
}
_ob_get_upstreamver_proteanos()
{
- _ob_local _obguvpro_version
+ local version=
- _obguvpro_version="${1}"
+ version="${1}"
- echo "${_obguvpro_version%-*}"
+ echo "${version%-*}"
- _ob_return 0
- return ${?}
+ return 0
}
_ob_get_distrev_proteanos()
{
- _ob_local _obgdrpro_version
+ local version=
- _obgdrpro_version="${1}"
+ version="${1}"
- echo "${_obgdrpro_version##*-}"
+ echo "${version##*-}"
- _ob_return 0
- return ${?}
+ return 0
}
_ob_get_system_arch_proteanos()
{
- _ob_local
-
cat '@@SYSCONFDIR@@/proteanos_arch'
- _ob_return 0
- return ${?}
+ return 0
}
_ob_get_system_plat_proteanos()
{
- _ob_local
-
cat '@@SYSCONFDIR@@/proteanos_plat'
- _ob_return 0
- return ${?}
+ return 0
}
_ob_get_system_path_proteanos()
{
- _ob_local _obgsppro_path_id _obgsppro_pkgver
+ local path_id=
+ local pkgver=
- _obgsppro_path_id="${1}"
+ path_id="${1}"
shift 1
- case "${_obgsppro_path_id}" in
+ case "${path_id}" in
'package-source')
# source version
if [ ${#} -eq 2 ]; then
printf '/usr/src/%s_%s' "${1}" "${2}"
else
- _ob_return 125
- return ${?}
+ return 125
fi
;;
'package-docs')
@@ -153,8 +138,7 @@ _ob_get_system_path_proteanos()
if [ ${#} -eq 2 ]; then
printf '/usr/share/doc/%s' "${1}"
else
- _ob_return 125
- return ${?}
+ return 125
fi
;;
'buildflags')
@@ -162,20 +146,18 @@ _ob_get_system_path_proteanos()
if [ ${#} -eq 1 ]; then
printf '@@DATADIR@@/opkbuild/buildflags/%s' "${1}"
else
- _ob_return 125
- return ${?}
+ return 125
fi
;;
'platconf')
# source version plat
if [ ${#} -eq 3 ]; then
- ob_parse_version -u '_obgsppro_pkgver' "${2}"
+ ob_parse_version -u 'pkgver' "${2}"
printf '@@DATADIR@@/platconf/%s/%s\n' "${3}" "${1}"
printf '@@DATADIR@@/platconf/%s/%s_%s\n' "${3}" "${1}" \
- "${_obgsppro_pkgver}"
+ "${pkgver}"
else
- _ob_return 125
- return ${?}
+ return 125
fi
;;
'build-helper')
@@ -186,17 +168,14 @@ _ob_get_system_path_proteanos()
printf '%s' '@@OPKHELPER_3_0@@'
;;
*)
- _ob_return 1
- return ${?}
+ return 1
;;
esac
else
- _ob_return 125
- return ${?}
+ return 125
fi
;;
esac
- _ob_return 0
- return ${?}
+ return 0
}
diff --git a/lib/package.sh b/lib/package.sh
index 4b5ce6a..4d040ab 100644
--- a/lib/package.sh
+++ b/lib/package.sh
@@ -30,16 +30,16 @@ _OB_BINARY_PARAMETERS=
ob_init_package()
{
- _ob_local _obip_dir _obip_orig_text_domain
+ local dir=
+ local orig_text_domain=
if [ ${#} -eq 1 ]; then
- _obip_dir="${1}"
+ dir="${1}"
else
- _ob_return 125
- return ${?}
+ return 125
fi
- _OB_PACKAGE_DIR="$(cd "${_obip_dir}" && pwd)"
+ _OB_PACKAGE_DIR="$(cd "${dir}" && pwd)"
if [ -r "${_OB_PACKAGE_DIR}/format" ]; then
case "$(cat "${_OB_PACKAGE_DIR}/format")" in
@@ -50,110 +50,111 @@ ob_init_package()
fi
if [ -z "${_OB_PACKAGE_FORMAT}" ]; then
- _obip_orig_text_domain="$(ob_get_text_domain)"
+ orig_text_domain="$(ob_get_text_domain)"
ob_set_text_domain "${_OB_INTERNAL_TEXT_DOMAIN}"
ob_warn "$(ob_get_msg 'unable_to_detect_package_format')"
- ob_set_text_domain "${_obip_orig_text_domain}"
- _ob_return 1
- return ${?}
+ ob_set_text_domain "${orig_text_domain}"
+ return 1
fi
ob_use "package/${_OB_PACKAGE_FORMAT}"
_OB_BINARY_PACKAGES=
- _ob_return 0
- return ${?}
+ return 0
}
ob_parse_package_metadata()
{
- _ob_local _obppm_opt _obppm_cache_file _obppm_pkg _obppm_pkg_clean \
- _obppm_param_name _obppm_param_value
-
- while getopts 'c:' _obppm_opt; do
- case "${_obppm_opt}" in
+ local opt=
+ local cache_file=
+ local pkg=
+ local pkg_clean=
+ local param_name=
+ local param_value=
+
+ while getopts 'c:' opt; do
+ case "${opt}" in
c)
- _obppm_cache_file="${OPTARG}"
+ cache_file="${OPTARG}"
;;
?)
- _ob_return 125
- return ${?}
+ return 125
;;
esac
done
shift $(($OPTIND - 1))
if [ ${#} -gt 0 ]; then
- _ob_return 125
- return ${?}
+ return 125
fi
# Load a previously saved cache file, if any.
- if [ -n "${_obppm_cache_file}" -a -r "${_obppm_cache_file}" ]; then
- if [ "${_obppm_cache_file#*/}" != "${_obppm_cache_file}" ]; then
- . "${_obppm_cache_file}"
+ if [ -n "${cache_file}" -a -r "${cache_file}" ]; then
+ if [ "${cache_file#*/}" != "${cache_file}" ]; then
+ . "${cache_file}"
else
- . "./${_obppm_cache_file}"
+ . "./${cache_file}"
fi
- _ob_return 0
- return ${?}
+ return 0
fi
_ob_package_do 'parse_package_metadata'
- if [ -n "${_obppm_cache_file}" ]; then
- >"${_obppm_cache_file}"
- for _obppm_param_name in ${_OB_SOURCE_PARAMETERS}; do
- _obppm_param_value="$(ob_get_source_parameter \
- "${_obppm_param_name}" | sed "s/'/'\\\\''/g")"
+ if [ -n "${cache_file}" ]; then
+ >"${cache_file}"
+ for param_name in ${_OB_SOURCE_PARAMETERS}; do
+ param_value="$(ob_get_source_parameter \
+ "${param_name}" | sed "s/'/'\\\\''/g")"
printf "%s='%s'\n" \
- "_OB_SRCFIELD_${_obppm_param_name}" "${_obppm_param_value}" \
- >>"${_obppm_cache_file}"
+ "_OB_SRCFIELD_${param_name}" "${param_value}" \
+ >>"${cache_file}"
done
- for _obppm_pkg in $(ob_get_binary_packages); do
- _obppm_pkg_clean="$(echo "${_obppm_pkg}" | tr 'a-z' 'A-Z' | \
+ for pkg in $(ob_get_binary_packages); do
+ pkg_clean="$(echo "${pkg}" | tr 'a-z' 'A-Z' | \
tr -dC 'A-Z0-9')"
- for _obppm_param_name in ${_OB_BINARY_PARAMETERS}; do
- _obppm_param_value="$(ob_get_binary_parameter "${_obppm_pkg}" \
- "${_obppm_param_name}" | sed "s/'/'\\\\''/g")"
+ for param_name in ${_OB_BINARY_PARAMETERS}; do
+ param_value="$(ob_get_binary_parameter "${pkg}" \
+ "${param_name}" | sed "s/'/'\\\\''/g")"
printf "%s='%s'\n" \
- "_OB_BINFIELD_${_obppm_pkg_clean}_${_obppm_param_name}" \
- "${_obppm_param_value}" \
- >>"${_obppm_cache_file}"
+ "_OB_BINFIELD_${pkg_clean}_${param_name}" \
+ "${param_value}" \
+ >>"${cache_file}"
done
done
fi
- _ob_return 0
- return ${?}
+ return 0
}
ob_get_binary_packages()
{
- _ob_local _obgbpk_opt _obgbpk_host_arch _obgbpk_host_plat \
- _obgbpk_pkgs _obgbpk_pkg \
- _obgbpk_pkgs_clean _obgbpk_pkg_clean _obgbpk_orig_text_domain
-
- while getopts 'a:P:' _obgbpk_opt; do
- case "${_obgbpk_opt}" in
+ local opt=
+ local host_arch=
+ local host_plat=
+ local pkgs=
+ local pkg=
+ local pkgs_clean=
+ local pkg_clean=
+ local orig_text_domain=
+
+ while getopts 'a:P:' opt; do
+ case "${opt}" in
a)
- _obgbpk_host_arch="${OPTARG}"
+ host_arch="${OPTARG}"
;;
P)
- _obgbpk_host_plat="${OPTARG}"
+ host_plat="${OPTARG}"
;;
?)
- _ob_return 125
- return ${?}
+ return 125
;;
esac
done
shift $(($OPTIND - 1))
if [ ${#} -gt 0 ]; then
- _ob_return 125
- return ${?}
+ return 125
fi
# NB: If a source package lists no binary packages, this will be true each
@@ -162,293 +163,267 @@ ob_get_binary_packages()
_ob_package_do 'get_binary_packages'
- _obgbpk_orig_text_domain="$(ob_get_text_domain)"
+ orig_text_domain="$(ob_get_text_domain)"
ob_set_text_domain "${_OB_INTERNAL_TEXT_DOMAIN}"
- _obgbpk_pkgs_clean=' '
+ pkgs_clean=' '
- for _obgbpk_pkg in ${_OB_BINARY_PACKAGES}; do
+ for pkg in ${_OB_BINARY_PACKAGES}; do
# Validate the name.
- if ! ob_validate_binary_name "${_obgbpk_pkg}"; then
- ob_warn "$(ob_get_msg 'bad_binary_name')" "${_obgbpk_pkg}"
+ if ! ob_validate_binary_name "${pkg}"; then
+ ob_warn "$(ob_get_msg 'bad_binary_name')" "${pkg}"
continue
fi
# Make sure the "clean" name is unique.
- _obgbpk_pkg_clean=" $(echo "${_obgbpk_pkg}" | tr 'a-z' 'A-Z' | \
+ pkg_clean=" $(echo "${pkg}" | tr 'a-z' 'A-Z' | \
tr -dC 'A-Z0-9') "
- if echo "${_obgbpk_pkgs_clean}" | grep "${_obgbpk_pkg_clean}" \
+ if echo "${pkgs_clean}" | grep "${pkg_clean}" \
>/dev/null 2>&1; then
ob_warn "$(ob_get_msg 'duplicate_clean_binary_name')" \
- "${_obgbpk_pkg_clean}"
+ "${pkg_clean}"
continue
else
- _obgbpk_pkgs_clean="${_obgbpk_pkgs_clean}${_obgbpk_pkg_clean} "
+ pkgs_clean="${pkgs_clean}${pkg_clean} "
fi
- _obgbpk_pkgs="${_obgbpk_pkgs} ${_obgbpk_pkg}"
+ pkgs="${pkgs} ${pkg}"
done
- _OB_BINARY_PACKAGES="$(IFS=' ' echo ${_obgbpk_pkgs})"
+ _OB_BINARY_PACKAGES="$(IFS=' ' echo ${pkgs})"
- ob_set_text_domain "${_obgbpk_orig_text_domain}"
+ ob_set_text_domain "${orig_text_domain}"
fi
- _obgbpk_pkgs=''
+ pkgs=''
- for _obgbpk_pkg in ${_OB_BINARY_PACKAGES}; do
- if [ -n "${_obgbpk_host_arch}" ] && ! ob_arch_is_concerned \
- "${_obgbpk_host_arch}" "$(ob_get_binary_parameter \
- "${_obgbpk_pkg}" 'Architecture')"; then
+ for pkg in ${_OB_BINARY_PACKAGES}; do
+ if [ -n "${host_arch}" ] && ! ob_arch_is_concerned \
+ "${host_arch}" "$(ob_get_binary_parameter \
+ "${pkg}" 'Architecture')"; then
continue
fi
- if [ -n "${_obgbpk_host_plat}" ] && ! ob_plat_is_concerned \
- "${_obgbpk_host_plat}" "$(ob_get_binary_parameter \
- "${_obgbpk_pkg}" 'Platform')"; then
+ if [ -n "${host_plat}" ] && ! ob_plat_is_concerned \
+ "${host_plat}" "$(ob_get_binary_parameter \
+ "${pkg}" 'Platform')"; then
continue
fi
- _obgbpk_pkgs="${_obgbpk_pkgs} ${_obgbpk_pkg}"
+ pkgs="${pkgs} ${pkg}"
done
- IFS=' ' echo ${_obgbpk_pkgs}
+ IFS=' ' echo ${pkgs}
- _ob_return 0
- return ${?}
+ return 0
}
ob_get_source_parameter()
{
- _ob_local _obgsp_name
+ local name=
if [ ${#} -eq 1 ]; then
- _obgsp_name="${1}"
+ name="${1}"
else
- _ob_return 125
- return ${?}
+ return 125
fi
# Convert field name to uppercase and validate.
- _obgsp_name="$(echo "${_obgsp_name}" | tr 'a-z-' 'A-Z_')"
- case "${_obgsp_name:- }" in
+ name="$(echo "${name}" | tr 'a-z-' 'A-Z_')"
+ case "${name:- }" in
*[!A-Z0-9_]*)
- _ob_return 125
- return ${?}
+ return 125
;;
esac
- eval echo \"\$\{"_OB_SRCFIELD_${_obgsp_name}"\}\"
+ eval echo \"\$\{"_OB_SRCFIELD_${name}"\}\"
- _ob_return 0
- return ${?}
+ return 0
}
ob_get_binary_parameter()
{
- _ob_local _obgbp_package _obgbp_name
+ local package=
+ local name=
if [ ${#} -eq 2 ]; then
- _obgbp_package="${1}"
- _obgbp_name="${2}"
+ package="${1}"
+ name="${2}"
else
- _ob_return 125
- return ${?}
+ return 125
fi
- if ! ob_validate_binary_name "${_obgbp_package}"; then
- _ob_return 125
- return ${?}
+ if ! ob_validate_binary_name "${package}"; then
+ return 125
fi
# Convert package name to its uppercase "clean" form.
- _obgbp_package="$(echo "${_obgbp_package}" | tr 'a-z' 'A-Z' | \
+ package="$(echo "${package}" | tr 'a-z' 'A-Z' | \
tr -dC 'A-Z0-9')"
# Convert field name to uppercase and validate.
- _obgbp_name="$(echo "${_obgbp_name}" | tr 'a-z-' 'A-Z_')"
- case "${_obgbp_name:- }" in
+ name="$(echo "${name}" | tr 'a-z-' 'A-Z_')"
+ case "${name:- }" in
*[!A-Z0-9_]*)
- _ob_return 125
- return ${?}
+ return 125
;;
esac
- eval echo \"\$\{"_OB_BINFIELD_${_obgbp_package}_${_obgbp_name}"\}\"
+ eval echo \"\$\{"_OB_BINFIELD_${package}_${name}"\}\"
- _ob_return 0
- return ${?}
+ return 0
}
ob_get_doc_package()
{
- _ob_local
-
if [ ${#} -gt 0 ]; then
- _ob_return 125
- return ${?}
+ return 125
fi
_ob_package_do 'get_doc_package'
- _ob_return ${?}
return ${?}
}
ob_get_doc_files()
{
- _ob_local _obgdf_arch _obgdf_plat
+ local arch=
+ local plat=
if [ ${#} -eq 2 ]; then
- _obgdf_arch="${1}"
- _obgdf_plat="${2}"
+ arch="${1}"
+ plat="${2}"
else
- _ob_return 125
- return ${?}
+ return 125
fi
- _ob_package_do 'get_doc_files' "${_obgdf_arch}" "${_obgdf_plat}"
+ _ob_package_do 'get_doc_files' "${arch}" "${plat}"
- _ob_return ${?}
return ${?}
}
ob_summarize_package_arch()
{
- _ob_local
-
if [ ${#} -gt 0 ]; then
- _ob_return 125
- return ${?}
+ return 125
fi
# XXX: Stub.
- _ob_return 0
- return ${?}
+ return 0
}
ob_summarize_package_plat()
{
- _ob_local
-
if [ ${#} -gt 0 ]; then
- _ob_return 125
- return ${?}
+ return 125
fi
# XXX: Stub.
- _ob_return 0
- return ${?}
+ return 0
}
ob_set_package_substvars()
{
- _ob_local _obspsv_pkg
+ local pkg=
if [ ${#} -eq 1 ]; then
- _obspsv_pkg="${1}"
+ pkg="${1}"
else
- _ob_return 125
- return ${?}
+ return 125
fi
- _ob_package_do 'set_package_substvars' "${_obspsv_pkg}"
+ _ob_package_do 'set_package_substvars' "${pkg}"
- _ob_return ${?}
return ${?}
}
_ob_package_do()
{
- _ob_local _obpd_func
+ local func=
- _obpd_func="${1}"
+ func="${1}"
shift 1
- "_ob_${_obpd_func}_${_OB_PACKAGE_FORMAT}" "${@}"
+ "_ob_${func}_${_OB_PACKAGE_FORMAT}" "${@}"
- _ob_return ${?}
return ${?}
}
_ob_set_binary_packages()
{
- _ob_local _obsbpk_packages
+ local packages=
- _obsbpk_packages="${1}"
+ packages="${1}"
- _OB_BINARY_PACKAGES="${_obsbpk_packages}"
+ _OB_BINARY_PACKAGES="${packages}"
- _ob_return 0
- return ${?}
+ return 0
}
_ob_set_source_parameter()
{
- _ob_local _obssp_name _obssp_value
+ local name=
+ local value=
- _obssp_name="${1}"
- _obssp_value="${2}"
+ name="${1}"
+ value="${2}"
# Convert field name to uppercase and validate.
- _obssp_name="$(echo "${_obssp_name}" | tr 'a-z-' 'A-Z_')"
- case "${_obssp_name:- }" in
+ name="$(echo "${name}" | tr 'a-z-' 'A-Z_')"
+ case "${name:- }" in
*[!A-Z0-9_]*)
- _ob_return 125
- return ${?}
+ return 125
;;
esac
- _OB_SOURCE_PARAMETERS="${_OB_SOURCE_PARAMETERS} ${_obssp_name}"
+ _OB_SOURCE_PARAMETERS="${_OB_SOURCE_PARAMETERS} ${name}"
# Escape the value.
- _obssp_value="$(echo "${_obssp_value}" | sed "s/'/'\\\\''/g")"
+ value="$(echo "${value}" | sed "s/'/'\\\\''/g")"
- eval "_OB_SRCFIELD_${_obssp_name}='${_obssp_value}'"
+ eval "_OB_SRCFIELD_${name}='${value}'"
- _ob_return 0
- return ${?}
+ return 0
}
_ob_set_binary_parameter()
{
- _ob_local _obsbp_package _obsbp_name _obsbp_value
+ local package=
+ local name=
+ local value=
- _obsbp_package="${1}"
- _obsbp_name="${2}"
- _obsbp_value="${3}"
+ package="${1}"
+ name="${2}"
+ value="${3}"
- if ! ob_validate_binary_name "${_obsbp_package}"; then
- _ob_return 125
- return ${?}
+ if ! ob_validate_binary_name "${package}"; then
+ return 125
fi
# Convert package name to its uppercase "clean" form.
- _obsbp_package="$(echo "${_obsbp_package}" | tr 'a-z' 'A-Z' | \
+ package="$(echo "${package}" | tr 'a-z' 'A-Z' | \
tr -dC 'A-Z0-9')"
# Convert field name to uppercase and validate.
- _obsbp_name="$(echo "${_obsbp_name}" | tr 'a-z-' 'A-Z_')"
- case "${_obsbp_name:- }" in
+ name="$(echo "${name}" | tr 'a-z-' 'A-Z_')"
+ case "${name:- }" in
*[!A-Z0-9_]*)
- _ob_return 125
- return ${?}
+ return 125
;;
esac
- if ! echo " ${_OB_BINARY_PARAMETERS} " | grep " ${_obsbp_name} " \
+ if ! echo " ${_OB_BINARY_PARAMETERS} " | grep " ${name} " \
>/dev/null 2>&1; then
- _OB_BINARY_PARAMETERS="${_OB_BINARY_PARAMETERS} ${_obsbp_name}"
+ _OB_BINARY_PARAMETERS="${_OB_BINARY_PARAMETERS} ${name}"
fi
# Escape the value.
- _obsbp_value="$(echo "${_obsbp_value}" | sed "s/'/'\\\\''/g")"
+ value="$(echo "${value}" | sed "s/'/'\\\\''/g")"
- eval "_OB_BINFIELD_${_obsbp_package}_${_obsbp_name}='${_obsbp_value}'"
+ eval "_OB_BINFIELD_${package}_${name}='${value}'"
- _ob_return 0
- return ${?}
+ return 0
}
diff --git a/lib/package/2.sh b/lib/package/2.sh
index b3dfc52..25c4865 100644
--- a/lib/package/2.sh
+++ b/lib/package/2.sh
@@ -32,62 +32,56 @@ _OB_CURRENT_PACKAGE_2=
_ob_parse_package_metadata_2()
{
- _ob_local _obppm2_pkg
+ local pkg=
ob_parse_control "${_OB_PACKAGE_DIR}/control" _ob_srcfield_2 \
"${_OB_SOURCE_FIELDS_REQUIRED_2}" "${_OB_SOURCE_FIELDS_OPTIONAL_2}"
ob_parse_changelog "${_OB_PACKAGE_DIR}/changelog" _ob_change_2
- for _obppm2_pkg in $(ob_get_binary_packages); do
- _OB_CURRENT_PACKAGE_2="${_obppm2_pkg}"
- ob_parse_control "${_OB_PACKAGE_DIR}/${_obppm2_pkg}.pkg/control" \
+ for pkg in $(ob_get_binary_packages); do
+ _OB_CURRENT_PACKAGE_2="${pkg}"
+ ob_parse_control "${_OB_PACKAGE_DIR}/${pkg}.pkg/control" \
_ob_binfield_2 \
"${_OB_BINARY_FIELDS_REQUIRED_2}" "${_OB_BINARY_FIELDS_OPTIONAL_2}"
done
- _ob_return 0
- return ${?}
+ return 0
}
_ob_get_binary_packages_2()
{
- _ob_local _obgbp2_pkgs _obgbp2_pkg_control
+ local pkgs=
+ local pkg_control=
- for _obgbp2_pkg_control in "${_OB_PACKAGE_DIR}/"*'.pkg/control'; do
+ for pkg_control in "${_OB_PACKAGE_DIR}/"*'.pkg/control'; do
- if [ ! -f "${_obgbp2_pkg_control}" ]; then
+ if [ ! -f "${pkg_control}" ]; then
continue
fi
- _obgbp2_pkg_control="${_obgbp2_pkg_control%.pkg/control}"
- _obgbp2_pkg_control="${_obgbp2_pkg_control##*/}"
+ pkg_control="${pkg_control%.pkg/control}"
+ pkg_control="${pkg_control##*/}"
- ob_validate_binary_name "${_obgbp2_pkg_control}"
+ ob_validate_binary_name "${pkg_control}"
- _obgbp2_pkgs="${_obgbp2_pkgs} ${_obgbp2_pkg_control}"
+ pkgs="${pkgs} ${pkg_control}"
done
- _ob_set_binary_packages "${_obgbp2_pkgs}"
+ _ob_set_binary_packages "${pkgs}"
- _ob_return 0
- return ${?}
+ return 0
}
_ob_srcfield_2()
{
- _ob_local
-
_ob_set_source_parameter "${OB_CONTROL_NAME}" "${OB_CONTROL_VALUE}"
- _ob_return 0
- return ${?}
+ return 0
}
_ob_change_2()
{
- _ob_local
-
_ob_set_source_parameter Source "${OB_CHANGELOG_SOURCE}"
_ob_set_source_parameter Version "${OB_CHANGELOG_VERSION}"
_ob_set_source_parameter Distribution "${OB_CHANGELOG_DISTRIBUTION}"
@@ -96,75 +90,69 @@ _ob_change_2()
_ob_set_source_parameter Date "${OB_CHANGELOG_DATE}"
# Parse only the first changelog entry.
- _ob_return 1
- return ${?}
+ return 1
}
_ob_binfield_2()
{
- _ob_local
-
_ob_set_binary_parameter "${_OB_CURRENT_PACKAGE_2}" "${OB_CONTROL_NAME}" \
"${OB_CONTROL_VALUE}"
- _ob_return 0
- return ${?}
+ return 0
}
_ob_get_doc_package_2()
{
- _ob_local _obgdp2_pkg _obgdp2_doc_pkg
+ local pkg=
+ local doc_pkg=
- for _obgdp2_pkg in $(ob_get_binary_packages); do
- if [ -r "${_OB_PACKAGE_DIR}/${_obgdp2_pkg}.pkg/docs" ]; then
- if [ -n "${_obgdp2_doc_pkg}" ]; then
- _ob_return 1
- return ${?}
+ for pkg in $(ob_get_binary_packages); do
+ if [ -r "${_OB_PACKAGE_DIR}/${pkg}.pkg/docs" ]; then
+ if [ -n "${doc_pkg}" ]; then
+ return 1
fi
- _obgdp2_doc_pkg="${_obgdp2_pkg}"
+ doc_pkg="${pkg}"
fi
done
- if [ -z "${_obgdp2_doc_pkg}" ]; then
- _ob_return 1
- return ${?}
+ if [ -z "${doc_pkg}" ]; then
+ return 1
fi
- echo "${_obgdp2_doc_pkg}"
+ echo "${doc_pkg}"
- _ob_return 0
- return ${?}
+ return 0
}
_ob_get_doc_files_2()
{
- _ob_local _obgdf2_arch _obgdf2_plat _obgdf2_doc_pkg
+ local arch=
+ local plat=
+ local doc_pkg=
- _obgdf2_arch="${1}"
- _obgdf2_plat="${2}"
+ arch="${1}"
+ plat="${2}"
- _obgdf2_doc_pkg="$(_ob_get_doc_package_2)"
+ doc_pkg="$(_ob_get_doc_package_2)"
cat <<-EOF
../copyright
../changelog changelog.dist
../README README.dist
EOF
- cat "${_OB_PACKAGE_DIR}/${_obgdf2_doc_pkg}.pkg/docs"
+ cat "${_OB_PACKAGE_DIR}/${doc_pkg}.pkg/docs"
- _ob_return 0
- return ${?}
+ return 0
}
_ob_set_package_substvars_2()
{
- _ob_local _obspsv2_pkg
+ local pkg=
if [ ${#} -eq 1 ]; then
- _obspsv2_pkg="${1}"
+ pkg="${1}"
else
- _ob_return 125
- return ${?}
+ return 125
fi
if [ -f "${_OB_PACKAGE_DIR}/substvars" ]; then
@@ -175,14 +163,13 @@ _ob_set_package_substvars_2()
ob_set_substvar 'Binary-Version' "$(ob_get_source_parameter 'Version')"
ob_set_substvar 'Host-Arch' "${OPK_HOST_ARCH}"
ob_set_substvar 'Host-Plat' "${OPK_HOST_PLAT}"
+
+ return 0
}
_ob_substvar_2()
{
- _ob_local
-
ob_set_substvar "${OB_CONTROL_NAME}" "${OB_CONTROL_VALUE}"
- _ob_return 0
- return ${?}
+ return 0
}