You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by mi...@apache.org on 2012/09/25 23:08:52 UTC

svn commit: r1390139 - in /lucene/dev/trunk: ./ dev-tools/ dev-tools/scripts/smokeTestRelease.py solr/ solr/webapp/ solr/webapp/build.xml

Author: mikemccand
Date: Tue Sep 25 21:08:51 2012
New Revision: 1390139

URL: http://svn.apache.org/viewvc?rev=1390139&view=rev
Log:
SOLR-3879: don't ship servlet-api*.jar

Modified:
    lucene/dev/trunk/   (props changed)
    lucene/dev/trunk/dev-tools/   (props changed)
    lucene/dev/trunk/dev-tools/scripts/smokeTestRelease.py
    lucene/dev/trunk/solr/   (props changed)
    lucene/dev/trunk/solr/webapp/   (props changed)
    lucene/dev/trunk/solr/webapp/build.xml

Modified: lucene/dev/trunk/dev-tools/scripts/smokeTestRelease.py
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/dev-tools/scripts/smokeTestRelease.py?rev=1390139&r1=1390138&r2=1390139&view=diff
==============================================================================
--- lucene/dev/trunk/dev-tools/scripts/smokeTestRelease.py (original)
+++ lucene/dev/trunk/dev-tools/scripts/smokeTestRelease.py Tue Sep 25 21:08:51 2012
@@ -15,6 +15,7 @@
 
 import os
 import tarfile
+import zipfile
 import threading
 import traceback
 import subprocess
@@ -33,6 +34,7 @@ import filecmp
 import platform
 import checkJavaDocs
 import checkJavadocLinks
+import io
 
 # This tool expects to find /lucene and /solr off the base URL.  You
 # must have a working gpg, tar, unzip in your path.  This has been
@@ -155,7 +157,41 @@ def download(name, urlString, tmpDir, qu
     
 def load(urlString):
   return urllib.request.urlopen(urlString).read().decode('utf-8')
+
+def noJavaPackageClasses(desc, file):
+  with zipfile.ZipFile(file) as z2:
+    for name2 in z2.namelist():
+      if name2.endswith('.class') and (name2.startswith('java/') or name2.startswith('javax/')):
+        raise RuntimeError('%s contains sheisty class "%s"' % \
+                           (desc, name2))
+
+def checkAllLuceneJARs(root):
+  print('    make sure Lucene JARs don\'t have javax.* or java.* classes...')  
+  for root, dirs, files in os.walk(root):
+    if root.endswith('demo/lib'):
+      # Lucene demo intentionally ships servlet-api JAR:
+      continue
+    
+    for file in files:
+      if file.lower().endswith('.jar'):
+        fullPath = '%s/%s' % (root, file)
+        noJavaPackageClasses('JAR file "%s"' % fullPath, fullPath)
   
+def checkSolrWAR(warFileName):
+
+  """
+  Crawls for JARs inside the WAR and ensures there are no classes
+  under java.* or javax.* namespace.
+  """
+
+  print('    make sure WAR file has no javax.* or java.* classes...')
+
+  with zipfile.ZipFile(warFileName, 'r') as z:
+    for name in z.namelist():
+      if name.endswith('.jar'):
+        noJavaPackageClasses('JAR file %s inside WAR file %s' % (name, warFileName),
+                             io.BytesIO(z.read(name)))
+        
 def checkSigs(project, urlString, version, tmpDir, isSigned):
 
   print('  test basics...')
@@ -530,8 +566,12 @@ def verifyUnpacked(project, artifact, un
 
   else:
     if project == 'lucene':
+      checkAllLuceneJARs(os.getcwd())
       testDemo(isSrc, version)
+
     else:
+      checkSolrWAR('%s/example/webapps/solr.war' % unpackPath)
+
       print('    copying unpacked distribution for Java 6 ...')
       java6UnpackPath = '%s-java6' %unpackPath
       if os.path.exists(java6UnpackPath):

Modified: lucene/dev/trunk/solr/webapp/build.xml
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/webapp/build.xml?rev=1390139&r1=1390138&r2=1390139&view=diff
==============================================================================
--- lucene/dev/trunk/solr/webapp/build.xml (original)
+++ lucene/dev/trunk/solr/webapp/build.xml Tue Sep 25 21:08:51 2012
@@ -48,7 +48,7 @@
          webxml="web/WEB-INF/web.xml"
          manifest="${manifest.file}">
       <lib dir="${common-solr.dir}/core/lib" excludes="${exclude.from.war},${common.classpath.excludes}">
-        <exclude name="servlet-api*.jar" />
+        <exclude name="*servlet-api*.jar" />
         <exclude name="easymock-*.jar" />
       </lib>
       <lib dir="${common-solr.dir}/solrj/lib" excludes="${exclude.from.war},${common.classpath.excludes}"/>