lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sar...@apache.org
Subject [6/6] lucene-solr:branch_6_0: LUCENE-7542: Release smoker should fail when CHANGES.txt has a release section for a future release
Date Thu, 17 Nov 2016 17:58:23 GMT
LUCENE-7542: Release smoker should fail when CHANGES.txt has a release section for a future
release


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/b354ee3d
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/b354ee3d
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/b354ee3d

Branch: refs/heads/branch_6_0
Commit: b354ee3dfc31f39a7154ca53bc2f02b57e2faf0a
Parents: 3e79bac
Author: Steve Rowe <sarowe@apache.org>
Authored: Thu Nov 17 12:54:33 2016 -0500
Committer: Steve Rowe <sarowe@apache.org>
Committed: Thu Nov 17 12:57:21 2016 -0500

----------------------------------------------------------------------
 dev-tools/scripts/smokeTestRelease.py | 28 +++++++++++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/b354ee3d/dev-tools/scripts/smokeTestRelease.py
----------------------------------------------------------------------
diff --git a/dev-tools/scripts/smokeTestRelease.py b/dev-tools/scripts/smokeTestRelease.py
index b7608f1..31b5ace 100644
--- a/dev-tools/scripts/smokeTestRelease.py
+++ b/dev-tools/scripts/smokeTestRelease.py
@@ -424,6 +424,7 @@ reChangesSectionHREF = re.compile('<a id="(.*?)".*?>(.*?)</a>',
re.IGNORECASE)
 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)
 def checkChangesContent(s, version, name, project, isHTML):
+  currentVersionTuple = versionToTuple(version, name)
 
   if isHTML and s.find('Release %s' % version) == -1:
     raise RuntimeError('did not see "Release %s" in %s' % (version, name))
@@ -452,7 +453,8 @@ def checkChangesContent(s, version, name, project, isHTML):
         raise RuntimeError('did not see "%s" in %s' % (sub, name))
 
   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()
     seenText = set()
 
@@ -461,6 +463,9 @@ def checkChangesContent(s, version, name, project, isHTML):
       if text.lower().startswith('release '):
         release = text[8:].strip()
         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:
         raise RuntimeError('%s has duplicate section "%s" under release "%s"' % (name, text,
release))
       seenIDs.add(id)
@@ -468,6 +473,27 @@ def checkChangesContent(s, version, name, project, isHTML):
         raise RuntimeError('%s has duplicate section "%s" under release "%s"' % (name, text,
release))
       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"|'(?:\\'|[^'])*')"
\
                         + r'|(/(?:\\.|[^"\'\s])*)' \
                         + r'|("/(?:\\.|[^"])*")'   \


Mime
View raw message