Use VERSION instead of icinga2.spec

This commit is contained in:
Michael Friedrich 2018-04-05 16:41:10 +02:00 committed by Jean Flach
parent 1f5567a3ed
commit 5479adb908
5 changed files with 12 additions and 31 deletions

View File

@ -40,7 +40,7 @@ option(ICINGA2_WITH_PERFDATA "Build the perfdata module" ON)
option(ICINGA2_WITH_STUDIO "Build the Icinga Studio application" OFF)
option(ICINGA2_WITH_TESTS "Run unit tests" ON)
file(STRINGS icinga2.spec VERSION_LINE REGEX "^Version: ")
file(STRINGS VERSION VERSION_LINE REGEX "^Version: ")
string(REPLACE "Version: " "" ICINGA2_VERSION ${VERSION_LINE})
include(GNUInstallDirs)
@ -75,7 +75,7 @@ file(READ "${CMAKE_CURRENT_SOURCE_DIR}/COPYING.Exceptions" ICINGA2_LICENSE_ADDIT
set(ICINGA2_LICENSE "${ICINGA2_LICENSE_GPL}\n\n---\n\n${ICINGA2_LICENSE_ADDITIONS}")
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/LICENSE.txt" ${ICINGA2_LICENSE})
file(STRINGS icinga2.spec SPEC_VERSION REGEX "^Version:")
file(STRINGS VERSION SPEC_VERSION REGEX "^Version:")
string(LENGTH "${SPEC_VERSION}" SPEC_VERSION_LENGTH)
math(EXPR SPEC_VERSION_LENGTH "${SPEC_VERSION_LENGTH} - 9")
string(SUBSTRING ${SPEC_VERSION} 9 ${SPEC_VERSION_LENGTH} SPEC_VERSION)
@ -88,10 +88,10 @@ 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(NOT ICINGA2_GIT_VERSION_INFO OR GIT_VERSION MATCHES "-NOTFOUND$")
file(STRINGS icinga2.spec SPEC_REVISION REGEX "^%define revision ")
file(STRINGS VERSION SPEC_REVISION REGEX "^Revision: ")
string(LENGTH "${SPEC_REVISION}" SPEC_REVISION_LENGTH)
math(EXPR SPEC_REVISION_LENGTH "${SPEC_REVISION_LENGTH} - 17")
string(SUBSTRING ${SPEC_REVISION} 17 ${SPEC_REVISION_LENGTH} SPEC_REVISION)
math(EXPR SPEC_REVISION_LENGTH "${SPEC_REVISION_LENGTH} - 10")
string(SUBSTRING ${SPEC_REVISION} 10 ${SPEC_REVISION_LENGTH} SPEC_REVISION)
set(GIT_VERSION "r${SPEC_VERSION}-${SPEC_REVISION}")
endif()

View File

@ -128,7 +128,7 @@ Defaults to `OFF`.
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](icinga2.spec) file. This behavior can be
is extracted from the [VERSION](VERSION) file. This behavior can be
overridden by creating a file called `icinga-version.h.force` in the source
directory. Alternatively the `-DICINGA2_GIT_VERSION_INFO=OFF` option for CMake
can be used to disable the usage of `git describe`.
@ -164,7 +164,9 @@ Prepare the rpmbuild directory tree:
Copy the icinga2.spec file to `rpmbuild/SPEC` or fetch the latest version:
curl https://raw.githubusercontent.com/Icinga/icinga2/master/icinga2.spec -o $HOME/rpmbuild/SPECS/icinga2.spec
```
curl https://raw.githubusercontent.com/Icinga/rpm-icinga2/master/icinga2.spec -o $HOME/rpmbuild/SPECS/icinga2.spec
```
Copy the tarball to `rpmbuild/SOURCES` e.g. by using the `spectool` binary
provided with `rpmdevtools`:

View File

@ -29,7 +29,7 @@ git log --use-mailmap | grep '^Author:' | cut -f2- -d' ' | sort | uniq > AUTHORS
Update the version in the spec file:
```
gsed -i "s/Version: .*/Version: $VERSION/g" icinga2.spec
gsed -i "s/Version: .*/Version: $VERSION/g" VERSION
```
## Changelog

2
VERSION Normal file
View File

@ -0,0 +1,2 @@
Version: 2.8.2
Revision: 1

View File

@ -1,23 +0,0 @@
#/******************************************************************************
# * Icinga 2 *
# * Copyright (C) 2012-2017 Icinga Development Team (https://www.icinga.com/) *
# * *
# * 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. *
# ******************************************************************************/
# The spec file was moved to https://github.com/Icinga/icinga-packaging
%define revision 1
Version: 2.8.2