From 4dc51411ccbef104a5ce72735985a38053ff5398 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucio=20Andr=C3=A9s=20Illanes=20Albornoz?= Date: Sat, 29 Feb 2020 02:51:08 +0000 Subject: subr/build_init.subr:buildp_init_vars(): reject unknown groups. --- subr/build_init.subr | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/subr/build_init.subr b/subr/build_init.subr index 27af80da..213bf7d6 100644 --- a/subr/build_init.subr +++ b/subr/build_init.subr @@ -179,7 +179,7 @@ buildp_init_getopts() { }; buildp_init_vars() { - local _default_build_groups="" _fname="" _rc=0 _target=""; _status=""; + local _default_build_groups="" _fname="" _group="" _groups="" _rc=0; _status=""; if ! rtl_lmatch "${ARCH}" "nt32 nt64"; then _rc=1; _status="Error: invalid architecture \`${ARCH}'."; elif ! rtl_lmatch "${BUILD}" "debug release"; then @@ -208,17 +208,20 @@ buildp_init_vars() { for _fname in $(find ./groups -name *.group | sort); do rtl_fileop source_opt "${_fname}"; if [ -n "${GROUP_TARGET}" ]; then - _target="${GROUP_TARGET}"; unset GROUP_TARGET; + _group="${GROUP_TARGET}"; unset GROUP_TARGET; else - _fname="${_fname##*/}"; _fname="${_fname%.group}"; _target="${_fname#*.}"; + _group="${_fname##*/}"; _group="${_group%.group}"; _group="${_group#*.}"; fi; - if [ -n "${GROUP_AUTO}" ]; then - if [ "${GROUP_AUTO:-0}" -ne 0 ]; then - _default_build_groups="$(rtl_lconcat "${_default_build_groups}" "${_target}")"; + if ! rtl_lmatch "${_groups}" "${_group}"; then + _groups="$(rtl_lconcat "${_groups}" "${_group}")"; + if [ -n "${GROUP_AUTO}" ]; then + if [ "${GROUP_AUTO:-0}" -ne 0 ]; then + _default_build_groups="$(rtl_lconcat "${_default_build_groups}" "${_group}")"; + fi; + unset GROUP_AUTO; + else + _default_build_groups="$(rtl_lconcat "${_default_build_groups}" "${_group}")"; fi; - unset GROUP_AUTO; - else - _default_build_groups="$(rtl_lconcat "${_default_build_groups}" "${_target}")"; fi; done; _default_build_groups="$(rtl_uniq "${_default_build_groups}")"; @@ -229,6 +232,11 @@ buildp_init_vars() { BUILD_GROUPS="${_default_build_groups}"; fi; BUILD_GROUPS="$(rtl_lconcat "$(rtl_lfilter "${BUILD_GROUPS}" "invariants")" "invariants")"; + for _group in ${BUILD_GROUPS}; do + if ! rtl_lmatch "${_groups}" "${_group}"; then + _rc=1; _status="Error: unknown build group \`${_group}'."; break; + fi; + done; fi; fi; return "${_rc}"; -- cgit v1.2.3