You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by sa...@apache.org on 2016/06/21 04:05:18 UTC

[14/14] lucene-solr:branch_5x: - Modernize example usage - Fail if script version is incompatible with release version

- Modernize example usage
- Fail if script version is incompatible with release version


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

Branch: refs/heads/branch_5x
Commit: 75975019ba62199c5ef7fcedf771a4a74c32b443
Parents: 530f261
Author: Steve Rowe <sa...@apache.org>
Authored: Wed May 25 16:09:22 2016 -0400
Committer: Steve Rowe <sa...@apache.org>
Committed: Tue Jun 21 00:04:52 2016 -0400

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


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/75975019/dev-tools/scripts/smokeTestRelease.py
----------------------------------------------------------------------
diff --git a/dev-tools/scripts/smokeTestRelease.py b/dev-tools/scripts/smokeTestRelease.py
index 8288a9d..3316583 100644
--- a/dev-tools/scripts/smokeTestRelease.py
+++ b/dev-tools/scripts/smokeTestRelease.py
@@ -1227,7 +1227,7 @@ revision_re = re.compile(r'rev([a-f\d]+)')
 def parse_config():
   epilogue = textwrap.dedent('''
     Example usage:
-    python3.2 -u dev-tools/scripts/smokeTestRelease.py http://people.apache.org/~whoever/staging_area/lucene-solr-4.3.0-RC1-rev1469340
+    python3 -u dev-tools/scripts/smokeTestRelease.py https://dist.apache.org/repos/dist/dev/lucene/lucene-solr-6.0.1-RC2-revc7510a0...
   ''')
   description = 'Utility to test a release.'
   parser = argparse.ArgumentParser(description=description, epilog=epilogue,
@@ -1381,8 +1381,25 @@ def confirmAllReleasesAreTestedForBackCompat(smokeVersion, unpackPath):
   else:
     print('    success!')
 
+def getScriptVersion():
+  topLevelDir = '../..'                       # Assumption: this script is in dev-tools/scripts/ of a checkout
+  m = re.compile(r'(.*)/').match(sys.argv[0]) # Get this script's directory
+  if m is not None and m.group(1) != '.':
+    origCwd = os.getcwd()
+    os.chdir(m.group(1))
+    os.chdir('../..')
+    topLevelDir = os.getcwd()
+    os.chdir(origCwd)
+  reBaseVersion = re.compile(r'version\.base\s*=\s*(\d+\.\d+)')
+  return reBaseVersion.search(open('%s/lucene/version.properties' % topLevelDir).read()).group(1)
+
 def main():
   c = parse_config()
+
+  scriptVersion = getScriptVersion()
+  if not c.version.startswith(scriptVersion + '.'):
+    raise RuntimeError('smokeTestRelease.py for %s.X is incompatible with a %s release.' % (scriptVersion, c.version))
+
   print('NOTE: output encoding is %s' % sys.stdout.encoding)
   smokeTest(c.java, c.url, c.revision, c.version, c.tmp_dir, c.is_signed, ' '.join(c.test_args))