summaryrefslogtreecommitdiffstats
path: root/lib/changelog.sh
diff options
context:
space:
mode:
authorP. J. McDermott <pjm@nac.net>2012-08-01 04:30:22 (EDT)
committer P. J. McDermott <pjm@nac.net>2012-08-01 04:30:22 (EDT)
commit23c9f268392bcb735337f1c2580824886c5981dd (patch)
tree35e07b8c5ac49351afd7647633dfd9335138f21e /lib/changelog.sh
parentbb2c1e32b6614b01f9acef03871a0a403e59b06d (diff)
Mostly internationalize changelog library.
Diffstat (limited to 'lib/changelog.sh')
-rw-r--r--lib/changelog.sh25
1 files changed, 11 insertions, 14 deletions
diff --git a/lib/changelog.sh b/lib/changelog.sh
index 847bd4f..327cc2d 100644
--- a/lib/changelog.sh
+++ b/lib/changelog.sh
@@ -30,9 +30,6 @@ OH_SOURCE_VERSION_ID_RE="${OH_SOURCE_VERSION_ID_RE}"'(-[1-9][0-9]*)?'
OH_SOURCE_VERSION_ID_RE="${OH_SOURCE_VERSION_ID_RE}"'(\+[a-z0-9]+-[1-9][0-9]*)?'
OH_SOURCE_VERSION_ID_RE="${OH_SOURCE_VERSION_ID_RE}"'$'
-# TODO: Either add an error callback to oh_changelog_parse() or make a central
-# error handling library.
-# TODO: Move message strings into locales.
oh_changelog_parse_error()
{
_file="${1}"
@@ -73,7 +70,7 @@ ${_line}"
:
elif [ "${_expect}" != CHANGES_OR_TRAILER ]; then
oh_changelog_parse_error "${_file}" "${_line_nr}" \
- 'found blank line where expected %s' "${_expect}"
+ "${oh_str_changelog_found_blank_line}" "${_expect}"
else
_blank_lines="${_blank_lines}
${_line}"
@@ -82,7 +79,7 @@ ${_line}"
if [ "${_expect}" != FIRST_HEADING -a \
"${_expect}" != NEXT_OR_EOF ]; then
oh_changelog_parse_error "${_file}" "${_line_nr}" \
- 'found start of entry where expected %s' "${_expect}"
+ "${oh_str_changelog_found_heading}" "${_expect}"
fi
_source="${_line%% (*}"
_line_="${_line#* (}"
@@ -93,7 +90,7 @@ ${_line}"
-z "${_version}" -o \
"${_version% *}" != "${_version}" ]; then
oh_changelog_parse_error "${_file}" "${_line_nr}" \
- 'badly formatted heading line'
+ "${oh_str_changelog_bad_heading}"
OH_CHANGELOG_SOURCE=
OH_CHANGELOG_VERSION=
OH_CHANGELOG_DISTRIBUTION=
@@ -103,13 +100,13 @@ ${_line}"
grep -E "${OH_SOURCE_RE}" >/dev/null 2>&1
if [ "${?}" -ne 0 ]; then
oh_changelog_parse_error "${_file}" "${_line_nr}" \
- "${oh_str_bad_source}"
+ "${oh_str_changelog_bad_source}"
fi
echo "${_version}" | \
grep -E "${OH_SOURCE_VERSION_ID_RE}" >/dev/null 2>&1
if [ "${?}" -ne 0 ]; then
oh_changelog_parse_error "${_file}" "${_line_nr}" \
- "${oh_str_bad_source_version}"
+ "${oh_str_changelog_bad_source_version}"
fi
OH_CHANGELOG_SOURCE="${_source}"
OH_CHANGELOG_VERSION="${_version}"
@@ -121,7 +118,7 @@ ${_line}"
elif [ "${_line# -- }" != "${_line}" ]; then
if [ "${_expect}" != CHANGES_OR_TRAILER ]; then
oh_changelog_parse_error "${_file}" "${_line_nr}" \
- 'found trailer where expected %s' "${_expect}"
+ "${oh_str_changelog_found_trailer}" "${_expect}"
fi
_line="${_line# -- }"
_maintainer="${_line%% *}"
@@ -129,7 +126,7 @@ ${_line}"
if [ -z "${_maintainer}" -o -z "${_date}" -o \
"${_maintainer}" = "${_date}" ]; then
oh_changelog_parse_error "${_file}" "${_line_nr}" \
- 'badly formatted trailer line'
+ "${oh_str_changelog_bad_trailer}"
OH_CHANGELOG_MAINTAINER=
OH_CHANGELOG_DATE=
elif [ -n "${OH_CHANGELOG_SOURCE}" ]; then
@@ -143,12 +140,12 @@ ${_line}"
_blank_lines=
elif [ "${_line# --}" != "${_line}" ]; then
oh_changelog_parse_error "${_file}" "${_line_nr}" \
- 'badly formatted trailer line'
+ "${oh_str_changelog_bad_trailer}"
elif [ "${_line## }" != "${_line}" ]; then
if [ "${_expect}" != START_CHANGES -a \
"${_expect}" != CHANGES_OR_TRAILER ]; then
oh_changelog_parse_error "${_file}" "${_line_nr}" \
- 'found change data where expected %s' "${_expect}"
+ "${oh_str_changelog_found_change}" "${_expect}"
fi
OH_CHANGELOG_CHANGES="${OH_CHANGELOG_CHANGES}
${_blank_lines}${_line}"
@@ -156,14 +153,14 @@ ${_blank_lines}${_line}"
_blank_lines=
else
oh_changelog_parse_error "${_file}" "${_line_nr}" \
- 'unrecognized line'
+ "${oh_str_changelog_bad_line}"
_blank_lines=
fi
done <"${_file}"
if [ "${_expect}" != NEXT_OR_EOF ]; then
oh_changelog_parse_error "${_file}" "${_line_nr}" \
- 'found eof where expected %s' "${_expect}"
+ "${oh_str_changelog_found_eof}" "${_expect}"
fi
return ${_entries}