mirror of
https://github.com/armbian/build.git
synced 2025-08-11 21:56:58 +02:00
- all interactive commands now **don't build the artifact** anymore; just patches/.configs are produced and then build ends - user is required to put the produced patches in the right place and build again, for full consistency - split ATF and U-BOOT manual patching process; use CLI command `atf-patch` to patch ATF, and `uboot-patch` to patch u-boot - non-interactive artifact builds are now 100% sans-stdin - introduce `uboot-config` CLI command; still experimental, only produces a defconfig and not a patch - reworked `userpatch_create()` to be (hopefully) more useful: - detects a previous patch and offers to apply it before continuing - enters a loop showing the diff, and only proceeds when user indicates he's happy with the patch - produces `mbox`-formatted patches via `format-patch` and standard Armbian parameters - uses MAINTAINER and MAINTAINERMAIL instead of git configuration (so it works in containers) - don't allow image builds with any patching or configuring _at all_ (it has been deprecated with a warning for months already, and results are inconsistent)
80 lines
3.2 KiB
Bash
80 lines
3.2 KiB
Bash
#!/usr/bin/env bash
|
|
#
|
|
# SPDX-License-Identifier: GPL-2.0
|
|
#
|
|
# Copyright (c) 2013-2023 Igor Pecovnik, igor@armbian.com
|
|
#
|
|
# This file is a part of the Armbian Build Framework
|
|
# https://github.com/armbian/build/
|
|
|
|
function cli_artifact_pre_run() {
|
|
initialize_artifact "${WHAT}"
|
|
# Run the pre run adapter
|
|
artifact_cli_adapter_pre_run
|
|
}
|
|
|
|
function cli_artifact_run() {
|
|
: "${chosen_artifact:?chosen_artifact is not set}"
|
|
: "${chosen_artifact_impl:?chosen_artifact_impl is not set}"
|
|
|
|
if [[ "${CONFIG_DEFS_ONLY}" != "yes" ]]; then
|
|
# Make sure ORAS tooling is installed before starting.
|
|
run_tool_oras
|
|
fi
|
|
|
|
display_alert "artifact" "${chosen_artifact}" "debug"
|
|
display_alert "artifact" "${chosen_artifact} :: ${chosen_artifact_impl}()" "debug"
|
|
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.
|
|
# If remote cache is found, does nothing.
|
|
declare default_update_remote_only="no"
|
|
if [[ "${CI}" == "true" ]] && [[ "${GITHUB_ACTIONS}" == "true" ]]; then
|
|
display_alert "Running in GitHub Actions, assuming we're updating remote cache only" "GHA remote-only" "info"
|
|
default_update_remote_only="yes"
|
|
fi
|
|
|
|
declare skip_unpack_if_found_in_caches="${skip_unpack_if_found_in_caches:-"${default_update_remote_only}"}"
|
|
declare ignore_local_cache="${ignore_local_cache:-"${default_update_remote_only}"}"
|
|
declare deploy_to_remote="${deploy_to_remote:-"${default_update_remote_only}"}"
|
|
|
|
# If OCI_TARGET_BASE is explicitly set, ignore local, skip if found in remote, and deploy to remote after build.
|
|
if [[ -n "${OCI_TARGET_BASE}" ]]; then
|
|
skip_unpack_if_found_in_caches="yes"
|
|
ignore_local_cache="yes"
|
|
deploy_to_remote="yes"
|
|
|
|
# Pass ARTIFACT_USE_CACHE=yes to actually use the cache versions, but don't deploy to remote.
|
|
# @TODO this is confusing. each op should be individually controlled...
|
|
# what we want is:
|
|
# 1: - check remote, if not found, check local, if not found, build, then deploy to remote
|
|
# - if remote found, do nothing.
|
|
# - if local found, deploy it to remote (for switching targets)
|
|
# 2: - get from remote -> get local -> build, then DON'T deploy to remote
|
|
if [[ "${ARTIFACT_USE_CACHE}" == "yes" ]]; then
|
|
skip_unpack_if_found_in_caches="no"
|
|
ignore_local_cache="no"
|
|
deploy_to_remote="no"
|
|
fi
|
|
fi
|
|
|
|
# Force artifacts download we need to populate repository
|
|
if [[ "${FORCE_ARTIFACTS_DOWNLOAD}" == "yes" ]]; then
|
|
skip_unpack_if_found_in_caches="no"
|
|
fi
|
|
|
|
if [[ "${ARTIFACT_BUILD_INTERACTIVE}" == "yes" ]]; then # Set by `kernel-config`, `kernel-patch`, `uboot-config`, `uboot-patch`, etc.
|
|
display_alert "Running artifact build in interactive mode" "log file will be incomplete" "info"
|
|
do_with_default_build obtain_complete_artifact
|
|
else
|
|
do_with_default_build obtain_complete_artifact < /dev/null
|
|
fi
|
|
}
|