build-system: use_flags in YAML config file

This commit is contained in:
2024-09-10 10:42:28 +02:00
parent ed30c4a73d
commit 5e1c3feb53
2 changed files with 10 additions and 11 deletions
+1 -1
View File
@@ -328,7 +328,7 @@ readonly -f pbuild::version_eq
#.............................................................................. #..............................................................................
# #
pbuild::use_flag() { pbuild::use_flag() {
[[ "${USE_FLAGS}" == *:${1}:* ]] [[ "${ModuleConfig['use_flags']}" =~ " ${1} " ]]
} }
readonly -f pbuild::use_flag readonly -f pbuild::use_flag
+9 -10
View File
@@ -243,14 +243,6 @@ parse_args() {
--check-mode ) --check-mode )
opt_check_mode='yes' opt_check_mode='yes'
;; ;;
--use-flags | --use-flags=* )
if [[ $1 == *=* ]]; then
USE_FLAGS=":${1#--*=}:"
else
USE_FLAGS=":$2:"
shift
fi
;;
--with | --with=*/* ) --with | --with=*/* )
if [[ $1 == *=* ]]; then if [[ $1 == *=* ]]; then
opt_with_modules+=( "${1#--*=}" ) opt_with_modules+=( "${1#--*=}" )
@@ -457,13 +449,13 @@ init_module_environment(){
parse_version() { parse_version() {
local v="$1" local v="$1"
V="$1" V="$1"
USE_FLAGS=${USE_FLAGS:-''}
local tmp='' local tmp=''
SUFFIX=''
if [[ "$v" =~ "_" ]]; then if [[ "$v" =~ "_" ]]; then
tmp="${v#*_}" tmp="${v#*_}"
USE_FLAGS+=":${tmp//_/:}:" SUFFIX+=":${tmp//_/:}:"
v="${v%%_*}" v="${v%%_*}"
fi fi
V_PKG="${v%%-*}" # version without the release number V_PKG="${v%%-*}" # version without the release number
@@ -545,6 +537,7 @@ declare -A Yaml_default_config=(
['sub_packages']='' # !!map ['sub_packages']='' # !!map
['target_cpus']='' # !!seq of strings ['target_cpus']='' # !!seq of strings
['urls']='' # !!map ['urls']='' # !!map
['use_flags']='' # !!seq
['use_overlays']='' # !!seq ['use_overlays']='' # !!seq
['variant']='' # !!str ['variant']='' # !!str
) )
@@ -773,6 +766,12 @@ build_modules_yaml_v1(){
pm::get_value "${yaml_input}" value "${key}" '!!map' pm::get_value "${yaml_input}" value "${key}" '!!map'
cfg[${key,,}]="${value}" cfg[${key,,}]="${value}"
;; ;;
use_flags )
pm::get_seq "${yaml_input}" value "${key}"
local -a tmp=()
readarray -t tmp <<<"${value}"
cfg[${key,,}]=" ${tmp[*]} "
;;
relstage ) relstage )
pm::get_value "${yaml_input}" value "${key}" '!!str' pm::get_value "${yaml_input}" value "${key}" '!!str'
case ${value,,} in case ${value,,} in