kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cmcc...@apache.org
Subject [kafka] branch 2.1 updated: MINOR: release.py: fix some compatibility problems.
Date Fri, 08 Feb 2019 18:27:04 GMT
This is an automated email from the ASF dual-hosted git repository.

cmccabe pushed a commit to branch 2.1
in repository https://gitbox.apache.org/repos/asf/kafka.git

The following commit(s) were added to refs/heads/2.1 by this push:
     new 70974ff  MINOR: release.py: fix some compatibility problems.
70974ff is described below

commit 70974fff637e1765e8ce43a0d9884f6ea1e2ec96
Author: Colin P. Mccabe <cmccabe@confluent.io>
AuthorDate: Mon Feb 4 14:27:50 2019 -0800

    MINOR: release.py: fix some compatibility problems.
    Rather than using sed, use built-in Python regular expressions to strip
    the SNAPSHOT expression from the pom.xml files.  Sed has different flags
    on different platforms, such as Linux.  Using Python directly here is
    more compatible, as well as being more efficient, and not requiring an
    rm command afterwards.
    When running release_notes.py, use the current Python interpreter.
    This is needed to prevent attempting to run release_notes.py with
    Python 3 on some systems.  release_notes.py will not (yet) work with
    Python 3.
    Author: Colin P. Mccabe <cmccabe@confluent.io>
    Reviewers: Magnus Edenhill <magnus@edenhill.se>, David Arthur <mumrah@gmail.com>,
Manikumar Reddy <manikumar.reddy@gmail.com>
    Closes #6198 from cmccabe/release_py
    (cherry picked from commit e942e294f0a700cdc2f94bb7f967c2e9bcb1a271)
 release.py | 29 ++++++++++++++++++++++-------
 1 file changed, 22 insertions(+), 7 deletions(-)

diff --git a/release.py b/release.py
index 802c9de..fe15f7e 100755
--- a/release.py
+++ b/release.py
@@ -141,6 +141,16 @@ def replace(path, pattern, replacement):
         for line in updated:
+def regexReplace(path, pattern, replacement):
+    updated = []
+    with open(path, 'r') as f:
+        for line in f:
+            updated.append(re.sub(pattern, replacement, line))
+    with open(path, 'w') as f:
+        for line in updated:
+            f.write(line)
 def user_ok(msg):
     ok = raw_input(msg)
     return ok.lower() == 'y'
@@ -522,12 +532,17 @@ cmd("Checking out current development branch", "git checkout -b %s %s"
% (releas
 print("Updating version numbers")
 replace("gradle.properties", "version", "version=%s" % release_version)
 replace("tests/kafkatest/__init__.py", "__version__", "__version__ = '%s'" % release_version)
-cmd("update streams quickstart pom", ["sed", "-i", ".orig"," s/-SNAPSHOT//", "streams/quickstart/pom.xml"])
-cmd("update streams quickstart java pom", ["sed", "-i", ".orig", "s/-SNAPSHOT//", "streams/quickstart/java/pom.xml"])
-cmd("update streams quickstart java pom", ["sed", "-i", ".orig", "s/-SNAPSHOT//", "streams/quickstart/java/src/main/resources/archetype-resources/pom.xml"])
-cmd("remove backup pom.xml", "rm streams/quickstart/pom.xml.orig")
-cmd("remove backup java pom.xml", "rm streams/quickstart/java/pom.xml.orig")
-cmd("remove backup java pom.xml", "rm streams/quickstart/java/src/main/resources/archetype-resources/pom.xml.orig")
+print("updating streams quickstart pom")
+regexReplace("streams/quickstart/pom.xml", "-SNAPSHOT", "")
+print("updating streams quickstart java pom")
+regexReplace("streams/quickstart/java/pom.xml", "-SNAPSHOT", "")
+print("updating streams quickstart archetype pom")
+regexReplace("streams/quickstart/java/src/main/resources/archetype-resources/pom.xml", "-SNAPSHOT",
+print("updating ducktape version.py")
+regexReplace("./tests/kafkatest/version.py", "^DEV_VERSION =.*",
+    "DEV_VERSION = KafkaVersion(\"%s-SNAPSHOT\")" % release_version)
+print("updating ducktape __init__.py")
+regexReplace("./tests/kafkatest/__init__.py", ".dev.*", "")
 # Command in explicit list due to messages with spaces
 cmd("Commiting version number updates", ["git", "commit", "-a", "-m", "Bump version to %s"
% release_version])
 # Command in explicit list due to messages with spaces
@@ -555,7 +570,7 @@ cmd("Verifying the correct year in NOTICE", "grep %s NOTICE" % current_year,
 with open(os.path.join(artifacts_dir, "RELEASE_NOTES.html"), 'w') as f:
     print("Generating release notes")
-        subprocess.check_call(["./release_notes.py", release_version], stdout=f)
+        subprocess.check_call([sys.executable, "./release_notes.py", release_version], stdout=f)
     except subprocess.CalledProcessError as e:

View raw message