Skip to content

Commit 7cca500

Browse files
committed
fix: make release version parsing portable
1 parent eae924b commit 7cca500

2 files changed

Lines changed: 3 additions & 5 deletions

File tree

scripts/releasing/create_source_release.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,7 @@ done
115115

116116
CMAKE_VERSION=$(
117117
git -C "${SOURCE_ROOT}" show "${GIT_REF}:CMakeLists.txt" |
118-
sed -n 's/^[[:space:]]*VERSION[[:space:]]\+\([0-9][0-9.]*\).*$/\1/p' |
119-
head -n 1
118+
awk '$1 == "VERSION" && $2 ~ /^[0-9]+\.[0-9]+\.[0-9]+$/ { print $2; exit }'
120119
)
121120
[[ "${CMAKE_VERSION}" == "${RELEASE_VERSION}" ]] ||
122121
fail "CMake version ${CMAKE_VERSION:-<missing>} does not match ${RELEASE_VERSION}"

scripts/releasing/verify_release_candidate.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,8 @@ for required_file in LICENSE NOTICE CMakeLists.txt docs/source/conf.py; do
167167
done
168168

169169
CMAKE_VERSION=$(
170-
sed -n 's/^[[:space:]]*VERSION[[:space:]]\+\([0-9][0-9.]*\).*$/\1/p' \
171-
"${SOURCE_DIR}/CMakeLists.txt" |
172-
head -n 1
170+
awk '$1 == "VERSION" && $2 ~ /^[0-9]+\.[0-9]+\.[0-9]+$/ { print $2; exit }' \
171+
"${SOURCE_DIR}/CMakeLists.txt"
173172
)
174173
[[ "${CMAKE_VERSION}" == "${RELEASE_VERSION}" ]] ||
175174
fail "CMake version ${CMAKE_VERSION:-<missing>} does not match ${RELEASE_VERSION}"

0 commit comments

Comments
 (0)