From f86a366b97b3c466fa355984e85bf55f5122fed6 Mon Sep 17 00:00:00 2001 From: Michael McCandless Date: Wed, 26 Sep 2012 14:51:36 +0000 Subject: [PATCH] LUCENE-4430: check for/warn about javax.* and java.* class in any Lucene/Solr, or dependency JARs git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1390534 13f79535-47bb-0310-9956-ffa450edef68 --- dev-tools/scripts/smokeTestRelease.py | 31 +++++++++++++++++++++------ 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/dev-tools/scripts/smokeTestRelease.py b/dev-tools/scripts/smokeTestRelease.py index 2150167ac05..bb234bf1ba1 100644 --- a/dev-tools/scripts/smokeTestRelease.py +++ b/dev-tools/scripts/smokeTestRelease.py @@ -162,17 +162,32 @@ 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)) + 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): +def normSlashes(path): + return path.replace(os.sep, '/') + +def checkAllJARs(topDir, project): + print(' make sure JARs don\'t have javax.* or java.* classes...') + for root, dirs, files in os.walk(topDir): + + normRoot = normSlashes(root) + + if project == 'solr' and normRoot.endswith('/example/lib'): + # Solr's example intentionally ships servlet JAR: + continue + for file in files: if file.lower().endswith('.jar'): + if project == 'solr': + + if normRoot.endswith('/contrib/dataimporthandler/lib') and (file.startswith('mail-') or file.startswith('activation-')): + print(' **WARNING**: skipping check of %s/%s: it has javax.* classes' % (root, file)) + continue + fullPath = '%s/%s' % (root, file) noJavaPackageClasses('JAR file "%s"' % fullPath, fullPath) - + def checkSolrWAR(warFileName): """ @@ -561,8 +576,10 @@ def verifyUnpacked(project, artifact, unpackPath, version, tmpDir): testNotice(unpackPath) else: + + checkAllJARs(os.getcwd(), project) + if project == 'lucene': - checkAllLuceneJARs(os.getcwd()) testDemo(isSrc, version) else: