diff --git a/lib/functions/artifacts/artifact-firmware.sh b/lib/functions/artifacts/artifact-firmware.sh index 8f03827cfb..fbed55d031 100644 --- a/lib/functions/artifacts/artifact-firmware.sh +++ b/lib/functions/artifacts/artifact-firmware.sh @@ -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]}\"" diff --git a/lib/functions/artifacts/artifact-full_firmware.sh b/lib/functions/artifacts/artifact-full_firmware.sh index 7b51b16553..f151ed15f4 100644 --- a/lib/functions/artifacts/artifact-full_firmware.sh +++ b/lib/functions/artifacts/artifact-full_firmware.sh @@ -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]}\"" diff --git a/lib/functions/artifacts/artifact-kernel.sh b/lib/functions/artifacts/artifact-kernel.sh index 6b290aff75..b6c6e9e43f 100644 --- a/lib/functions/artifacts/artifact-kernel.sh +++ b/lib/functions/artifacts/artifact-kernel.sh @@ -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]}\"" diff --git a/lib/functions/artifacts/artifact-rootfs.sh b/lib/functions/artifacts/artifact-rootfs.sh index 66bcd270e8..11bd041a7f 100644 --- a/lib/functions/artifacts/artifact-rootfs.sh +++ b/lib/functions/artifacts/artifact-rootfs.sh @@ -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" diff --git a/lib/functions/artifacts/artifact-uboot.sh b/lib/functions/artifacts/artifact-uboot.sh index 5b5ead3528..8e23472dd8 100644 --- a/lib/functions/artifacts/artifact-uboot.sh +++ b/lib/functions/artifacts/artifact-uboot.sh @@ -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]}\"" diff --git a/lib/functions/artifacts/artifacts-obtain.sh b/lib/functions/artifacts/artifacts-obtain.sh index 62a8f4e592..e4035f8c88 100644 --- a/lib/functions/artifacts/artifacts-obtain.sh +++ b/lib/functions/artifacts/artifacts-obtain.sh @@ -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) diff --git a/lib/functions/compilation/uboot.sh b/lib/functions/compilation/uboot.sh index a029388264..f74af65a1c 100644 --- a/lib/functions/compilation/uboot.sh +++ b/lib/functions/compilation/uboot.sh @@ -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 } diff --git a/lib/functions/configuration/main-config.sh b/lib/functions/configuration/main-config.sh index 5bfada1f0b..87cfb0c4f0 100644 --- a/lib/functions/configuration/main-config.sh +++ b/lib/functions/configuration/main-config.sh @@ -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