artifacts (all): require prefixing of artifact_version with artifact_prefix_version (which is ${REVISION}--)

This commit is contained in:
Ricardo Pardini
2023-03-13 00:10:01 -03:00
committed by Igor Pečovnik
parent 4a1eec83e7
commit ff657fcf90
8 changed files with 25 additions and 7 deletions

View File

@@ -34,7 +34,7 @@ function artifact_firmware_prepare_version() {
declare bash_hash_short="${bash_hash:0:${short_hash_size}}"
# outer scope
artifact_version="${fake_unchanging_base_version}-SA${short_sha1}-B${bash_hash_short}"
artifact_version="${artifact_prefix_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

@@ -10,6 +10,7 @@
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"}"
@@ -40,7 +41,7 @@ function artifact_full_firmware_prepare_version() {
declare bash_hash_short="${bash_hash:0:${short_hash_size}}"
# outer scope
artifact_version="${fake_unchanging_base_version}-SA${short_sha1}-SM${short_sha1_mainline}-B${bash_hash_short}"
artifact_version="${artifact_prefix_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

@@ -14,6 +14,7 @@
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)
@@ -101,7 +102,8 @@ function artifact_kernel_prepare_version() {
declare bash_hash_short="${bash_hash:0:${short_hash_size}}"
# outer scope
artifact_version="${GIT_INFO_KERNEL[MAKEFILE_VERSION]}-S${short_sha1}-D${kernel_drivers_hash_short}-P${kernel_patches_hash_short}-C${config_hash_short}H${kernel_config_modification_hash_short}-B${bash_hash_short}"
# @TODO: support NOT having the GIT_INFO_KERNEL, for families that patch the version or are private...
artifact_version="${artifact_prefix_version}${GIT_INFO_KERNEL[MAKEFILE_VERSION]}-S${short_sha1}-D${kernel_drivers_hash_short}-P${kernel_patches_hash_short}-C${config_hash_short}H${kernel_config_modification_hash_short}-B${bash_hash_short}"
declare -a reasons=(
"version \"${GIT_INFO_KERNEL[MAKEFILE_FULL_VERSION]}\""

View File

@@ -10,6 +10,7 @@
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
@@ -30,7 +31,7 @@ function artifact_rootfs_prepare_version() {
# @TODO: gotta include the extensions rootfs-modifying id to cache_type...
# outer scope
artifact_version="${rootfs_cache_id}"
artifact_version="${artifact_prefix_version}${rootfs_cache_id}"
artifact_version_reason="${reasons[*]}"
artifact_name="${ARCH}-${RELEASE}-${cache_type}"
artifact_type="tar.zst"

View File

@@ -10,6 +10,7 @@
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.
@@ -53,7 +54,7 @@ function artifact_uboot_prepare_version() {
declare bash_hash_short="${bash_hash:0:${short_hash_size}}"
# outer scope
artifact_version="${GIT_INFO_UBOOT[MAKEFILE_VERSION]}-S${short_sha1}-P${uboot_patches_hash_short}-B${bash_hash_short}"
artifact_version="${artifact_prefix_version}${GIT_INFO_UBOOT[MAKEFILE_VERSION]}-S${short_sha1}-P${uboot_patches_hash_short}-B${bash_hash_short}"
declare -a reasons=(
"version \"${GIT_INFO_UBOOT[MAKEFILE_FULL_VERSION]}\""

View File

@@ -101,6 +101,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
[[ "${artifact_version}" =~ ^${artifact_prefix_version} ]] || exit_with_error "artifact_version '${artifact_version}' does not begin with artifact_prefix_version '${artifact_prefix_version}'"
# validate artifact_type... it must be one of the supported types
case "${artifact_type}" in
deb | deb-tar)

View File

@@ -402,6 +402,6 @@ function compile_uboot() {
done_with_temp_dir "${cleanup_id}" # changes cwd to "${SRC}" and fires the cleanup function early
display_alert "Built u-boot deb OK" "${uboot_name}.deb" "info"
display_alert "Built u-boot deb OK" "linux-u-boot-${BOARD}-${BRANCH} ${artifact_version}" "info"
return 0 # success
}

View File

@@ -23,11 +23,21 @@ function do_main_configuration() {
# common options
# daily beta build contains date in subrevision
#if [[ $BETA == yes && -z $SUBREVISION ]]; then SUBREVISION="."$(date --date="tomorrow" +"%j"); fi
declare revision_from="undetermined"
if [ -f $USERPATCHES_PATH/VERSION ]; then
REVISION=$(cat "${USERPATCHES_PATH}"/VERSION)"$SUBREVISION" # all boards have same revision
revision_from="userpatches VERSION file"
else
REVISION=$(cat "${SRC}"/VERSION)"$SUBREVISION" # all boards have same revision
revision_from="main VERSION file"
fi
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 $ROOTPWD ]] && ROOTPWD="1234" # Must be changed @first login
[[ -z $MAINTAINER ]] && MAINTAINER="Igor Pecovnik" # deb signature
@@ -241,7 +251,7 @@ function do_main_configuration() {
*give the config a chance to override the family/arch defaults, per branch*
This hook is called after the family configuration (`sources/families/xxx.conf`) is sourced,
and after `post_family_config()` hook is already run.
The sole purpose of this is to avoid "case ... esac for $BRANCH" in the board configuration,
The sole purpose of this is to avoid "case ... esac for $BRANCH" in the board configuration,
allowing separate functions for different branches. You're welcome.
POST_FAMILY_CONFIG_PER_BRANCH