summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/changelog.sh21
-rw-r--r--locale/en_US.sh5
-rw-r--r--src/opkbuild.sh16
3 files changed, 25 insertions, 17 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}"
diff --git a/locale/en_US.sh b/locale/en_US.sh
index 074db25..533f48e 100644
--- a/locale/en_US.sh
+++ b/locale/en_US.sh
@@ -17,6 +17,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+# lib/changelog
+oh_str_bad_source='Invalid source package name "%s"'
+oh_str_bad_source_version='Invalid source package version identifier "%s"'
+
# All utilities
oh_str_usage_none='No usage found'
oh_str_help_none='No help found'
@@ -63,7 +67,6 @@ oh_str_no_control='No "control" file found'
oh_str_no_config='No "config" file found'
oh_str_no_copyright='No "copyright" file found'
oh_str_no_changelog='No "changelog" file found'
-oh_str_bad_source_version='Invalid source package version identifier "%s"'
oh_str_installing_src_pkg_files='Installing files for source package...'
oh_str_cant_make_src_pkg_dir='Can'\''t make data directory for source package'
oh_str_cant_install_src_pkg_file='Can'\''t install source package file'
diff --git a/src/opkbuild.sh b/src/opkbuild.sh
index 3ca6eab..94c12e8 100644
--- a/src/opkbuild.sh
+++ b/src/opkbuild.sh
@@ -55,14 +55,6 @@ export SIZE=
export STRINGS=
export STRIP=
-# Constant global parameters:
-SOURCE_VERSION_ID_RE='^'
-SOURCE_VERSION_ID_RE="${SOURCE_VERSION_ID_RE}"'[0-9a-z.~]+'
-SOURCE_VERSION_ID_RE="${SOURCE_VERSION_ID_RE}"'(\+sip[1-9][0-9]*)?'
-SOURCE_VERSION_ID_RE="${SOURCE_VERSION_ID_RE}"'(-[1-9][0-9]*)?'
-SOURCE_VERSION_ID_RE="${SOURCE_VERSION_ID_RE}"'(\+[a-z0-9]+-[1-9][0-9]*)?'
-SOURCE_VERSION_ID_RE="${SOURCE_VERSION_ID_RE}"'$'
-
# Global parameters:
OPT_BUILD=
OPT_TARGET=
@@ -231,14 +223,6 @@ setup_package()
{
OH_SOURCE="${OH_CHANGELOG_SOURCE}"
OH_SOURCE_VERSION="${OH_CHANGELOG_VERSION}"
-
- # Validate source package version identifier.
- echo "${OH_SOURCE_VERSION}" | grep -E "${SOURCE_VERSION_ID_RE}" \
- >/dev/null 2>&1
- if [ "${?}" -ne 0 ]; then
- oh_error "${oh_str_bad_source_version}" "${OH_SOURCE_VERSION}"
- fi
-
OH_SOURCE_VERSION_UPSTREAM="${OH_SOURCE_VERSION:%%-}"
OH_BINARY_VERSION="${OH_SOURCE_VERSION}"