summaryrefslogtreecommitdiffstats
path: root/lib/changelog.sh
diff options
context:
space:
mode:
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}