Extend BUILD_ONLY value to single value "default" (#4519)

* Extend BUILD_ONLY value to single value "any"

- build-tasks.sh:
  - build_task_is_enabled():
    - handle value "any" adequate to logic for empty string
  - build_validate_buildOnly():
    - handle value "any" adequate to logic for empty string
    - add specific error message in case "any" appears in a list of task names
  - add function build_only_value_for_kernel_only_build():
    - provide a constant list of task names for kernel only package build
      supposed to be used unique at several places
  - backward_compatibility_build_only():
    - propagate KERNEL_ONLY="no" to BUILD_ONLY="any"
    - propagate KERNEL_ONLY="yes" to BUILD_ONLY="$(build_only_value_for_kernel_only_build)"
    - update log messages accordingly

- interactive.sh:
  - re-factor interactive_config_ask_kernel_only()
    -> interactive_config_ask_build_only()
  - interactive_config_ask_build_only():
    - provide three pre-defined choices:
      - "u-boot" - "U-boot package only"
      - "$(build_only_value_for_kernel_only_build)" - "U-boot and kernel packages"
      - "any" - "Full OS image for flashing"
  - un-comment call of interactive_config_ask_build_only
    in interactive_config_ask_kernel()

* Extend BUILD_ONLY value to single value "default"

- build-tasks.sh:
  - change BUILD_ONLY setting of "any" to "default"
    to be closer to parallel WIP of #4526

- interactive.sh:
  - interactive_config_ask_build_only():
    - improve menu selection texts for unique quick selection first characters:
      - "u-boot" - "U-boot package only"
      - "$(build_only_value_for_kernel_only_build)" - "Kernel and U-boot packages only"
      - "default" - "Full OS image for flashing"

* Update sequence of BUILD_ONLY selection

- start with default to "Kernel and U-Boot packages only"

Co-authored-by: Igor <igor@armbian.com>
This commit is contained in:
Markus Hoffrogge 2023-01-22 08:57:50 +01:00 committed by GitHub
parent e1482b1e9a
commit fba71fa703
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 34 additions and 16 deletions

View File

@ -13,19 +13,20 @@ function interactive_config_prepare_terminal() {
}
function interactive_config_ask_kernel() {
# interactive_config_ask_kernel_only
interactive_config_ask_build_only
interactive_config_ask_kernel_configure
}
function interactive_config_ask_kernel_only() {
if [[ -z $KERNEL_ONLY ]]; then
function interactive_config_ask_build_only() {
if [[ -z $BUILD_ONLY ]]; then
options+=("yes" "U-boot and kernel packages")
options+=("no" "Full OS image for flashing")
KERNEL_ONLY=$(dialog --stdout --title "Choose an option" --backtitle "$backtitle" --no-tags \
options+=("$(build_only_value_for_kernel_only_build)" "Kernel and U-boot packages only")
options+=("u-boot" "U-boot package only")
options+=("default" "Full OS image for flashing")
BUILD_ONLY=$(dialog --stdout --title "Choose an option" --backtitle "$backtitle" --no-tags \
--menu "Select what to build" $TTY_Y $TTY_X $((TTY_Y - 8)) "${options[@]}")
unset options
[[ -z $KERNEL_ONLY ]] && exit_with_error "No option selected"
[[ -z $BUILD_ONLY ]] && exit_with_error "No option selected"
fi
}

View File

@ -12,8 +12,8 @@ build_task_is_enabled() {
# remove all "
local _taskNameToCheck=${1//\"/}
local _buildOnly=${BUILD_ONLY//\"/}
# An empty _buildOnly allows any taskname
[[ -z $_buildOnly ]] && return 0
# An empty _buildOnly allows default taskname
[[ -z $_buildOnly || "${_buildOnly}" == "default" ]] && return 0
_buildOnly=${_buildOnly//,/ }
for _buildOnlyTaskName in ${_buildOnly}; do
[[ "$_taskNameToCheck" == "$_buildOnlyTaskName" ]] && return 0
@ -40,7 +40,7 @@ build_validate_buildOnly() {
# relace all :comma: by :space:
_all_valid_buildOnly=${_all_valid_buildOnly//,/ }
_buildOnly=${_buildOnly//,/ }
[[ -z $_buildOnly ]] && return
[[ -z $_buildOnly || "${_buildOnly}" == "default" ]] && return
local _invalidTaskNames=""
for _taskName in ${_buildOnly}; do
local _isFound=0
@ -52,13 +52,30 @@ build_validate_buildOnly() {
fi
done
if [[ -n $_invalidTaskNames ]]; then
display_alert "BUILD_ONLY has invalid task name(s):" "${_invalidTaskNames}" "err"
display_alert "Use BUILD_ONLY valid task names only:" "${_all_valid_buildOnly}" "ext"
if [[ "${_invalidTaskNames}" == "default" ]]; then
display_alert "BUILD_ONLY value \"default\" must be configured as a single value only and must not be listed with other task names." "${BUILD_ONLY}" "err"
else
display_alert "BUILD_ONLY has invalid task name(s):" "${_invalidTaskNames}" "err"
display_alert "Use BUILD_ONLY valid task names only:" "${_all_valid_buildOnly}" "ext"
fi
display_alert "Process aborted" "" "info"
exit 1
fi
}
###############################################################################
#
# build_only_value_for_kernel_only_build()
#
# This function provides the list of task names for a kernel package only build.
#
# In case of future updates, please review and maintain this list of task names.
#
build_only_value_for_kernel_only_build() {
echo "u-boot,kernel,armbian-config,armbian-zsh,plymouth-theme-armbian,armbian-firmware,armbian-bsp"
return 0
}
###############################################################################
#
# backward_compatibility_build_only()
@ -68,7 +85,7 @@ build_validate_buildOnly() {
# It exists for backward compatibility only.
#
backward_compatibility_build_only() {
local _kernel_buildOnly="u-boot,kernel,armbian-config,armbian-zsh,plymouth-theme-armbian,armbian-firmware,armbian-bsp"
local _kernel_buildOnly=$(build_only_value_for_kernel_only_build)
# These checks are necessary for backward compatibility with logic
# https://github.com/armbian/scripts/tree/master /.github/workflows scripts.
@ -76,12 +93,12 @@ backward_compatibility_build_only() {
[[ -n $KERNEL_ONLY ]] && {
display_alert "The KERNEL_ONLY key is no longer used." "KERNEL_ONLY=$KERNEL_ONLY" "wrn"
if [ "$KERNEL_ONLY" == "no" ]; then
display_alert "Use an empty BUILD_ONLY variable instead" "" "info"
display_alert "Use BUILD_ONLY=default instead" "" "info"
[[ -n "${BUILD_ONLY}" ]] && {
display_alert "A contradiction. BUILD_ONLY contains a goal. Fix it." "${BUILD_ONLY}" "wrn"
BUILD_ONLY=""
display_alert "Enforced BUILD_ONLY to an empty string." "" "info"
}
BUILD_ONLY="default"
display_alert "BUILD_ONLY enforced to:" "${BUILD_ONLY}" "info"
elif [ "$KERNEL_ONLY" == "yes" ]; then
display_alert "Instead, use BUILD_ONLY to select the build target." "$_kernel_buildOnly" "wrn"
BUILD_ONLY="$_kernel_buildOnly"