Use VERSION instead of icinga2.spec

This commit is contained in:
Michael Friedrich 2018-04-05 16:41:10 +02:00
parent 3a8017fd99
commit 441536f292
5 changed files with 10 additions and 31 deletions

View File

@ -42,7 +42,7 @@ option (USE_SYSTEMD
set(HAVE_SYSTEMD ${USE_SYSTEMD}) set(HAVE_SYSTEMD ${USE_SYSTEMD})
file(STRINGS icinga2.spec VERSION_LINE REGEX "^Version: ") file(STRINGS VERSION VERSION_LINE REGEX "^Version: ")
string(REPLACE "Version: " "" ICINGA2_VERSION ${VERSION_LINE}) string(REPLACE "Version: " "" ICINGA2_VERSION ${VERSION_LINE})
include(GNUInstallDirs) include(GNUInstallDirs)
@ -72,7 +72,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}") set(ICINGA2_LICENSE "${ICINGA2_LICENSE_GPL}\n\n---\n\n${ICINGA2_LICENSE_ADDITIONS}")
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/LICENSE.txt" ${ICINGA2_LICENSE}) 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) string(LENGTH "${SPEC_VERSION}" SPEC_VERSION_LENGTH)
math(EXPR SPEC_VERSION_LENGTH "${SPEC_VERSION_LENGTH} - 9") math(EXPR SPEC_VERSION_LENGTH "${SPEC_VERSION_LENGTH} - 9")
string(SUBSTRING ${SPEC_VERSION} 9 ${SPEC_VERSION_LENGTH} SPEC_VERSION) string(SUBSTRING ${SPEC_VERSION} 9 ${SPEC_VERSION_LENGTH} SPEC_VERSION)
@ -85,10 +85,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) configure_file(icinga-version.h.force ${CMAKE_CURRENT_BINARY_DIR}/icinga-version.h COPYONLY)
else() else()
if(NOT ICINGA2_GIT_VERSION_INFO OR GIT_VERSION MATCHES "-NOTFOUND$") 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) string(LENGTH "${SPEC_REVISION}" SPEC_REVISION_LENGTH)
math(EXPR SPEC_REVISION_LENGTH "${SPEC_REVISION_LENGTH} - 17") math(EXPR SPEC_REVISION_LENGTH "${SPEC_REVISION_LENGTH} - 10")
string(SUBSTRING ${SPEC_REVISION} 17 ${SPEC_REVISION_LENGTH} SPEC_REVISION) string(SUBSTRING ${SPEC_REVISION} 10 ${SPEC_REVISION_LENGTH} SPEC_REVISION)
set(GIT_VERSION "r${SPEC_VERSION}-${SPEC_REVISION}") set(GIT_VERSION "r${SPEC_VERSION}-${SPEC_REVISION}")
endif() endif()

View File

@ -188,7 +188,7 @@ See [FindMySQL.cmake](third-party/cmake/FindPostgreSQL.cmake) for the implementa
CMake determines the Icinga 2 version number using `git describe` if the CMake determines the Icinga 2 version number using `git describe` if the
source directory is contained in a Git repository. Otherwise the version number 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 overridden by creating a file called `icinga-version.h.force` in the source
directory. Alternatively the `-DICINGA2_GIT_VERSION_INFO=OFF` option for CMake directory. Alternatively the `-DICINGA2_GIT_VERSION_INFO=OFF` option for CMake
can be used to disable the usage of `git describe`. can be used to disable the usage of `git describe`.
@ -232,7 +232,7 @@ rpmdev-setuptree
Copy the icinga2.spec file to `rpmbuild/SPEC` or fetch the latest version: 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 Copy the tarball to `rpmbuild/SOURCES` e.g. by using the `spectool` binary

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: 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 ## 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-2018 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