Skip to content

Commit d847509

Browse files
#92 -- Merge branch '#fix_version_regex' into master
2 parents 1a00db8 + 5c26de3 commit d847509

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

keychain_lib/src/version_info.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,15 @@ about_info keychain_app::version_info::about()
4040

4141
std::string keychain_app::version_info::version()
4242
{
43-
static const std::regex VERSION_REGEXP("^\\d+\\.\\d+\\-\\d+");
43+
static const std::regex VERSION_REGEXP("^\\d+\\.\\d+(\\-\\d)*");
4444
std::string description_string( git_revision_description );
4545
auto it = std::sregex_iterator(description_string.begin(), description_string.end(), VERSION_REGEXP);
4646
if(it == std::sregex_iterator())
4747
FC_LIGHT_THROW_EXCEPTION(fc_light::internal_error_exception, "Invalid version string has been returned by Git");
4848
auto version_string = it->str();
4949
auto replace_pos = version_string.find('-');
50-
version_string[replace_pos] = '.';
50+
if (replace_pos != std::string::npos)
51+
version_string[replace_pos] = '.';
5152
return version_string;
5253
}
5354

keychain_win/keychain_service/service_installer/wsserverinstaller/CMakeLists.txt

+8-2
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,15 @@ if(WIN32)
127127
list( APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/git_version_gen" )
128128
include( GetGitRevisionDescription )
129129
git_describe(KEYCHAIN_COMMON_GIT_REVISION_DESCRIPTION --tags)
130-
SET(VERSION_REGEXP "^[0-9]+\\.[0-9]+\\-[0-9]+")
130+
SET(VERSION_REGEXP "^[0-9]+\\.[0-9]+(\\-[0-9])*")
131131
string(REGEX MATCH ${VERSION_REGEXP} VERSION_STRING_GIT ${KEYCHAIN_COMMON_GIT_REVISION_DESCRIPTION})
132-
string(REGEX REPLACE "\\-" "." VERSION_STRING ${VERSION_STRING_GIT})
132+
string(FIND ${VERSION_STRING_GIT} "-" 3RD_NUM_POS)
133+
if (${3RD_NUM_POS} EQUAL "-1")
134+
set(VERSION_STRING ${VERSION_STRING_GIT})
135+
string(APPEND VERSION_STRING ".0")
136+
else()
137+
string(REPLACE "-" "." VERSION_STRING ${VERSION_STRING_GIT})
138+
endif()
133139
set(installerversion ${VERSION_STRING})
134140

135141
#-bf - flag causes all of the files to be bound int the resulting .wixout/.* file.

0 commit comments

Comments
 (0)