From a05348acd2fd1768362cd2a8bb8015d8ffa79b18 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Sun, 18 May 2014 14:19:16 +0200 Subject: [PATCH] Implement support for overriding the version number. Fixes #5410 --- CMakeLists.txt | 11 +++++++---- INSTALL | 24 ++++++++++++++---------- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7178d5411..1aab592fe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 92ae73b30..d51440dd6 100644 --- 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). +* Merge the "next" branch into the "master" branch (using --ff-only). +* Bump the version to "v-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-/ tags/v 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-.tar.gz | less Building Icinga 2 -----------------