Skip to content

Commit

Permalink
Fix comparison check
Browse files Browse the repository at this point in the history
  • Loading branch information
ppkarwasz committed Oct 11, 2024
1 parent 4a8266a commit be35669
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/package_code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
- name: Determine version
shell: bash
run: |
VERSION=$(grep -Po '(?<=set\(log4cxx_VER ")(.*)(?="\))' src/cmake/projectVersionDetails.cmake)
VERSION=$(sed -n -e "s/^set(log4cxx_VER \"\(.*\)\")/\1/p" < src/cmake/projectVersionDetails.cmake)
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Create release files
Expand Down Expand Up @@ -74,7 +74,7 @@ jobs:
- name: Determine version
shell: bash
run: |
VERSION=$(grep -Po '(?<=set\(log4cxx_VER ")(.*)(?="\))' src/cmake/projectVersionDetails.cmake)
VERSION=$(sed -n -e "s/^set(log4cxx_VER \"\(.*\)\")/\1/p" < src/cmake/projectVersionDetails.cmake)
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Download artifacts
Expand All @@ -89,12 +89,14 @@ jobs:
shell: bash
run: |
./package.sh
current=CMakeFiles/apache-log4cxx-$VERSION
current=CMakeFiles/dist/apache-log4cxx-$VERSION
reference=CMakeFiles/reference/apache-log4cxx-$VERSION
for format in tar.gz zip; do
for hash in sha256 sha512; do
if cmp --silent "$reference.$format.$hash" "$current.$format.$hash"; then
if ! cmp --silent "$reference.$format.$hash" "$current.$format.$hash"; then
echo Files apache-log4cxx-$VERSION.$format differ\! >& 2
cat $reference.$format.$hash >& 2
cat $current.$format.$hash >& 2
exit 1
fi
done
Expand Down
4 changes: 2 additions & 2 deletions package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
set -e

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

OUTPUT_TIMESTAMP=$(grep -Po '(?<=set\(log4cxx_OUTPUT_TIMESTAMP ")(.*)(?="\))' src/cmake/projectVersionDetails.cmake)
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
echo Invalid build timestamp: "$OUTPUT_TIMESTAMP" >& 2
echo Run '`'date -u +%Y-%m-%dT%H:%M:%SZ'`' to generate it
Expand Down

0 comments on commit be35669

Please sign in to comment.