mirror of
https://github.com/armbian/build
synced 2025-09-24 19:47:06 +07:00
artifacts: introduce PRE_PREPARED_HOST=yes: allow running pre-prepared host CLI's for artifacts that require aggregation
This commit is contained in:
@@ -88,6 +88,7 @@ function artifact_armbian-bsp-desktop_cli_adapter_config_prep() {
|
||||
: "${DESKTOP_ENVIRONMENT_CONFIG_NAME:?DESKTOP_ENVIRONMENT_CONFIG_NAME is not set}"
|
||||
|
||||
# this requires aggregation, and thus RELEASE, but also everything else.
|
||||
declare -g artifact_version_requires_aggregation="yes"
|
||||
use_board="yes" allow_no_family="no" skip_kernel="no" prep_conf_main_only_rootfs_ni < /dev/null # no stdin for this, so it bombs if tries to be interactive.
|
||||
}
|
||||
|
||||
|
||||
@@ -87,6 +87,7 @@ function artifact_armbian-desktop_cli_adapter_config_prep() {
|
||||
: "${DESKTOP_ENVIRONMENT_CONFIG_NAME:?DESKTOP_ENVIRONMENT_CONFIG_NAME is not set}"
|
||||
|
||||
# this requires aggregation, and thus RELEASE, but also everything else.
|
||||
declare -g artifact_version_requires_aggregation="yes"
|
||||
use_board="yes" allow_no_family="no" skip_kernel="no" prep_conf_main_only_rootfs_ni < /dev/null # no stdin for this, so it bombs if tries to be interactive.
|
||||
}
|
||||
|
||||
|
||||
@@ -99,6 +99,7 @@ function artifact_rootfs_cli_adapter_pre_run() {
|
||||
}
|
||||
|
||||
function artifact_rootfs_cli_adapter_config_prep() {
|
||||
declare -g artifact_version_requires_aggregation="yes"
|
||||
declare -g ROOTFS_COMPRESSION_RATIO="${ROOTFS_COMPRESSION_RATIO:-"15"}" # default to Compress stronger when we make rootfs cache
|
||||
|
||||
# If BOARD is set, use it to convert to an ARCH.
|
||||
|
||||
@@ -24,7 +24,13 @@ function cli_artifact_run() {
|
||||
|
||||
display_alert "artifact" "${chosen_artifact}" "debug"
|
||||
display_alert "artifact" "${chosen_artifact} :: ${chosen_artifact_impl}()" "debug"
|
||||
artifact_cli_adapter_config_prep # only if in cli.
|
||||
declare -g artifact_version_requires_aggregation="no" # marker
|
||||
artifact_cli_adapter_config_prep # only if in cli.
|
||||
|
||||
# if asked by _config_prep to aggregate, and HOSTRELEASE is not set, obtain it.
|
||||
if [[ "${artifact_version_requires_aggregation}" == "yes" ]] && [[ -z "${HOSTRELEASE}" ]]; then
|
||||
obtain_hostrelease_only # Sets HOSTRELEASE
|
||||
fi
|
||||
|
||||
# When run in GHA, assume we're checking/updating the remote cache only.
|
||||
# Local cache is ignored, and if found, it's not unpacked, either from local or remote.
|
||||
@@ -64,9 +70,5 @@ function cli_artifact_run() {
|
||||
skip_unpack_if_found_in_caches="no"
|
||||
fi
|
||||
|
||||
if [[ "${CONFIG_DEFS_ONLY}" != "yes" ]]; then
|
||||
do_with_default_build obtain_complete_artifact # @TODO: < /dev/null -- but what about kernel configure?
|
||||
else
|
||||
obtain_complete_artifact
|
||||
fi
|
||||
do_with_default_build obtain_complete_artifact # @TODO: < /dev/null -- but what about kernel configure?
|
||||
}
|
||||
|
||||
@@ -8,11 +8,8 @@
|
||||
# https://github.com/armbian/build/
|
||||
|
||||
function obtain_and_check_host_release_and_arch() {
|
||||
# obtain the host release either from os-release or debian_version
|
||||
declare -g HOSTRELEASE
|
||||
HOSTRELEASE="$(cat /etc/os-release | grep VERSION_CODENAME | cut -d"=" -f2)"
|
||||
[[ -z $HOSTRELEASE ]] && HOSTRELEASE="$(cut -d'/' -f1 /etc/debian_version)"
|
||||
display_alert "Build host OS release" "${HOSTRELEASE:-(unknown)}" "info"
|
||||
|
||||
obtain_hostrelease_only
|
||||
|
||||
# obtain the host arch, from dpkg
|
||||
declare -g HOSTARCH
|
||||
@@ -45,3 +42,11 @@ function obtain_and_check_host_release_and_arch() {
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
function obtain_hostrelease_only() {
|
||||
# obtain the host release either from os-release or debian_version
|
||||
declare -g HOSTRELEASE
|
||||
HOSTRELEASE="$(cat /etc/os-release | grep VERSION_CODENAME | cut -d"=" -f2)"
|
||||
[[ -z $HOSTRELEASE ]] && HOSTRELEASE="$(cut -d'/' -f1 /etc/debian_version)"
|
||||
display_alert "Build host OS release" "${HOSTRELEASE:-(unknown)}" "info"
|
||||
}
|
||||
|
||||
@@ -19,6 +19,10 @@ function prepare_host() {
|
||||
}
|
||||
|
||||
function assert_prepared_host() {
|
||||
if [[ "${PRE_PREPARED_HOST:-"no"}" == "yes" ]]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [[ ${prepare_host_has_already_run:-0} -lt 1 ]]; then
|
||||
exit_with_error "assert_prepared_host: Host has not yet been prepared. This is a bug in armbian-next code. Please report!"
|
||||
fi
|
||||
|
||||
@@ -53,6 +53,13 @@ function determine_artifacts_to_build_for_image() {
|
||||
artifacts_to_build+=("armbian-bsp-desktop")
|
||||
fi
|
||||
fi
|
||||
|
||||
# If we're only dumping the config, include the rootfs artifact.
|
||||
# In a "real" build, this artifact is built/consumed by get_or_create_rootfs_cache_chroot_sdcard(), not here.
|
||||
if [[ "${CONFIG_DEFS_ONLY}" == "yes" ]]; then
|
||||
artifacts_to_build+=("rootfs")
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
function main_default_build_packages() {
|
||||
|
||||
@@ -10,6 +10,25 @@
|
||||
# Common start/end build functions. Used by the default build and others
|
||||
|
||||
function main_default_start_build() {
|
||||
if [[ "${PRE_PREPARED_HOST:-"no"}" != "yes" ]]; then
|
||||
prepare_host_init # this has its own logging sections, and is possibly interactive.
|
||||
fi
|
||||
|
||||
# Prepare ccache, cthreads, etc for the build
|
||||
LOG_SECTION="prepare_compilation_vars" do_with_logging prepare_compilation_vars
|
||||
|
||||
# from mark_aggregation_required_in_default_build_start() possibly marked during config
|
||||
if [[ ${aggregation_required_in_default_build_start:-0} -gt 0 ]]; then
|
||||
display_alert "Configuration requires aggregation" "running aggregation now" "debug"
|
||||
aggregate_packages_in_logging_section
|
||||
else
|
||||
display_alert "Configuration does not require aggregation" "skipping aggregation" "debug"
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
function prepare_host_init() {
|
||||
wait_for_disk_sync "before starting build" # fsync, wait for disk to sync, and then continue. alert user if takes too long.
|
||||
|
||||
# Check that WORKDIR_BASE_TMP exists; if not, create it.
|
||||
@@ -48,19 +67,6 @@ function main_default_start_build() {
|
||||
mkdir -p "${BIN_WORK_DIR}"
|
||||
ln -s "/usr/bin/python2" "${BIN_WORK_DIR}/python"
|
||||
declare -g PATH="${BIN_WORK_DIR}:${PATH}"
|
||||
|
||||
# Prepare ccache, cthreads, etc for the build
|
||||
LOG_SECTION="prepare_compilation_vars" do_with_logging prepare_compilation_vars
|
||||
|
||||
# from mark_aggregation_required_in_default_build_start() possibly marked during config
|
||||
if [[ ${aggregation_required_in_default_build_start:-0} -gt 0 ]]; then
|
||||
display_alert "Configuration requires aggregation" "running aggregation now" "debug"
|
||||
aggregate_packages_in_logging_section
|
||||
else
|
||||
display_alert "Configuration does not require aggregation" "skipping aggregation" "debug"
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
function main_default_end_build() {
|
||||
|
||||
Reference in New Issue
Block a user