mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
9c1d4f5b54
The "make" build system was deprecated in v4.0 in favor of idf.py (cmake). The remaining support is removed in v5.0.
48 lines
1.7 KiB
Bash
Executable File
48 lines
1.7 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -u
|
|
set -e
|
|
|
|
echo "Checking if IDF version in esp_idf_version.h matches 'git describe' output"
|
|
|
|
function get_ver_from_header() {
|
|
# Get the 3rd word from '#define ESP_IDF_VERSION_X <number>' line.
|
|
grep -E "^#define ${1}" components/esp_common/include/esp_idf_version.h | awk '{print $3;}'
|
|
}
|
|
|
|
function get_ver_from_cmake() {
|
|
grep -E "^set\(${1}" tools/cmake/version.cmake | sed -En "s/set\(${1} ([0-9])\)/\1/p"
|
|
}
|
|
|
|
header_ver_major=$(get_ver_from_header ESP_IDF_VERSION_MAJOR)
|
|
header_ver_minor=$(get_ver_from_header ESP_IDF_VERSION_MINOR)
|
|
header_ver_patch=$(get_ver_from_header ESP_IDF_VERSION_PATCH)
|
|
version_from_header="${header_ver_major}.${header_ver_minor}.${header_ver_patch}"
|
|
|
|
cmake_ver_major=$(get_ver_from_cmake IDF_VERSION_MAJOR)
|
|
cmake_ver_minor=$(get_ver_from_cmake IDF_VERSION_MINOR)
|
|
cmake_ver_patch=$(get_ver_from_cmake IDF_VERSION_PATCH)
|
|
version_from_cmake="${cmake_ver_major}.${cmake_ver_minor}.${cmake_ver_patch}"
|
|
|
|
git_desc=$(git describe)
|
|
git_desc_regex="^v([0-9]+)\.([0-9]+)(\.([0-9]+))?.*$"
|
|
if [[ ! ${git_desc} =~ ${git_desc_regex} ]]; then
|
|
echo "Could not determine the version from 'git describe' output: ${git_desc}"
|
|
exit 1
|
|
fi
|
|
version_from_git="${BASH_REMATCH[1]}.${BASH_REMATCH[2]}.${BASH_REMATCH[4]:-0}"
|
|
|
|
echo "From esp_idf_version.h: ${version_from_header}"
|
|
echo "From version.cmake: ${version_from_cmake}"
|
|
echo "From git describe: ${version_from_git}"
|
|
|
|
if [[ "${version_from_header}" != "${version_from_git}" ]]; then
|
|
echo "esp_idf_version.h does not match 'git describe' output"
|
|
exit 1
|
|
fi
|
|
|
|
if [[ "${version_from_cmake}" != "${version_from_git}" ]]; then
|
|
echo "version.cmake does not match 'git describe' output"
|
|
exit 1
|
|
fi
|