configdump: include rudimentary artifact dependency information for config-dump-json (artifact implementations)

- include rudimentary artifact dependency information for config-dump-json: fixes/refactor/cleanup
- artifact-rootfs.sh: include rudimentary artifact dependency information for config-dump-json
- artifact-armbian-(config/plymouth-theme/zsh).sh: include rudimentary artifact dependency information for config-dump-json
- artifact-fake-ubuntu-advantage-tools.sh: include rudimentary artifact dependency information for config-dump-json
This commit is contained in:
Ricardo Pardini
2023-03-28 01:11:34 +02:00
committed by Igor Pečovnik
parent 42fc56697b
commit 55ba084acc
12 changed files with 154 additions and 33 deletions

View File

@@ -7,6 +7,10 @@
# This file is a part of the Armbian Build Framework
# https://github.com/armbian/build/
function artifact_armbian-config_config_dump() {
artifact_input_variables[BUILD_MINIMAL]="${BUILD_MINIMAL}"
}
function artifact_armbian-config_prepare_version() {
artifact_version="undetermined" # outer scope
artifact_version_reason="undetermined" # outer scope

View File

@@ -7,6 +7,11 @@
# This file is a part of the Armbian Build Framework
# https://github.com/armbian/build/
function artifact_armbian-plymouth-theme_config_dump() {
# artifact_input_variables: None, for armbian-plymouth-theme.
:
}
function artifact_armbian-plymouth-theme_prepare_version() {
artifact_version="undetermined" # outer scope
artifact_version_reason="undetermined" # outer scope

View File

@@ -7,6 +7,11 @@
# This file is a part of the Armbian Build Framework
# https://github.com/armbian/build/
function artifact_armbian-zsh_config_dump() {
# artifact_input_variables: None, for armbian-zsh.
:
}
function artifact_armbian-zsh_prepare_version() {
artifact_version="undetermined" # outer scope
artifact_version_reason="undetermined" # outer scope

View File

@@ -7,6 +7,11 @@
# This file is a part of the Armbian Build Framework
# https://github.com/armbian/build/
function artifact_fake_ubuntu_advantage_tools_config_dump() {
# artifact_input_variables: None, for fake ubuntu advantage.
:
}
function artifact_fake_ubuntu_advantage_tools_prepare_version() {
artifact_version="undetermined" # outer scope
artifact_version_reason="undetermined" # outer scope

View File

@@ -7,6 +7,11 @@
# This file is a part of the Armbian Build Framework
# https://github.com/armbian/build/
function artifact_firmware_config_dump() {
# artifact_input_variables: None, for firmware.
:
}
function artifact_firmware_prepare_version() {
artifact_version="undetermined" # outer scope
artifact_version_reason="undetermined" # outer scope

View File

@@ -7,6 +7,11 @@
# This file is a part of the Armbian Build Framework
# https://github.com/armbian/build/
function artifact_full_firmware_config_dump() {
# artifact_input_variables: None, for firmware.
:
}
function artifact_full_firmware_prepare_version() {
artifact_version="undetermined" # outer scope
artifact_version_reason="undetermined" # outer scope

View File

@@ -7,6 +7,16 @@
# This file is a part of the Armbian Build Framework
# https://github.com/armbian/build/
function artifact_kernel_config_dump() {
# BOARD is NOT included. See explanation below.
artifact_input_variables[LINUXFAMILY]="${LINUXFAMILY}"
artifact_input_variables[BRANCH]="${BRANCH}"
artifact_input_variables[KERNEL_MAJOR_MINOR]="${KERNEL_MAJOR_MINOR}"
artifact_input_variables[KERNELSOURCE]="${KERNELSOURCE}"
artifact_input_variables[KERNELBRANCH]="${KERNELBRANCH}"
artifact_input_variables[KERNELPATCHDIR]="${KERNELPATCHDIR}"
}
# This is run in a logging section.
# Prepare the version, "sans-repos": just the armbian/build repo contents are available.
# It is OK to reach out to the internet for a curl or ls-remote, but not for a git clone, but

View File

@@ -7,6 +7,12 @@
# This file is a part of the Armbian Build Framework
# https://github.com/armbian/build/
function artifact_rootfs_config_dump() {
artifact_input_variables[ARCH]="${ARCH}"
artifact_input_variables[RELEASE]="${RELEASE}"
artifact_input_variables[CACHE_TYPE]="${cache_type:-"no_cache_type_yet"}"
}
function artifact_rootfs_prepare_version() {
artifact_version="undetermined" # outer scope
artifact_version_reason="undetermined" # outer scope

View File

@@ -7,6 +7,14 @@
# This file is a part of the Armbian Build Framework
# https://github.com/armbian/build/
function artifact_uboot_config_dump() {
artifact_input_variables[BOOTSOURCE]="${BOOTSOURCE}"
artifact_input_variables[BOOTBRANCH]="${BOOTBRANCH}"
artifact_input_variables[BOOTPATCHDIR]="${BOOTPATCHDIR}"
artifact_input_variables[BOARD]="${BOARD}"
artifact_input_variables[BRANCH]="${BRANCH}"
}
function artifact_uboot_prepare_version() {
artifact_version="undetermined" # outer scope
artifact_version_reason="undetermined" # outer scope

View File

@@ -10,6 +10,7 @@
function create_artifact_functions() {
declare -a funcs=(
"cli_adapter_pre_run" "cli_adapter_config_prep"
"config_dump"
"prepare_version"
"get_default_oci_target"
"is_available_in_local_cache" "is_available_in_remote_cache" "obtain_from_remote_cache"
@@ -215,6 +216,27 @@ function obtain_complete_artifact() {
fi
}
function dump_artifact_config() {
initialize_artifact "${WHAT}"
declare -A -g artifact_input_variables=()
debug_dict artifact_input_variables
artifact_config_dump
debug_dict artifact_input_variables
# loop over the keys
declare -a concat
for key in "${!artifact_input_variables[@]}"; do
# echo the key and its value
concat+=("${key}=${artifact_input_variables[${key}]}")
done
declare -g artifact_input_vars="${concat[*]@Q}" # @Q to quote
}
# This is meant to be run after config, inside default build.
function build_artifact_for_image() {
initialize_artifact "${WHAT}"

View File

@@ -23,7 +23,37 @@ function cli_config_dump_json_run() {
function config_board_and_remove_useless() {
skip_host_config=yes use_board=yes skip_kernel=no do_logging=no prep_conf_main_minimal_ni # avoid logging during configdump; it's useless; skip host config
determine_artifacts_needed_and_its_inputs_for_configdump
# Remove unwanted variables from the config dump JSON.
unset FINALDEST
unset DEB_STORAGE
unset ROOTPWD
}
function determine_artifacts_needed_and_its_inputs_for_configdump() {
# Determine which artifacts to build.
declare -a artifacts_to_build=()
determine_artifacts_to_build_for_image
display_alert "Artifacts to build:" "${artifacts_to_build[*]}" "info"
# For each artifact, get the input variables from each.
declare -a all_wanted_artifact_names=() all_wanted_artifact_vars=()
declare one_artifact one_artifact_package
for one_artifact in "${artifacts_to_build[@]}"; do
declare -g artifact_input_vars
WHAT="${one_artifact}" dump_artifact_config
declare WHAT_UPPERCASE="${one_artifact^^}"
declare WHAT_UPPERCASE_REPLACED="${WHAT_UPPERCASE//[-.]/_}"
all_wanted_artifact_names+=("${one_artifact}")
all_wanted_artifact_vars+=("${WHAT_UPPERCASE_REPLACED}")
eval "declare -r -g WANT_ARTIFACT_${WHAT_UPPERCASE_REPLACED}_INPUTS_ARRAY=\"${artifact_input_vars}\""
done
declare -r -g WANT_ARTIFACT_ALL_NAMES_ARRAY="${all_wanted_artifact_names[*]}"
declare -r -g WANT_ARTIFACT_ALL_ARRAY="${all_wanted_artifact_vars[*]}"
}

View File

@@ -6,9 +6,56 @@
#
# This file is a part of the Armbian Build Framework
# https://github.com/armbian/build/
function determine_artifacts_to_build_for_image() {
# outer scope: declare -a artifacts_to_build=()
if [[ "${BOOTCONFIG}" != "none" ]]; then
artifacts_to_build+=("uboot")
fi
if [[ -n $KERNELSOURCE ]]; then
artifacts_to_build+=("kernel")
fi
if [[ "${INSTALL_ARMBIAN_FIRMWARE:-yes}" == "yes" ]]; then
if [[ ${BOARD_FIRMWARE_INSTALL:-""} == "-full" ]]; then
artifacts_to_build+=("full_firmware")
else
artifacts_to_build+=("firmware")
fi
fi
if [[ "${DISTRIBUTION}" == "Ubuntu" ]]; then
artifacts_to_build+=("fake_ubuntu_advantage_tools")
fi
if [[ "${PACKAGE_LIST_RM}" != *armbian-config* ]]; then
if [[ $BUILD_MINIMAL != yes ]]; then
artifacts_to_build+=("armbian-config")
fi
fi
if [[ "${PACKAGE_LIST_RM}" != *armbian-zsh* ]]; then
if [[ $BUILD_MINIMAL != yes ]]; then
artifacts_to_build+=("armbian-zsh")
fi
fi
if [[ $PLYMOUTH == yes ]]; then
artifacts_to_build+=("armbian-plymouth-theme")
fi
if [[ -n "${RELEASE}" ]]; then
# Further packages require aggregation
assert_requires_aggregation
artifacts_to_build+=("armbian-bsp-cli")
if [[ -n "${DESKTOP_ENVIRONMENT}" ]]; then
artifacts_to_build+=("armbian-desktop")
artifacts_to_build+=("armbian-bsp-desktop")
fi
fi
}
function main_default_build_packages() {
# early cleaning for sources, since fetch_and_build_host_tools() uses it.
if [[ "${CLEAN_LEVEL}" == *sources* ]]; then
LOG_SECTION="cleaning_early_sources" do_with_logging general_cleaning "sources"
@@ -27,38 +74,7 @@ function main_default_build_packages() {
# determine which artifacts to build.
declare -a artifacts_to_build=()
if [[ "${BOOTCONFIG}" != "none" ]]; then
artifacts_to_build+=("uboot")
fi
if [[ -n $KERNELSOURCE ]]; then
artifacts_to_build+=("kernel")
fi
if [[ "${INSTALL_ARMBIAN_FIRMWARE:-yes}" == "yes" ]]; then
if [[ ${BOARD_FIRMWARE_INSTALL:-""} == "-full" ]]; then
artifacts_to_build+=("full_firmware")
else
artifacts_to_build+=("firmware")
fi
fi
artifacts_to_build+=("fake_ubuntu_advantage_tools")
artifacts_to_build+=("armbian-config")
artifacts_to_build+=("armbian-zsh")
artifacts_to_build+=("armbian-plymouth-theme")
if [[ -n "${RELEASE}" ]]; then
# Further packages require aggregation
assert_requires_aggregation
artifacts_to_build+=("armbian-bsp-cli")
if [[ -n "${DESKTOP_ENVIRONMENT}" ]]; then
artifacts_to_build+=("armbian-desktop")
artifacts_to_build+=("armbian-bsp-desktop")
fi
fi
determine_artifacts_to_build_for_image
display_alert "Artifacts to build:" "${artifacts_to_build[*]}" "debug"
# For each artifact, try to obtain them from the local cache, remote cache, or build them.