summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick McDermott <patrick.mcdermott@libiquity.com>2020-07-05 23:01:13 (EDT)
committer Patrick McDermott <patrick.mcdermott@libiquity.com>2020-07-05 23:01:13 (EDT)
commit088a61c64c29acb17ea9a097d644418f90635496 (patch)
tree858897a3a9929f87d860ef97c56dac43d420c7ac
parent137700f42f49ed0ed30ebe3c3bce6092635a0ece (diff)
_ob_parse_package_metadata_2(): Validate section
On ob_get_binary_packages()'s first run, binary package control files haven't yet been parsed.
-rw-r--r--lib/package.sh8
-rw-r--r--lib/package/2.sh6
-rw-r--r--locale/en_US/libopkbuild_2.sh4
3 files changed, 10 insertions, 8 deletions
diff --git a/lib/package.sh b/lib/package.sh
index 772fdc0..8ed6645 100644
--- a/lib/package.sh
+++ b/lib/package.sh
@@ -93,7 +93,6 @@ ob_get_binary_packages()
local host_plat=
local pkg=
local pkgs_clean=
- local sect=
local pkg_clean=
local pkgs=
@@ -121,16 +120,11 @@ ob_get_binary_packages()
for pkg in ${_ob_binary_packages}; do
- # Validate the name and section.
+ # Validate the name.
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/lib/package/2.sh b/lib/package/2.sh
index 1ed7466..3e7bc0a 100644
--- a/lib/package/2.sh
+++ b/lib/package/2.sh
@@ -28,6 +28,7 @@ _ob_source_substvars_set_2=false
_ob_parse_package_metadata_2()
{
local pkg=
+ local sect=
ob_parse_control "${_ob_package_dir}/control" _ob_srcfield_2 '' \
"${_OB_SOURCE_FIELDS_REQUIRED_2}" \
@@ -39,6 +40,11 @@ _ob_parse_package_metadata_2()
_ob_binfield_2 "${pkg}" \
"${_OB_BINARY_FIELDS_REQUIRED_2}" \
"${_OB_BINARY_FIELDS_OPTIONAL_2}"
+ sect="$(ob_get_binary_parameter "${pkg}" 'Section')"
+ if ! ob_validate_section "${sect}"; then
+ _ob_warn_msg 'bad_section' "${pkg}" "${sect}"
+ continue
+ fi
done
return 0
diff --git a/locale/en_US/libopkbuild_2.sh b/locale/en_US/libopkbuild_2.sh
index b85eb1d..726bfcc 100644
--- a/locale/en_US/libopkbuild_2.sh
+++ b/locale/en_US/libopkbuild_2.sh
@@ -25,9 +25,11 @@ 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/package/*.sh
+msg_libopkbuild_2_bad_section='Binary package "%s" has invalid section name "%s"'
+
# lib/control.sh
msg_libopkbuild_2_control_empty_line='%s: empty line'
msg_libopkbuild_2_control_bad_nv='%s: badly formatted control field'