summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/changelog.sh31
1 files changed, 15 insertions, 16 deletions
diff --git a/lib/changelog.sh b/lib/changelog.sh
index 53cca58..909c955 100644
--- a/lib/changelog.sh
+++ b/lib/changelog.sh
@@ -23,6 +23,7 @@
_OH_CHANGELOG_SH=true
. @@LIBDIR@@/messages
+. @@LIBDIR@@/util
# Constant global parameters:
OH_SOURCE_RE='^[a-z0-9][a-z0-9+.-]+$'
@@ -35,7 +36,6 @@ OH_SOURCE_VERSION_ID_RE="${OH_SOURCE_VERSION_ID_RE}"'$'
oh_changelog_parse_error()
{
- _file="${1}"
_line_nr="${2}"
_error="${3}"
_expect_id="${4}"
@@ -48,7 +48,7 @@ oh_changelog_parse_error()
*) _expect_str='unknown';;
esac
- _file_info=$(printf '%20s(l%d):' "${_file}" "${_line_nr}")
+ _file_info=$(printf '%20s(l%d):' "${OH_SOURCE_DIR}/changelog" "${_line_nr}")
oh_warn "${_file_info} ${_error}" "${_expect_str}"
}
@@ -56,8 +56,7 @@ oh_changelog_parse()
{
# Parsing logic based on that of dpkg.
- _file="${1}"
- _cb="${2}"
+ _cb="${1}"
_expect=FIRST_HEADING
_line_nr=0
@@ -72,7 +71,7 @@ ${_line}"
elif [ "${_expect}" = NEXT_OR_EOF ]; then
:
elif [ "${_expect}" != CHANGES_OR_TRAILER ]; then
- oh_changelog_parse_error "${_file}" "${_line_nr}" \
+ oh_changelog_parse_error "${_line_nr}" \
"${oh_str_changelog_found_blank_line}" "${_expect}"
else
_blank_lines="${_blank_lines}
@@ -81,7 +80,7 @@ ${_line}"
elif [ "${_line# }" = "${_line}" ]; then
if [ "${_expect}" != FIRST_HEADING -a \
"${_expect}" != NEXT_OR_EOF ]; then
- oh_changelog_parse_error "${_file}" "${_line_nr}" \
+ oh_changelog_parse_error "${_line_nr}" \
"${oh_str_changelog_found_heading}" "${_expect}"
fi
_source="${_line%% (*}"
@@ -92,7 +91,7 @@ ${_line}"
if [ -z "${_source}" -o -z "${_distribution}" -o \
-z "${_version}" -o \
"${_version% *}" != "${_version}" ]; then
- oh_changelog_parse_error "${_file}" "${_line_nr}" \
+ oh_changelog_parse_error "${_line_nr}" \
"${oh_str_changelog_bad_heading}"
OH_CHANGELOG_SOURCE=
OH_CHANGELOG_VERSION=
@@ -102,13 +101,13 @@ ${_line}"
echo "${_source}" | \
grep -E "${OH_SOURCE_RE}" >/dev/null 2>&1
if [ "${?}" -ne 0 ]; then
- oh_changelog_parse_error "${_file}" "${_line_nr}" \
+ oh_changelog_parse_error "${_line_nr}" \
"${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_changelog_parse_error "${_line_nr}" \
"${oh_str_changelog_bad_source_version}"
fi
OH_CHANGELOG_SOURCE="${_source}"
@@ -120,7 +119,7 @@ ${_line}"
_blank_lines=
elif [ "${_line# -- }" != "${_line}" ]; then
if [ "${_expect}" != CHANGES_OR_TRAILER ]; then
- oh_changelog_parse_error "${_file}" "${_line_nr}" \
+ oh_changelog_parse_error "${_line_nr}" \
"${oh_str_changelog_found_trailer}" "${_expect}"
fi
_line="${_line# -- }"
@@ -128,7 +127,7 @@ ${_line}"
_date="${_line#* }"
if [ -z "${_maintainer}" -o -z "${_date}" -o \
"${_maintainer}" = "${_date}" ]; then
- oh_changelog_parse_error "${_file}" "${_line_nr}" \
+ oh_changelog_parse_error "${_line_nr}" \
"${oh_str_changelog_bad_trailer}"
OH_CHANGELOG_MAINTAINER=
OH_CHANGELOG_DATE=
@@ -142,12 +141,12 @@ ${_line}"
_expect=NEXT_OR_EOF
_blank_lines=
elif [ "${_line# --}" != "${_line}" ]; then
- oh_changelog_parse_error "${_file}" "${_line_nr}" \
+ oh_changelog_parse_error "${_line_nr}" \
"${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}" \
+ oh_changelog_parse_error "${_line_nr}" \
"${oh_str_changelog_found_change}" "${_expect}"
fi
OH_CHANGELOG_CHANGES="${OH_CHANGELOG_CHANGES}
@@ -155,14 +154,14 @@ ${_blank_lines}${_line}"
_expect=CHANGES_OR_TRAILER
_blank_lines=
else
- oh_changelog_parse_error "${_file}" "${_line_nr}" \
+ oh_changelog_parse_error "${_line_nr}" \
"${oh_str_changelog_bad_line}"
_blank_lines=
fi
- done <"${_file}"
+ done <"${OH_SOURCE_DIR}/changelog"
if [ "${_expect}" != NEXT_OR_EOF ]; then
- oh_changelog_parse_error "${_file}" "${_line_nr}" \
+ oh_changelog_parse_error "${_line_nr}" \
"${oh_str_changelog_found_eof}" "${_expect}"
fi