mirror of https://github.com/Icinga/icinga2.git
Merge pull request #7944 from Icinga/bugfix/chocolatey
Chocolatey: Prepare new build process
This commit is contained in:
commit
a96403331f
|
@ -119,7 +119,9 @@ endif()
|
|||
# NuGet on Windows requires a semantic versioning, example: 2.10.4.123 (only 4 element, only numeric)
|
||||
string(REGEX REPLACE "-([0-9]+).*$" ".\\1" ICINGA2_VERSION_SAFE "${ICINGA2_VERSION}")
|
||||
string(REGEX REPLACE "-[^\\.]*(.*)$" "\\1" ICINGA2_VERSION_SAFE "${ICINGA2_VERSION_SAFE}")
|
||||
message(STATUS "ICINGA2_VERSION_SAFE=${ICINGA2_VERSION_SAFE}")
|
||||
string(REGEX REPLACE "^([0-9]+\\.[0-9]+\\.[0-9]+)[\\.]?[0-9]*" "\\1" CHOCO_VERSION_SHORT "${ICINGA2_VERSION_SAFE}")
|
||||
|
||||
message(STATUS "ICINGA2_VERSION_SAFE=${ICINGA2_VERSION_SAFE} CHOCO_VERSION_SHORT=${CHOCO_VERSION_SHORT}")
|
||||
|
||||
if(WIN32)
|
||||
set(Boost_USE_STATIC_LIBS ON)
|
||||
|
@ -518,4 +520,4 @@ if(WIN32)
|
|||
)
|
||||
endif()
|
||||
|
||||
include(CPack)
|
||||
include(CPack)
|
|
@ -1,14 +1,6 @@
|
|||
# Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+
|
||||
|
||||
if(WIN32)
|
||||
find_program(CHOCO_BINARY choco)
|
||||
|
||||
configure_file(icinga2.nuspec.cmake icinga2.nuspec)
|
||||
configure_file(chocolateyInstall.ps1.cmake chocolateyInstall.ps1)
|
||||
|
||||
add_custom_target(choco-pkg ALL
|
||||
COMMAND choco pack
|
||||
COMMAND ${CMAKE_COMMAND} -E rename ${CMAKE_CURRENT_BINARY_DIR}/icinga2.${ICINGA2_VERSION_SAFE}.nupkg ${CMAKE_CURRENT_BINARY_DIR}/icinga2.nupkg
|
||||
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/icinga2.nuspec ${CMAKE_CURRENT_BINARY_DIR}/chocolateyInstall.ps1 chocolateyUninstall.ps1
|
||||
)
|
||||
configure_file(chocolateyInstall.ps1.template.cmake chocolateyInstall.ps1.template)
|
||||
endif()
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
$packageName = 'icinga2'
|
||||
$installerType = 'msi'
|
||||
$url32 = 'https://packages.icinga.com/windows/Icinga2-v${ICINGA2_VERSION_SAFE}-x86.msi'
|
||||
$url64 = 'https://packages.icinga.com/windows/Icinga2-v${ICINGA2_VERSION_SAFE}-x86_64.msi'
|
||||
$silentArgs = '/qn /norestart'
|
||||
$validExitCodes = @(0)
|
||||
|
||||
Install-ChocolateyPackage "$packageName" "$installerType" "$silentArgs" "$url32" "$url64" -validExitCodes $validExitCodes
|
|
@ -0,0 +1,20 @@
|
|||
$packageName= 'icinga2'
|
||||
$toolsDir = "$(Split-Path -Parent $MyInvocation.MyCommand.Definition)"
|
||||
$url = 'https://packages.icinga.com/windows/Icinga2-v${CHOCO_VERSION_SHORT}-x86.msi'
|
||||
$url64 = 'https://packages.icinga.com/windows/Icinga2-v${CHOCO_VERSION_SHORT}-x86_64.msi'
|
||||
|
||||
$packageArgs = @{
|
||||
packageName = $packageName
|
||||
fileType = 'msi'
|
||||
url = $url
|
||||
url64bit = $url64
|
||||
silentArgs = "/qn /norestart"
|
||||
validExitCodes= @(0)
|
||||
softwareName = 'Icinga 2*'
|
||||
checksum = '%CHOCO_32BIT_CHECKSUM%'
|
||||
checksumType = 'sha256'
|
||||
checksum64 = '%CHOCO_64BIT_CHECKSUM%'
|
||||
checksumType64= 'sha256'
|
||||
}
|
||||
|
||||
Install-ChocolateyPackage @packageArgs
|
|
@ -10,17 +10,20 @@
|
|||
<authors>Icinga GmbH</authors>
|
||||
<owners>Icinga GmbH</owners>
|
||||
<summary>icinga2 - Monitoring Agent for Windows</summary>
|
||||
<description>Icinga 2 is an open source monitoring platform which notifies users about host and service outages.</description>
|
||||
<description>Icinga is an open source monitoring platform which notifies users about host and service outages.</description>
|
||||
<projectUrl>https://icinga.com/</projectUrl>
|
||||
<tags>icinga2 agent monitoring admin</tags>
|
||||
<licenseUrl>https://icinga.com/resources/faq/</licenseUrl>
|
||||
<tags>icinga2 icinga agent monitoring admin</tags>
|
||||
<licenseUrl>https://github.com/Icinga/icinga2/blob/master/COPYING</licenseUrl>
|
||||
<releaseNotes>https://github.com/Icinga/icinga2/blob/master/ChangeLog</releaseNotes>
|
||||
<docsUrl>https://docs.icinga.com/icinga2/</docsUrl>
|
||||
<docsUrl>https://icinga.com/docs/icinga2/latest/</docsUrl>
|
||||
<bugTrackerUrl>https://github.com/Icinga/icinga2/issues</bugTrackerUrl>
|
||||
<packageSourceUrl>https://github.com/Icinga/icinga2</packageSourceUrl>
|
||||
<projectSourceUrl>https://github.com/Icinga/icinga2</projectSourceUrl>
|
||||
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
||||
<iconUrl>https://icinga.com/wp-content/uploads/2015/05/icinga_icon_128x128.png</iconUrl>
|
||||
<iconUrl>https://raw.githubusercontent.com/Icinga/icinga2/master/icinga-app/icinga.ico</iconUrl>
|
||||
<dependencies>
|
||||
<dependency id='netfx-4.6.2' />
|
||||
</dependencies>
|
||||
</metadata>
|
||||
<files>
|
||||
<file src="${CMAKE_CURRENT_BINARY_DIR}/chocolateyInstall.ps1" target="tools" />
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
Set-PsDebug -Trace 1
|
||||
|
||||
if(-not (Test-Path "$($env:ProgramData)\chocolatey\choco.exe")) {
|
||||
throw "Could not find Choco executable. Abort."
|
||||
}
|
||||
|
||||
if (-not (Test-Path env:ICINGA2_BUILDPATH)) {
|
||||
$env:ICINGA2_BUILDPATH = '.\build'
|
||||
}
|
||||
|
||||
if(-not (Test-Path "$($env:ICINGA2_BUILDPATH)\choco\chocolateyInstall.ps1.template")) {
|
||||
throw "Could not find Chocolatey install script template. Abort."
|
||||
}
|
||||
|
||||
$chocoInstallScriptTemplatePath = "$($env:ICINGA2_BUILDPATH)\choco\chocolateyInstall.ps1.template"
|
||||
$chocoInstallScript = Get-Content $chocoInstallScriptTemplatePath
|
||||
|
||||
if(-not (Test-Path "$($env:ICINGA2_BUILDPATH)\*-x86.msi")) {
|
||||
throw "Could not find Icinga 2 32 bit MSI package. Abort."
|
||||
}
|
||||
|
||||
$hashMSIpackage32 = Get-FileHash "$($env:ICINGA2_BUILDPATH)\*-x86.msi"
|
||||
Write-Output "File Hash for 32 bit MSI package: $($hashMSIpackage32.Hash)."
|
||||
|
||||
if(-not (Test-Path "$($env:ICINGA2_BUILDPATH)\*-x86_64.msi")) {
|
||||
throw "Could not find Icinga 2 64 bit MSI package. Abort."
|
||||
}
|
||||
|
||||
$hashMSIpackage64 = Get-FileHash "$($env:ICINGA2_BUILDPATH)\*-x86_64.msi"
|
||||
Write-Output "File Hash for 32 bit MSI package: $($hashMSIpackage64.Hash)"
|
||||
|
||||
$chocoInstallScript = $chocoInstallScript.Replace("%CHOCO_32BIT_CHECKSUM%", "$($hashMSIpackage32.Hash)")
|
||||
$chocoInstallScript = $chocoInstallScript.Replace("%CHOCO_64BIT_CHECKSUM%", "$($hashMSIpackage64.Hash)")
|
||||
Write-Output $chocoInstallScript
|
||||
|
||||
Set-Content -Path "$($env:ICINGA2_BUILDPATH)\choco\chocolateyInstall.ps1" -Value $chocoInstallScript
|
||||
|
||||
cd "$($env:ICINGA2_BUILDPATH)\choco"
|
||||
& "$($env:ProgramData)\chocolatey\choco.exe" "pack"
|
||||
cd "..\.."
|
||||
|
||||
Move-Item -Path "$($env:ICINGA2_BUILDPATH)\choco\*.nupkg" -Destination "$($env:ICINGA2_BUILDPATH)"
|
Loading…
Reference in New Issue