This is an automated email from the ASF dual-hosted git repository. swebb2066 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/logging-log4cxx.git
The following commit(s) were added to refs/heads/master by this push: new 7bf9fc1a Support for Windows release validation (#447) 7bf9fc1a is described below commit 7bf9fc1a3ba324a43343780dc94a40efe8f0280c Author: Stephen Webb <stephen.w...@ieee.org> AuthorDate: Tue Jan 14 13:06:53 2025 +1100 Support for Windows release validation (#447) --- admin/release-review-instructions.md | 38 +++++++++++---- admin/validate-release.ps1 | 91 ++++++++++++++++++++++++++++++++++++ 2 files changed, 121 insertions(+), 8 deletions(-) diff --git a/admin/release-review-instructions.md b/admin/release-review-instructions.md index 85e3a1de..b1e7c978 100644 --- a/admin/release-review-instructions.md +++ b/admin/release-review-instructions.md @@ -8,19 +8,30 @@ The steps below use version 1.4.0 as an example. Prerequisites ---------- -* [GNU Privacy Guard](https://www.gnupg.org/) is installed on your system * A C++ compiler is available on your system * cmake, APR and APR-Util are installed on your system +* [GNU Privacy Guard](https://www.gnupg.org/) is installed on your system * You have imported the [Apache Logging KEYS file](https://dist.apache.org/repos/dist/release/logging/KEYS) +Additional Prerequisites (Windows only) +---------- + +* The `PATH` environment variable includes directories containing `cmake.exe` and `gpg.exe` +* One of these environment variables is set (using / directory separators): + - `CMAKE_TOOLCHAIN_FILE` - The full path to the `vcpkg.cmake` file (where APR-Util is installed) + - `CMAKE_INSTALL_PREFIX` - The full path to the directory where EXPAT, APR and APR-Util libraries are installed +* If the programs `zip.exe`, `gzip.exe` and `sed.exe` are not in `C:/msys64/usr/bin`, the environment has a variable `LOG4CXX_TEST_PROGRAM_PATH` set to the full path containing those programs + Steps ----- 1. Download, verify check-sums, verify signatures, build and test - - Save to your system the verification script https://github.com/apache/logging-log4cxx/blob/master/admin/validate-release.sh + - Save to your system a verification script from https://github.com/apache/logging-log4cxx/blob/master/admin + - Linux, MacOS: `validate-release.sh` + - Windows: `validate-release.ps1` - Run the script - For success, the final output line needs to include: - - `100% tests passed, 0 tests failed out of 62` + - `100% tests passed, 0 tests failed out of 63` 1. Download the packaged release files from Github - Open https://github.com/apache/logging-log4cxx/commits/v1.4.0-RC1 in your web browser - Click the green tick mark on the top commit @@ -32,8 +43,19 @@ Steps - Click the link next to `Artifact download URL:` - The browser will download the file `release_files.zip` onto your system 1. Confirm the artifacts were sourced from Github using these commands - - `mkdir /tmp/log4cxx-github` - - `cd /tmp/log4cxx-github` - - `unzip "$HOME/Downloads/release_files.zip"` - - `diff /tmp/log4cxx-{1.4.0,github}/apache-log4cxx-1.4.0.tar.gz.sha512` - - `diff /tmp/log4cxx-{1.4.0,github}/apache-log4cxx-1.4.0.zip.sha512` + - Linux, MacOS (bash): + - `cd /tmp/log4cxx-1.4.0` + - `unzip $HOME/Downloads/release_files.zip -d github` + - `ARCHIVE=apache-log4cxx-1.4.0` + - `for TYPE in tar.gz zip; do` + - `diff {,github/}$ARCHIVE.$TYPE.sha512 && echo "$ARCHIVE.$TYPE.sha512: OK"` + - `done` + - Windows (powershell): + - `Set-Location -Path "${ENV:TEMP}\log4cxx-1.4.0"` + - `Expand-Archive -Path "${ENV:HOMEPATH}\Downloads\release_files.zip" -DestinationPath "github"` + - `$ARCHIVE="apache-log4cxx-1.4.0"` + - `foreach ($TYPE in @("tar.gz", "zip")) {` + - `` if (@(Get-Content -Path "$ARCHIVE.$TYPE.sha512")[0]` `` + - `-eq @(Get-Content -Path "github\$ARCHIVE.$TYPE.sha512")[0]) {` + - `Write-Output "$ARCHIVE.$TYPE.sha512: OK" } }` + diff --git a/admin/validate-release.ps1 b/admin/validate-release.ps1 new file mode 100644 index 00000000..3b3822aa --- /dev/null +++ b/admin/validate-release.ps1 @@ -0,0 +1,91 @@ + +# Allow the version to be provided as a parameter +param ( [string]$VERSION ) +if (-not $VERSION) { $VERSION = "1.4.0" } + +$STAGE="dev" +#$STAGE="release" +if ( ${ENV:STAGE} ) { $STAGE = ${ENV:STAGE} } + +$BASE_DL="https://dist.apache.org/repos/dist/$STAGE/logging/log4cxx" +if ( ${ENV:BASE_DL} ) { $BASE_DL = ${ENV:BASE_DL} } + +$ARCHIVE="apache-log4cxx-$VERSION" +if ( ${ENV:ARCHIVE} ) { $ARCHIVE = ${ENV:ARCHIVE} } + +$TEST_DIRECTORY="${ENV:TEMP}/log4cxx-$VERSION" +if ( ${ENV:TEST_DIRECTORY} ) { $TEST_DIRECTORY = "${ENV:TEST_DIRECTORY}" } + +try +{ + gpg --version | Out-Null +} +catch +{ + Write-Error "The gpg program directory must be included the PATH environment variable" -ErrorAction Stop +} + +if (-not (Test-Path -Path "$TEST_DIRECTORY" -PathType Container)) +{ + New-Item -ItemType Directory -Path "$TEST_DIRECTORY" -ErrorAction Stop +} +Set-Location -Path "$TEST_DIRECTORY" + +$FULL_DL="$BASE_DL/$VERSION/$ARCHIVE" +$ARCHIVE_TYPES = @("tar.gz", "zip") +foreach ($ARCHIVE_TYPE in $ARCHIVE_TYPES) +{ + if (Test-Path "$ARCHIVE.$ARCHIVE_TYPE") { Remove-Item "$ARCHIVE.$ARCHIVE_TYPE" } + Invoke-WebRequest -Uri "$FULL_DL.$ARCHIVE_TYPE" -OutFile "$ARCHIVE.$ARCHIVE_TYPE" -ErrorAction Stop + $EXTS = @("asc", "sha512", "sha256") + foreach ($EXT in $EXTS) + { + if (Test-Path "$ARCHIVE.$ARCHIVE_TYPE.$EXT") { Remove-Item "$ARCHIVE.$ARCHIVE_TYPE.$EXT" } + Invoke-WebRequest -Uri "$FULL_DL.$ARCHIVE_TYPE.$EXT" -OutFile "$ARCHIVE.$ARCHIVE_TYPE.$EXT" -ErrorAction Stop + } + $SUMS = @("sha512", "sha256") + foreach ($SUM in $SUMS) + { + Write-Output "Validating $ARCHIVE.$ARCHIVE_TYPE $SUM checksum..." + $Line = @(Get-Content -Path "$ARCHIVE.$ARCHIVE_TYPE.$SUM")[0] + $Fields = $Line -split '\s+' + $Hash = $Fields[0].Trim().ToUpper() + $ComputedHash = (Get-FileHash -Algorithm $SUM -Path "$ARCHIVE.$ARCHIVE_TYPE").Hash.ToUpper() + if ($Hash -ne $ComputedHash) + { + Write-Error "Read from $ARCHIVE.$ARCHIVE_TYPE.${SUM}: $Hash" -ErrorAction Continue + Write-Error "Computed: $ComputedHash" -ErrorAction Continue + Write-Error "${File}: Not Passed" -ErrorAction Stop + } + } + Write-Output "Validating $ARCHIVE.$ARCHIVE_TYPE signature..." + gpg --verify "$ARCHIVE.$ARCHIVE_TYPE.asc" + if (!$? ) { exit 1 } +} + +if (Test-Path "$ARCHIVE") { Remove-Item -Recurse "$ARCHIVE" } +if (Test-Path test-build) { Remove-Item -Recurse test-build } +Write-Output "Extracting files..." +Expand-Archive -Path "$ARCHIVE.zip" -DestinationPath . -ErrorAction Stop + +# Check tools are on the PATH +try +{ + cmake --version | Out-Null +} +catch +{ + Write-Error "The cmake program directory must be included the PATH environment variable" -ErrorAction Stop +} + +${LOG4CXX_TEST_PROGRAM_PATH}="C:/msys64/usr/bin" +if ( ${ENV:LOG4CXX_TEST_PROGRAM_PATH} ) { $LOG4CXX_TEST_PROGRAM_PATH = ${ENV:LOG4CXX_TEST_PROGRAM_PATH} } +cmake -S $ARCHIVE -B test-build "-DLOG4CXX_TEST_PROGRAM_PATH=$LOG4CXX_TEST_PROGRAM_PATH" +if ( ! $? ) { exit 1 } + +cmake --build test-build --config Release +if ( ! $? ) { exit 1 } + +Set-Location -Path test-build +ctest -C Release --output-on-failure +