Merge pull request #5559

33e91e1 wallet, rpc: add a release field to get_version (moneromooo-monero)
This commit is contained in:
luigi1111 2019-08-27 15:09:37 -05:00
commit 3e80f44503
No known key found for this signature in database
GPG key ID: F4ACA0183641E010
7 changed files with 16 additions and 2 deletions

View file

@ -36,6 +36,7 @@ if(RET)
message(WARNING "Cannot determine current commit. Make sure that you are building either from a Git working tree or from a source archive.") 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") set(VERSIONTAG "unknown")
set(VERSION_IS_RELEASE "false")
configure_file("src/version.cpp.in" "${TO}") configure_file("src/version.cpp.in" "${TO}")
else() else()
string(SUBSTRING ${COMMIT} 0 9 COMMIT) string(SUBSTRING ${COMMIT} 0 9 COMMIT)
@ -47,6 +48,7 @@ else()
if(NOT TAGGEDCOMMIT) if(NOT TAGGEDCOMMIT)
message(WARNING "Cannot determine most recent tag. Make sure that you are building either from a Git working tree or from a source archive.") 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}") set(VERSIONTAG "${COMMIT}")
set(VERSION_IS_RELEASE "false")
else() else()
message(STATUS "The most recent tag was at ${TAGGEDCOMMIT}") message(STATUS "The most recent tag was at ${TAGGEDCOMMIT}")
@ -54,9 +56,11 @@ else()
if(COMMIT STREQUAL TAGGEDCOMMIT) if(COMMIT STREQUAL TAGGEDCOMMIT)
message(STATUS "You are building a tagged release") message(STATUS "You are building a tagged release")
set(VERSIONTAG "release") set(VERSIONTAG "release")
set(VERSION_IS_RELEASE "true")
else() else()
message(STATUS "You are ahead of or behind a tagged release") message(STATUS "You are ahead of or behind a tagged release")
set(VERSIONTAG "${COMMIT}") set(VERSIONTAG "${COMMIT}")
set(VERSION_IS_RELEASE "false")
endif() endif()
endif() endif()

View file

@ -2147,6 +2147,7 @@ namespace cryptonote
return r; return r;
res.version = CORE_RPC_VERSION; res.version = CORE_RPC_VERSION;
res.release = MONERO_VERSION_IS_RELEASE;
res.status = CORE_RPC_STATUS_OK; res.status = CORE_RPC_STATUS_OK;
return true; return true;
} }

View file

@ -87,7 +87,7 @@ namespace cryptonote
// advance which version they will stop working with // advance which version they will stop working with
// Don't go over 32767 for any of these // Don't go over 32767 for any of these
#define CORE_RPC_VERSION_MAJOR 2 #define CORE_RPC_VERSION_MAJOR 2
#define CORE_RPC_VERSION_MINOR 9 #define CORE_RPC_VERSION_MINOR 10
#define MAKE_CORE_RPC_VERSION(major,minor) (((major)<<16)|(minor)) #define MAKE_CORE_RPC_VERSION(major,minor) (((major)<<16)|(minor))
#define CORE_RPC_VERSION MAKE_CORE_RPC_VERSION(CORE_RPC_VERSION_MAJOR, CORE_RPC_VERSION_MINOR) #define CORE_RPC_VERSION MAKE_CORE_RPC_VERSION(CORE_RPC_VERSION_MAJOR, CORE_RPC_VERSION_MINOR)
@ -2053,11 +2053,13 @@ namespace cryptonote
{ {
std::string status; std::string status;
uint32_t version; uint32_t version;
bool release;
bool untrusted; bool untrusted;
BEGIN_KV_SERIALIZE_MAP() BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(status) KV_SERIALIZE(status)
KV_SERIALIZE(version) KV_SERIALIZE(version)
KV_SERIALIZE(release)
KV_SERIALIZE(untrusted) KV_SERIALIZE(untrusted)
END_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP()
}; };

View file

@ -2,6 +2,7 @@
#define DEF_MONERO_VERSION "0.14.1.2" #define DEF_MONERO_VERSION "0.14.1.2"
#define DEF_MONERO_RELEASE_NAME "Boron Butterfly" #define DEF_MONERO_RELEASE_NAME "Boron Butterfly"
#define DEF_MONERO_VERSION_FULL DEF_MONERO_VERSION "-" DEF_MONERO_VERSION_TAG #define DEF_MONERO_VERSION_FULL DEF_MONERO_VERSION "-" DEF_MONERO_VERSION_TAG
#define DEF_MONERO_VERSION_IS_RELEASE @VERSION_IS_RELEASE@
#include "version.h" #include "version.h"
@ -9,3 +10,4 @@ const char* const MONERO_VERSION_TAG = DEF_MONERO_VERSION_TAG;
const char* const MONERO_VERSION = DEF_MONERO_VERSION; const char* const MONERO_VERSION = DEF_MONERO_VERSION;
const char* const MONERO_RELEASE_NAME = DEF_MONERO_RELEASE_NAME; const char* const MONERO_RELEASE_NAME = DEF_MONERO_RELEASE_NAME;
const char* const MONERO_VERSION_FULL = DEF_MONERO_VERSION_FULL; const char* const MONERO_VERSION_FULL = DEF_MONERO_VERSION_FULL;
const bool MONERO_VERSION_IS_RELEASE = DEF_MONERO_VERSION_IS_RELEASE;

View file

@ -4,3 +4,4 @@ extern const char* const MONERO_VERSION_TAG;
extern const char* const MONERO_VERSION; extern const char* const MONERO_VERSION;
extern const char* const MONERO_RELEASE_NAME; extern const char* const MONERO_RELEASE_NAME;
extern const char* const MONERO_VERSION_FULL; extern const char* const MONERO_VERSION_FULL;
extern const bool MONERO_VERSION_IS_RELEASE;

View file

@ -36,6 +36,7 @@
#include "include_base_utils.h" #include "include_base_utils.h"
using namespace epee; using namespace epee;
#include "version.h"
#include "wallet_rpc_server.h" #include "wallet_rpc_server.h"
#include "wallet/wallet_args.h" #include "wallet/wallet_args.h"
#include "common/command_line.h" #include "common/command_line.h"
@ -4188,6 +4189,7 @@ namespace tools
bool wallet_rpc_server::on_get_version(const wallet_rpc::COMMAND_RPC_GET_VERSION::request& req, wallet_rpc::COMMAND_RPC_GET_VERSION::response& res, epee::json_rpc::error& er, const connection_context *ctx) bool wallet_rpc_server::on_get_version(const wallet_rpc::COMMAND_RPC_GET_VERSION::request& req, wallet_rpc::COMMAND_RPC_GET_VERSION::response& res, epee::json_rpc::error& er, const connection_context *ctx)
{ {
res.version = WALLET_RPC_VERSION; res.version = WALLET_RPC_VERSION;
res.release = MONERO_VERSION_IS_RELEASE;
return true; return true;
} }
//------------------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------------------

View file

@ -47,7 +47,7 @@
// advance which version they will stop working with // advance which version they will stop working with
// Don't go over 32767 for any of these // Don't go over 32767 for any of these
#define WALLET_RPC_VERSION_MAJOR 1 #define WALLET_RPC_VERSION_MAJOR 1
#define WALLET_RPC_VERSION_MINOR 13 #define WALLET_RPC_VERSION_MINOR 14
#define MAKE_WALLET_RPC_VERSION(major,minor) (((major)<<16)|(minor)) #define MAKE_WALLET_RPC_VERSION(major,minor) (((major)<<16)|(minor))
#define WALLET_RPC_VERSION MAKE_WALLET_RPC_VERSION(WALLET_RPC_VERSION_MAJOR, WALLET_RPC_VERSION_MINOR) #define WALLET_RPC_VERSION MAKE_WALLET_RPC_VERSION(WALLET_RPC_VERSION_MAJOR, WALLET_RPC_VERSION_MINOR)
namespace tools namespace tools
@ -2418,9 +2418,11 @@ namespace wallet_rpc
struct response_t struct response_t
{ {
uint32_t version; uint32_t version;
bool release;
BEGIN_KV_SERIALIZE_MAP() BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(version) KV_SERIALIZE(version)
KV_SERIALIZE(release)
END_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP()
}; };
typedef epee::misc_utils::struct_init<response_t> response; typedef epee::misc_utils::struct_init<response_t> response;