You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by va...@apache.org on 2026/10/06 21:35:49 UTC

(couchdb) 08/10: configure.ps1: extract clouseau.zip flat

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

nickva pushed a commit to branch 3.5.3-rc2-fixes
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 5169ab01164a5a5f6a6ddbc635aa16df0a1e66da
Author: Gabor Pali <ga...@ibm.com>
AuthorDate: Sat Oct 3 15:06:43 2026 +0200

    configure.ps1: extract clouseau.zip flat
    
    On Windows, unzipping the archive for Clouseau does not implement
    the `-j` flag so it will not drop directory names if there are
    some, like the Unix-like systems do.
    
    Starting from Clouseau 3.4.0, the `-dist.zip` contains a top-level
    directory to become consistent the `.tar.gz` format it now also
    provides -- not ignoring this can break the Windows port, that is
    why I may make sense to bring the two implementations in sync.
    
    (cherry picked from commit 3a7bacce48011b23a55965277d78257a52f70f6e)
---
 configure.ps1 | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/configure.ps1 b/configure.ps1
index 9a012923f..8fa053136 100644
--- a/configure.ps1
+++ b/configure.ps1
@@ -347,11 +347,23 @@ if ($WithClouseau) {
             exit 1
         }
 
-        Expand-Archive clouseau.zip -DestinationPath $ClouseauDir -Force
-        If ($LASTEXITCODE -ne 0) {
+        Add-Type -AssemblyName 'System.IO.Compression.FileSystem'
+
+        try {
+            $Archive = [System.IO.Compression.ZipFile]::OpenRead("clouseau.zip")
+            Foreach ($entry in $Archive.Entries.Where({ $_.Name.length -gt 0 })) {
+                [System.IO.Compression.ZipFileExtensions]::ExtractToFile($entry, "$ClouseauDir\$($entry.Name)")
+            }
+        }
+        catch {
             Write-Output "ERROR: Clouseau distribution package (clouseau.zip) could not be extracted."
             exit 1
         }
+        finally {
+            if ($null -ne $Archive) {
+                $Archive.Dispose()
+            }
+        }
 
         Remove-Item clouseau.zip