]> granicus.if.org Git - icinga2/commitdiff
cmake: Use the actual GIT_VERSION for ICINGA2_VERSION
authorMarkus Frosch <markus.frosch@icinga.com>
Thu, 4 Apr 2019 10:55:52 +0000 (12:55 +0200)
committerMarkus Frosch <markus.frosch@icinga.com>
Fri, 5 Apr 2019 07:03:04 +0000 (09:03 +0200)
And use a safe version with dots only for Windows.

CMakeLists.txt
choco/CMakeLists.txt
choco/chocolateyInstall.ps1.cmake
choco/icinga2.nuspec.cmake

index 4ddfa2649e5e03234d9a2eec95997fc4ffbcede1..7ad1c95b34d4b4c40900877d85cd8bffa5349b1f 100644 (file)
@@ -27,9 +27,6 @@ option (USE_SYSTEMD
 
 set(HAVE_SYSTEMD ${USE_SYSTEMD})
 
-file(STRINGS VERSION VERSION_LINE REGEX "^Version: ")
-string(REPLACE "Version: " "" ICINGA2_VERSION ${VERSION_LINE})
-
 include(GNUInstallDirs)
 include(InstallConfig)
 include(SetFullDir)
@@ -104,10 +101,17 @@ else()
     string(SUBSTRING ${SPEC_REVISION} 10 ${SPEC_REVISION_LENGTH} SPEC_REVISION)
 
     set(GIT_VERSION "r${SPEC_VERSION}-${SPEC_REVISION}")
+    set(ICINGA2_VERSION "${SPEC_VERSION}")
+  else()
+    # use GIT version as ICINGA2_VERSION
+    string(REGEX REPLACE "^[rv]" "" ICINGA2_VERSION "${GIT_VERSION}")
   endif()
   configure_file(icinga-version.h.cmake icinga-version.h)
 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}")
+
 if(WIN32)
   set(Boost_USE_STATIC_LIBS ON)
   # Disabled for linking issues for newer Boost versions, they link against Windows SDKs
@@ -391,7 +395,7 @@ endif()
 
 set(CPACK_PACKAGE_NAME "Icinga 2")
 set(CPACK_PACKAGE_VENDOR "Icinga GmbH")
-set(CPACK_PACKAGE_VERSION ${ICINGA2_VERSION})
+set(CPACK_PACKAGE_VERSION ${ICINGA2_VERSION_SAFE})
 set(CPACK_PACKAGE_INSTALL_DIRECTORY "ICINGA2")
 set(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/icinga-app\\\\icinga.ico")
 set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_BINARY_DIR}/LICENSE.txt")
index 650c41cf18adc07f9c012f9c9cfa66c5b05d5992..d7b90bb471541e8b2874f1a215c71866778d5080 100644 (file)
@@ -8,7 +8,7 @@ if(WIN32)
 
   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
+    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
   )
 endif()
index cbf4ca0d98d05f7e13fcc7b88e44273b68ee4b86..ab1660324bea3039820e7bcd667a59354157572a 100755 (executable)
@@ -1,7 +1,7 @@
 $packageName = 'icinga2'\r
 $installerType = 'msi'\r
-$url32 = 'https://packages.icinga.com/windows/Icinga2-v${SPEC_VERSION}-x86.msi'\r
-$url64 = 'https://packages.icinga.com/windows/Icinga2-v${SPEC_VERSION}-x86_64.msi'\r
+$url32 = 'https://packages.icinga.com/windows/Icinga2-v${ICINGA2_VERSION_SAFE}-x86.msi'\r
+$url64 = 'https://packages.icinga.com/windows/Icinga2-v${ICINGA2_VERSION_SAFE}-x86_64.msi'\r
 $silentArgs = '/qn /norestart'\r
 $validExitCodes = @(0)\r
 \r
index 1b1465df6c8cc5425535d9e41d4115f9e5bc86d5..46225b556fde706eda5b39b49d61058c28f8326b 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>Icinga 2</title>\r
-    <version>${SPEC_VERSION}</version>\r
+    <version>${ICINGA2_VERSION_SAFE}</version>\r
     <authors>Icinga GmbH</authors>\r
     <owners>Icinga GmbH</owners>\r
     <summary>icinga2 - Monitoring Agent for Windows</summary>\r