amoeba commented on code in PR #4624:
URL: https://github.com/apache/arrow-adbc/pull/4624#discussion_r3706608912


##########
dev/release/verify-release-candidate.ps1:
##########
@@ -82,81 +124,188 @@ if ($env:ARROW_TMPDIR -eq $null) {
     $ArrowTempDir = $env:ARROW_TMPDIR
 }
 New-Item -ItemType Directory -Force -Path $ArrowTempDir | Out-Null
-
 echo "Using $($ArrowTempDir)"
 
-Show-Header "Ensure Source Directory"
-
-if ($SourceKind -eq "local") {
-    $ArrowSourceDir = Join-Path $PSScriptRoot "..\.." | Resolve-Path | % { 
$_.Path }
+Show-Header "Clone apache/arrow"
+$ArrowSourceDir = Join-Path $ArrowTempDir "arrow"
+$StampFile = Join-Path $ArrowSourceDir "stamp.txt"
+if (-not (Test-Path -Path $StampFile)) {
+    git clone --depth 1 https://github.com/apache/arrow $ArrowSourceDir
+    if (-not $?) { throw "Failed to clone apache/arrow" }
+    New-Item -ItemType File -Force -Path $StampFile | Out-Null
 } else {
-    $ArrowSourceDir = Join-Path $ArrowTempDir $DistName
-    New-Item -ItemType Directory -Path $ArrowSourceDir -Force
-    # Convert to an absolute now that it should exist
-    $ArrowSourceDir = $ArrowSourceDir | Resolve-Path | % { $_.Path }
+    echo "Using cached $($ArrowSourceDir)"
+}
+
+$BinaryDir = Join-Path $ArrowTempDir "binaries"
+if ($TestBinaries) {
+    Show-Header "Download binary artifacts"
+
+    $StampFile = Join-Path $BinaryDir "stamp.txt"
+    if (-not (Test-Path -Path $StampFile)) {
+        python "$ArrowSourceDir/dev/release/download_rc_binaries.py" `
+               $Version $RcNumber `
+               --dest="$BinaryDir" `
+               --num_parallel 4 `
+               --package_type=github `
+               --repository="apache/arrow-adbc" `
+               --tag="apache-arrow-adbc-$($Version)-rc$($RcNumber)"
+        if (-not $?) { throw "Failed to download binary artifacts" }
+        New-Item -ItemType File -Force -Path $StampFile | Out-Null
+    } else {
+        echo "Using cached $($BinaryDir)"
+    }
+}
 
-    Download-Dist-File "$($DistName).tar.gz"
-    Download-Dist-File "$($DistName).tar.gz.sha512"
 
-    $DistPath = Join-Path $ArrowTempDir "$($DistName).tar.gz"
-    $Sha512Path = Join-Path $ArrowTempDir "$($DistName).tar.gz.sha512"
+# ============================================================
+# Test release
+# ============================================================
+if ($TestSource) {
+    Show-Header "Ensure Source Directory"
 
-    $ExpectedSha512 = (Get-Content $Sha512Path).Split(" ")[0]
-    if (-not ((Get-FileHash -Algorithm SHA512 $DistPath).Hash -eq 
$ExpectedSha512)) {
-        echo "SHA512 hash mismatch"
-        exit 1
+    if ($SourceKind -eq "local") {
+        $ArrowSourceDir = Join-Path $PSScriptRoot "..\.." | Resolve-Path | % { 
$_.Path }
+    } else {
+        $ArrowSourceDir = Join-Path $ArrowTempDir $DistName
+        New-Item -ItemType Directory -Path $ArrowSourceDir -Force
+        # Convert to an absolute now that it should exist
+        $ArrowSourceDir = $ArrowSourceDir | Resolve-Path | % { $_.Path }
+
+        Download-Dist-File "$($DistName).tar.gz"
+        Download-Dist-File "$($DistName).tar.gz.sha512"
+
+        $DistPath = Join-Path $ArrowTempDir "$($DistName).tar.gz"
+        $Sha512Path = Join-Path $ArrowTempDir "$($DistName).tar.gz.sha512"
+
+        $ExpectedSha512 = (Get-Content $Sha512Path).Split(" ")[0]
+        if (-not ((Get-FileHash -Algorithm SHA512 $DistPath).Hash -eq 
$ExpectedSha512)) {
+            echo "SHA512 hash mismatch"
+            exit 1
+        }
+
+        tar -C $ArrowSourceDir --strip-components 1 -xf $DistPath
     }
 
-    tar -C $ArrowSourceDir --strip-components 1 -xf $DistPath
-}
+    echo "Using $($ArrowSourceDir)"
 
-echo "Using $($ArrowSourceDir)"
+    Show-Header "Create Conda Environment"
 
-Show-Header "Create Conda Environment"
+    mamba create -c conda-forge --yes --prefix $(Join-Path $ArrowTempDir 
conda-env) `
+      --file $(Join-Path $ArrowSourceDir ci\conda_env_cpp.txt) `
+      --file $(Join-Path $ArrowSourceDir ci\conda_env_python.txt) `
+      go `
+      m2w64-gcc
 
-mamba create -c conda-forge --yes --prefix $(Join-Path $ArrowTempDir 
conda-env) `
-  --file $(Join-Path $ArrowSourceDir ci\conda_env_cpp.txt) `
-  --file $(Join-Path $ArrowSourceDir ci\conda_env_python.txt) `
-  go `
-  m2w64-gcc
+    Invoke-Expression $(conda shell.powershell hook | Out-String)
+    conda activate $(Join-Path $ArrowTempDir conda-env)
+    # XXX: force bundled gtest as the conda-forge version appears to require 
you
+    # to exactly match the MSVC version it was compiled with.  Uninstalling 
also
+    # removes a bunch of other things, so force-remove instead
+    # (https://github.com/conda-forge/libprotobuf-feedstock/issues/186)
+    # Use conda, mamba appears to ignore --force
+    conda remove -y --force gtest
 
-Invoke-Expression $(conda shell.powershell hook | Out-String)
-conda activate $(Join-Path $ArrowTempDir conda-env)
-# XXX: force bundled gtest as the conda-forge version appears to require you
-# to exactly match the MSVC version it was compiled with.  Uninstalling also
-# removes a bunch of other things, so force-remove instead
-# (https://github.com/conda-forge/libprotobuf-feedstock/issues/186)
-# Use conda, mamba appears to ignore --force
-conda remove -y --force gtest
+    # Activating doesn't appear to set GOROOT
+    $env:GOROOT = $(Join-Path $ArrowTempDir conda-env go)

Review Comment:
   We should make any use of Join-Path compatible with Powershell 5 which is 
default. Only newer Join-Path supports more than two args to Join-Path.
   
   ```suggestion
       $env:GOROOT = $(Join-Path $ArrowTempDir $(Join-Path conda-env go))
   ```



##########
dev/release/verify-release-candidate.ps1:
##########
@@ -82,81 +124,188 @@ if ($env:ARROW_TMPDIR -eq $null) {
     $ArrowTempDir = $env:ARROW_TMPDIR
 }
 New-Item -ItemType Directory -Force -Path $ArrowTempDir | Out-Null
-
 echo "Using $($ArrowTempDir)"
 
-Show-Header "Ensure Source Directory"
-
-if ($SourceKind -eq "local") {
-    $ArrowSourceDir = Join-Path $PSScriptRoot "..\.." | Resolve-Path | % { 
$_.Path }
+Show-Header "Clone apache/arrow"
+$ArrowSourceDir = Join-Path $ArrowTempDir "arrow"
+$StampFile = Join-Path $ArrowSourceDir "stamp.txt"
+if (-not (Test-Path -Path $StampFile)) {
+    git clone --depth 1 https://github.com/apache/arrow $ArrowSourceDir
+    if (-not $?) { throw "Failed to clone apache/arrow" }
+    New-Item -ItemType File -Force -Path $StampFile | Out-Null
 } else {
-    $ArrowSourceDir = Join-Path $ArrowTempDir $DistName
-    New-Item -ItemType Directory -Path $ArrowSourceDir -Force
-    # Convert to an absolute now that it should exist
-    $ArrowSourceDir = $ArrowSourceDir | Resolve-Path | % { $_.Path }
+    echo "Using cached $($ArrowSourceDir)"
+}
+
+$BinaryDir = Join-Path $ArrowTempDir "binaries"
+if ($TestBinaries) {
+    Show-Header "Download binary artifacts"
+
+    $StampFile = Join-Path $BinaryDir "stamp.txt"
+    if (-not (Test-Path -Path $StampFile)) {
+        python "$ArrowSourceDir/dev/release/download_rc_binaries.py" `
+               $Version $RcNumber `
+               --dest="$BinaryDir" `
+               --num_parallel 4 `
+               --package_type=github `
+               --repository="apache/arrow-adbc" `
+               --tag="apache-arrow-adbc-$($Version)-rc$($RcNumber)"
+        if (-not $?) { throw "Failed to download binary artifacts" }
+        New-Item -ItemType File -Force -Path $StampFile | Out-Null
+    } else {
+        echo "Using cached $($BinaryDir)"
+    }
+}
 
-    Download-Dist-File "$($DistName).tar.gz"
-    Download-Dist-File "$($DistName).tar.gz.sha512"
 
-    $DistPath = Join-Path $ArrowTempDir "$($DistName).tar.gz"
-    $Sha512Path = Join-Path $ArrowTempDir "$($DistName).tar.gz.sha512"
+# ============================================================
+# Test release
+# ============================================================
+if ($TestSource) {
+    Show-Header "Ensure Source Directory"
 
-    $ExpectedSha512 = (Get-Content $Sha512Path).Split(" ")[0]
-    if (-not ((Get-FileHash -Algorithm SHA512 $DistPath).Hash -eq 
$ExpectedSha512)) {
-        echo "SHA512 hash mismatch"
-        exit 1
+    if ($SourceKind -eq "local") {
+        $ArrowSourceDir = Join-Path $PSScriptRoot "..\.." | Resolve-Path | % { 
$_.Path }
+    } else {
+        $ArrowSourceDir = Join-Path $ArrowTempDir $DistName
+        New-Item -ItemType Directory -Path $ArrowSourceDir -Force
+        # Convert to an absolute now that it should exist
+        $ArrowSourceDir = $ArrowSourceDir | Resolve-Path | % { $_.Path }
+
+        Download-Dist-File "$($DistName).tar.gz"
+        Download-Dist-File "$($DistName).tar.gz.sha512"
+
+        $DistPath = Join-Path $ArrowTempDir "$($DistName).tar.gz"
+        $Sha512Path = Join-Path $ArrowTempDir "$($DistName).tar.gz.sha512"
+
+        $ExpectedSha512 = (Get-Content $Sha512Path).Split(" ")[0]
+        if (-not ((Get-FileHash -Algorithm SHA512 $DistPath).Hash -eq 
$ExpectedSha512)) {
+            echo "SHA512 hash mismatch"
+            exit 1
+        }
+
+        tar -C $ArrowSourceDir --strip-components 1 -xf $DistPath
     }
 
-    tar -C $ArrowSourceDir --strip-components 1 -xf $DistPath
-}
+    echo "Using $($ArrowSourceDir)"
 
-echo "Using $($ArrowSourceDir)"
+    Show-Header "Create Conda Environment"
 
-Show-Header "Create Conda Environment"
+    mamba create -c conda-forge --yes --prefix $(Join-Path $ArrowTempDir 
conda-env) `
+      --file $(Join-Path $ArrowSourceDir ci\conda_env_cpp.txt) `
+      --file $(Join-Path $ArrowSourceDir ci\conda_env_python.txt) `
+      go `
+      m2w64-gcc
 
-mamba create -c conda-forge --yes --prefix $(Join-Path $ArrowTempDir 
conda-env) `
-  --file $(Join-Path $ArrowSourceDir ci\conda_env_cpp.txt) `
-  --file $(Join-Path $ArrowSourceDir ci\conda_env_python.txt) `
-  go `
-  m2w64-gcc
+    Invoke-Expression $(conda shell.powershell hook | Out-String)
+    conda activate $(Join-Path $ArrowTempDir conda-env)
+    # XXX: force bundled gtest as the conda-forge version appears to require 
you
+    # to exactly match the MSVC version it was compiled with.  Uninstalling 
also
+    # removes a bunch of other things, so force-remove instead
+    # (https://github.com/conda-forge/libprotobuf-feedstock/issues/186)
+    # Use conda, mamba appears to ignore --force
+    conda remove -y --force gtest
 
-Invoke-Expression $(conda shell.powershell hook | Out-String)
-conda activate $(Join-Path $ArrowTempDir conda-env)
-# XXX: force bundled gtest as the conda-forge version appears to require you
-# to exactly match the MSVC version it was compiled with.  Uninstalling also
-# removes a bunch of other things, so force-remove instead
-# (https://github.com/conda-forge/libprotobuf-feedstock/issues/186)
-# Use conda, mamba appears to ignore --force
-conda remove -y --force gtest
+    # Activating doesn't appear to set GOROOT
+    $env:GOROOT = $(Join-Path $ArrowTempDir conda-env go)
 
-# Activating doesn't appear to set GOROOT
-$env:GOROOT = $(Join-Path $ArrowTempDir conda-env go)
+    Show-Header "Verify C/C++ Sources"
 
-Show-Header "Verify C/C++ Sources"
+    $CppBuildDir = Join-Path $ArrowTempDir cpp-build
+    New-Item -ItemType Directory -Force -Path $CppBuildDir | Out-Null
 
-$CppBuildDir = Join-Path $ArrowTempDir cpp-build
-New-Item -ItemType Directory -Force -Path $CppBuildDir | Out-Null
+    $env:_ADBC_IS_CONDA = "1"
+    # XXX(apache/arrow-adbc#634): not working on Windows due to it picking
+    # up MSVC as the C compiler, which then blows up when /Werror gets
+    # passed in by some package
+    $env:BUILD_DRIVER_FLIGHTSQL = "0"
 
-$env:_ADBC_IS_CONDA = "1"
-# XXX(apache/arrow-adbc#634): not working on Windows due to it picking
-# up MSVC as the C compiler, which then blows up when /Werror gets
-# passed in by some package
-$env:BUILD_DRIVER_FLIGHTSQL = "0"
+    & $(Join-Path $ArrowSourceDir ci\scripts\cpp_build.ps1) $ArrowSourceDir 
$CppBuildDir
+    if (-not $?) { exit 1 }
 
-& $(Join-Path $ArrowSourceDir ci\scripts\cpp_build.ps1) $ArrowSourceDir 
$CppBuildDir
-if (-not $?) { exit 1 }
+    $env:BUILD_DRIVER_POSTGRESQL = "0"
+    & $(Join-Path $ArrowSourceDir ci\scripts\cpp_test.ps1) $CppBuildDir
+    if (-not $?) { exit 1 }
+    $env:BUILD_DRIVER_POSTGRESQL = "1"
 
-$env:BUILD_DRIVER_POSTGRESQL = "0"
-& $(Join-Path $ArrowSourceDir ci\scripts\cpp_test.ps1) $CppBuildDir
-if (-not $?) { exit 1 }
-$env:BUILD_DRIVER_POSTGRESQL = "1"
+    Show-Header "Verify Python Sources"
 
-Show-Header "Verify Python Sources"
+    & $(Join-Path $ArrowSourceDir ci\scripts\python_build.ps1) $ArrowSourceDir 
$CppBuildDir
+    if (-not $?) { exit 1 }
 
-& $(Join-Path $ArrowSourceDir ci\scripts\python_build.ps1) $ArrowSourceDir 
$CppBuildDir
-if (-not $?) { exit 1 }
+    & $(Join-Path $ArrowSourceDir ci\scripts\python_test.ps1) $ArrowSourceDir 
$CppBuildDir
+    if (-not $?) { exit 1 }
+}
 
-& $(Join-Path $ArrowSourceDir ci\scripts\python_test.ps1) $ArrowSourceDir 
$CppBuildDir
-if (-not $?) { exit 1 }
+if ($TestBinaries) {
+    Show-Header "Verify Binary Distribution"
+
+    if ($TestJars) {
+        Show-Header "Verify Java JARs"
+        if ($env:JAVA_HOME -eq $null) {
+            $env:JAVA_HOME = & java -XshowSettings:properties -version 2>&1 | 
Select-String "java.home" | ForEach-Object { $_.ToString().Split("=")[1].Trim() 
}

Review Comment:
   When I test this locally, I error at this step:
   
   ```
   ============================================================
   Verify Java JARs
   ============================================================
   java.exe : Property settings:
   At 
C:\Users\Bryce\src\apache\arrow-adbc\dev\release\verify-release-candidate.ps1:246
 char:30
   + ... nv:JAVA_HOME = & java -XshowSettings:properties -version 2>&1 | Selec 
...
   +                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       + CategoryInfo          : NotSpecified: (Property settings::String) [], 
RemoteException
       + FullyQualifiedErrorId : NativeCommandError
   ```
   
   Claude thinks this is because of setting,
   
   ```powershell
   $ErrorActionPreference = "Stop"
   ```
   
   earlier in the script. This was its suggestion which seems reasonable:
   
   ```suggestion
         $javaPath = (Get-Command java).Source
         $env:JAVA_HOME = Split-Path (Split-Path $javaPath -Parent) -Parent
   ```
   
   Tested locally and it works.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to