diff options
Diffstat (limited to 'packaging/hal-rootstrap-checker.sh')
-rw-r--r-- | packaging/hal-rootstrap-checker.sh | 65 |
1 files changed, 34 insertions, 31 deletions
diff --git a/packaging/hal-rootstrap-checker.sh b/packaging/hal-rootstrap-checker.sh index b1215fb..e4e1701 100644 --- a/packaging/hal-rootstrap-checker.sh +++ b/packaging/hal-rootstrap-checker.sh @@ -12,59 +12,62 @@ UNSPECIFIED="Unspecified" LINE_MAX_LENGTH=90 print_border() { - PLACEHOLDER=$(printf "%*s" "$LINE_MAX_LENGTH" " ") - echo ${PLACEHOLDER// /\#} + local placeholder=$(printf "%*s" "$LINE_MAX_LENGTH" " ") + echo ${placeholder// /\#} } print_message() { - MESSAGE_MAX_LENGTH=$(($LINE_MAX_LENGTH - 3)) - printf "# %-*s#\n" "$MESSAGE_MAX_LENGTH" "$1" + local message_max_length=$(($LINE_MAX_LENGTH - 3)) + printf "# %-*s#\n" "$message_max_length" "$1" } print_not_allowed_log() { - WARNING_TYPE=$1 - NOT_ALLOWED_LIST=$2 - ALLOWED_PACKAGE_NAME_LIST=$3 - ALLOWED_GROUP_NAME_LIST=$4 - ACTION=$5 + local warning_type=$1 + local not_allowed_list=$2 + local allowed_package_name_list=$3 + local allowed_group_name_list=$4 + local action=$5 - if [[ "$ACTION" == "ignore" ]]; then + if [[ "$action" == "ignore" ]]; then return fi - PREFIX="WARNING" - if [[ "$ACTION" == "error" ]]; then - PREFIX="ERROR" + local prefix="WARNING" + if [[ "$action" == "error" ]]; then + prefix="ERROR" fi + local not_allowed="" + local allowed="" + print_border print_border - print_message "$PREFIX: There are not allowed $WARNING_TYPE. They might cause ABI break." - for NOT_ALLOWED in ${NOT_ALLOWED_LIST}; do - NOT_ALLOWED_PACKAGE_NAME="" - NOT_ALLOWED_GROUP_NAME="" - if [[ $NOT_ALLOWED =~ (.*)@(.*) ]]; then - NOT_ALLOWED_PACKAGE_NAME=${BASH_REMATCH[1]} - NOT_ALLOWED_GROUP_NAME=${BASH_REMATCH[2]} + print_message "$prefix: There are not allowed $warning_type. They might cause ABI break." + for not_allowed in ${not_allowed_list}; do + local not_allowed_package_name="" + local not_allowed_group_name="" + if [[ $not_allowed =~ (.*)@(.*) ]]; then + not_allowed_package_name=${BASH_REMATCH[1]} + not_allowed_group_name=${BASH_REMATCH[2]} fi - print_message "$PREFIX: - $NOT_ALLOWED_PACKAGE_NAME, Group: $NOT_ALLOWED_GROUP_NAME" + print_message "$prefix: - $not_allowed_package_name, Group: $not_allowed_group_name" done - print_message "$PREFIX:" - if [[ ! -z $ALLOWED_PACKAGE_NAME_LIST ]]; then - print_message "$PREFIX: Use only allowed packages below for $WARNING_TYPE" - for ALLOWED in ${ALLOWED_PACKAGE_NAME_LIST}; do - print_message "$PREFIX: - $ALLOWED" + print_message "$prefix:" + if [[ ! -z $allowed_package_name_list ]]; then + print_message "$prefix: Use only allowed packages below for $warning_type" + for allowed in ${allowed_package_name_list}; do + print_message "$prefix: - $allowed" done else - print_message "$PREFIX: It is not allowed to specify $WARNING_TYPE" + print_message "$prefix: It is not allowed to specify $warning_type" fi - if [[ ! -z $ALLOWED_GROUP_NAME_LIST ]]; then - print_message "$PREFIX: Use only allowed package groups below for $WARNING_TYPE" - for ALLOWED in ${ALLOWED_GROUP_NAME_LIST}; do - print_message "$PREFIX: - $ALLOWED" + if [[ ! -z $allowed_group_name_list ]]; then + print_message "$prefix: Use only allowed package groups below for $warning_type" + for allowed in ${allowed_group_name_list}; do + print_message "$prefix: - $allowed" done fi |