You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by th...@apache.org on 2015/05/01 22:56:28 UTC

svn commit: r1677230 - in /lucene/dev/branches/branch_5x: ./ dev-tools/ dev-tools/scripts/addVersion.py solr/ solr/CHANGES.txt solr/build.xml

Author: thelabdude
Date: Fri May  1 20:56:28 2015
New Revision: 1677230

URL: http://svn.apache.org/r1677230
Log:
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.

Modified:
    lucene/dev/branches/branch_5x/   (props changed)
    lucene/dev/branches/branch_5x/dev-tools/   (props changed)
    lucene/dev/branches/branch_5x/dev-tools/scripts/addVersion.py
    lucene/dev/branches/branch_5x/solr/   (props changed)
    lucene/dev/branches/branch_5x/solr/CHANGES.txt   (contents, props changed)
    lucene/dev/branches/branch_5x/solr/build.xml   (contents, props changed)

Modified: lucene/dev/branches/branch_5x/dev-tools/scripts/addVersion.py
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/dev-tools/scripts/addVersion.py?rev=1677230&r1=1677229&r2=1677230&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/dev-tools/scripts/addVersion.py (original)
+++ lucene/dev/branches/branch_5x/dev-tools/scripts/addVersion.py Fri May  1 20:56:28 2015
@@ -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) 

Modified: lucene/dev/branches/branch_5x/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/CHANGES.txt?rev=1677230&r1=1677229&r2=1677230&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/CHANGES.txt (original)
+++ lucene/dev/branches/branch_5x/solr/CHANGES.txt Fri May  1 20:56:28 2015
@@ -247,6 +247,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

Modified: lucene/dev/branches/branch_5x/solr/build.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/build.xml?rev=1677230&r1=1677229&r2=1677230&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/build.xml (original)
+++ lucene/dev/branches/branch_5x/solr/build.xml Fri May  1 20:56:28 2015
@@ -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.">