Implement support for overriding the version number.

Fixes #5410
This commit is contained in:
Gunnar Beutner 2014-05-18 14:19:16 +02:00
parent 7310a254e8
commit a05348acd2
2 changed files with 21 additions and 14 deletions

View 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")

24
INSTALL
View File

@ -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.
Update the package name to reflect the version of the tarball you're creating.
Use "git archive" to build the release tarball:
$ 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
-----------------