Apache Lucene open-source search software
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.
Timothy Potter1e83e3396263
diff --git a/dev-tools/scripts/addVersion.py b/dev-tools/scripts/addVersion.pyindex 2b18e436ac8..702bc4d1012 100644--- a/dev-tools/scripts/addVersion.py+++ b/dev-tools/scripts/addVersion.py@@ -118,12 +118,18 @@ 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)diff --git a/solr/CHANGES.txt b/solr/CHANGES.txtindex 7c493239c0c..59b0b1beb10 100644--- a/solr/CHANGES.txt+++ b/solr/CHANGES.txt@@ -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 releasediff --git a/solr/build.xml b/solr/build.xmlindex 43126020ec1..0cf8860a47b 100644--- a/solr/build.xml+++ b/solr/build.xml@@ -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="<luceneMatchVersion>${tests.luceneMatchVersion}<" 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.">