Apache Lucene open-source search software
Correct python release scripts for the new location of base version (#14798)
Dawid Weiss35f9ca26b030
diff --git a/.gitignore b/.gitignoreindex 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.mdindex 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 toreleasing 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.txtdiff --git a/dev-tools/scripts/addVersion.py b/dev-tools/scripts/addVersion.pyindex 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.pyindex 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.pyindex 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):breakelse: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)