SOLR-7487: Fix check-example-lucene-match-version Ant task to check luceneMatchVersion in solr/server/solr/configsets instead of example and harden error checking / validation logic.

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1677228 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Timothy Potter 2015-05-01 20:55:28 +00:00
parent e7691745ce
commit 1e83e33962
3 changed files with 32 additions and 4 deletions

View File

@ -119,11 +119,17 @@ def update_latest_constant(new_version):
changed = update_file(filename, matcher, edit)
print('done' if changed else 'uptodate')
def onerror(x):
raise x
def update_example_solrconfigs(new_version):
print(' updating example solrconfig.xml files')
matcher = re.compile('<luceneMatchVersion>')
for root,dirs,files in os.walk('solr/example'):
configset_dir = 'solr/server/solr/configsets'
if not os.path.isdir(configset_dir):
raise RuntimeError("Can't locate configset dir (layout change?) : " + configset_dir)
for root,dirs,files in os.walk(configset_dir, onerror=onerror):
for f in files:
if f == 'solrconfig.xml':
update_solrconfig(os.path.join(root, f), matcher, new_version)

View File

@ -304,6 +304,10 @@ Other Changes
* SOLR-7336: Added Replica.getState() and removed ZkStateReader state-related constants.
You should use Replica.State to compare a replica's state. (Shai Erera)
* SOLR-7487: Fix check-example-lucene-match-version Ant task to check luceneMatchVersion
in solr/server/solr/configsets instead of example and harden error checking / validation
logic. (hossman, Timothy Potter)
================== 5.1.0 ==================
Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release

View File

@ -277,10 +277,11 @@
<target name="validate" depends="check-example-lucene-match-version,check-licenses,rat-sources,check-forbidden-apis" description="Validate stuff." />
<target name="check-example-lucene-match-version">
<fail message="Some example solrconfig.xml files do not refer to the correct luceneMatchVersion: ${tests.luceneMatchVersion}">
<property name="configsets.dir" value="${server.dir}/solr/configsets"/>
<fail message="Some example solrconfig.xml files under ${configsets.dir} do not refer to the correct luceneMatchVersion: ${tests.luceneMatchVersion}">
<condition>
<resourcecount when="greater" count="0">
<fileset dir="${example}" includes="**/solrconfig.xml">
<fileset dir="${configsets.dir}" includes="**/solrconfig.xml">
<not>
<contains text="&lt;luceneMatchVersion&gt;${tests.luceneMatchVersion}&lt;" casesensitive="no"/>
</not>
@ -288,6 +289,23 @@
</resourcecount>
</condition>
</fail>
<!-- Count the immediate sub-directories of the configsets dir to ensure all sub-dirs have a solrconfig.xml -->
<resourcecount property="count.subdirs">
<dirset dir="${configsets.dir}" includes="*"/>
</resourcecount>
<!-- Ensure there is at least one sub-directory -->
<fail message="No sub-directories found under ${configsets.dir}">
<condition>
<equals arg1="${count.subdirs}" arg2="0"/>
</condition>
</fail>
<fail message="At least one sub-directory under ${configsets.dir} does not have a solrconfig.xml file">
<condition>
<resourcecount when="ne" count="${count.subdirs}">
<fileset dir="${configsets.dir}" includes="**/solrconfig.xml"/>
</resourcecount>
</condition>
</fail>
</target>
<target name="check-licenses" depends="compile-tools,resolve,load-custom-tasks" description="Validate license stuff.">