mirror of https://github.com/apache/lucene.git
LUCENE-7542: Release smoker should fail when CHANGES.txt has a release section for a future release
This commit is contained in:
parent
cbc83929e7
commit
7d7e362d6f
|
@ -431,6 +431,7 @@ reChangesSectionHREF = re.compile('<a id="(.*?)".*?>(.*?)</a>', re.IGNORECASE)
|
||||||
reUnderbarNotDashHTML = re.compile(r'<li>(\s*(LUCENE|SOLR)_\d\d\d\d+)')
|
reUnderbarNotDashHTML = re.compile(r'<li>(\s*(LUCENE|SOLR)_\d\d\d\d+)')
|
||||||
reUnderbarNotDashTXT = re.compile(r'\s+((LUCENE|SOLR)_\d\d\d\d+)', re.MULTILINE)
|
reUnderbarNotDashTXT = re.compile(r'\s+((LUCENE|SOLR)_\d\d\d\d+)', re.MULTILINE)
|
||||||
def checkChangesContent(s, version, name, project, isHTML):
|
def checkChangesContent(s, version, name, project, isHTML):
|
||||||
|
currentVersionTuple = versionToTuple(version, name)
|
||||||
|
|
||||||
if isHTML and s.find('Release %s' % version) == -1:
|
if isHTML and s.find('Release %s' % version) == -1:
|
||||||
raise RuntimeError('did not see "Release %s" in %s' % (version, name))
|
raise RuntimeError('did not see "Release %s" in %s' % (version, name))
|
||||||
|
@ -459,7 +460,8 @@ def checkChangesContent(s, version, name, project, isHTML):
|
||||||
raise RuntimeError('did not see "%s" in %s' % (sub, name))
|
raise RuntimeError('did not see "%s" in %s' % (sub, name))
|
||||||
|
|
||||||
if isHTML:
|
if isHTML:
|
||||||
# Make sure a section only appears once under each release:
|
# Make sure that a section only appears once under each release,
|
||||||
|
# and that each release is not greater than the current version
|
||||||
seenIDs = set()
|
seenIDs = set()
|
||||||
seenText = set()
|
seenText = set()
|
||||||
|
|
||||||
|
@ -468,6 +470,9 @@ def checkChangesContent(s, version, name, project, isHTML):
|
||||||
if text.lower().startswith('release '):
|
if text.lower().startswith('release '):
|
||||||
release = text[8:].strip()
|
release = text[8:].strip()
|
||||||
seenText.clear()
|
seenText.clear()
|
||||||
|
releaseTuple = versionToTuple(release, name)
|
||||||
|
if releaseTuple > currentVersionTuple:
|
||||||
|
raise RuntimeError('Future release %s is greater than %s in %s' % (release, version, name))
|
||||||
if id in seenIDs:
|
if id in seenIDs:
|
||||||
raise RuntimeError('%s has duplicate section "%s" under release "%s"' % (name, text, release))
|
raise RuntimeError('%s has duplicate section "%s" under release "%s"' % (name, text, release))
|
||||||
seenIDs.add(id)
|
seenIDs.add(id)
|
||||||
|
@ -475,6 +480,27 @@ def checkChangesContent(s, version, name, project, isHTML):
|
||||||
raise RuntimeError('%s has duplicate section "%s" under release "%s"' % (name, text, release))
|
raise RuntimeError('%s has duplicate section "%s" under release "%s"' % (name, text, release))
|
||||||
seenText.add(text)
|
seenText.add(text)
|
||||||
|
|
||||||
|
|
||||||
|
reVersion = re.compile(r'(\d+)\.(\d+)(?:\.(\d+))?\s*(-alpha|-beta|final|RC\d+)?\s*(?:\[.*\])?', re.IGNORECASE)
|
||||||
|
def versionToTuple(version, name):
|
||||||
|
versionMatch = reVersion.match(version)
|
||||||
|
if versionMatch is None:
|
||||||
|
raise RuntimeError('Version %s in %s cannot be parsed' % (version, name))
|
||||||
|
versionTuple = versionMatch.groups()
|
||||||
|
while versionTuple[-1] is None or versionTuple[-1] == '':
|
||||||
|
versionTuple = versionTuple[:-1]
|
||||||
|
if versionTuple[-1].lower() == '-alpha':
|
||||||
|
versionTuple = versionTuple[:-1] + ('0',)
|
||||||
|
elif versionTuple[-1].lower() == '-beta':
|
||||||
|
versionTuple = versionTuple[:-1] + ('1',)
|
||||||
|
elif versionTuple[-1].lower() == 'final':
|
||||||
|
versionTuple = versionTuple[:-2] + ('100',)
|
||||||
|
elif versionTuple[-1].lower()[:2] == 'rc':
|
||||||
|
versionTuple = versionTuple[:-2] + (versionTuple[-1][2:],)
|
||||||
|
print('%s: %s' % (version, versionTuple))
|
||||||
|
return versionTuple
|
||||||
|
|
||||||
|
|
||||||
reUnixPath = re.compile(r'\b[a-zA-Z_]+=(?:"(?:\\"|[^"])*"' + '|(?:\\\\.|[^"\'\\s])*' + r"|'(?:\\'|[^'])*')" \
|
reUnixPath = re.compile(r'\b[a-zA-Z_]+=(?:"(?:\\"|[^"])*"' + '|(?:\\\\.|[^"\'\\s])*' + r"|'(?:\\'|[^'])*')" \
|
||||||
+ r'|(/(?:\\.|[^"\'\s])*)' \
|
+ r'|(/(?:\\.|[^"\'\s])*)' \
|
||||||
+ r'|("/(?:\\.|[^"])*")' \
|
+ r'|("/(?:\\.|[^"])*")' \
|
||||||
|
|
Loading…
Reference in New Issue