Browse Source

Auto merge of #1468 - str4d:1138-change-versioning-scheme, r=str4d

Change versioning scheme

Closes #1138
pull/4/head
zkbot 8 years ago
parent
commit
fa632c1c91
  1. 27
      doc/release-process.md
  2. 36
      src/clientversion.cpp
  3. 14
      src/test/util_tests.cpp

27
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
Also, the following commands use the `ZCASH_RELEASE_PREV` bash variable for the
previous release:
$ ZCASH_RELEASE_PREV=0.11.2.z1
$ 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

36
src/clientversion.cpp

@ -8,6 +8,12 @@
#include <string>
#include <boost/preprocessor/arithmetic/add.hpp>
#include <boost/preprocessor/arithmetic/sub.hpp>
#include <boost/preprocessor/comparison/equal.hpp>
#include <boost/preprocessor/comparison/less.hpp>
#include <boost/preprocessor/control/if.hpp>
/**
* 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()

14
src/test/util_tests.cpp

@ -351,8 +351,16 @@ BOOST_AUTO_TEST_CASE(test_FormatSubVersion)
std::vector<std::string> comments2;
comments2.push_back(std::string("comment1"));
comments2.push_back(std::string("comment2"));
BOOST_CHECK_EQUAL(FormatSubVersion("Test", 99900, std::vector<std::string>()),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>()), std::string("/Test:0.9.99-beta1/"));
BOOST_CHECK_EQUAL(FormatSubVersion("Test", 99924, std::vector<std::string>()), std::string("/Test:0.9.99-beta25/"));
BOOST_CHECK_EQUAL(FormatSubVersion("Test", 99925, std::vector<std::string>()), std::string("/Test:0.9.99-rc1/"));
BOOST_CHECK_EQUAL(FormatSubVersion("Test", 99949, std::vector<std::string>()), std::string("/Test:0.9.99-rc25/"));
BOOST_CHECK_EQUAL(FormatSubVersion("Test", 99950, std::vector<std::string>()), std::string("/Test:0.9.99/"));
BOOST_CHECK_EQUAL(FormatSubVersion("Test", 99951, std::vector<std::string>()), std::string("/Test:0.9.99-1/"));
BOOST_CHECK_EQUAL(FormatSubVersion("Test", 99999, std::vector<std::string>()), 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()

Loading…
Cancel
Save