Merge pull request #5815 from daira/hotfix-versioning

Change the numbering convention for hotfixes
This commit is contained in:
Marshall Gaucher 2022-04-26 10:32:18 -07:00 committed by GitHub
commit 6ce896e878
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 55 additions and 50 deletions

View File

@ -1,14 +1,14 @@
Hotfix Release Process Hotfix Release Process
====================== ======================
Hotfix releases are versioned by incrementing the build number of the latest Hotfix releases are versioned by incrementing the patch number of the latest
release. For example: release. For example:
First hotfix: v1.0.11 -> v1.0.11-1 First hotfix: v1.0.0 -> v1.0.1
Second hotfix: v1.0.11-1 -> v1.0.11-2 Second hotfix: v1.0.1 -> v1.0.2
In the commands below, <RELEASE> and <RELEASE_PREV> are prefixed with a v, ie. In the commands below, <RELEASE> and <RELEASE_PREV> are prefixed with a v, ie.
v1.0.11 (not 1.0.11). v1.0.2 (not 1.0.2).
## Create a hotfix branch ## Create a hotfix branch

View File

@ -14,15 +14,9 @@ is a common reason.)
### Pre-release checklist: ### Pre-release checklist:
Check that dependencies are properly hosted by looking at the `check-depends` builder: Check that dependencies are properly hosted.
https://ci.z.cash/#/builders/1 Check that there are no surprising performance regressions.
Check that there are no surprising performance regressions:
https://speed.z.cash
Ensure that new performance metrics appear on that site.
Update `src/chainparams.cpp` nMinimumChainWork with information from the getblockchaininfo rpc. Update `src/chainparams.cpp` nMinimumChainWork with information from the getblockchaininfo rpc.
@ -70,7 +64,7 @@ progress bar displayed during the build process.
## Release process ## Release process
In the commands below, <RELEASE> and <RELEASE_PREV> are prefixed with a v, ie. In the commands below, <RELEASE> and <RELEASE_PREV> are prefixed with a v, ie.
v1.0.9 (not 1.0.9). v1.1.0 (not 1.1.0).
### Create the release branch ### Create the release branch
@ -82,8 +76,8 @@ changes to that branch locally:
Examples: Examples:
$ ./zcutil/make-release.py v1.0.9 v1.0.8-1 v1.0.8-1 120000 $ ./zcutil/make-release.py v1.1.0 v1.0.0 v1.0.0 120000
$ ./zcutil/make-release.py v1.0.13 v1.0.13-rc1 v1.0.12 222900 $ ./zcutil/make-release.py v1.1.0 v1.1.0-rc1 v1.0.0 222900
### Create, Review, and Merge the release branch pull request ### Create, Review, and Merge the release branch pull request
@ -121,8 +115,8 @@ Then create the git tag. The `-s` means the release tag will be signed.
Enter "Release <version>." and save when prompted for a commit message. Enter "Release <version>." and save when prompted for a commit message.
**CAUTION:** Remember the `v` at the beginning here: **CAUTION:** Remember the `v` at the beginning here:
$ git tag -s v1.0.9 $ git tag -s v1.1.0
$ git push origin v1.0.9 $ git push origin v1.1.0
## Make and deploy deterministic builds ## Make and deploy deterministic builds

View File

@ -55,7 +55,7 @@ def parse_args(args):
p.add_argument( p.add_argument(
'RELEASE_VERSION', 'RELEASE_VERSION',
type=Version.parse_arg, type=Version.parse_arg,
help='The release version: vX.Y.Z-N', help='The release version: vX.Y.Z',
) )
p.add_argument( p.add_argument(
'RELEASE_PREV', 'RELEASE_PREV',
@ -145,7 +145,9 @@ def verify_tags(releaseprev, releasefrom):
for tag in sh_out('git', 'tag', '--list').splitlines(): for tag in sh_out('git', 'tag', '--list').splitlines():
if candidatergx.match(tag): if candidatergx.match(tag):
candidates.append(Version.parse_arg(tag)) v = Version.parse(tag)
if v is not None:
candidates.append(v)
candidates.sort() candidates.sort()
try: try:
@ -196,9 +198,9 @@ def verify_version(release, releaseprev, hotfix):
expected = Version( expected = Version(
releaseprev.major, releaseprev.major,
releaseprev.minor, releaseprev.minor,
releaseprev.patch, releaseprev.patch + 1,
releaseprev.betarc, releaseprev.betarc,
releaseprev.hotfix + 1 if releaseprev.hotfix else 1, None
) )
if release != expected: if release != expected:
raise SystemExit( raise SystemExit(
@ -226,7 +228,7 @@ def initialize_git(release, hotfix):
), ),
) )
logging.info('Pulling to latest master.') logging.info('Ensuring we are up to date with the branch to be released...')
sh_log('git', 'pull', '--ff-only') sh_log('git', 'pull', '--ff-only')
branch = 'release-' + release.vtext branch = 'release-' + release.vtext
@ -488,9 +490,24 @@ class Version (object):
) )
@staticmethod @staticmethod
def parse_arg(text): def parse(text):
m = Version.RGX.match(text) m = Version.RGX.match(text)
if m is None: if m is None:
return None
else:
[major, minor, patch, _, betarc, hyphen] = m.groups()
return Version(
int(major),
int(minor),
int(patch),
betarc,
int(hyphen) if hyphen is not None else None,
)
@staticmethod
def parse_arg(text):
v = Version.parse(text)
if v is None:
raise argparse.ArgumentTypeError( raise argparse.ArgumentTypeError(
'Could not parse version {!r} against regex {}'.format( 'Could not parse version {!r} against regex {}'.format(
text, text,
@ -498,39 +515,32 @@ class Version (object):
), ),
) )
else: else:
[major, minor, patch, _, betarc, hotfix] = m.groups() return v
return Version(
int(major),
int(minor),
int(patch),
betarc,
int(hotfix) if hotfix is not None else None,
)
def __init__(self, major, minor, patch, betarc, hotfix): def __init__(self, major, minor, patch, betarc, hyphen):
for i in [major, minor, patch]: for i in [major, minor, patch]:
assert type(i) is int, i assert type(i) is int, i
assert betarc in {None, 'rc', 'beta'}, betarc assert betarc in {None, 'rc', 'beta'}, betarc
assert hotfix is None or type(hotfix) is int, hotfix assert hyphen is None or type(hyphen) is int, hyphen
if betarc is not None: if betarc is not None:
assert hotfix is not None, (betarc, hotfix) assert hyphen is not None, (betarc, hyphen)
self.major = major self.major = major
self.minor = minor self.minor = minor
self.patch = patch self.patch = patch
self.betarc = betarc self.betarc = betarc
self.hotfix = hotfix self.hyphen = hyphen
if hotfix is None: if hyphen is None:
self.build = 50 self.build = 50
else: else:
assert hotfix > 0, hotfix assert hyphen > 0, hyphen
if betarc is None: if betarc is None:
assert hotfix < 50, hotfix assert hyphen < 50, hyphen
self.build = 50 + hotfix self.build = 50 + hyphen
else: else:
assert hotfix < 26, hotfix assert hyphen < 26, hyphen
self.build = {'beta': 0, 'rc': 25}[betarc] + hotfix - 1 self.build = {'beta': 0, 'rc': 25}[betarc] + hyphen - 1
@property @property
def novtext(self): def novtext(self):
@ -547,29 +557,29 @@ class Version (object):
def _novtext(self, debian): def _novtext(self, debian):
novtext = '{}.{}.{}'.format(self.major, self.minor, self.patch) novtext = '{}.{}.{}'.format(self.major, self.minor, self.patch)
if self.hotfix is None: if self.hyphen is None:
return novtext return novtext
else: else:
assert self.hotfix > 0, self.hotfix assert self.hyphen > 0, self.hyphen
if self.betarc is None: if self.betarc is None:
assert self.hotfix < 50, self.hotfix assert self.hyphen < 50, self.hyphen
sep = '+' if debian else '-' sep = '+' if debian else '-'
return '{}{}{}'.format(novtext, sep, self.hotfix) return '{}{}{}'.format(novtext, sep, self.hyphen)
else: else:
assert self.hotfix < 26, self.hotfix assert self.hyphen < 26, self.hyphen
sep = '~' if debian else '-' sep = '~' if debian else '-'
return '{}{}{}{}'.format( return '{}{}{}{}'.format(
novtext, novtext,
sep, sep,
self.betarc, self.betarc,
self.hotfix, self.hyphen,
) )
def __repr__(self): def __repr__(self):
return '<Version {}>'.format(self.vtext) return '<Version {}>'.format(self.vtext)
def _sort_tup(self): def _sort_tup(self):
if self.hotfix is None: if self.hyphen is None:
prio = 2 prio = 2
else: else:
prio = {'beta': 0, 'rc': 1, None: 3}[self.betarc] prio = {'beta': 0, 'rc': 1, None: 3}[self.betarc]
@ -579,7 +589,7 @@ class Version (object):
self.minor, self.minor,
self.patch, self.patch,
prio, prio,
self.hotfix, self.hyphen,
) )
def __lt__(self, other): def __lt__(self, other):
@ -646,7 +656,8 @@ class TestVersion (unittest.TestCase):
cases = [ cases = [
'v07.0.0', 'v07.0.0',
'v1.0.03', 'v1.0.03',
'v1.2.3-0', # Hotfix numbers must begin w/ 1 'v1.2.3-0',
'v1.2.3-foobar',
'v1.2.3~0', 'v1.2.3~0',
'v1.2.3+0', 'v1.2.3+0',
'1.2.3', '1.2.3',