aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2014-09-12 13:06:51 +0200
committerRiccardo Spagni <ric@spagni.net>2014-09-12 13:06:51 +0200
commit14b3b6ea02ab5a228a2551bc8be7212ec7c15f37 (patch)
tree25bdf5988b19ded9df97555d9b8a808c1ad7acb9
parentalways check git diff (diff)
downloadmonero-14b3b6ea02ab5a228a2551bc8be7212ec7c15f37.tar.xz
versioning now includes the commit hash, or -final for tagged releases
-rw-r--r--CMakeLists.txt26
-rw-r--r--src/daemon/daemon.cpp6
-rw-r--r--src/daemon/daemon_commands_handler.h2
-rw-r--r--src/p2p/net_node.inl2
-rw-r--r--src/simplewallet/simplewallet.cpp6
-rw-r--r--src/version.cmake26
-rw-r--r--src/version.h.in7
7 files changed, 38 insertions, 37 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 237181253..b80712737 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -30,9 +30,6 @@
cmake_minimum_required(VERSION 2.8.6)
-set(VERSION "0.1")
-# $Format:Packaged from commit %H%nset(COMMIT %h)%nset(REFS "%d")$
-
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
set(CMAKE_CONFIGURATION_TYPES "Debug;Release")
enable_testing()
@@ -161,24 +158,15 @@ elseif(NOT MSVC)
endif()
file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/version")
-if(DEFINED COMMIT)
- string(REPLACE "." "\\." VERSION_RE "${VERSION}")
- if(NOT REFS MATCHES "(\\(|, )tag: v${VERSION_RE}(\\)|, )")
- set(VERSION "${VERSION}-g${COMMIT}")
- endif()
+find_package(Git QUIET)
+if(Git_FOUND OR GIT_FOUND)
+ message(STATUS "Found Git: ${GIT_EXECUTABLE}")
+ add_custom_target(version ALL "${CMAKE_COMMAND}" "-D" "GIT=${GIT_EXECUTABLE}" "-D" "TO=${CMAKE_BINARY_DIR}/version/version.h" "-P" "src/version.cmake" WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}")
+else()
+ message(STATUS "WARNING: Git was not found!")
+ set(VERSIONTAG "unknown")
configure_file("src/version.h.in" "version/version.h")
add_custom_target(version ALL)
-else()
- find_package(Git QUIET)
- if(Git_FOUND OR GIT_FOUND)
- message(STATUS "Found Git: ${GIT_EXECUTABLE}")
- add_custom_target(version ALL "${CMAKE_COMMAND}" "-D" "VERSION=${VERSION}" "-D" "GIT=${GIT_EXECUTABLE}" "-D" "TO=${CMAKE_BINARY_DIR}/version/version.h" "-P" "src/version.cmake" WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}")
- else()
- message(STATUS "WARNING: Git was not found!")
- set(VERSION "${VERSION}-unknown")
- configure_file("src/version.h.in" "version/version.h")
- add_custom_target(version ALL)
- endif()
endif()
add_subdirectory(external)
diff --git a/src/daemon/daemon.cpp b/src/daemon/daemon.cpp
index 461068837..fc7ec4ed2 100644
--- a/src/daemon/daemon.cpp
+++ b/src/daemon/daemon.cpp
@@ -109,7 +109,7 @@ int main(int argc, char* argv[])
if (command_line::get_arg(vm, command_line::arg_help))
{
- std::cout << CRYPTONOTE_NAME << " v" << PROJECT_VERSION_LONG << ENDL << ENDL;
+ std::cout << CRYPTONOTE_NAME << " v" << MONERO_VERSION_FULL << ENDL << ENDL;
std::cout << desc_options << std::endl;
return false;
}
@@ -144,7 +144,7 @@ int main(int argc, char* argv[])
log_dir = log_file_path.has_parent_path() ? log_file_path.parent_path().string() : log_space::log_singletone::get_default_log_folder();
log_space::log_singletone::add_logger(LOGGER_FILE, log_file_path.filename().string().c_str(), log_dir.c_str());
- LOG_PRINT_L0(CRYPTONOTE_NAME << " v" << PROJECT_VERSION_LONG);
+ LOG_PRINT_L0(CRYPTONOTE_NAME << " v" << MONERO_VERSION_FULL);
if (command_line_preprocessor(vm))
{
@@ -240,7 +240,7 @@ bool command_line_preprocessor(const boost::program_options::variables_map& vm)
bool exit = false;
if (command_line::get_arg(vm, command_line::arg_version))
{
- std::cout << CRYPTONOTE_NAME << " v" << PROJECT_VERSION_LONG << ENDL;
+ std::cout << CRYPTONOTE_NAME << " v" << MONERO_VERSION_FULL << ENDL;
exit = true;
}
if (command_line::get_arg(vm, arg_os_version))
diff --git a/src/daemon/daemon_commands_handler.h b/src/daemon/daemon_commands_handler.h
index 165cded21..2d0f7e5a8 100644
--- a/src/daemon/daemon_commands_handler.h
+++ b/src/daemon/daemon_commands_handler.h
@@ -83,7 +83,7 @@ private:
std::string get_commands_str()
{
std::stringstream ss;
- ss << CRYPTONOTE_NAME << " v" << PROJECT_VERSION_LONG << ENDL;
+ ss << CRYPTONOTE_NAME << " v" << MONERO_VERSION_FULL << ENDL;
ss << "Commands: " << ENDL;
std::string usage = m_cmd_binder.get_usage();
boost::replace_all(usage, "\n", "\n ");
diff --git a/src/p2p/net_node.inl b/src/p2p/net_node.inl
index 626e227bc..ee401ce42 100644
--- a/src/p2p/net_node.inl
+++ b/src/p2p/net_node.inl
@@ -866,7 +866,7 @@ namespace nodetool
}
rsp.connections_count = m_net_server.get_config_object().get_connections_count();
rsp.incoming_connections_count = rsp.connections_count - get_outgoing_connections_count();
- rsp.version = PROJECT_VERSION_LONG;
+ rsp.version = MONERO_VERSION_FULL;
rsp.os_version = tools::get_os_version_string();
m_payload_handler.get_stat_info(rsp.payload_info);
return 1;
diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp
index 960b1be9d..e822e6636 100644
--- a/src/simplewallet/simplewallet.cpp
+++ b/src/simplewallet/simplewallet.cpp
@@ -1090,14 +1090,14 @@ int main(int argc, char* argv[])
if (command_line::get_arg(vm, command_line::arg_help))
{
- success_msg_writer() << CRYPTONOTE_NAME << " wallet v" << PROJECT_VERSION_LONG;
+ success_msg_writer() << CRYPTONOTE_NAME << " wallet v" << MONERO_VERSION_FULL;
success_msg_writer() << "Usage: simplewallet [--wallet-file=<file>|--generate-new-wallet=<file>] [--daemon-address=<host>:<port>] [<COMMAND>]";
success_msg_writer() << desc_all << '\n' << w.get_commands_str();
return false;
}
else if (command_line::get_arg(vm, command_line::arg_version))
{
- success_msg_writer() << CRYPTONOTE_NAME << " wallet v" << PROJECT_VERSION_LONG;
+ success_msg_writer() << CRYPTONOTE_NAME << " wallet v" << MONERO_VERSION_FULL;
return false;
}
@@ -1116,7 +1116,7 @@ int main(int argc, char* argv[])
log_space::log_singletone::get_default_log_file().c_str(),
log_space::log_singletone::get_default_log_folder().c_str(), LOG_LEVEL_4);
- message_writer(epee::log_space::console_color_white, true) << CRYPTONOTE_NAME << " wallet v" << PROJECT_VERSION_LONG;
+ message_writer(epee::log_space::console_color_white, true) << CRYPTONOTE_NAME << " wallet v" << MONERO_VERSION_FULL;
if(command_line::has_arg(vm, arg_log_level))
{
diff --git a/src/version.cmake b/src/version.cmake
index 880224dc6..40243c018 100644
--- a/src/version.cmake
+++ b/src/version.cmake
@@ -1,11 +1,25 @@
-execute_process(COMMAND "${GIT}" describe --dirty --match "v${VERSION}" RESULT_VARIABLE RET OUTPUT_VARIABLE DESCRIPTION OUTPUT_STRIP_TRAILING_WHITESPACE)
+execute_process(COMMAND "${GIT}" rev-parse --short HEAD RESULT_VARIABLE RET OUTPUT_VARIABLE COMMIT OUTPUT_STRIP_TRAILING_WHITESPACE)
+
if(RET)
- message(WARNING "Cannot determine current revision. Make sure that you are building either from a Git working tree or from a source archive.")
- set(VERSION "${COMMIT}")
+ message(WARNING "Cannot determine current commit. Make sure that you are building either from a Git working tree or from a source archive.")
+ set(VERSIONTAG "unknown")
configure_file("src/version.h.in" "${TO}")
else()
- string(REGEX MATCH "([0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f])?(-dirty)? $" COMMIT "${DESCRIPTION} ")
- string(STRIP "${COMMIT}" COMMIT)
- set(VERSION "${COMMIT}")
+ message(STATUS "You are currently on commit ${COMMIT}")
+ execute_process(COMMAND "${GIT}" show-ref --tags -d --abbrev COMMAND awk "END{print $1}" RESULT_VARIABLE RET OUTPUT_VARIABLE TAGGEDCOMMIT OUTPUT_STRIP_TRAILING_WHITESPACE)
+ if(RET)
+ message(WARNING "Cannot determine most recent tag. Make sure that you are building either from a Git working tree or from a source archive.")
+ set(VERSIONTAG "${COMMIT}")
+ else()
+ message(STATUS "The most recent tag was at ${TAGGEDCOMMIT}")
+ if(COMMIT MATCHES TAGGEDCOMMIT)
+ message(STATUS "You are building a tagged release")
+ set(VERSIONTAG "release")
+ else()
+ message(STATUS "You are ahead or behind of a tagged release")
+ set(VERSIONTAG "${COMMIT}")
+ endif()
+ endif()
+
configure_file("src/version.h.in" "${TO}")
endif() \ No newline at end of file
diff --git a/src/version.h.in b/src/version.h.in
index 7ff77150e..9862431de 100644
--- a/src/version.h.in
+++ b/src/version.h.in
@@ -1,4 +1,3 @@
-#define BUILD_COMMIT_ID "@VERSION@"
-#define PROJECT_VERSION "0.8.8"
-#define PROJECT_VERSION_BUILD_NO "4"
-#define PROJECT_VERSION_LONG PROJECT_VERSION "." PROJECT_VERSION_BUILD_NO "(" BUILD_COMMIT_ID ")"
+#define MONERO_VERSION_TAG "@VERSIONTAG@"
+#define MONERO_VERSION "0.8.8.4"
+#define MONERO_VERSION_FULL MONERO_VERSION "-" MONERO_VERSION_TAG