From 7b0f33237df7aba9109aae58e4559c25a8d38456 Mon Sep 17 00:00:00 2001 From: Ricardo Pardini Date: Sun, 12 Feb 2023 00:16:31 +0100 Subject: [PATCH] armbian-next: artifacts (all): curb logging, use more descriptive git source var names --- lib/functions/artifacts/artifact-firmware.sh | 12 +++++----- .../artifacts/artifact-full_firmware.sh | 22 +++++++++---------- lib/functions/artifacts/artifact-kernel.sh | 18 +++++++-------- lib/functions/artifacts/artifact-rootfs.sh | 2 +- lib/functions/artifacts/artifact-uboot.sh | 16 +++++++------- lib/functions/artifacts/artifacts-obtain.sh | 10 ++++----- 6 files changed, 40 insertions(+), 40 deletions(-) diff --git a/lib/functions/artifacts/artifact-firmware.sh b/lib/functions/artifacts/artifact-firmware.sh index 0ce07c94f..d118666ea 100644 --- a/lib/functions/artifacts/artifact-firmware.sh +++ b/lib/functions/artifacts/artifact-firmware.sh @@ -10,17 +10,17 @@ function artifact_firmware_prepare_version() { declare short_hash_size=4 - declare -A GIT_INFO=([GIT_SOURCE]="${ARMBIAN_FIRMWARE_SOURCE}" [GIT_REF]="${ARMBIAN_FIRMWARE_BRANCH}") - run_memoized GIT_INFO "git2info" memoized_git_ref_to_info - debug_dict GIT_INFO + declare -A GIT_INFO_ARMBIAN_FIRMWARE=([GIT_SOURCE]="${ARMBIAN_FIRMWARE_SOURCE}" [GIT_REF]="${ARMBIAN_FIRMWARE_BRANCH}") + run_memoized GIT_INFO_ARMBIAN_FIRMWARE "git2info" memoized_git_ref_to_info + debug_dict GIT_INFO_ARMBIAN_FIRMWARE declare fake_unchanging_base_version="1" - declare short_sha1="${GIT_INFO[SHA1]:0:${short_hash_size}}" + declare short_sha1="${GIT_INFO_ARMBIAN_FIRMWARE[SHA1]:0:${short_hash_size}}" # get the hashes of the lib/ bash sources involved... declare hash_files="undetermined" - calculate_hash_for_files "${SRC}"/lib/functions/compilation/packages/firmware-deb.sh "${SRC}"/lib/functions/artifacts/artifact-firmware.sh + calculate_hash_for_files "${SRC}"/lib/functions/compilation/packages/firmware-deb.sh declare bash_hash="${hash_files}" declare bash_hash_short="${bash_hash:0:${short_hash_size}}" @@ -28,7 +28,7 @@ function artifact_firmware_prepare_version() { artifact_version="${fake_unchanging_base_version}-SA${short_sha1}-B${bash_hash_short}" declare -a reasons=( - "Armbian firmware git revision \"${GIT_INFO[SHA1]}\"" + "Armbian firmware git revision \"${GIT_INFO_ARMBIAN_FIRMWARE[SHA1]}\"" "framework bash hash \"${bash_hash}\"" ) diff --git a/lib/functions/artifacts/artifact-full_firmware.sh b/lib/functions/artifacts/artifact-full_firmware.sh index 51c0f2de6..f65eeb938 100644 --- a/lib/functions/artifacts/artifact-full_firmware.sh +++ b/lib/functions/artifacts/artifact-full_firmware.sh @@ -11,22 +11,22 @@ function artifact_full_firmware_prepare_version() { declare short_hash_size=4 - declare -A GIT_INFO=([GIT_SOURCE]="${ARMBIAN_FIRMWARE_SOURCE}" [GIT_REF]="${ARMBIAN_FIRMWARE_BRANCH}") - run_memoized GIT_INFO "git2info" memoized_git_ref_to_info - debug_dict GIT_INFO + declare -A GIT_INFO_ARMBIAN_FIRMWARE=([GIT_SOURCE]="${ARMBIAN_FIRMWARE_SOURCE}" [GIT_REF]="${ARMBIAN_FIRMWARE_BRANCH}") + run_memoized GIT_INFO_ARMBIAN_FIRMWARE "git2info" memoized_git_ref_to_info + debug_dict GIT_INFO_ARMBIAN_FIRMWARE - declare -A GIT_INFO_MAINLINE=([GIT_SOURCE]="${MAINLINE_FIRMWARE_SOURCE}" [GIT_REF]="branch:main") - run_memoized GIT_INFO_MAINLINE "git2info" memoized_git_ref_to_info - debug_dict GIT_INFO_MAINLINE + declare -A GIT_INFO_MAINLINE_FIRMWARE=([GIT_SOURCE]="${MAINLINE_FIRMWARE_SOURCE}" [GIT_REF]="branch:main") + run_memoized GIT_INFO_MAINLINE_FIRMWARE "git2info" memoized_git_ref_to_info + debug_dict GIT_INFO_MAINLINE_FIRMWARE declare fake_unchanging_base_version="1" - declare short_sha1="${GIT_INFO[SHA1]:0:${short_hash_size}}" - declare short_sha1_mainline="${GIT_INFO_MAINLINE[SHA1]:0:${short_hash_size}}" + declare short_sha1="${GIT_INFO_ARMBIAN_FIRMWARE[SHA1]:0:${short_hash_size}}" + declare short_sha1_mainline="${GIT_INFO_MAINLINE_FIRMWARE[SHA1]:0:${short_hash_size}}" # get the hashes of the lib/ bash sources involved... declare hash_files="undetermined" - calculate_hash_for_files "${SRC}"/lib/functions/compilation/packages/firmware-deb.sh "${SRC}"/lib/functions/artifacts/artifact-firmware.sh + calculate_hash_for_files "${SRC}"/lib/functions/compilation/packages/firmware-deb.sh declare bash_hash="${hash_files}" declare bash_hash_short="${bash_hash:0:${short_hash_size}}" @@ -34,8 +34,8 @@ function artifact_full_firmware_prepare_version() { 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[SHA1]}\"" - "Mainline firmware git revision \"${GIT_INFO_MAINLINE[SHA1]}\"" + "Armbian firmware git revision \"${GIT_INFO_ARMBIAN_FIRMWARE[SHA1]}\"" + "Mainline firmware git revision \"${GIT_INFO_MAINLINE_FIRMWARE[SHA1]}\"" "framework bash hash \"${bash_hash}\"" ) diff --git a/lib/functions/artifacts/artifact-kernel.sh b/lib/functions/artifacts/artifact-kernel.sh index 5f0bab45f..c4e679962 100644 --- a/lib/functions/artifacts/artifact-kernel.sh +++ b/lib/functions/artifacts/artifact-kernel.sh @@ -48,11 +48,11 @@ function artifact_kernel_prepare_version() { declare short_hash_size=4 - declare -A GIT_INFO=([GIT_SOURCE]="${KERNELSOURCE}" [GIT_REF]="${KERNELBRANCH}") - run_memoized GIT_INFO "git2info" memoized_git_ref_to_info "include_makefile_body" - debug_dict GIT_INFO + declare -A GIT_INFO_KERNEL=([GIT_SOURCE]="${KERNELSOURCE}" [GIT_REF]="${KERNELBRANCH}") + run_memoized GIT_INFO_KERNEL "git2info" memoized_git_ref_to_info "include_makefile_body" + debug_dict GIT_INFO_KERNEL - declare short_sha1="${GIT_INFO[SHA1]:0:${short_hash_size}}" + declare short_sha1="${GIT_INFO_KERNEL[SHA1]:0:${short_hash_size}}" # get the drivers hash... declare kernel_drivers_patch_hash @@ -87,17 +87,17 @@ function artifact_kernel_prepare_version() { # get the hashes of the lib/ bash sources involved... declare hash_files="undetermined" - calculate_hash_for_files "${SRC}"/lib/functions/compilation/kernel*.sh # maybe also this file, "${SRC}"/lib/functions/artifacts/kernel.sh + calculate_hash_for_files "${SRC}"/lib/functions/compilation/kernel*.sh declare bash_hash="${hash_files}" declare bash_hash_short="${bash_hash:0:${short_hash_size}}" # outer scope - artifact_version="${GIT_INFO[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}" + 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}" declare -a reasons=( - "version \"${GIT_INFO[MAKEFILE_FULL_VERSION]}\"" - "git revision \"${GIT_INFO[SHA1]}\"" - "codename \"${GIT_INFO[MAKEFILE_CODENAME]}\"" + "version \"${GIT_INFO_KERNEL[MAKEFILE_FULL_VERSION]}\"" + "git revision \"${GIT_INFO_KERNEL[SHA1]}\"" + "codename \"${GIT_INFO_KERNEL[MAKEFILE_CODENAME]}\"" "drivers hash \"${kernel_drivers_patch_hash}\"" "patches hash \"${patches_hash}\"" ".config hash \"${config_hash}\"" diff --git a/lib/functions/artifacts/artifact-rootfs.sh b/lib/functions/artifacts/artifact-rootfs.sh index f2be1e847..1a4c16bc5 100644 --- a/lib/functions/artifacts/artifact-rootfs.sh +++ b/lib/functions/artifacts/artifact-rootfs.sh @@ -56,7 +56,7 @@ function artifact_rootfs_build_from_sources() { if [[ ! -f "${artifact_final_file}" ]]; then exit_with_error "Rootfs cache file '${artifact_final_file}' does not exist after create_new_rootfs_cache()." else - display_alert "Rootfs cache file '${artifact_final_file}' exists after create_new_rootfs_cache()." "YESSS" "warn" + display_alert "Rootfs cache file '${artifact_final_file}' exists after create_new_rootfs_cache()." "YESSS" "debug" fi # obtain the size, in MiB, of "${SDCARD}" at this point. diff --git a/lib/functions/artifacts/artifact-uboot.sh b/lib/functions/artifacts/artifact-uboot.sh index f6dfcbb65..cabac18d5 100644 --- a/lib/functions/artifacts/artifact-uboot.sh +++ b/lib/functions/artifacts/artifact-uboot.sh @@ -22,11 +22,11 @@ function artifact_uboot_prepare_version() { declare short_hash_size=4 - declare -A GIT_INFO=([GIT_SOURCE]="${BOOTSOURCE}" [GIT_REF]="${BOOTBRANCH}") - run_memoized GIT_INFO "git2info" memoized_git_ref_to_info "include_makefile_body" - debug_dict GIT_INFO + declare -A GIT_INFO_UBOOT=([GIT_SOURCE]="${BOOTSOURCE}" [GIT_REF]="${BOOTBRANCH}") + run_memoized GIT_INFO_UBOOT "git2info" memoized_git_ref_to_info "include_makefile_body" + debug_dict GIT_INFO_UBOOT - declare short_sha1="${GIT_INFO[SHA1]:0:${short_hash_size}}" + declare short_sha1="${GIT_INFO_UBOOT[SHA1]:0:${short_hash_size}}" # get the uboot patches hash... # @TODO: why not just delegate this to the python patching, with some "dry-run" / hash-only option? @@ -39,16 +39,16 @@ function artifact_uboot_prepare_version() { # get the hashes of the lib/ bash sources involved... declare hash_files="undetermined" - calculate_hash_for_files "${SRC}"/lib/functions/compilation/uboot*.sh # maybe also this file, "${SRC}"/lib/functions/artifacts/u-boot.sh + calculate_hash_for_files "${SRC}"/lib/functions/compilation/uboot*.sh declare bash_hash="${hash_files}" declare bash_hash_short="${bash_hash:0:${short_hash_size}}" # outer scope - artifact_version="${GIT_INFO[MAKEFILE_VERSION]}-S${short_sha1}-P${uboot_patches_hash_short}-B${bash_hash_short}" + artifact_version="${GIT_INFO_UBOOT[MAKEFILE_VERSION]}-S${short_sha1}-P${uboot_patches_hash_short}-B${bash_hash_short}" declare -a reasons=( - "version \"${GIT_INFO[MAKEFILE_FULL_VERSION]}\"" - "git revision \"${GIT_INFO[SHA1]}\"" + "version \"${GIT_INFO_UBOOT[MAKEFILE_FULL_VERSION]}\"" + "git revision \"${GIT_INFO_UBOOT[SHA1]}\"" "patches hash \"${patches_hash}\"" "framework bash hash \"${bash_hash}\"" ) diff --git a/lib/functions/artifacts/artifacts-obtain.sh b/lib/functions/artifacts/artifacts-obtain.sh index f4dec8396..d59ce8f0d 100644 --- a/lib/functions/artifacts/artifacts-obtain.sh +++ b/lib/functions/artifacts/artifacts-obtain.sh @@ -151,7 +151,7 @@ function obtain_complete_artifact() { # If available in local cache, we're done (except for deb-tar which needs unpacking...) if [[ "${artifact_exists_in_local_cache}" == "yes" ]]; then - display_alert "artifact" "exists in local cache: ${artifact_name} ${artifact_version}" "cachehit" + display_alert "artifact" "exists in local cache: ${artifact_name} ${artifact_version}" "debug" if [[ "${skip_unpack_if_found_in_caches:-"no"}" == "yes" ]]; then display_alert "artifact" "skipping unpacking as requested" "info" else @@ -170,7 +170,7 @@ function obtain_complete_artifact() { debug_var artifact_exists_in_remote_cache if [[ "${artifact_exists_in_remote_cache}" == "yes" ]]; then - display_alert "artifact" "exists in remote cache: ${artifact_name} ${artifact_version}" "cachehit" + display_alert "artifact" "exists in remote cache: ${artifact_name} ${artifact_version}" "debug" if [[ "${skip_unpack_if_found_in_caches:-"no"}" == "yes" ]]; then display_alert "artifact" "skipping obtain from remote & unpacking as requested" "info" return 0 @@ -194,7 +194,7 @@ function obtain_complete_artifact() { if [[ ! -f "${artifact_final_file}" ]]; then exit_with_error "Artifact file ${artifact_final_file} did not exist, after artifact_build_from_sources()." else - display_alert "Artifact file exists" "${artifact_final_file} YESSS" "warn" + display_alert "Artifact file exists" "${artifact_final_file} YESSS" "debug" fi fi @@ -224,7 +224,7 @@ function unpack_artifact_from_local_cache() { for deb_name in "${artifact_map_debs[@]}"; do declare new_name_full="${artifact_base_dir}/${deb_name}" if [[ ! -f "${new_name_full}" ]]; then - display_alert "Unpacking artifact" "deb-tar: ${artifact_final_file_basename} missing: ${new_name_full}" "warn" + display_alert "Unpacking artifact" "deb-tar: ${artifact_final_file_basename} missing: ${new_name_full}" "debug" any_missing="yes" fi done @@ -238,7 +238,7 @@ function unpack_artifact_from_local_cache() { for deb_name in "${artifact_map_debs[@]}"; do declare new_name_full="${artifact_base_dir}/${deb_name}" if [[ ! -f "${new_name_full}" ]]; then - display_alert "Unpacking artifact" "AFTER UNPACK! deb-tar: ${artifact_final_file_basename} missing: ${new_name_full}" "err" + display_alert "Unpacking artifact" "after unpack deb-tar: ${artifact_final_file_basename} missing: ${new_name_full}" "err" any_missing="yes" fi done