Apache Lucene open-source search software
LUCENE-10200: store git revision in the release folder and read it back from buildAndPushRelease (#419)
Dawid Weiss0544819b7892
diff --git a/dev-tools/scripts/buildAndPushRelease.py b/dev-tools/scripts/buildAndPushRelease.pyindex e47edd80bd7..98c141a7db4 100755--- a/dev-tools/scripts/buildAndPushRelease.py+++ b/dev-tools/scripts/buildAndPushRelease.py@@ -30,7 +30,6 @@ import xml.etree.ElementTree as ETimport scriptutilLOG = '/tmp/release.log'-REV_FILE = '/tmp/lucene-rev.txt'dev_mode = Falsedef log(msg):@@ -108,8 +107,6 @@ def prepare(root, version, gpg_key_id, gpg_password, gpg_home=None, sign_gradle=rev = getGitRev()print(' git rev: %s' % rev)log('\nGIT rev: %s\n' % rev)- with open(REV_FILE, mode='wb') as f:- f.write(rev.encode('UTF-8'))print(' Check DOAP files')checkDOAPfiles(version)@@ -203,14 +200,16 @@ def normalizeVersion(tup):return '.'.join(tup) + suffix-def pushLocal(version, root, rev, rcNum, localDir):+def pushLocal(version, root, rcNum, localDir):print('Push local [%s]...' % localDir)os.makedirs(localDir)- dir = 'lucene-%s-RC%d-rev%s' % (version, rcNum, rev)+ lucene_dist_dir = '%s/lucene/distribution/build/release' % root+ rev = open('%s/lucene/distribution/build/release/.gitrev' % root, encoding='UTF-8').read()++ dir = 'lucene-%s-RC%d-rev-%s' % (version, rcNum, rev)os.makedirs('%s/%s/lucene' % (localDir, dir))print(' Lucene')- lucene_dist_dir = '%s/lucene/distribution/build/release' % rootos.chdir(lucene_dist_dir)print(' archive...')if os.path.exists('lucene.tar'):@@ -390,13 +389,12 @@ def main():c.key_password = Noneif c.prepare:- rev = prepare(c.root, c.version, c.key_id, c.key_password, gpg_home=gpg_home, sign_gradle=c.sign_method_gradle)+ prepare(c.root, c.version, c.key_id, c.key_password, gpg_home=gpg_home, sign_gradle=c.sign_method_gradle)else:os.chdir(c.root)- rev = open(REV_FILE, encoding='UTF-8').read()if c.push_local:- url = pushLocal(c.version, c.root, rev, c.rc_num, c.push_local)+ url = pushLocal(c.version, c.root, c.rc_num, c.push_local)else:url = Nonediff --git a/dev-tools/scripts/smokeTestRelease.py b/dev-tools/scripts/smokeTestRelease.pyindex 999a15303b4..4e98dd4600b 100755--- a/dev-tools/scripts/smokeTestRelease.py+++ b/dev-tools/scripts/smokeTestRelease.py@@ -936,11 +936,11 @@ def make_java_config(parser, java17_home):return jc(run_java11, java11_home, run_java17, java17_home)version_re = re.compile(r'(\d+\.\d+\.\d+(-ALPHA|-BETA)?)')-revision_re = re.compile(r'rev([a-f\d]+)')+revision_re = re.compile(r'rev-([a-f\d]+)')def parse_config():epilogue = textwrap.dedent('''Example usage:- python3 -u dev-tools/scripts/smokeTestRelease.py https://dist.apache.org/repos/dist/dev/lucene/lucene-6.0.1-RC2-revc7510a0...+ python3 -u dev-tools/scripts/smokeTestRelease.py https://dist.apache.org/repos/dist/dev/lucene/lucene-9.0.0-RC1-rev-c7510a0...''')description = 'Utility to test a release.'parser = argparse.ArgumentParser(description=description, epilog=epilogue,diff --git a/gradle/generation/kuromoji.gradle b/gradle/generation/kuromoji.gradleindex 566eaec4ceb..5754bd68d6d 100644--- a/gradle/generation/kuromoji.gradle+++ b/gradle/generation/kuromoji.gradle@@ -73,7 +73,10 @@ configure(project(":lucene:analysis:kuromoji")) {// Apply patch via local git.project.quietExec {workingDir = unpackedDir- executable "git" // TODO: better use jgit to apply patch, this is not portable!!!+ // TODO: Uwe says: better use jgit to apply patch, this is not portable!!!+ // Dawid answers: (LUCENE-10215) jgit's patch was broken - would not handle binary patches+ // Seems like this has been fixed: https://gerrit.googlesource.com/jgit/+/10ac4499115965ff10e547a0632c89873a06cf91+ executable "git"args += ["apply",file("src/tools/patches/Noun.proper.csv.patch").absolutePathdiff --git a/lucene/distribution/build.gradle b/lucene/distribution/build.gradleindex 1cd0ba21dcc..9da62f00175 100644--- a/lucene/distribution/build.gradle+++ b/lucene/distribution/build.gradle@@ -17,6 +17,9 @@import org.apache.lucene.gradle.Checksum+import java.nio.charset.StandardCharsets+import java.nio.file.Files+plugins {id 'signing'}@@ -73,6 +76,20 @@ task computeChecksums(type: Checksum) {}+task prepareGitRev() {+ dependsOn ":gitStatus"++ ext.outputFile = file("${buildDir}/.gitrev")++ outputs.file(ext.outputFile)+ inputs.property("gitrev", provider { -> rootProject.ext.gitRev })++ doFirst {+ Files.writeString(ext.outputFile.toPath(), rootProject.ext.gitRev, StandardCharsets.UTF_8)+ }+}++// Assemble everything needed in the release folder structure.task assembleRelease(type: Sync) {description "Assemble all Lucene artifacts for a release."@@ -85,6 +102,7 @@ task assembleRelease(type: Sync) {into "maven"})+ from tasks.prepareGitRevfrom tasks.assembleSourceTgzfrom tasks.assembleBinaryTgzdiff --git a/lucene/distribution/src/binary-release/README.md b/lucene/distribution/src/binary-release/README.mdindex bb09f59b697..e3c9f641bac 100644--- a/lucene/distribution/src/binary-release/README.md+++ b/lucene/distribution/src/binary-release/README.md@@ -27,9 +27,9 @@ and an API that can easily be used to add search capabilities to applications.* Please join the Lucene-User mailing list by sending a message to:-## Files in a binary distribution+## Files in this binary distribution-The following sub-folders are included in the binary Lucene distribution:+The following sub-folders are included in the binary distribution of Lucene:* `bin/`:Convenience scripts to launch Lucene Luke and other index-maintenance tools.@@ -40,6 +40,10 @@ The following sub-folders are included in the binary Lucene distribution:* `licenses/`Third-party licenses and notice files.+Please note that this package does not include all the binary dependencies+of all Lucene modules. Up-to-date dependency information for each Lucene+module is published to Maven central (as Maven POMs).+To review the documentation, read the main documentation page, located at:`docs/index.html`