From 899d8cf5f3adad6c21cbfecdea324aaac11fe6cb Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Sun, 2 Oct 2016 00:20:02 +1300 Subject: [PATCH 1/4] Use CLIENT_VERSION_BUILD to represent -beta and -rc in client version --- src/clientversion.cpp | 36 +++++++++++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 5 deletions(-) diff --git a/src/clientversion.cpp b/src/clientversion.cpp index aae0569bb..740a44ff9 100644 --- a/src/clientversion.cpp +++ b/src/clientversion.cpp @@ -8,6 +8,12 @@ #include +#include +#include +#include +#include +#include + /** * Name of client reported in the 'version' message. Report the same name * for both bitcoind and bitcoin-core, to make it harder for attackers to @@ -48,14 +54,30 @@ const std::string CLIENT_NAME("Satoshi"); #define GIT_COMMIT_DATE "$Format:%cD$" #endif +#define RENDER_BETA_STRING(num) "-beta" DO_STRINGIZE(num) +#define RENDER_RC_STRING(num) "-rc" DO_STRINGIZE(num) +#define RENDER_DEV_STRING(num) "-" DO_STRINGIZE(num) + +#define RENDER_BUILD(build) \ + BOOST_PP_IF( \ + BOOST_PP_LESS(build, 25), \ + RENDER_BETA_STRING(BOOST_PP_ADD(build, 1)), \ + BOOST_PP_IF( \ + BOOST_PP_LESS(build, 50), \ + RENDER_RC_STRING(BOOST_PP_SUB(build, 24)), \ + BOOST_PP_IF( \ + BOOST_PP_EQUAL(build, 50), \ + "", \ + RENDER_DEV_STRING(BOOST_PP_SUB(build, 50))))) + #define BUILD_DESC_WITH_SUFFIX(maj, min, rev, build, suffix) \ - "v" DO_STRINGIZE(maj) "." DO_STRINGIZE(min) "." DO_STRINGIZE(rev) "." DO_STRINGIZE(build) "-" DO_STRINGIZE(suffix) + "v" DO_STRINGIZE(maj) "." DO_STRINGIZE(min) "." DO_STRINGIZE(rev) RENDER_BUILD(build) "-" DO_STRINGIZE(suffix) #define BUILD_DESC_FROM_COMMIT(maj, min, rev, build, commit) \ - "v" DO_STRINGIZE(maj) "." DO_STRINGIZE(min) "." DO_STRINGIZE(rev) "." DO_STRINGIZE(build) "-g" commit + "v" DO_STRINGIZE(maj) "." DO_STRINGIZE(min) "." DO_STRINGIZE(rev) RENDER_BUILD(build) "-g" commit #define BUILD_DESC_FROM_UNKNOWN(maj, min, rev, build) \ - "v" DO_STRINGIZE(maj) "." DO_STRINGIZE(min) "." DO_STRINGIZE(rev) "." DO_STRINGIZE(build) "-unk" + "v" DO_STRINGIZE(maj) "." DO_STRINGIZE(min) "." DO_STRINGIZE(rev) RENDER_BUILD(build) "-unk" #ifndef BUILD_DESC #ifdef BUILD_SUFFIX @@ -80,10 +102,14 @@ const std::string CLIENT_DATE(BUILD_DATE); static std::string FormatVersion(int nVersion) { - if (nVersion % 100 == 0) + if (nVersion % 100 < 25) + return strprintf("%d.%d.%d-beta%d", nVersion / 1000000, (nVersion / 10000) % 100, (nVersion / 100) % 100, (nVersion % 100)+1); + if (nVersion % 100 < 50) + return strprintf("%d.%d.%d-rc%d", nVersion / 1000000, (nVersion / 10000) % 100, (nVersion / 100) % 100, (nVersion % 100)-24); + else if (nVersion % 100 == 50) return strprintf("%d.%d.%d", nVersion / 1000000, (nVersion / 10000) % 100, (nVersion / 100) % 100); else - return strprintf("%d.%d.%d.%d", nVersion / 1000000, (nVersion / 10000) % 100, (nVersion / 100) % 100, nVersion % 100); + return strprintf("%d.%d.%d-%d", nVersion / 1000000, (nVersion / 10000) % 100, (nVersion / 100) % 100, (nVersion % 100)-50); } std::string FormatFullVersion() From 1fa852f7a0169f05746d26fb9c1ac7aa39af4309 Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Sun, 2 Oct 2016 00:27:50 +1300 Subject: [PATCH 2/4] Update release process with version schema --- doc/release-process.md | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/doc/release-process.md b/doc/release-process.md index a5836cf3f..f01e6d33c 100644 --- a/doc/release-process.md +++ b/doc/release-process.md @@ -4,15 +4,16 @@ Meta: There should always be a single release engineer to disambiguate responsib ## A. Define the release version as: - $ ZCASH_RELEASE=${UPSTREAM_VERSION}.z${ZCASH_RELEASE_COUNTER} - + $ ZCASH_RELEASE=MAJOR.MINOR.REVISION(-BUILD_STRING) + Example: - $ ZCASH_RELEASE=0.11.2.z2 - -Also, the following commands use the ZCASH_RELEASE_PREV bash variable for the previous release: + $ ZCASH_RELEASE=1.0.0-beta2 - $ ZCASH_RELEASE_PREV=0.11.2.z1 +Also, the following commands use the `ZCASH_RELEASE_PREV` bash variable for the +previous release: + + $ ZCASH_RELEASE_PREV=1.0.0-beta1 ## B. create a new release branch / github PR ### B1. update (commit) version in sources @@ -21,8 +22,18 @@ Also, the following commands use the ZCASH_RELEASE_PREV bash variable for the pr src/clientversion.h configure.ac -In `configure.ac` and `clientversion.h` change CLIENT_VERSION_IS_RELEASE to -false while Zcash is in alpha-test phase. +In `configure.ac` and `clientversion.h`: + +- Increment `CLIENT_VERSION_BUILD` according to the following schema: + + - 0-24: `1.0.0-beta1`-`1.0.0-beta25` + - 25-49: `1.0.0-rc1-1.0.0-rc25` + - 50: `1.0.0` + - 51-99: `1.0.0-1`-`1.0.0-49` + - (`CLIENT_VERSION_REVISION` rolls over) + - 0-24: `1.0.1-beta1`-`1.0.1-beta25` + +- Change `CLIENT_VERSION_IS_RELEASE` to false while Zcash is in beta-test phase. ### B2. write release notes From 5428c6ca3415b0121d4ba8862be7a50be9b83779 Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Sun, 2 Oct 2016 19:15:01 +1300 Subject: [PATCH 3/4] Formatting fix --- doc/release-process.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/release-process.md b/doc/release-process.md index f01e6d33c..0ee15ce8f 100644 --- a/doc/release-process.md +++ b/doc/release-process.md @@ -27,7 +27,7 @@ In `configure.ac` and `clientversion.h`: - Increment `CLIENT_VERSION_BUILD` according to the following schema: - 0-24: `1.0.0-beta1`-`1.0.0-beta25` - - 25-49: `1.0.0-rc1-1.0.0-rc25` + - 25-49: `1.0.0-rc1`-`1.0.0-rc25` - 50: `1.0.0` - 51-99: `1.0.0-1`-`1.0.0-49` - (`CLIENT_VERSION_REVISION` rolls over) From 0fafbd5d0aa4c24e36af81afe92c8ea592c7d364 Mon Sep 17 00:00:00 2001 From: Daira Hopwood Date: Sun, 2 Oct 2016 16:44:56 +0100 Subject: [PATCH 4/4] Repair FormatSubVersion tests. refs #1138 Signed-off-by: Daira Hopwood --- src/test/util_tests.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/test/util_tests.cpp b/src/test/util_tests.cpp index 3309e2e38..46114c066 100644 --- a/src/test/util_tests.cpp +++ b/src/test/util_tests.cpp @@ -351,8 +351,16 @@ BOOST_AUTO_TEST_CASE(test_FormatSubVersion) std::vector comments2; comments2.push_back(std::string("comment1")); comments2.push_back(std::string("comment2")); - BOOST_CHECK_EQUAL(FormatSubVersion("Test", 99900, std::vector()),std::string("/Test:0.9.99/")); - BOOST_CHECK_EQUAL(FormatSubVersion("Test", 99900, comments),std::string("/Test:0.9.99(comment1)/")); - BOOST_CHECK_EQUAL(FormatSubVersion("Test", 99900, comments2),std::string("/Test:0.9.99(comment1; comment2)/")); + BOOST_CHECK_EQUAL(FormatSubVersion("Test", 99900, std::vector()), std::string("/Test:0.9.99-beta1/")); + BOOST_CHECK_EQUAL(FormatSubVersion("Test", 99924, std::vector()), std::string("/Test:0.9.99-beta25/")); + BOOST_CHECK_EQUAL(FormatSubVersion("Test", 99925, std::vector()), std::string("/Test:0.9.99-rc1/")); + BOOST_CHECK_EQUAL(FormatSubVersion("Test", 99949, std::vector()), std::string("/Test:0.9.99-rc25/")); + BOOST_CHECK_EQUAL(FormatSubVersion("Test", 99950, std::vector()), std::string("/Test:0.9.99/")); + BOOST_CHECK_EQUAL(FormatSubVersion("Test", 99951, std::vector()), std::string("/Test:0.9.99-1/")); + BOOST_CHECK_EQUAL(FormatSubVersion("Test", 99999, std::vector()), std::string("/Test:0.9.99-49/")); + BOOST_CHECK_EQUAL(FormatSubVersion("Test", 99900, comments), std::string("/Test:0.9.99-beta1(comment1)/")); + BOOST_CHECK_EQUAL(FormatSubVersion("Test", 99950, comments), std::string("/Test:0.9.99(comment1)/")); + BOOST_CHECK_EQUAL(FormatSubVersion("Test", 99900, comments2), std::string("/Test:0.9.99-beta1(comment1; comment2)/")); + BOOST_CHECK_EQUAL(FormatSubVersion("Test", 99950, comments2), std::string("/Test:0.9.99(comment1; comment2)/")); } BOOST_AUTO_TEST_SUITE_END()