Browse Source

Fixed version parsing for 'commits ahead'

tempestpy_adaptions
Matthias Volk 7 years ago
parent
commit
9902bb9dff
  1. 34
      CMakeLists.txt
  2. 8
      src/storm/utility/storm-version.h
  3. 2
      storm-version.cpp.in

34
CMakeLists.txt

@ -420,16 +420,22 @@ set(STORM_VERSION_MAJOR "${CMAKE_MATCH_1}")
set(STORM_VERSION_MINOR "${CMAKE_MATCH_2}")
set(STORM_VERSION_PATCH "${CMAKE_MATCH_3}")
set(STORM_GIT_VERSION_REST "${CMAKE_MATCH_4}")
# parse rest of the form (-label)-commitsahead-hash-appendix
# parse rest of the form (-label)-commitsahead-hash(-appendix)
string(REGEX MATCH "^(\\-([a-z][a-z0-9\\.]+))?\\-([0-9]+)\\-([a-z0-9]+)(\\-.*)?$" STORM_VERSION_REST_MATCH "${STORM_GIT_VERSION_REST}")
set(STORM_VERSION_LABEL "${CMAKE_MATCH_2}") # might be empty
set(STORM_VERSION_COMMITS_AHEAD "${CMAKE_MATCH_3}")
set(STORM_VERSION_TAG_HASH "${CMAKE_MATCH_4}")
set(STORM_VERSION_TAG_HASH "${CMAKE_MATCH_4}") # is not used
set(STORM_VERSION_APPENDIX "${CMAKE_MATCH_5}") # might be empty
set(STORM_VERSION_DIRTY boost::none)
if (NOT "${STORM_GIT_VERSION_STRING}" STREQUAL "")
# check whether the git version lookup failed
if (STORM_GIT_VERSION_STRING MATCHES "NOTFOUND")
set(STORM_VERSION_SOURCE "VersionSource::Static")
set(STORM_VERSION_COMMITS_AHEAD 0)
set(STORM_VERSION_DIRTY boost::none)
include(version.cmake)
message(WARNING "Storm - Git version information not available, statically assuming version ${STORM_VERSION_MAJOR}.${STORM_VERSION_MINOR}.${STORM_VERSION_PATCH}.")
else()
set(STORM_VERSION_SOURCE "VersionSource::Git")
if ("${STORM_VERSION_APPENDIX}" MATCHES "^.*dirty.*$")
set(STORM_VERSION_DIRTY "true")
else()
@ -437,15 +443,6 @@ if (NOT "${STORM_GIT_VERSION_STRING}" STREQUAL "")
endif()
endif()
# now check whether the git version lookup failed
set(STORM_VERSION_SOURCE "VersionSource::Git")
if (STORM_GIT_VERSION_STRING MATCHES "NOTFOUND")
set(STORM_VERSION_SOURCE "VersionSource::Static")
set(STORM_VERSION_COMMITS_AHEAD "boost::none")
include(version.cmake)
message(WARNING "Storm - Git version information not available, statically assuming version ${STORM_VERSION_MAJOR}.${STORM_VERSION_MINOR}.${STORM_VERSION_PATCH}.")
endif()
# check whether there is a label ('alpha', 'pre', etc.)
if ("${STORM_VERSION_LABEL}" STREQUAL "")
set(STORM_VERSION_LABEL_STRING "")
@ -454,18 +451,19 @@ else()
endif()
# check for development version with commits ahead of latest tag
set(STORM_VERSION_DEV "false")
set(STORM_VERSION_DEV_STRING "")
if(STORM_VERSION_COMMITS_AHEAD)
set(STORM_VERSION_DEV "true")
set(STORM_VERSION_DEV_STRING " (dev)")
if ("${STORM_VERSION_LABEL}" STREQUAL "")
# increase patch number to indicate newer version
MATH(EXPR STORM_VERSION_DEV_PATCH "${STORM_VERSION_PATCH}+1")
else()
set(STORM_VERSION_DEV_PATCH "${STORM_VERSION_PATCH}")
endif()
set(STORM_VERSION_DEV "true")
set(STORM_VERSION_DEV_STRING " (dev)")
else()
set(STORM_VERSION_COMMITS_AHEAD 0)
set(STORM_VERSION_DEV "false")
set(STORM_VERSION_DEV_STRING "")
set(STORM_VERSION_DEV_PATCH ${STORM_VERSION_PATCH})
endif()

8
src/storm/utility/storm-version.h

@ -30,12 +30,12 @@ namespace storm {
/// The source of the versioning information.
const static VersionSource versionSource;
/// The short hash of the git commit this build is based on
const static std::string gitRevisionHash;
/// How many commits passed since the tag was last set.
const static boost::optional<unsigned> commitsAhead;
const static unsigned commitsAhead;
/// 0 iff there no files were modified in the checkout, 1 otherwise. If none, no information about dirtyness is given.
const static boost::optional<bool> dirty;
@ -70,8 +70,8 @@ namespace storm {
if (versionSource == VersionSource::Static) {
sstream << " (derived statically)";
}
if (commitsAhead) {
sstream << " (+ " << commitsAhead.get() << " commits)";
if (commitsAhead > 0) {
sstream << " (+ " << commitsAhead << " commits)";
}
if (!gitRevisionHash.empty()) {
sstream << " build from revision " << gitRevisionHash;

2
storm-version.cpp.in

@ -11,7 +11,7 @@ namespace storm {
const bool StormVersion::versionDev = @STORM_VERSION_DEV@;
const StormVersion::VersionSource StormVersion::versionSource = @STORM_VERSION_SOURCE@;
const std::string StormVersion::gitRevisionHash = "@STORM_VERSION_GIT_HASH@";
const boost::optional<unsigned> StormVersion::commitsAhead = @STORM_VERSION_COMMITS_AHEAD@;
const unsigned StormVersion::commitsAhead = @STORM_VERSION_COMMITS_AHEAD@;
const boost::optional<bool> StormVersion::dirty = @STORM_VERSION_DIRTY@;
const std::string StormVersion::systemName = "@CMAKE_SYSTEM_NAME@";
const std::string StormVersion::systemVersion = "@CMAKE_SYSTEM_VERSION@";

Loading…
Cancel
Save