Skip to content

Commit

Permalink
Use extended regex instead of Perl regex
Browse files Browse the repository at this point in the history
  • Loading branch information
ppkarwasz committed Oct 11, 2024
1 parent be35669 commit 1c85ca3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,17 @@
#
set -e

# Shorthand for digit class:
d="[[:digit:]]"
# Determine the version and build timestamp
VERSION=$(sed -n -e "s/^set(log4cxx_VER \"\(.*\)\")/\1/p" < src/cmake/projectVersionDetails.cmake)
if ! echo "$VERSION" | grep -Pq '^\d+\.\d+\.\d+$'; then
if ! echo "$VERSION" | grep -Eq "^$d+\.$d+\.$d+$"; then
echo Invalid version number: "$VERSION" >& 2
exit 1
fi

OUTPUT_TIMESTAMP=$(sed -n -e "s/^set(log4cxx_OUTPUT_TIMESTAMP \"\(.*\)\")/\1/p" < src/cmake/projectVersionDetails.cmake)
if ! echo "$OUTPUT_TIMESTAMP" | grep -Pq '^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$'; then
if ! echo "$OUTPUT_TIMESTAMP" | grep -Eq "^$d{4}-$d{2}-$d{2}T$d{2}:$d{2}:$d{2}Z$"; then
echo Invalid build timestamp: "$OUTPUT_TIMESTAMP" >& 2
echo Run '`'date -u +%Y-%m-%dT%H:%M:%SZ'`' to generate it
exit 1
Expand Down

0 comments on commit 1c85ca3

Please sign in to comment.