]> granicus.if.org Git - icinga2/commitdiff
Improve support for building the chocolatey package
authorGunnar Beutner <gunnar.beutner@netways.de>
Wed, 31 Aug 2016 11:41:13 +0000 (13:41 +0200)
committerGunnar Beutner <gunnar.beutner@netways.de>
Wed, 31 Aug 2016 12:55:20 +0000 (14:55 +0200)
fixes #12603

CMakeLists.txt
RELEASE.md
choco/CMakeLists.txt [new file with mode: 0644]
choco/chocolateyInstall.ps1.cmake [moved from tools/chocolateyInstall.ps1 with 57% similarity]
choco/chocolateyUninstall.ps1 [moved from tools/chocolateyUninstall.ps1 with 100% similarity]
choco/icinga2.nuspec.cmake [moved from icinga2.nuspec with 84% similarity]

index 504b0eb11d063830230149069e0c923dd152d440..7282d17da1b29aef388cba8d351ee46e59f5106a 100644 (file)
@@ -281,6 +281,7 @@ add_subdirectory(itl)
 add_subdirectory(doc)
 add_subdirectory(agent)
 add_subdirectory(plugins)
+add_subdirectory(choco)
 
 if(MSVC)
   add_subdirectory(icinga-installer)
index 4d5f88f92f6a3d1b94b9e53489e8c4f0ada9ac86..0ef9991651ea623c84b0081e25b5a16560f9a471 100644 (file)
@@ -41,11 +41,9 @@ Update the [.mailmap](.mailmap) and [AUTHORS](AUTHORS) files:
 
 ## Version
 
-Update the version number in the following files:
+Update the version number in the following file:
 
 * [icinga2.spec]: Version: (.*)
-* [icinga2.nuspec]: <version>(.*)</version>
-* [tools/chocolateyInstall.ps1]: Icinga2-v(.*)-{x86,x86_64}.msi
 
 Example:
 
diff --git a/choco/CMakeLists.txt b/choco/CMakeLists.txt
new file mode 100644 (file)
index 0000000..d6e9575
--- /dev/null
@@ -0,0 +1,29 @@
+# Icinga 2
+# Copyright (C) 2012-2016 Icinga Development Team (https://www.icinga.org/)
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+
+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.${SPEC_VERSION}.nupkg ${CMAKE_CURRENT_BINARY_DIR}/icinga2.nupkg
+    DEPENDS icinga2.nuspec ${CMAKE_CURRENT_BINARY_DIR}/chocolateyInstall.ps1 chocolateyUninstall.ps1
+  )
+endif()
similarity index 57%
rename from tools/chocolateyInstall.ps1
rename to choco/chocolateyInstall.ps1.cmake
index 9618aa93690d86dc7879f7f1411bc9ad7d0fc7f1..1888cf770ce1d90d5243b797e8f436eccfef9556 100755 (executable)
@@ -1,7 +1,7 @@
 $packageName = 'icinga2'\r
 $installerType = 'msi'\r
-$url32 = 'http://packages.icinga.org/windows/Icinga2-v2.5.4-x86.msi'\r
-$url64 = 'http://packages.icinga.org/windows/Icinga2-v2.5.4-x86_64.msi'\r
+$url32 = 'http://packages.icinga.org/windows/Icinga2-v${SPEC_VERSION}-x86.msi'\r
+$url64 = 'http://packages.icinga.org/windows/Icinga2-v${SPEC_VERSION}-x86_64.msi'\r
 $silentArgs = '/qn /norestart'\r
 $validExitCodes = @(0)\r
 \r
similarity index 84%
rename from icinga2.nuspec
rename to choco/icinga2.nuspec.cmake
index 59a274cb2ad6332aae4724b9a10b21827dacedef..90280ee3dc1fd3471c62934f18ed238b067b7e70 100755 (executable)
@@ -6,7 +6,7 @@
     <!-- Read this before publishing packages to chocolatey.org: https://github.com/chocolatey/chocolatey/wiki/CreatePackages -->\r
     <id>icinga2</id>\r
     <title>Icinga2</title>\r
-    <version>2.5.4</version>\r
+    <version>${SPEC_VERSION}</version>\r
     <authors>2016 - The Icinga Project</authors>\r
     <owners>Icinga Development Team</owners>\r
     <summary>icinga2 - Monitoring Agent for Windows</summary>\r
@@ -18,7 +18,7 @@
     <iconUrl>https://www.icinga.org/wp-content/uploads/2015/05/icinga_icon_128x128.png</iconUrl>\r
   </metadata>\r
   <files>\r
-    <file src="tools\chocolateyInstall.ps1" target="tools" />\r
-    <file src="tools\chocolateyUninstall.ps1" target="tools" />\r
+    <file src="${CMAKE_CURRENT_BINARY_DIR}/chocolateyInstall.ps1" target="tools" />\r
+    <file src="${CMAKE_CURRENT_SOURCE_DIR}/chocolateyUninstall.ps1" target="tools" />\r
   </files>\r
 </package>\r