summaryrefslogtreecommitdiffstats
path: root/lib/changelog.sh
diff options
context:
space:
mode:
authorP. J. McDermott <pjm@nac.net>2012-08-01 04:59:20 (EDT)
committer P. J. McDermott <pjm@nac.net>2012-08-01 05:02:57 (EDT)
commit1bd1f57312bc110d487aa4d3ce09842816bbaf99 (patch)
tree638ef960940c4dd44978bfc996389cc641d8a612 /lib/changelog.sh
parente42905f2bd31ba3929d03110f6da91832f312050 (diff)
Hardcode relative path to changelog.
Diffstat (limited to 'lib/changelog.sh')
-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