hashed-OCI-revisioned-debs: get completely rid of artifact_prefix_version

This commit is contained in:
Ricardo Pardini 2023-07-28 10:56:14 +02:00 committed by Igor
parent 6e5b8ffba0
commit ec0a87efb5
15 changed files with 18 additions and 36 deletions

View File

@ -17,7 +17,6 @@ function artifact_armbian-base-files_config_dump() {
}
function artifact_armbian-base-files_prepare_version() {
: "${artifact_prefix_version:?artifact_prefix_version is not set}"
: "${RELEASE:?RELEASE is not set}"
: "${ARCH:?ARCH is not set}"
@ -25,7 +24,7 @@ function artifact_armbian-base-files_prepare_version() {
artifact_version_reason="undetermined" # outer scope
declare short_hash_size=4
declare fake_unchanging_base_version="${RELEASE}-1armbian1"
declare fake_unchanging_base_version="1-${RELEASE}-1armbian1"
declare found_package_version="undetermined" found_package_filename="undetermined" found_package_down_url="undetermined"
sleep_seconds="15" do_with_retries 10 apt_find_upstream_package_version_and_download_url "base-files"
@ -45,7 +44,7 @@ function artifact_armbian-base-files_prepare_version() {
declare bash_hash_short="${bash_hash:0:${short_hash_size}}"
# outer scope
artifact_version="${artifact_prefix_version}${fake_unchanging_base_version}-B${bash_hash_short}"
artifact_version="${fake_unchanging_base_version}-B${bash_hash_short}"
declare -a reasons=("Armbian armbian-base-files" "original ${RELEASE} version \"${base_files_wanted_upstream_version}\"" "framework bash hash \"${bash_hash}\"")

View File

@ -14,7 +14,6 @@ function artifact_armbian-bsp-cli_config_dump() {
}
function artifact_armbian-bsp-cli_prepare_version() {
: "${artifact_prefix_version:?artifact_prefix_version is not set}"
: "${BRANCH:?BRANCH is not set}"
: "${BOARD:?BOARD is not set}"
@ -87,7 +86,7 @@ function artifact_armbian-bsp-cli_prepare_version() {
declare bash_hash_short="${bash_hash:0:${short_hash_size}}"
# outer scope
artifact_version="${artifact_prefix_version}${fake_unchanging_base_version}-PC${packages_config_hash_short}-V${var_config_hash_short}-H${hash_hooks_short}-B${bash_hash_short}"
artifact_version="${fake_unchanging_base_version}-PC${packages_config_hash_short}-V${var_config_hash_short}-H${hash_hooks_short}-B${bash_hash_short}"
declare -a reasons=(
"Armbian package armbian-bsp-cli"
@ -124,7 +123,7 @@ function artifact_armbian-bsp-cli_prepare_version() {
}
function artifact_armbian-bsp-cli_build_from_sources() {
# Generate transitional package when needed.
# Generate transitional package when needed.
if artifact_armbian-bsp-cli_needs_transitional_package ; then
LOG_SECTION="compile_armbian-bsp-cli" do_with_logging compile_armbian-bsp-cli-transitional
fi

View File

@ -18,7 +18,6 @@ function artifact_armbian-bsp-desktop_config_dump() {
}
function artifact_armbian-bsp-desktop_prepare_version() {
: "${artifact_prefix_version:?artifact_prefix_version is not set}"
: "${BRANCH:?BRANCH is not set}"
: "${BOARD:?BOARD is not set}"
: "${RELEASE:?RELEASE is not set}"
@ -43,7 +42,7 @@ function artifact_armbian-bsp-desktop_prepare_version() {
declare bash_hash_short="${bash_hash:0:${short_hash_size}}"
# outer scope
artifact_version="${artifact_prefix_version}${fake_unchanging_base_version}-B${bash_hash_short}"
artifact_version="${fake_unchanging_base_version}-B${bash_hash_short}"
declare -a reasons=(
"Armbian armbian-bsp-desktop"

View File

@ -41,7 +41,7 @@ function artifact_armbian-config_prepare_version() {
declare bash_hash_short="${bash_hash:0:${short_hash_size}}"
# outer scope
artifact_version="${artifact_prefix_version}${fake_unchanging_base_version}-SA${short_sha1}-B${bash_hash_short}"
artifact_version="${fake_unchanging_base_version}-SA${short_sha1}-B${bash_hash_short}"
declare -a reasons=(
"Armbian armbian-config git revision \"${GIT_INFO_ARMBIAN_CONFIG[SHA1]}\""

View File

@ -18,7 +18,6 @@ function artifact_armbian-desktop_config_dump() {
}
function artifact_armbian-desktop_prepare_version() {
: "${artifact_prefix_version:?artifact_prefix_version is not set}"
: "${RELEASE:?RELEASE is not set}"
: "${DESKTOP_ENVIRONMENT:?DESKTOP_ENVIRONMENT is not set}"
@ -48,7 +47,7 @@ function artifact_armbian-desktop_prepare_version() {
declare bash_hash_short="${bash_hash:0:${short_hash_size}}"
# outer scope
artifact_version="${artifact_prefix_version}${fake_unchanging_base_version}-V${var_config_hash_short}-B${bash_hash_short}"
artifact_version="${fake_unchanging_base_version}-V${var_config_hash_short}-B${bash_hash_short}"
declare -a reasons=(
"Armbian armbian-desktop"

View File

@ -27,7 +27,7 @@ function artifact_armbian-plymouth-theme_prepare_version() {
declare bash_hash_short="${bash_hash:0:${short_hash_size}}"
# outer scope
artifact_version="${artifact_prefix_version}-B${bash_hash_short}"
artifact_version="${fake_unchanging_base_version}-B${bash_hash_short}"
declare -a reasons=(
"Armbian armbian-plymouth-theme"

View File

@ -42,7 +42,7 @@ function artifact_armbian-zsh_prepare_version() {
declare bash_hash_short="${bash_hash:0:${short_hash_size}}"
# outer scope
artifact_version="${artifact_prefix_version}${fake_unchanging_base_version}-SA${short_sha1}-B${bash_hash_short}"
artifact_version="${fake_unchanging_base_version}-SA${short_sha1}-B${bash_hash_short}"
declare -a reasons=(
"Armbian armbian-zsh git revision \"${GIT_INFO_ARMBIAN_ZSH[SHA1]}\""

View File

@ -27,7 +27,7 @@ function artifact_fake_ubuntu_advantage_tools_prepare_version() {
declare bash_hash_short="${bash_hash:0:${short_hash_size}}"
# outer scope
artifact_version="${artifact_prefix_version}${fake_unchanging_base_version}-B${bash_hash_short}"
artifact_version="${fake_unchanging_base_version}-B${bash_hash_short}"
declare -a reasons=(
"Armbian fake-ubuntu-advantage-tools"

View File

@ -42,7 +42,7 @@ function artifact_firmware_prepare_version() {
declare bash_hash_short="${bash_hash:0:${short_hash_size}}"
# outer scope
artifact_version="${artifact_prefix_version}${fake_unchanging_base_version}-SA${short_sha1}-B${bash_hash_short}"
artifact_version="${fake_unchanging_base_version}-SA${short_sha1}-B${bash_hash_short}"
declare -a reasons=(
"Armbian firmware git revision \"${GIT_INFO_ARMBIAN_FIRMWARE[SHA1]}\""

View File

@ -15,7 +15,6 @@ function artifact_full_firmware_config_dump() {
function artifact_full_firmware_prepare_version() {
artifact_version="undetermined" # outer scope
artifact_version_reason="undetermined" # outer scope
[[ -z "${artifact_prefix_version}" ]] && exit_with_error "artifact_prefix_version is not set"
local ARMBIAN_FIRMWARE_SOURCE="${ARMBIAN_FIRMWARE_GIT_SOURCE:-"https://github.com/armbian/firmware"}"
local ARMBIAN_FIRMWARE_BRANCH="branch:${ARMBIAN_FIRMWARE_GIT_BRANCH:-"master"}"
@ -52,7 +51,7 @@ function artifact_full_firmware_prepare_version() {
declare bash_hash_short="${bash_hash:0:${short_hash_size}}"
# outer scope
artifact_version="${artifact_prefix_version}${fake_unchanging_base_version}-SA${short_sha1}-SM${short_sha1_mainline}-B${bash_hash_short}"
artifact_version="${fake_unchanging_base_version}-SA${short_sha1}-SM${short_sha1_mainline}-B${bash_hash_short}"
declare -a reasons=(
"Armbian firmware git revision \"${GIT_INFO_ARMBIAN_FIRMWARE[SHA1]}\""

View File

@ -26,7 +26,6 @@ function artifact_kernel_config_dump() {
function artifact_kernel_prepare_version() {
artifact_version="undetermined" # outer scope
artifact_version_reason="undetermined" # outer scope
[[ -z "${artifact_prefix_version}" ]] && exit_with_error "artifact_prefix_version is not set"
# - Given KERNELSOURCE and KERNELBRANCH, get:
# - SHA1 of the commit (this is generic... and used for other pkgs)
@ -63,7 +62,6 @@ function artifact_kernel_prepare_version() {
debug_var BOARDFAMILY # Heh.
debug_var KERNEL_MAJOR_MINOR # Double heh. transitional stuff, from when armbian-next began. 🤣
debug_var BRANCH
debug_var REVISION
debug_var KERNELSOURCE
debug_var KERNELBRANCH
debug_var LINUXFAMILY
@ -175,9 +173,9 @@ function artifact_kernel_prepare_version() {
# outer scope
if [[ "${KERNEL_SKIP_MAKEFILE_VERSION:-"no"}" == "yes" ]]; then
artifact_version="${artifact_prefix_version}${common_version_suffix}"
artifact_version="${common_version_suffix}"
else
artifact_version="${artifact_prefix_version}${GIT_INFO_KERNEL[MAKEFILE_VERSION]}-${common_version_suffix}"
artifact_version="${GIT_INFO_KERNEL[MAKEFILE_VERSION]}-${common_version_suffix}"
fi
declare -a reasons=(

View File

@ -24,7 +24,6 @@ function artifact_rootfs_config_dump() {
function artifact_rootfs_prepare_version() {
artifact_version="undetermined" # outer scope
artifact_version_reason="undetermined" # outer scope
[[ -z "${artifact_prefix_version}" ]] && exit_with_error "artifact_prefix_version is not set"
assert_requires_aggregation # Bombs if aggregation has not run
@ -48,8 +47,7 @@ function artifact_rootfs_prepare_version() {
reasons+=("desktop_appgroups_selected \"${DESKTOP_APPGROUPS_SELECTED}\"")
fi
# rootfs does NOT include ${artifact_prefix_version} -- there's no reason to, since rootfs is not in an apt repo
# instead, we use YYYYMM to make a new rootfs cache version per-month, even if nothing else changes.
# we use YYYYMM to make a new rootfs cache version per-month, even if nothing else changes.
declare yyyymm="undetermined"
yyyymm="$(date +%Y%m)"

View File

@ -19,7 +19,6 @@ function artifact_uboot_config_dump() {
function artifact_uboot_prepare_version() {
artifact_version="undetermined" # outer scope
artifact_version_reason="undetermined" # outer scope
[[ -z "${artifact_prefix_version}" ]] && exit_with_error "artifact_prefix_version is not set"
# 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/fetch.
@ -111,7 +110,7 @@ function artifact_uboot_prepare_version() {
declare bash_hash_short="${bash_hash:0:${short_hash_size}}"
# outer scope
artifact_version="${artifact_prefix_version}${GIT_INFO_UBOOT[MAKEFILE_VERSION]}-S${short_sha1}-P${uboot_patches_hash_short}-H${hash_hooks_and_functions_short}-V${var_config_hash_short}-B${bash_hash_short}"
artifact_version="${GIT_INFO_UBOOT[MAKEFILE_VERSION]}-S${short_sha1}-P${uboot_patches_hash_short}-H${hash_hooks_and_functions_short}-V${var_config_hash_short}-B${bash_hash_short}"
declare -a reasons=(
"version \"${GIT_INFO_UBOOT[MAKEFILE_FULL_VERSION]}\""

View File

@ -68,8 +68,6 @@ function initialize_artifact() {
}
function obtain_complete_artifact() {
: "${artifact_prefix_version:?artifact_prefix_version is not set}"
declare -g artifact_name="undetermined"
declare -g artifact_type="undetermined"
declare -g artifact_version="undetermined"
@ -81,9 +79,6 @@ function obtain_complete_artifact() {
declare -A -g artifact_map_packages=()
declare -A -g artifact_map_debs=()
# Check if REVISION is set, otherwise exit_with_error
[[ "x${REVISION}x" == "xx" ]] && exit_with_error "REVISION is not set"
# Contentious; it might be that prepare_version is complex enough to warrant more than 1 logging section.
LOG_SECTION="artifact_prepare_version" do_with_logging artifact_prepare_version
@ -104,9 +99,9 @@ function obtain_complete_artifact() {
[[ "x${artifact_base_dir}x" == "xx" || "${artifact_base_dir}" == "undetermined" ]] && exit_with_error "artifact_base_dir is not set after artifact_prepare_version"
[[ "x${artifact_final_file}x" == "xx" || "${artifact_final_file}" == "undetermined" ]] && exit_with_error "artifact_final_file is not set after artifact_prepare_version"
# validate artifact_version begins with artifact_prefix_version when building deb packages (or deb-tar)
# validate artifact_version begins with a digit when building deb packages (or deb-tar); dpkg requires it
if [[ "${artifact_type}" != "tar.zst" ]]; then
[[ "${artifact_version}" =~ ^${artifact_prefix_version} ]] || exit_with_error "artifact_version '${artifact_version}' does not begin with artifact_prefix_version '${artifact_prefix_version}'"
[[ "${artifact_version}" =~ ^[0-9] ]] || exit_with_error "${artifact_type}: artifact_version '${artifact_version}' does not begin with a digit"
fi
declare -a artifact_map_debs_values=() artifact_map_packages_values=() artifact_map_debs_keys=() artifact_map_packages_keys=()

View File

@ -33,9 +33,6 @@ function do_main_configuration() {
declare -g -r REVISION="${REVISION}"
display_alert "Using revision from" "${revision_from}: '${REVISION}'" "info"
# This is the prefix used by all artifacts. Readonly. It's just $REVISION and a double dash.
declare -r -g artifact_prefix_version="${REVISION}--"
[[ -z $VENDOR ]] && VENDOR="Armbian"
[[ -z $VENDORURL ]] && VENDORURL="https://www.armbian.com"
[[ -z $VENDORSUPPORT ]] && VENDORSUPPORT="https://forum.armbian.com"