Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Override v2.13.0-555-g11e37a0bd from git describe with v2.13.6 #9649

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .git-archive-version
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Becomes like v2.13.0-555-g11e37a0bd if git-archived, is kept as-is otherwise
$Format:%(describe)$
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
debian/ export-ignore
.gitattributes export-ignore

# Include version information on `git archive'
/.git-archive-version export-subst
14 changes: 12 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,14 @@ string(SUBSTRING ${SPEC_VERSION} 9 ${SPEC_VERSION_LENGTH} SPEC_VERSION)

configure_file(icinga-spec-version.h.cmake icinga-spec-version.h)

include(GetGitRevisionDescription)
git_describe(GIT_VERSION --tags)
file(STRINGS .git-archive-version GIT_ARCHIVE_VERSION REGEX "^[^#]")
if(GIT_ARCHIVE_VERSION MATCHES "Format")
include(GetGitRevisionDescription)
git_describe(GIT_VERSION --tags)
else()
set(GIT_VERSION "${GIT_ARCHIVE_VERSION}")
endif()

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()
Expand All @@ -120,6 +126,10 @@ else()
set(GIT_VERSION "r${SPEC_VERSION}-${SPEC_REVISION}")
set(ICINGA2_VERSION "${SPEC_VERSION}")
else()
if(GIT_VERSION MATCHES "-g")
# Override v2.13.0-555-g11e37a0bd from git describe with 2.13.7 from ./ICINGA2_VERSION -> v2.13.7-555-g11e37a0bd
string(REGEX REPLACE ^[v0-9.]+ "v${SPEC_VERSION}" GIT_VERSION "${GIT_VERSION}")
endif()
# use GIT version as ICINGA2_VERSION
string(REGEX REPLACE "^[rv]" "" ICINGA2_VERSION "${GIT_VERSION}")
endif()
Expand Down
Loading