summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick McDermott <patrick.mcdermott@libiquity.com>2020-07-05 00:41:14 (EDT)
committer Patrick McDermott <patrick.mcdermott@libiquity.com>2020-07-05 00:41:14 (EDT)
commit137700f42f49ed0ed30ebe3c3bce6092635a0ece (patch)
treee7ae775f45db126dd18d698b3bb0a2c324909b52
parentaee0be0d0605d98c411c4c042be70d66503c6215 (diff)
ob_get_binary_packages(): Validate section
-rw-r--r--lib/package.sh8
-rw-r--r--locale/en_US/libopkbuild_2.sh1
2 files changed, 8 insertions, 1 deletions
diff --git a/lib/package.sh b/lib/package.sh
index 8ed6645..772fdc0 100644
--- a/lib/package.sh
+++ b/lib/package.sh
@@ -93,6 +93,7 @@ ob_get_binary_packages()
local host_plat=
local pkg=
local pkgs_clean=
+ local sect=
local pkg_clean=
local pkgs=
@@ -120,11 +121,16 @@ ob_get_binary_packages()
for pkg in ${_ob_binary_packages}; do
- # Validate the name.
+ # Validate the name and section.
if ! ob_validate_binary_name "${pkg}"; then
_ob_warn_msg 'bad_binary_name' "${pkg}"
continue
fi
+ sect="$(ob_get_binary_parameter "${pkg}" 'Section')"
+ if ! ob_validate_section "${sect}"; then
+ _ob_warn_msg 'bad_section' "${pkg}" "${sect}"
+ continue
+ fi
# Make sure the "clean" name is unique.
pkg_clean="$(printf '%s' "${pkg}" | tr 'a-z' 'A-Z' | \
diff --git a/locale/en_US/libopkbuild_2.sh b/locale/en_US/libopkbuild_2.sh
index 275177e..b85eb1d 100644
--- a/locale/en_US/libopkbuild_2.sh
+++ b/locale/en_US/libopkbuild_2.sh
@@ -25,6 +25,7 @@ msg_libopkbuild_2_output_info_format='%s: %s'
# lib/package.sh
msg_libopkbuild_2_unable_to_detect_package_format='Unable to detect package format'
msg_libopkbuild_2_bad_binary_name='Bad binary package name: "%s"'
+msg_libopkbuild_2_bad_section='Binary package "%s" has invalid section name "%s"'
msg_libopkbuild_2_duplicate_clean_binary_name='Duplicate clean binary package name: "%s"'
# lib/control.sh