]> granicus.if.org Git - icinga2/commitdiff
Implement support for overriding the version number.
authorGunnar Beutner <gunnar.beutner@netways.de>
Sun, 18 May 2014 12:19:16 +0000 (14:19 +0200)
committerGunnar Beutner <gunnar.beutner@netways.de>
Sun, 18 May 2014 12:20:11 +0000 (14:20 +0200)
Fixes #5410

CMakeLists.txt
INSTALL

index 7178d541190c19b7dfc74d032ac426ba4deb45e9..1aab592fe1fc6f8a5a49180b36cb2720de1c6c13 100644 (file)
@@ -42,11 +42,15 @@ file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/LICENSE.txt" ${ICINGA2_LICENSE})
 
 include(GetGitRevisionDescription)
 git_describe(GIT_VERSION --tags)
-if(GIT_VERSION MATCHES "-NOTFOUND$")
-  configure_file(icinga-version.h.fallback ${CMAKE_CURRENT_BINARY_DIR}/icinga-version.h COPYONLY)
+if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/icinga-version.h.force)
+  configure_file(icinga-version.h.force ${CMAKE_CURRENT_BINARY_DIR}/icinga-version.h COPYONLY)
 else()
+  if(GIT_VERSION MATCHES "-NOTFOUND$")
+    file(STRINGS icinga2.spec SPEC_VERSION REGEX "^Version:")
+    string(SUBSTRING ${SPEC_VERSION} 9 -1 SPEC_VERSION)
+    set(GIT_VERSION "r${SPEC_VERSION}")
+  endif()
   configure_file(icinga-version.h.cmake icinga-version.h)
-  configure_file(${CMAKE_CURRENT_BINARY_DIR}/icinga-version.h ${CMAKE_CURRENT_SOURCE_DIR}/icinga-version.h.fallback COPYONLY)
 endif()
 
 if(WIN32)
@@ -140,7 +144,6 @@ set(CPACK_NSIS_MUI_ICON "${CMAKE_CURRENT_SOURCE_DIR}/icinga-app\\\\icinga.ico")
 set(CPACK_NSIS_MUI_UNIICON "${CMAKE_CURRENT_SOURCE_DIR}/icinga-app\\\\icinga.ico")
 set(CPACK_NSIS_INSTALLED_ICON_NAME "sbin\\\\icinga2.exe")
 set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_BINARY_DIR}/LICENSE.txt")
-set(CPACK_SOURCE_IGNORE_FILES "/.git/" "/debian/" "/.vagrant/" "/release/" "/debug/" "/build/" )
 
 set(CPACK_NSIS_EXECUTABLES_DIRECTORY "sbin")
 set(CPACK_PACKAGE_EXECUTABLES "Icinga2SetupAgent;Icinga 2 Agent Wizard")
diff --git a/INSTALL b/INSTALL
index 92ae73b30fa71e1d61ede922f2d7c29f8675f167..d51440dd65a27488e46272a96044703f8b86c228 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -69,22 +69,26 @@ that there are no local modifications:
 
 $ git status
 
-The CPack tool will package _all_ files in the source directory.
+Here's a short check-list for releases:
 
-Next you'll have to create a separate build directory that is not inside
-the source directory. If you fail to do this CPack will try to include the
-build directory in the tarball.
+* Bump the version in icinga2.spec.
+* Update the ChangeLog and doc/1-about.md files.
+* Commit these changes to the "next" branch and create a signed tag (tags/v<VERSION>).
+* Merge the "next" branch into the "master" branch (using --ff-only).
+* Bump the version to "v<NEXT-VERSION>-dev" and commit this change to the "next" branch.
 
-$ cd ..
-$ mkdir icinga2-release && cd icinga2-release
-$ cmake ../icinga2 -DCPACK_SOURCE_GENERATE=TGZ -DCPACK_SOURCE_PACKAGE_FILE_NAME=icinga2-0.0.10
-$ make package_source
+Note: CMake determines the Icinga 2 version number using "git describe" if the
+source directory is contained in a Git repository. Otherwise the version number
+is extracted from the icinga2.spec file. This behavior can be overridden by
+creating a file called "icinga-version.h.force" in the source directory.
+
+Use "git archive" to build the release tarball:
 
-Update the package name to reflect the version of the tarball you're creating.
+$ git archive --format=tgz --prefix=icinga2-<VERSION>/ tags/v<VERSION>
 
 Finally you should verify that the tarball only contains the files it should contain:
 
-$ tar ztf icinga2-0.0.10.tar.gz | less
+$ tar ztf icinga2-<VERSION>.tar.gz | less
 
 Building Icinga 2
 -----------------