mirror of
https://github.com/armbian/build.git
synced 2026-02-18 14:12:05 +01:00
Some checks failed
Infrastructure: Dispatch to fork / 📢 Run repository dispatch on fork (push) Has been cancelled
Infrastructure: Mirror to Codeberg / codeberg (push) Has been cancelled
Maintenance: Announce merge / announcepush (push) Has been cancelled
Maintenance: Security scan / Scorecards analysis (push) Has been cancelled
Add opt-in extension that includes gcc/clang major.minor version in the kernel artifact version string for cache invalidation when the toolchain changes. Enable with ENABLE_EXTENSIONS="kernel-version-toolchain". Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
36 lines
1.2 KiB
Bash
36 lines
1.2 KiB
Bash
# Add compiler (gcc/clang) identifier to kernel artifact version string.
|
|
# This ensures cache invalidation when the toolchain changes.
|
|
# Enable with: ENABLE_EXTENSIONS="kernel-version-toolchain"
|
|
|
|
function artifact_kernel_version_parts__add_toolchain() {
|
|
# Determine compiler binary
|
|
declare kernel_compiler_bin="${KERNEL_COMPILER}gcc"
|
|
if [[ "${KERNEL_COMPILER}" == "clang" ]]; then
|
|
kernel_compiler_bin="clang"
|
|
fi
|
|
|
|
# Get compiler version (major.minor only)
|
|
declare toolchain_id="unknown"
|
|
if command -v "${kernel_compiler_bin}" &> /dev/null; then
|
|
declare full_version
|
|
full_version="$(${kernel_compiler_bin} -dumpfullversion -dumpversion 2>/dev/null || echo "")"
|
|
if [[ -n "${full_version}" ]]; then
|
|
# Extract major.minor, drop patch version
|
|
declare short_version
|
|
short_version="$(echo "${full_version}" | cut -d'.' -f1-2)"
|
|
# Build identifier: gcc13.3 or clang18.1
|
|
if [[ "${KERNEL_COMPILER}" == "clang" ]]; then
|
|
toolchain_id="clang${short_version}"
|
|
else
|
|
toolchain_id="gcc${short_version}"
|
|
fi
|
|
fi
|
|
fi
|
|
|
|
display_alert "Extension: ${EXTENSION}: Adding toolchain to kernel version" "${toolchain_id}" "debug"
|
|
|
|
# Add to version parts
|
|
artifact_version_parts["_T"]="${toolchain_id}"
|
|
artifact_version_part_order+=("0085-_T")
|
|
}
|