You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ro...@apache.org on 2025/02/27 08:39:24 UTC

(couchdb-glazier) branch improved-git-sha-detection created (now fb74934)

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

ronny pushed a change to branch improved-git-sha-detection
in repository https://gitbox.apache.org/repos/asf/couchdb-glazier.git


      at fb74934  Improve git sha detection

This branch includes the following new commits:

     new fb74934  Improve git sha detection

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(couchdb-glazier) 01/01: Improve git sha detection

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ronny pushed a commit to branch improved-git-sha-detection
in repository https://gitbox.apache.org/repos/asf/couchdb-glazier.git

commit fb7493467ff716a1f40dcc96e8b592fbfe77f1bc
Author: Ronny Berndt <ro...@apache.org>
AuthorDate: Thu Feb 27 09:37:23 2025 +0100

    Improve git sha detection
    
    If used with command param -IncludeGitSha, get the sha from
    the git directory (if available) or from the version.mk file
    from a dist zip.
---
 bin/build_installer.ps1 | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/bin/build_installer.ps1 b/bin/build_installer.ps1
index 9073495..b6d81ba 100644
--- a/bin/build_installer.ps1
+++ b/bin/build_installer.ps1
@@ -66,6 +66,7 @@ $Glazier = "${PSScriptRoot}\.."
 $VersionMK = Get-Content -Path "$CouchDB_Root\version.mk" | Out-String | ConvertFrom-StringData
 
 $CouchDBVersion = $VersionMK.vsn_major,$VersionMK.vsn_minor,$VersionMK.vsn_patch -join "."
+$CouchDBDistGitSha = $VersionMK.git_sha
 $RelNotesVersion = $CouchDBVersion -replace "^(\d+\.\d+)\..*", '$1'
 
 # clean up from previous runs
@@ -124,6 +125,10 @@ Move-Item -Path "${CouchDB}\etc\vm.args.dist" -Destination "${CouchDB}\etc\vm.ar
 Move-Item -Path "${Glazier}\installer\apache-couchdb-${CouchDBVersion}.msi" -Destination "." -Force
 
 if($IncludeGitSha) {
-   $GitSha = (git rev-parse --short HEAD)
-   Rename-Item -Path "apache-couchdb-${CouchDBVersion}.msi" -NewName "apache-couchdb-${CouchDBVersion}-${GitSha}.msi"
+   $GitSha = & git rev-parse --short HEAD 2>$null
+   if ($GitSha.Length -gt 0) { # Fetch git sha from git directory itself
+      Rename-Item -Path "apache-couchdb-${CouchDBVersion}.msi" -NewName "apache-couchdb-${CouchDBVersion}-${GitSha}.msi"
+   } elseif ($CouchDBDistGitSha -gt 0) { # Fetch git sha from version.mk within dist directory
+      Rename-Item -Path "apache-couchdb-${CouchDBVersion}.msi" -NewName "apache-couchdb-${CouchDBVersion}-${CouchDBDistGitSha}.msi"
+   }
 }