summaryrefslogtreecommitdiffstats
path: root/lib/changelog.sh
diff options
context:
space:
mode:
Diffstat (limited to 'lib/changelog.sh')
-rw-r--r--lib/changelog.sh21
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/changelog.sh b/lib/changelog.sh
index f757e90..847bd4f 100644
--- a/lib/changelog.sh
+++ b/lib/changelog.sh
@@ -21,6 +21,15 @@
. @@LIBDIR@@/messages
+# Constant global parameters:
+OH_SOURCE_RE='^[a-z0-9][a-z0-9+.-]+$'
+OH_SOURCE_VERSION_ID_RE='^'
+OH_SOURCE_VERSION_ID_RE="${OH_SOURCE_VERSION_ID_RE}"'[0-9a-z.~]+'
+OH_SOURCE_VERSION_ID_RE="${OH_SOURCE_VERSION_ID_RE}"'(\+sip[1-9][0-9]*)?'
+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.
@@ -90,6 +99,18 @@ ${_line}"
OH_CHANGELOG_DISTRIBUTION=
OH_CHANGELOG_CHANGES=
else
+ echo "${_source}" | \
+ grep -E "${OH_SOURCE_RE}" >/dev/null 2>&1
+ if [ "${?}" -ne 0 ]; then
+ oh_changelog_parse_error "${_file}" "${_line_nr}" \
+ "${oh_str_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}"
+ fi
OH_CHANGELOG_SOURCE="${_source}"
OH_CHANGELOG_VERSION="${_version}"
OH_CHANGELOG_DISTRIBUTION="${_distribution}"