You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by sw...@apache.org on 2025/01/12 07:10:45 UTC

(logging-log4cxx) 01/01: Support for Windows release validation

This is an automated email from the ASF dual-hosted git repository.

swebb2066 pushed a commit to branch windows_validate_release
in repository https://gitbox.apache.org/repos/asf/logging-log4cxx.git

commit e241c7169f35f26495e9ddf2f73d87c5bf9c14e1
Author: Stephen Webb <sw...@gmail.com>
AuthorDate: Sun Jan 12 18:10:26 2025 +1100

    Support for Windows release validation
---
 admin/release-review-instructions.md | 15 +++++-
 admin/validate-release.ps1           | 91 ++++++++++++++++++++++++++++++++++++
 2 files changed, 104 insertions(+), 2 deletions(-)

diff --git a/admin/release-review-instructions.md b/admin/release-review-instructions.md
index 85e3a1de..cc08eebf 100644
--- a/admin/release-review-instructions.md
+++ b/admin/release-review-instructions.md
@@ -8,16 +8,27 @@ 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`
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
+