LUCENE-10200: store git revision in the release folder and read it back from buildAndPushRelease (#419)

This commit is contained in:
Dawid Weiss 2021-11-01 09:29:06 +01:00 committed by GitHub
parent 1d152c5f67
commit 0544819b78
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 37 additions and 14 deletions

View File

@ -30,7 +30,6 @@ import xml.etree.ElementTree as ET
import scriptutil
LOG = '/tmp/release.log'
REV_FILE = '/tmp/lucene-rev.txt'
dev_mode = False
def 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' % root
os.chdir(lucene_dist_dir)
print(' archive...')
if os.path.exists('lucene.tar'):
@ -390,13 +389,12 @@ def main():
c.key_password = None
if 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 = None

View File

@ -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,

View File

@ -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").absolutePath

View File

@ -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.prepareGitRev
from tasks.assembleSourceTgz
from tasks.assembleBinaryTgz

View File

@ -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:
java-user-subscribe@lucene.apache.org
## 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`