You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by dw...@apache.org on 2025/06/17 09:40:24 UTC

(lucene) branch main updated: Correct python release scripts for the new location of base version (#14798)

This is an automated email from the ASF dual-hosted git repository.

dweiss pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/lucene.git


The following commit(s) were added to refs/heads/main by this push:
     new 35f9ca26b03 Correct python release scripts for the new location of base version (#14798)
35f9ca26b03 is described below

commit 35f9ca26b0303d8e9d6040eea5951d8fdf1f1fc1
Author: Dawid Weiss <da...@carrotsearch.com>
AuthorDate: Tue Jun 17 11:40:19 2025 +0200

    Correct python release scripts for the new location of base version (#14798)
    
    * Correct python release scripts for the new location of base version #14786
    
    * Apply reformat.
    
    * Remove test line.
    
    * Revert back to plain regexp.
    
    * Add build-options.properties to top-level files. Correct the code looking for expected strings in the manifest; jdk 24 doesn't have a not after the java.version property.
    
    * Autoformat actually broke the linter here (types). Corrected.
---
 .gitignore                            |  1 +
 dev-tools/scripts/README.md           |  2 +-
 dev-tools/scripts/addVersion.py       |  8 ++++----
 dev-tools/scripts/scriptutil.py       |  8 +++-----
 dev-tools/scripts/smokeTestRelease.py | 20 +++++++++++++++++---
 5 files changed, 26 insertions(+), 13 deletions(-)

diff --git a/.gitignore b/.gitignore
index a0d9c5612b4..3f769674c28 100644
--- a/.gitignore
+++ b/.gitignore
@@ -26,6 +26,7 @@ gradle/wrapper/gradle-wrapper.jar
 # Python
 .pydevproject
 __pycache__
+.venv
 
 # Emacs backup
 *~
diff --git a/dev-tools/scripts/README.md b/dev-tools/scripts/README.md
index e89f898119e..fe63a31967d 100644
--- a/dev-tools/scripts/README.md
+++ b/dev-tools/scripts/README.md
@@ -20,7 +20,7 @@
 This folder contains various useful scripts for developers, mostly related to
 releasing new versions of Lucene and testing those.
 
-Python scripts require Python 3.6 or avobe. To install necessary python modules, please run:
+Python scripts require Python 3.6 or above. To install necessary python modules, please run:
 
     pip3 install -r requirements.txt
 
diff --git a/dev-tools/scripts/addVersion.py b/dev-tools/scripts/addVersion.py
index 952177ca0c1..997a8a96a0f 100755
--- a/dev-tools/scripts/addVersion.py
+++ b/dev-tools/scripts/addVersion.py
@@ -104,15 +104,15 @@ def add_constant(new_version: Version, deprecate: bool):
 
 def update_build_version(new_version: Version):
   print("  changing baseVersion...", end="", flush=True)
-  filename = "build.gradle"
+  filename = "build-options.properties"
 
   def edit(buffer: list[str], _match: re.Match[str], line: str):
     if new_version.dot in line:
       return None
-    buffer.append("  String baseVersion = '" + new_version.dot + "'\n")
+    buffer.append("version.base=" + new_version.dot + "\n")
     return True
 
-  version_prop_re = re.compile(r'baseVersion\s*=\s*([\'"])(.*)\1')
+  version_prop_re = re.compile(r"version\.base=(.*)")
   changed = update_file(filename, version_prop_re, edit)
   print("done" if changed else "uptodate")
 
@@ -164,7 +164,7 @@ def parse_properties_file(filename: str):
 
 
 def main():
-  if not os.path.exists("build.gradle"):
+  if not os.path.exists("build-options.properties"):
     sys.exit("Tool must be run from the root of a source checkout.")
   current_version = Version.parse(find_current_version())
   newconf = read_config(current_version)
diff --git a/dev-tools/scripts/scriptutil.py b/dev-tools/scripts/scriptutil.py
index db83de1125e..7cbabf22abc 100644
--- a/dev-tools/scripts/scriptutil.py
+++ b/dev-tools/scripts/scriptutil.py
@@ -184,15 +184,13 @@ def attemptDownload(urlString: str, fileName: str):
       os.remove(fileName)
 
 
-version_prop_re = re.compile(r'baseVersion\s*=\s*([\'"])(.*)\1')
-
-
 def find_current_version():
+  version_prop_re = re.compile(r"version\.base=(.*)")
   script_path = os.path.dirname(os.path.realpath(__file__))
   top_level_dir = os.path.join(Path("%s/" % script_path).resolve(), os.path.pardir, os.path.pardir)
-  match = version_prop_re.search(open("%s/build.gradle" % top_level_dir).read())
+  match = version_prop_re.search(open("%s/build-options.properties" % top_level_dir).read())
   assert match
-  return match.group(2).strip()
+  return match.group(1).strip()
 
 
 if __name__ == "__main__":
diff --git a/dev-tools/scripts/smokeTestRelease.py b/dev-tools/scripts/smokeTestRelease.py
index 4948a80514b..fbcb0586cd2 100755
--- a/dev-tools/scripts/smokeTestRelease.py
+++ b/dev-tools/scripts/smokeTestRelease.py
@@ -149,13 +149,13 @@ def checkJARMetaData(desc: str, jarFile: str, gitRevision: str, version: str):
       "X-Compile-Source-JDK: %s" % BASE_JAVA_VERSION,
       "X-Compile-Target-JDK: %s" % BASE_JAVA_VERSION,
       "Specification-Version: %s" % version,
-      "X-Build-JDK: %s." % BASE_JAVA_VERSION,
+      re.compile("X-Build-JDK: %s[. ]" % re.escape(BASE_JAVA_VERSION)),
       "Extension-Name: org.apache.lucene",
     ):
       if type(verify) is not tuple:
         verify = (verify,)
       for x in verify:
-        if s.find(x) != -1:
+        if (isinstance(x, re.Pattern) and x.search(s)) or (isinstance(x, str) and s.find(x) != -1):
           break
       else:
         if len(verify) == 1:
@@ -604,7 +604,21 @@ def verifyUnpacked(java: Any, artifact: str, unpackPath: str, gitRevision: str,
     "licenses",
   ]
   if isSrc:
-    expected_src_root_files = ["build.gradle", "build-tools", "CONTRIBUTING.md", "dev-docs", "dev-tools", "gradle", "gradlew", "gradlew.bat", "help", "lucene", "settings.gradle", "versions.lock"]
+    expected_src_root_files = [
+      "build.gradle",
+      "build-options.properties",
+      "build-tools",
+      "CONTRIBUTING.md",
+      "dev-docs",
+      "dev-tools",
+      "gradle",
+      "gradlew",
+      "gradlew.bat",
+      "help",
+      "lucene",
+      "settings.gradle",
+      "versions.lock",
+    ]
     expected_src_lucene_files = ["build.gradle", "documentation", "distribution", "dev-docs"]
     is_in_list(in_root_folder, expected_src_root_files)
     is_in_list(in_lucene_folder, expected_folders)