From 13c3bf6d585b5d0b6b38b9c665704c1975c47ec4 Mon Sep 17 00:00:00 2001 From: Hiroshi Inoue Date: Wed, 1 Feb 2017 12:16:46 +0900 Subject: [PATCH] Use the same version number in buildBootstrapper.ps1 as buildInstaller.ps1 uses. --- installer/buildInstallers.ps1 | 14 +------------- installer/psqlodbc-setup/Make.bat | 6 +++--- installer/psqlodbc-setup/buildBootstrapper.ps1 | 10 ++++++++-- winbuild/Psqlodbc-config.psm1 | 14 +++++++++++++- 4 files changed, 25 insertions(+), 19 deletions(-) diff --git a/installer/buildInstallers.ps1 b/installer/buildInstallers.ps1 index 318efe6..6197f53 100644 --- a/installer/buildInstallers.ps1 +++ b/installer/buildInstallers.ps1 @@ -96,18 +96,6 @@ function findRuntime([int]$runtime_version, [String]$pgmvc) return "", $rt_dllname } -function getVersion($connInfo) -{ - $version_no = $connInfo.Configuration.version - if ("$version_no" -eq "") { - pushd "$scriptPath" - $splitItem = Get-Content "..\version.h" | Where-Object {($_.IndexOf("#define") -ge 0) -and ($_.IndexOf("POSTGRESDRIVERVERSION") -ge 0) -and ($_.IndexOF("`"") -ge 0)} | ForEach-Object {$_.split("`"")} - $version_no = $splitItem[1] - popd - } - return $version_no -} - function buildInstaller($CPUTYPE) { $LIBPQBINDIR=getPGDir $configInfo $CPUTYPE "bin" @@ -273,7 +261,7 @@ try { $dumpbinexe = Find-Dumpbin $wRedist=$false - $VERSION = getVersion $configInfo + $VERSION = GetPackageVersion $configInfo "$scriptPath/.." if ($cpu -eq "both") { buildInstaller "x86" buildInstaller "x64" diff --git a/installer/psqlodbc-setup/Make.bat b/installer/psqlodbc-setup/Make.bat index e79bf0a..c8cd9a1 100755 --- a/installer/psqlodbc-setup/Make.bat +++ b/installer/psqlodbc-setup/Make.bat @@ -3,9 +3,9 @@ :: @echo off if "%1" == "/?" ( - powershell Get-Help %~dp0\buildBootstrapper.ps1 -detailed + powershell Get-Help '%~dp0\buildBootstrapper.ps1' -detailed ) else if "%1" == "-?" ( - powershell Get-Help %~dp0\buildBootstrapper.ps1 %2 %3 %4 %5 %6 %7 %8 %9 + powershell Get-Help '%~dp0\buildBootstrapper.ps1' %2 %3 %4 %5 %6 %7 %8 %9 ) else ( - powershell %~dp0\buildBootstrapper.ps1 %* + powershell "& '%~dp0\buildBootstrapper.ps1' %*" ) diff --git a/installer/psqlodbc-setup/buildBootstrapper.ps1 b/installer/psqlodbc-setup/buildBootstrapper.ps1 index a122049..710d25d 100644 --- a/installer/psqlodbc-setup/buildBootstrapper.ps1 +++ b/installer/psqlodbc-setup/buildBootstrapper.ps1 @@ -36,8 +36,14 @@ write-host "Building bootstrapper program`n" $scriptPath = (Split-Path $MyInvocation.MyCommand.Path) if ("$version" -eq "") { - $configInfo = & "$scriptPath\..\..\winbuild\configuration.ps1" "$BuildConfigPath" - $version = $configInfo.Configuration.version + # $configInfo = & "$scriptPath\..\..\winbuild\configuration.ps1" "$BuildConfigPath" + $scriptPath = (Split-Path $MyInvocation.MyCommand.Path) + $modulePath="${scriptPath}\..\..\winbuild" + Import-Module ${modulePath}\Psqlodbc-config.psm1 + $defaultConfigDir=$modulePath + $configInfo = LoadConfiguration $BuildConfigPath $defaultConfigDir + $version = GetPackageVersion $configInfo "$scriptPath/../.." + Remove-Module Psqlodbc-config } if ("$env:WIX" -eq "") { diff --git a/winbuild/Psqlodbc-config.psm1 b/winbuild/Psqlodbc-config.psm1 index b1cea3e..9abe7e0 100755 --- a/winbuild/Psqlodbc-config.psm1 +++ b/winbuild/Psqlodbc-config.psm1 @@ -163,4 +163,16 @@ function getPGDir($configInfo, $Platform, $kind) return $result } -Export-ModuleMember -function LoadConfiguration, SaveConfiguration, unifyNodes, getPGDir -variable LIBPQ_VERSION +function GetPackageVersion($configInfo, $srcpath) +{ + $version_no = $configInfo.Configuration.version + if ("$version_no" -eq "") { + pushd "$srcpath" + $splitItem = Get-Content ".\version.h" | Where-Object {($_.IndexOf("#define") -ge 0) -and ($_.IndexOf("POSTGRESDRIVERVERSION") -ge 0) -and ($_.IndexOF("`"") -ge 0)} | ForEach-Object {$_.split("`"")} + $version_no = $splitItem[1] + popd + } + return $version_no +} + +Export-ModuleMember -function LoadConfiguration, SaveConfiguration, unifyNodes, getPGDir, getPackageVersion -variable LIBPQ_VERSION -- 2.39.5