From eeec2e20019846d8f35e0cbce6bc5741816b4f3a Mon Sep 17 00:00:00 2001 From: "Piotr P. Karwasz" Date: Fri, 11 Oct 2024 16:39:54 +0200 Subject: [PATCH 01/18] Add reproducibility verification --- .editorconfig | 24 +---- .github/workflows/package_code.yml | 121 +++++++++++++++++--------- package.sh | 103 ++++++++++++++++++++++ src/cmake/projectVersionDetails.cmake | 30 ++++++- 4 files changed, 209 insertions(+), 69 deletions(-) create mode 100755 package.sh diff --git a/.editorconfig b/.editorconfig index 4836cb688..7f92ca809 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,14 +1,5 @@ root = true -[.editorconfig] -charset = utf-8 -end_of_line = lf -indent_size = 4 -indent_style = tab -insert_final_newline = true -tab_width = 4 -trim_trailing_whitespace = true - [*] charset = utf-8 end_of_line = lf @@ -18,20 +9,7 @@ insert_final_newline = true tab_width = 4 trim_trailing_whitespace = true -[*.sh] -charset = utf-8 -end_of_line = lf -indent_size = 2 -indent_style = space -insert_final_newline = true -tab_width = 2 -trim_trailing_whitespace = true - -[CMakeLists.txt] -charset = utf-8 -end_of_line = lf +[{*.sh,*.yml,CMakeLists.txt}] indent_size = 2 indent_style = space -insert_final_newline = true tab_width = 2 -trim_trailing_whitespace = true diff --git a/.github/workflows/package_code.yml b/.github/workflows/package_code.yml index bd8ef316a..9383269ae 100644 --- a/.github/workflows/package_code.yml +++ b/.github/workflows/package_code.yml @@ -15,54 +15,91 @@ name: Generate release files on: + workflow_call: push: branches: - master -# pull_request: -# branches: -# - master + +permissions: read-all jobs: - job1: - name: 'Package code for release' - runs-on: ubuntu-20.04 - timeout-minutes: 38 - strategy: - fail-fast: false + + package: + name: Package code + runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - with: - persist-credentials: false # do not persist auth token in the local git config - path: clean-checkout + - name: Checkout repository + uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # 4.2.1 + with: + persist-credentials: false # do not persist auth token in the local git config -# Consider using CPack when it supports a white-list for included files -# - name: 'Install minimum dependencies' -# run: | -# sudo apt-get install -y libapr1-dev libaprutil1-dev -# -# - name: 'Create release files' -# run: | -# cmake -B package -S clean-checkout -DAPACHE_MAINTAINER=yes -DCPACK_PACKAGE_DIRECTORY=`pwd` -# cmake --build package --target dist -# - - name: 'Create release files' - run: | - cd clean-checkout - rm -r src/main/abi-symbols - VERSION=`grep 'set(log4cxx_VER ' src/cmake/projectVersionDetails.cmake|sed -Ee 's/.*log4cxx_VER ([0-9]*)\.([0-9]*)\.([0-9]*).*/\1.\2.\3/'` - tar -zcf "../apache-log4cxx-$VERSION.tar.gz" "--transform=s,^,apache-log4cxx-$VERSION/," INSTALL LICENSE NOTICE README.md CMakeLists.txt src liblog4cxx.pc.in liblog4cxx-qt.pc.in KEYS - cd .. - sha512sum "apache-log4cxx-$VERSION.tar.gz" > "apache-log4cxx-$VERSION.tar.gz.sha512" - sha256sum "apache-log4cxx-$VERSION.tar.gz" > "apache-log4cxx-$VERSION.tar.gz.sha256" - tar xf "apache-log4cxx-$VERSION.tar.gz" - zip -rm "apache-log4cxx-$VERSION.zip" apache-log4cxx-$VERSION - sha512sum "apache-log4cxx-$VERSION.zip" > "apache-log4cxx-$VERSION.zip.sha512" - sha256sum "apache-log4cxx-$VERSION.zip" > "apache-log4cxx-$VERSION.zip.sha256" + - name: Determine version + shell: bash + run: | + VERSION=$(grep -Po '(?<=set\(log4cxx_VER ")(.*)(?="\))' src/cmake/projectVersionDetails.cmake) + echo "VERSION=$VERSION" >> $GITHUB_ENV + + - name: Create release files + shell: bash + run: | + ./package.sh + + - name: Upload artifacts + uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # 4.4.3 + if: always() + with: + name: apache-log4cxx + path: | + CMakeLists/apache-log4cxx-* + + verify-reproducibility: + name: Verify reproducibility + needs: package + runs-on: + - ubuntu-latest + - macos-latest + - windows-latest + + steps: + - name: Checkout repository + uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # 4.2.1 + with: + persist-credentials: false # do not persist auth token in the local git config + + - name: Determine version + shell: bash + run: | + VERSION=$(grep -Po '(?<=set\(log4cxx_VER ")(.*)(?="\))' src/cmake/projectVersionDetails.cmake) + echo "VERSION=$VERSION" >> $GITHUB_ENV + + - name: Download artifacts + uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # 4.1.8 + with: + name: apache-log4cxx + path: | + CMakeLists/reference + + - name: Check release files + id: check + shell: bash + run: | + ./package.sh + current=CMakeLists/apache-log4cxx-$VERSION + reference=CMakeLists/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 + echo Files apache-log4cxx-$VERSION.$format differ\! >& 2 + exit 1 + fi + done + done - - uses: actions/upload-artifact@v4 - if: always() - with: - name: 'Upload release files' - path: | - apache-log4cxx-* + - name: Upload reproducibility results + uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # 4.4.3 + if: ${{ failure() && steps.check.conclusion == 'failure' }} + with: + name: apache-log4cxx-reproducibility-${{ runner.os }} + path: | + CMakeLists/apache-log4cxx-* diff --git a/package.sh b/package.sh new file mode 100755 index 000000000..0777f1060 --- /dev/null +++ b/package.sh @@ -0,0 +1,103 @@ +#!/bin/bash +# +set -e + +# Determine the version and build timestamp +VERSION=$(grep -Po '(?<=set\(log4cxx_VER ")(.*)(?="\))' 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) +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 + exit 1 +fi + +# Build directory +build=CMakeFiles + +# Create source directory +mkdir -p "$build" +OUTPUT_DIR="$build/apache-log4cxx-$VERSION" +if [ -f "$OUTPUT_DIR" ]; then + if [ ! -d "$OUTPUT_DIR" ]; then + echo File "$OUTPUT_DIR" is not a directory >& 2 + exit 1 + fi + if [ ! -z "$(ls -A "$OUTPUT_DIR")" ]; then + echo Directory "$OUTPUT_DIR" is not empty >& 2 + exit 1 + fi +fi +mkdir -p "$OUTPUT_DIR" + +# Copy files to directory +cp -r \ + CMakeLists.txt \ + KEYS \ + INSTALL \ + LICENSE \ + NOTICE \ + README.md \ + src \ + liblog4cxx.pc.in \ + liblog4cxx-qt.pc.in \ + "$OUTPUT_DIR" +rm -r "$OUTPUT_DIR"/src/main/abi-symbols + +# Create TAR file +# +# See https://reproducible-builds.org/docs/archives/ for reproducibility tips +TAR_ARCHIVE="$build/apache-log4cxx-$VERSION.tar.gz" +echo 'Tar version:' +tar --version | sed -e 's/^/\t/' +echo 'Gzip version:' +gzip --version | sed -e 's/^/\t/' +if [ -f "$TAR_ARCHIVE" ]; then + echo Archive "$TAR_ARCHIVE" already exists >& 2 + exit 1 +fi + +tar --transform="s!^$OUTPUT_DIR!apache-log4cxx-$VERSION!" \ + --mtime="$OUTPUT_TIMESTAMP" \ + --owner=0 --group=0 --numeric-owner \ + --sort=name \ + --pax-option=exthdr.name=%d/PaxHeaders/%f,delete=atime,delete=ctime \ + --create --gzip --file "$TAR_ARCHIVE" "$OUTPUT_DIR" + +echo -e Tar archive: "$TAR_ARCHIVE" + +# Create ZIP file +# +# See https://reproducible-builds.org/docs/archives/ for reproducibility tips +# Change the mtime of all files +ZIP_ARCHIVE="$build/apache-log4cxx-$VERSION.zip" +echo 'Zip version:' +zip --version | sed 's/^/\t/' +if [ -f "$ZIP_ARCHIVE" ]; then + echo Archive "$ZIP_ARCHIVE" already exists >& 2 + exit 1 +fi + +find "$OUTPUT_DIR" -exec touch --date="$OUTPUT_TIMESTAMP" -m {} + +# Sort files and zip. +( + cd "$build" + find apache-log4cxx-$VERSION -print0 | + LC_ALL=C sort -z | + xargs -0 zip -q -X apache-log4cxx-$VERSION.zip +) + +echo -e ZIP archive: "$ZIP_ARCHIVE" + +# Generate hashes +( + cd "$build" + for format in tar.gz zip; do + sha256sum apache-log4cxx-$VERSION.$format > apache-log4cxx-$VERSION.$format.sha256 + sha512sum apache-log4cxx-$VERSION.$format > apache-log4cxx-$VERSION.$format.sha512 + done +) diff --git a/src/cmake/projectVersionDetails.cmake b/src/cmake/projectVersionDetails.cmake index 362759913..2a8c078df 100644 --- a/src/cmake/projectVersionDetails.cmake +++ b/src/cmake/projectVersionDetails.cmake @@ -1,5 +1,27 @@ -# This file should contain nothing but the following line -# setting the project version. The variable name must not -# clash with the log4cxx_VERSION* variables automatically +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +## +# This file should contain only the current version and the build timestamp + +# The variable name must not clash with the log4cxx_VERSION* variables automatically # defined by the project() command. -set(log4cxx_VER 1.3.0.0) +set(log4cxx_VER "1.3.0") + +# Timestamp used for the source archive to guarantee reproducible builds in ISO 8601 format. +# +# To generate use: date -u +%Y-%m-%dT%H:%M:%SZ +set(log4cxx_OUTPUT_TIMESTAMP "2024-10-11T14:35:14Z") From fb4ef799f463f6dfb4e6dc21c888c8c078fae07d Mon Sep 17 00:00:00 2001 From: "Piotr P. Karwasz" Date: Fri, 11 Oct 2024 16:46:16 +0200 Subject: [PATCH 02/18] Add `workflow_dispatch` trigger --- .github/workflows/package_code.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/package_code.yml b/.github/workflows/package_code.yml index 9383269ae..919048f50 100644 --- a/.github/workflows/package_code.yml +++ b/.github/workflows/package_code.yml @@ -15,7 +15,7 @@ name: Generate release files on: - workflow_call: + workflow_dispatch: push: branches: - master From 9ef7d7388e7143da02f4857adf0d4b5b9368bdba Mon Sep 17 00:00:00 2001 From: "Piotr P. Karwasz" Date: Fri, 11 Oct 2024 16:57:53 +0200 Subject: [PATCH 03/18] Fix build --- .github/workflows/package_code.yml | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/.github/workflows/package_code.yml b/.github/workflows/package_code.yml index 919048f50..f729e9151 100644 --- a/.github/workflows/package_code.yml +++ b/.github/workflows/package_code.yml @@ -1,7 +1,8 @@ +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 +# The ASF licenses this file to you under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # @@ -12,6 +13,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +# name: Generate release files on: @@ -51,15 +53,17 @@ jobs: with: name: apache-log4cxx path: | - CMakeLists/apache-log4cxx-* + CMakeFiles/apache-log4cxx-* verify-reproducibility: name: Verify reproducibility needs: package - runs-on: - - ubuntu-latest - - macos-latest - - windows-latest + runs-on: ${{ matrix.os }} + + strategy: + fail-fast: false + matrix: + os: [ macos-latest, ubuntu-latest, windows-latest ] steps: - name: Checkout repository @@ -78,15 +82,15 @@ jobs: with: name: apache-log4cxx path: | - CMakeLists/reference + CMakeFiles/reference - name: Check release files id: check shell: bash run: | ./package.sh - current=CMakeLists/apache-log4cxx-$VERSION - reference=CMakeLists/reference/apache-log4cxx-$VERSION + current=CMakeFiles/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 @@ -100,6 +104,6 @@ jobs: uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # 4.4.3 if: ${{ failure() && steps.check.conclusion == 'failure' }} with: - name: apache-log4cxx-reproducibility-${{ runner.os }} + name: apache-log4cxx-reproducibility-${{ matrix.os }} path: | - CMakeLists/apache-log4cxx-* + CMakeFiles/apache-log4cxx-* From ef8a22a38bd4b0f380373883489ce58faca0a680 Mon Sep 17 00:00:00 2001 From: "Piotr P. Karwasz" Date: Fri, 11 Oct 2024 17:09:39 +0200 Subject: [PATCH 04/18] Fix uploaded archives --- .github/workflows/package_code.yml | 4 ++-- package.sh | 15 ++++++++++----- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/.github/workflows/package_code.yml b/.github/workflows/package_code.yml index f729e9151..a1eb0f9da 100644 --- a/.github/workflows/package_code.yml +++ b/.github/workflows/package_code.yml @@ -53,7 +53,7 @@ jobs: with: name: apache-log4cxx path: | - CMakeFiles/apache-log4cxx-* + CMakeFiles/dist/* verify-reproducibility: name: Verify reproducibility @@ -106,4 +106,4 @@ jobs: with: name: apache-log4cxx-reproducibility-${{ matrix.os }} path: | - CMakeFiles/apache-log4cxx-* + CMakeFiles/dist/* diff --git a/package.sh b/package.sh index 0777f1060..30647a772 100755 --- a/package.sh +++ b/package.sh @@ -16,9 +16,14 @@ if ! echo "$OUTPUT_TIMESTAMP" | grep -Pq '^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$ exit 1 fi -# Build directory +# Build directory containing temporary files +# build=CMakeFiles +# Directory containing the distribution archives +# +dist="$build/dist" + # Create source directory mkdir -p "$build" OUTPUT_DIR="$build/apache-log4cxx-$VERSION" @@ -51,7 +56,7 @@ rm -r "$OUTPUT_DIR"/src/main/abi-symbols # Create TAR file # # See https://reproducible-builds.org/docs/archives/ for reproducibility tips -TAR_ARCHIVE="$build/apache-log4cxx-$VERSION.tar.gz" +TAR_ARCHIVE="$dist/apache-log4cxx-$VERSION.tar.gz" echo 'Tar version:' tar --version | sed -e 's/^/\t/' echo 'Gzip version:' @@ -74,7 +79,7 @@ echo -e Tar archive: "$TAR_ARCHIVE" # # See https://reproducible-builds.org/docs/archives/ for reproducibility tips # Change the mtime of all files -ZIP_ARCHIVE="$build/apache-log4cxx-$VERSION.zip" +ZIP_ARCHIVE="$dist/apache-log4cxx-$VERSION.zip" echo 'Zip version:' zip --version | sed 's/^/\t/' if [ -f "$ZIP_ARCHIVE" ]; then @@ -88,14 +93,14 @@ find "$OUTPUT_DIR" -exec touch --date="$OUTPUT_TIMESTAMP" -m {} + cd "$build" find apache-log4cxx-$VERSION -print0 | LC_ALL=C sort -z | - xargs -0 zip -q -X apache-log4cxx-$VERSION.zip + xargs -0 zip -q -X dist/apache-log4cxx-$VERSION.zip ) echo -e ZIP archive: "$ZIP_ARCHIVE" # Generate hashes ( - cd "$build" + cd "$dist" for format in tar.gz zip; do sha256sum apache-log4cxx-$VERSION.$format > apache-log4cxx-$VERSION.$format.sha256 sha512sum apache-log4cxx-$VERSION.$format > apache-log4cxx-$VERSION.$format.sha512 From 4a8266acb17b12e27935094effd79fc1ed765c44 Mon Sep 17 00:00:00 2001 From: "Piotr P. Karwasz" Date: Fri, 11 Oct 2024 17:10:59 +0200 Subject: [PATCH 05/18] Create missing directory --- package.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.sh b/package.sh index 30647a772..470458d3a 100755 --- a/package.sh +++ b/package.sh @@ -25,7 +25,7 @@ build=CMakeFiles dist="$build/dist" # Create source directory -mkdir -p "$build" +mkdir -p "$dist" OUTPUT_DIR="$build/apache-log4cxx-$VERSION" if [ -f "$OUTPUT_DIR" ]; then if [ ! -d "$OUTPUT_DIR" ]; then From be356690f6425421ec02c0b50a3cc9fd5562838f Mon Sep 17 00:00:00 2001 From: "Piotr P. Karwasz" Date: Fri, 11 Oct 2024 17:28:48 +0200 Subject: [PATCH 06/18] Fix comparison check --- .github/workflows/package_code.yml | 10 ++++++---- package.sh | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/package_code.yml b/.github/workflows/package_code.yml index a1eb0f9da..86984f25d 100644 --- a/.github/workflows/package_code.yml +++ b/.github/workflows/package_code.yml @@ -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 @@ -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 @@ -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 diff --git a/package.sh b/package.sh index 470458d3a..d20747739 100755 --- a/package.sh +++ b/package.sh @@ -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 From 1c85ca38de935cd289c09718521397d47cb31809 Mon Sep 17 00:00:00 2001 From: "Piotr P. Karwasz" Date: Fri, 11 Oct 2024 17:35:56 +0200 Subject: [PATCH 07/18] Use extended regex instead of Perl regex --- package.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/package.sh b/package.sh index d20747739..f6259f85b 100755 --- a/package.sh +++ b/package.sh @@ -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 From 55effa8ba425d1793e1504aa99f29e14e05a5f40 Mon Sep 17 00:00:00 2001 From: "Piotr P. Karwasz" Date: Fri, 11 Oct 2024 17:41:58 +0200 Subject: [PATCH 08/18] Try to improve build on MacOS --- .github/workflows/package_code.yml | 17 ++++------ package.sh | 53 ++++++++++++++---------------- 2 files changed, 32 insertions(+), 38 deletions(-) diff --git a/.github/workflows/package_code.yml b/.github/workflows/package_code.yml index 86984f25d..1c7416195 100644 --- a/.github/workflows/package_code.yml +++ b/.github/workflows/package_code.yml @@ -63,7 +63,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ macos-latest, ubuntu-latest, windows-latest ] + os: [ macos-latest, ubuntu-latest ] steps: - name: Checkout repository @@ -92,19 +92,16 @@ jobs: 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 - echo Files apache-log4cxx-$VERSION.$format differ\! >& 2 - cat $reference.$format.$hash >& 2 - cat $current.$format.$hash >& 2 - exit 1 - fi - done + if ! cmp --silent "$reference.$format" "$current.$format"; then + echo Files apache-log4cxx-$VERSION.$format differ\! >& 2 + exit 1 + fi done - name: Upload reproducibility results uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # 4.4.3 - if: ${{ failure() && steps.check.conclusion == 'failure' }} + if: ${{ always() }} + #if: ${{ failure() && steps.check.conclusion == 'failure' }} with: name: apache-log4cxx-reproducibility-${{ matrix.os }} path: | diff --git a/package.sh b/package.sh index f6259f85b..75f02d2a7 100755 --- a/package.sh +++ b/package.sh @@ -18,17 +18,13 @@ if ! echo "$OUTPUT_TIMESTAMP" | grep -Eq "^$d{4}-$d{2}-$d{2}T$d{2}:$d{2}:$d{2}Z$ exit 1 fi -# Build directory containing temporary files +# Build directory containing temporary files, all the paths are relative to it. # build=CMakeFiles -# Directory containing the distribution archives -# -dist="$build/dist" - # Create source directory -mkdir -p "$dist" -OUTPUT_DIR="$build/apache-log4cxx-$VERSION" +mkdir -p "$build/dist" +OUTPUT_DIR="apache-log4cxx-$VERSION" if [ -f "$OUTPUT_DIR" ]; then if [ ! -d "$OUTPUT_DIR" ]; then echo File "$OUTPUT_DIR" is not a directory >& 2 @@ -39,7 +35,7 @@ if [ -f "$OUTPUT_DIR" ]; then exit 1 fi fi -mkdir -p "$OUTPUT_DIR" +mkdir -p "$build/$OUTPUT_DIR" # Copy files to directory cp -r \ @@ -52,13 +48,13 @@ cp -r \ src \ liblog4cxx.pc.in \ liblog4cxx-qt.pc.in \ - "$OUTPUT_DIR" -rm -r "$OUTPUT_DIR"/src/main/abi-symbols + "$build/$OUTPUT_DIR" +rm -r "$build/$OUTPUT_DIR"/src/main/abi-symbols # Create TAR file # # See https://reproducible-builds.org/docs/archives/ for reproducibility tips -TAR_ARCHIVE="$dist/apache-log4cxx-$VERSION.tar.gz" +TAR_ARCHIVE="dist/apache-log4cxx-$VERSION.tar.gz" echo 'Tar version:' tar --version | sed -e 's/^/\t/' echo 'Gzip version:' @@ -68,20 +64,21 @@ if [ -f "$TAR_ARCHIVE" ]; then exit 1 fi -tar --transform="s!^$OUTPUT_DIR!apache-log4cxx-$VERSION!" \ - --mtime="$OUTPUT_TIMESTAMP" \ - --owner=0 --group=0 --numeric-owner \ - --sort=name \ - --pax-option=exthdr.name=%d/PaxHeaders/%f,delete=atime,delete=ctime \ - --create --gzip --file "$TAR_ARCHIVE" "$OUTPUT_DIR" - -echo -e Tar archive: "$TAR_ARCHIVE" +( + cd "$build" + tar --mtime="$OUTPUT_TIMESTAMP" \ + --owner=0 --group=0 --numeric-owner \ + --sort=name \ + --pax-option=exthdr.name=%d/PaxHeaders/%f,delete=atime,delete=ctime \ + --create --gzip --file "$TAR_ARCHIVE" "$OUTPUT_DIR" +) +echo -e Tar archive: "$build/$TAR_ARCHIVE" # Create ZIP file # # See https://reproducible-builds.org/docs/archives/ for reproducibility tips # Change the mtime of all files -ZIP_ARCHIVE="$dist/apache-log4cxx-$VERSION.zip" +ZIP_ARCHIVE="dist/apache-log4cxx-$VERSION.zip" echo 'Zip version:' zip --version | sed 's/^/\t/' if [ -f "$ZIP_ARCHIVE" ]; then @@ -89,22 +86,22 @@ if [ -f "$ZIP_ARCHIVE" ]; then exit 1 fi -find "$OUTPUT_DIR" -exec touch --date="$OUTPUT_TIMESTAMP" -m {} + +find "$build/$OUTPUT_DIR" -exec touch --date="$OUTPUT_TIMESTAMP" -m {} + # Sort files and zip. ( cd "$build" - find apache-log4cxx-$VERSION -print0 | + find "$OUTPUT_DIR" -print0 | LC_ALL=C sort -z | - xargs -0 zip -q -X dist/apache-log4cxx-$VERSION.zip + xargs -0 zip -q -X "$ZIP_ARCHIVE" ) -echo -e ZIP archive: "$ZIP_ARCHIVE" +echo -e ZIP archive: "$build/$ZIP_ARCHIVE" # Generate hashes ( - cd "$dist" - for format in tar.gz zip; do - sha256sum apache-log4cxx-$VERSION.$format > apache-log4cxx-$VERSION.$format.sha256 - sha512sum apache-log4cxx-$VERSION.$format > apache-log4cxx-$VERSION.$format.sha512 + cd "$build/dist" + for file in *; do + sha256sum "$file" > "$file.sha256" + sha512sum "$file" > "$file.sha512" done ) From 73c322ed0ff94df7097426ebc5069afcfef713f6 Mon Sep 17 00:00:00 2001 From: "Piotr P. Karwasz" Date: Fri, 11 Oct 2024 18:01:16 +0200 Subject: [PATCH 09/18] Try achieve repro on MacOS --- .github/workflows/package_code.yml | 3 +-- package.sh | 7 ++++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/package_code.yml b/.github/workflows/package_code.yml index 1c7416195..50c92816e 100644 --- a/.github/workflows/package_code.yml +++ b/.github/workflows/package_code.yml @@ -100,8 +100,7 @@ jobs: - name: Upload reproducibility results uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # 4.4.3 - if: ${{ always() }} - #if: ${{ failure() && steps.check.conclusion == 'failure' }} + if: ${{ failure() && steps.check.conclusion == 'failure' }} with: name: apache-log4cxx-reproducibility-${{ matrix.os }} path: | diff --git a/package.sh b/package.sh index 75f02d2a7..c9d79fc03 100755 --- a/package.sh +++ b/package.sh @@ -51,6 +51,9 @@ cp -r \ "$build/$OUTPUT_DIR" rm -r "$build/$OUTPUT_DIR"/src/main/abi-symbols +# Fix last-modified time +find "$build/$OUTPUT_DIR" -exec touch --date="$OUTPUT_TIMESTAMP" -m {} + + # Create TAR file # # See https://reproducible-builds.org/docs/archives/ for reproducibility tips @@ -66,8 +69,7 @@ fi ( cd "$build" - tar --mtime="$OUTPUT_TIMESTAMP" \ - --owner=0 --group=0 --numeric-owner \ + tar --owner=0 --group=0 --numeric-owner \ --sort=name \ --pax-option=exthdr.name=%d/PaxHeaders/%f,delete=atime,delete=ctime \ --create --gzip --file "$TAR_ARCHIVE" "$OUTPUT_DIR" @@ -86,7 +88,6 @@ if [ -f "$ZIP_ARCHIVE" ]; then exit 1 fi -find "$build/$OUTPUT_DIR" -exec touch --date="$OUTPUT_TIMESTAMP" -m {} + # Sort files and zip. ( cd "$build" From c8d78b1145b9600787b2633e934e674b74d91738 Mon Sep 17 00:00:00 2001 From: "Piotr P. Karwasz" Date: Fri, 11 Oct 2024 18:53:27 +0200 Subject: [PATCH 10/18] Add signing and uploading --- .github/generate-email.sh | 99 ++++++++++++++++++++++++ .github/workflows/package_code.yml | 116 +++++++++++++++++++++++------ 2 files changed, 194 insertions(+), 21 deletions(-) create mode 100644 .github/generate-email.sh diff --git a/.github/generate-email.sh b/.github/generate-email.sh new file mode 100644 index 000000000..242e9e9ff --- /dev/null +++ b/.github/generate-email.sh @@ -0,0 +1,99 @@ +#!/bin/bash +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to you under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# Enable strict mode +set -euo pipefail +IFS=$'\n\t' + +stderr() { + echo "$*" 1>&2 +} + +fail_for_invalid_args() { + stderr "Invalid arguments!" + stderr "Expected arguments: " + exit 1 +} + +# Check arguments +[ $# -ne 3 ] && fail_for_invalid_args + +# Constants +PROJECT_NAME="Apache Log4cxx" +PROJECT_ID="log4cxx" +PROJECT_VERSION="$2" +PROJECT_SITE="https://logging.apache.org/$PROJECT_ID" +PROJECT_STAGING_SITE="${PROJECT_SITE/apache.org/staged.apache.org}" +PROJECT_REPO="https://github.com/apache/logging-log4cxx" +COMMIT_ID="$3" +PROJECT_DIST_URL="https://dist.apache.org/repos/dist/dev/logging/$PROJECT_ID/$PROJECT_VERSION" + +case $1 in + +vote) + cat <> $GITHUB_ENV - - name: Create release files shell: bash - run: | - ./package.sh + run: ./package.sh - name: Upload artifacts uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # 4.4.3 if: always() with: name: apache-log4cxx - path: | - CMakeFiles/dist/* + path: CMakeFiles/dist/* verify-reproducibility: name: Verify reproducibility @@ -63,7 +59,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ macos-latest, ubuntu-latest ] + os: [ ubuntu-latest ] steps: - name: Checkout repository @@ -71,24 +67,18 @@ jobs: with: persist-credentials: false # do not persist auth token in the local git config - - name: Determine version - shell: bash - run: | - VERSION=$(sed -n -e "s/^set(log4cxx_VER \"\(.*\)\")/\1/p" < src/cmake/projectVersionDetails.cmake) - echo "VERSION=$VERSION" >> $GITHUB_ENV - - name: Download artifacts uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # 4.1.8 with: name: apache-log4cxx - path: | - CMakeFiles/reference + path: CMakeFiles/reference - name: Check release files id: check shell: bash run: | ./package.sh + VERSION=$(sed -n -e "s/^set(log4cxx_VER \"\(.*\)\")/\1/p" < src/cmake/projectVersionDetails.cmake) current=CMakeFiles/dist/apache-log4cxx-$VERSION reference=CMakeFiles/reference/apache-log4cxx-$VERSION for format in tar.gz zip; do @@ -103,5 +93,89 @@ jobs: if: ${{ failure() && steps.check.conclusion == 'failure' }} with: name: apache-log4cxx-reproducibility-${{ matrix.os }} - path: | - CMakeFiles/dist/* + path: CMakeFiles/dist/* + + sign-and-upload: + name: Sign and upload + if: ${{ github.event_name == 'workflow_dispatch' }} + needs: + - package + - verify-reproducibility + runs-on: ubuntu-latest + + steps: + - name: Download artifacts + uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # 4.1.8 + with: + name: apache-log4cxx + + - name: Import GPG key + uses: crazy-max/ghaction-import-gpg@01dd5d3ca463c7f10f7f4f7b4f177225ac661ee4 # 6.1.0 + with: + gpg_private_key: ${{ secrets.LOGGING_GPG_SECRET_KEY }} + + - name: Check files and sign + env: + PROJECT_VERSION: ${{ inputs.project-version }} + shell: bash + run: | + for format in tar.gz zip; do + tmp=(apache-log4cxx-*.$format) + name="${tmp[@]}" + version=$(echo "$name" | sed -e "s/apache-log4cxx-\(.*\)\.$format") + if [ "$PROJECT_VERSION" != "$version" ]; then + echo Unexpected version number for file "$name" >& 2 + exit 1 + fi + sha256sum -c "$name.sha256" + sha512sum -c "$name.sha512" + # Sign + gpg --armor --detach-sign --yes --pinentry-mode error "$name" + done + + - name: Upload to Subversion + shell: bash + env: + DIST_FILENAME_PREFIX: apache-log4cxx + DIST_FILENAME_VERSIONED_PREFIX: apache-log4cxx-${{ inputs.project-version }} + PROJECT_ID: log4cxx + PROJECT_VERSION: ${{ inputs.project-version }} + SVN_USERNAME: ${{ secrets.LOGGING_SVN_DEV_USERNAME }} + SVN_PASSWORD: ${{ secrets.LOGGING_SVN_DEV_PASSWORD }} + run: | + # Find the effective Git commit ID + export COMMIT_ID=$(git rev-parse HEAD) + + # Checkout the SVN repository + export SVN_DIR="$(mktemp)/svn-repo" + svn co \ + "https://dist.apache.org/repos/dist/dev/logging/$PROJECT_ID" \ + "$SVN_DIR" + cd "$SVN_DIR" + + # Switch to the distribution folder + [ -d "$PROJECT_VERSION" ] || { + mkdir "$PROJECT_VERSION" + svn add "$PROJECT_VERSION" + } + cd "$PROJECT_VERSION" + + # Clean up old files + find . -name "${DIST_FILENAME_PREFIX}*" -type f -print0 | xargs -0 -r svn delete + + # Generate emails + for EMAIL_TYPE in vote announce; do + "$GITHUB_WORKSPACE/.github/generate-email.sh" \ + "$EMAIL_TYPE" "$PROJECT_VERSION" "$COMMIT_ID" \ + > "${DIST_FILENAME_VERSIONED_PREFIX}-email-${EMAIL_TYPE}.txt" + done + + # Copy the distribution + cp "$GITHUB_WORKSPACE/$DIST_FILENAME_VERSIONED_PREFIX"* . + + # Add & commit changes + svn add "$DIST_FILENAME_PREFIX"* + svn commit \ + --username "$SVN_USERNAME" \ + --password "$SVN_PASSWORD" \ + -m "Added \`${DIST_FILENAME_PREFIX}\` artifacts for release \`${PROJECT_VERSION}\`" From b7ee61c89c7b57d1f5aed72980e98cb702f67456 Mon Sep 17 00:00:00 2001 From: "Piotr P. Karwasz" Date: Fri, 11 Oct 2024 19:03:12 +0200 Subject: [PATCH 11/18] Replace `ghaction-import-gpg` with `setup-java` --- .github/workflows/package_code.yml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/package_code.yml b/.github/workflows/package_code.yml index 9831f9b52..8b477a059 100644 --- a/.github/workflows/package_code.yml +++ b/.github/workflows/package_code.yml @@ -109,10 +109,17 @@ jobs: with: name: apache-log4cxx - - name: Import GPG key - uses: crazy-max/ghaction-import-gpg@01dd5d3ca463c7f10f7f4f7b4f177225ac661ee4 # 6.1.0 + + - name: Setup GPG +# uses: crazy-max/ghaction-import-gpg@01dd5d3ca463c7f10f7f4f7b4f177225ac661ee4 # 6.1.0 +# with: +# gpg_private_key: ${{ secrets.LOGGING_GPG_SECRET_KEY }} + # Using `setup-java` as temporary workaround, since `crazy-max` is not authorized + uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73 # 3.7.0 with: - gpg_private_key: ${{ secrets.LOGGING_GPG_SECRET_KEY }} + distribution: temurin + java-version: 17 + gpg-private-key: ${{ secrets.GPG_SECRET_KEY }} - name: Check files and sign env: From e0a6b0ce166a15a5decbc756d8e15b4df4a9f2ce Mon Sep 17 00:00:00 2001 From: "Piotr P. Karwasz" Date: Fri, 11 Oct 2024 19:06:51 +0200 Subject: [PATCH 12/18] Fix `sed` command --- .github/workflows/package_code.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/package_code.yml b/.github/workflows/package_code.yml index 8b477a059..bc0ed08d3 100644 --- a/.github/workflows/package_code.yml +++ b/.github/workflows/package_code.yml @@ -129,7 +129,7 @@ jobs: for format in tar.gz zip; do tmp=(apache-log4cxx-*.$format) name="${tmp[@]}" - version=$(echo "$name" | sed -e "s/apache-log4cxx-\(.*\)\.$format") + version=$(echo "$name" | sed -e "s/apache-log4cxx-\(.*\)\.$format/\1/") if [ "$PROJECT_VERSION" != "$version" ]; then echo Unexpected version number for file "$name" >& 2 exit 1 From ccec187effde84b1421918591785a21eef16834b Mon Sep 17 00:00:00 2001 From: "Piotr P. Karwasz" Date: Fri, 11 Oct 2024 19:09:05 +0200 Subject: [PATCH 13/18] Fix wrong secret name --- .github/workflows/package_code.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/package_code.yml b/.github/workflows/package_code.yml index bc0ed08d3..5b97d201c 100644 --- a/.github/workflows/package_code.yml +++ b/.github/workflows/package_code.yml @@ -119,7 +119,7 @@ jobs: with: distribution: temurin java-version: 17 - gpg-private-key: ${{ secrets.GPG_SECRET_KEY }} + gpg-private-key: ${{ secrets.LOGGING_GPG_SECRET_KEY }} - name: Check files and sign env: From f8cf18436acf8705c43faf85c7ef674395adf850 Mon Sep 17 00:00:00 2001 From: "Piotr P. Karwasz" Date: Fri, 11 Oct 2024 19:19:55 +0200 Subject: [PATCH 14/18] Recover commit id from Github event --- .github/workflows/package_code.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/package_code.yml b/.github/workflows/package_code.yml index 5b97d201c..53efeec89 100644 --- a/.github/workflows/package_code.yml +++ b/.github/workflows/package_code.yml @@ -151,7 +151,7 @@ jobs: SVN_PASSWORD: ${{ secrets.LOGGING_SVN_DEV_PASSWORD }} run: | # Find the effective Git commit ID - export COMMIT_ID=$(git rev-parse HEAD) + export COMMIT_ID="$GITHUB_SHA" # Checkout the SVN repository export SVN_DIR="$(mktemp)/svn-repo" From 45f8768c3da20643083b1ba9ee74f1b00fb547e2 Mon Sep 17 00:00:00 2001 From: "Piotr P. Karwasz" Date: Fri, 11 Oct 2024 19:25:25 +0200 Subject: [PATCH 15/18] Create SVN directory --- .github/workflows/package_code.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/package_code.yml b/.github/workflows/package_code.yml index 53efeec89..519f4d32c 100644 --- a/.github/workflows/package_code.yml +++ b/.github/workflows/package_code.yml @@ -155,6 +155,7 @@ jobs: # Checkout the SVN repository export SVN_DIR="$(mktemp)/svn-repo" + mkdir -p "$SVN_DIR" svn co \ "https://dist.apache.org/repos/dist/dev/logging/$PROJECT_ID" \ "$SVN_DIR" From b910c1fb7e312bb636a9e2dd9e65077965d90be2 Mon Sep 17 00:00:00 2001 From: "Piotr P. Karwasz" Date: Fri, 11 Oct 2024 19:28:05 +0200 Subject: [PATCH 16/18] Fix `mktemp` invocation --- .github/workflows/package_code.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/package_code.yml b/.github/workflows/package_code.yml index 519f4d32c..409027413 100644 --- a/.github/workflows/package_code.yml +++ b/.github/workflows/package_code.yml @@ -154,8 +154,7 @@ jobs: export COMMIT_ID="$GITHUB_SHA" # Checkout the SVN repository - export SVN_DIR="$(mktemp)/svn-repo" - mkdir -p "$SVN_DIR" + export SVN_DIR="$(mktemp -d)/svn-repo" svn co \ "https://dist.apache.org/repos/dist/dev/logging/$PROJECT_ID" \ "$SVN_DIR" From 4b59cd3e845ff318c313986d101a12a02c4ef087 Mon Sep 17 00:00:00 2001 From: "Piotr P. Karwasz" Date: Fri, 11 Oct 2024 19:31:42 +0200 Subject: [PATCH 17/18] Add checkout step for e-mail --- .github/generate-email.sh | 2 -- .github/workflows/package_code.yml | 6 +++++- 2 files changed, 5 insertions(+), 3 deletions(-) mode change 100644 => 100755 .github/generate-email.sh diff --git a/.github/generate-email.sh b/.github/generate-email.sh old mode 100644 new mode 100755 index 242e9e9ff..4b53696d9 --- a/.github/generate-email.sh +++ b/.github/generate-email.sh @@ -72,7 +72,6 @@ positive than negative votes are required. == Release Notes EOF - dump_release_notes ;; announce) @@ -91,7 +90,6 @@ website[1]. == Release Notes EOF - dump_release_notes ;; *) fail_for_invalid_args diff --git a/.github/workflows/package_code.yml b/.github/workflows/package_code.yml index 409027413..9d67aabb8 100644 --- a/.github/workflows/package_code.yml +++ b/.github/workflows/package_code.yml @@ -104,12 +104,16 @@ jobs: runs-on: ubuntu-latest steps: + - name: Checkout repository + uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # 4.2.1 + with: + persist-credentials: false # do not persist auth token in the local git config + - name: Download artifacts uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # 4.1.8 with: name: apache-log4cxx - - name: Setup GPG # uses: crazy-max/ghaction-import-gpg@01dd5d3ca463c7f10f7f4f7b4f177225ac661ee4 # 6.1.0 # with: From b1dfdf25289db7926db803eaaaf99607ee9e8829 Mon Sep 17 00:00:00 2001 From: "Piotr P. Karwasz" Date: Fri, 11 Oct 2024 19:56:06 +0200 Subject: [PATCH 18/18] Fix version --- .github/workflows/package_code.yml | 2 +- package.sh | 2 +- src/cmake/projectVersionDetails.cmake | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/package_code.yml b/.github/workflows/package_code.yml index 9d67aabb8..23d69c528 100644 --- a/.github/workflows/package_code.yml +++ b/.github/workflows/package_code.yml @@ -78,7 +78,7 @@ jobs: shell: bash run: | ./package.sh - VERSION=$(sed -n -e "s/^set(log4cxx_VER \"\(.*\)\")/\1/p" < src/cmake/projectVersionDetails.cmake) + VERSION=$(sed -n -e "s/^set(log4cxx_VER \(.*\)\.[[:digit:]]\+)/\1/p" < src/cmake/projectVersionDetails.cmake) current=CMakeFiles/dist/apache-log4cxx-$VERSION reference=CMakeFiles/reference/apache-log4cxx-$VERSION for format in tar.gz zip; do diff --git a/package.sh b/package.sh index c9d79fc03..bb4afa489 100755 --- a/package.sh +++ b/package.sh @@ -5,7 +5,7 @@ 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) +VERSION=$(sed -n -e "s/^set(log4cxx_VER \(.*\)\.$d\+)/\1/p" < src/cmake/projectVersionDetails.cmake) if ! echo "$VERSION" | grep -Eq "^$d+\.$d+\.$d+$"; then echo Invalid version number: "$VERSION" >& 2 exit 1 diff --git a/src/cmake/projectVersionDetails.cmake b/src/cmake/projectVersionDetails.cmake index 2a8c078df..96e0de095 100644 --- a/src/cmake/projectVersionDetails.cmake +++ b/src/cmake/projectVersionDetails.cmake @@ -19,7 +19,7 @@ # The variable name must not clash with the log4cxx_VERSION* variables automatically # defined by the project() command. -set(log4cxx_VER "1.3.0") +set(log4cxx_VER 1.3.0.0) # Timestamp used for the source archive to guarantee reproducible builds in ISO 8601 format. #