2011-06-04 06:37:48 -04:00
|
|
|
# Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
# contributor license agreements. See the NOTICE file distributed with
|
|
|
|
# this work for additional information regarding copyright ownership.
|
|
|
|
# The ASF licenses this file to You under the Apache License, Version 2.0
|
|
|
|
# (the "License"); you may not use this file except in compliance with
|
|
|
|
# the License. You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
|
|
|
|
|
|
|
import os
|
2012-09-26 14:33:46 -04:00
|
|
|
import codecs
|
2012-04-06 09:33:54 -04:00
|
|
|
import tarfile
|
2012-09-25 17:08:51 -04:00
|
|
|
import zipfile
|
2012-04-06 09:33:54 -04:00
|
|
|
import threading
|
2012-09-24 08:31:22 -04:00
|
|
|
import traceback
|
2012-04-06 09:33:54 -04:00
|
|
|
import subprocess
|
|
|
|
import signal
|
2011-06-04 06:37:48 -04:00
|
|
|
import shutil
|
|
|
|
import hashlib
|
2012-08-03 17:18:14 -04:00
|
|
|
import http.client
|
2011-06-04 06:37:48 -04:00
|
|
|
import re
|
2012-08-03 17:18:14 -04:00
|
|
|
import urllib.request, urllib.error, urllib.parse
|
|
|
|
import urllib.parse
|
2011-06-04 06:37:48 -04:00
|
|
|
import sys
|
2012-08-03 17:18:14 -04:00
|
|
|
import html.parser
|
2012-03-19 13:36:27 -04:00
|
|
|
from collections import defaultdict
|
|
|
|
import xml.etree.ElementTree as ET
|
|
|
|
import filecmp
|
|
|
|
import platform
|
2012-03-22 11:24:44 -04:00
|
|
|
import checkJavaDocs
|
2012-06-08 06:18:09 -04:00
|
|
|
import checkJavadocLinks
|
2012-09-25 17:08:51 -04:00
|
|
|
import io
|
2012-09-26 11:55:27 -04:00
|
|
|
import codecs
|
2011-06-04 06:37:48 -04:00
|
|
|
|
|
|
|
# This tool expects to find /lucene and /solr off the base URL. You
|
2012-03-19 13:36:27 -04:00
|
|
|
# must have a working gpg, tar, unzip in your path. This has been
|
|
|
|
# tested on Linux and on Cygwin under Windows 7.
|
2011-06-04 06:37:48 -04:00
|
|
|
|
2012-09-24 12:33:39 -04:00
|
|
|
cygwin = platform.system().lower().startswith('cygwin')
|
|
|
|
cygwinWindowsRoot = os.popen('cygpath -w /').read().strip().replace('\\','/') if cygwin else ''
|
|
|
|
|
2012-04-08 14:22:14 -04:00
|
|
|
def unshortenURL(url):
|
2012-08-03 17:18:14 -04:00
|
|
|
parsed = urllib.parse.urlparse(url)
|
2012-04-08 14:22:14 -04:00
|
|
|
if parsed[0] in ('http', 'https'):
|
2012-08-03 17:18:14 -04:00
|
|
|
h = http.client.HTTPConnection(parsed.netloc)
|
2012-04-08 14:22:14 -04:00
|
|
|
h.request('HEAD', parsed.path)
|
|
|
|
response = h.getresponse()
|
2012-09-24 08:31:22 -04:00
|
|
|
if int(response.status/100) == 3 and response.getheader('Location'):
|
2012-04-08 14:22:14 -04:00
|
|
|
return response.getheader('Location')
|
|
|
|
return url
|
|
|
|
|
2012-04-06 09:33:54 -04:00
|
|
|
def javaExe(version):
|
2012-06-08 06:18:09 -04:00
|
|
|
if version == '1.6':
|
2012-04-06 09:33:54 -04:00
|
|
|
path = JAVA6_HOME
|
|
|
|
elif version == '1.7':
|
|
|
|
path = JAVA7_HOME
|
|
|
|
else:
|
|
|
|
raise RuntimeError("unknown Java version '%s'" % version)
|
2012-09-24 12:33:39 -04:00
|
|
|
if cygwin:
|
|
|
|
path = os.popen('cygpath -u "%s"' % path).read().strip()
|
2012-11-05 16:13:08 -05:00
|
|
|
return 'export JAVA_HOME="%s" PATH="%s/bin:$PATH" JAVACMD="%s/bin/java"' % (path, path, path)
|
2011-06-04 06:37:48 -04:00
|
|
|
|
2012-04-06 09:33:54 -04:00
|
|
|
def verifyJavaVersion(version):
|
|
|
|
s = os.popen('%s; java -version 2>&1' % javaExe(version)).read()
|
2012-08-10 05:24:51 -04:00
|
|
|
if s.find(' version "%s.' % version) == -1:
|
2012-04-06 09:33:54 -04:00
|
|
|
raise RuntimeError('got wrong version for java %s:\n%s' % (version, s))
|
|
|
|
|
|
|
|
# http://s.apache.org/lusolr32rc2
|
|
|
|
env = os.environ
|
|
|
|
try:
|
|
|
|
JAVA6_HOME = env['JAVA6_HOME']
|
|
|
|
except KeyError:
|
|
|
|
JAVA6_HOME = '/usr/local/jdk1.6.0_27'
|
2012-11-05 16:13:08 -05:00
|
|
|
print('JAVA6_HOME is %s' % JAVA6_HOME)
|
2012-04-06 09:33:54 -04:00
|
|
|
|
|
|
|
try:
|
|
|
|
JAVA7_HOME = env['JAVA7_HOME']
|
|
|
|
except KeyError:
|
|
|
|
JAVA7_HOME = '/usr/local/jdk1.7.0_01'
|
2012-11-05 16:13:08 -05:00
|
|
|
print('JAVA7_HOME is %s' % JAVA7_HOME)
|
2012-04-06 09:33:54 -04:00
|
|
|
|
|
|
|
verifyJavaVersion('1.6')
|
|
|
|
verifyJavaVersion('1.7')
|
2011-06-23 16:09:11 -04:00
|
|
|
|
2011-06-04 06:37:48 -04:00
|
|
|
# TODO
|
|
|
|
# + verify KEYS contains key that signed the release
|
|
|
|
# + make sure changes HTML looks ok
|
|
|
|
# - verify license/notice of all dep jars
|
|
|
|
# - check maven
|
|
|
|
# - check JAR manifest version
|
|
|
|
# - check license/notice exist
|
|
|
|
# - check no "extra" files
|
|
|
|
# - make sure jars exist inside bin release
|
|
|
|
# - run "ant test"
|
|
|
|
# - make sure docs exist
|
|
|
|
# - use java5 for lucene/modules
|
|
|
|
|
|
|
|
reHREF = re.compile('<a href="(.*?)">(.*?)</a>')
|
|
|
|
|
2012-09-26 14:33:46 -04:00
|
|
|
# Set to False to avoid re-downloading the packages...
|
|
|
|
FORCE_CLEAN = True
|
2011-06-04 06:37:48 -04:00
|
|
|
|
|
|
|
def getHREFs(urlString):
|
|
|
|
|
|
|
|
# Deref any redirects
|
|
|
|
while True:
|
2012-08-03 17:18:14 -04:00
|
|
|
url = urllib.parse.urlparse(urlString)
|
|
|
|
h = http.client.HTTPConnection(url.netloc)
|
2011-06-04 06:37:48 -04:00
|
|
|
h.request('GET', url.path)
|
|
|
|
r = h.getresponse()
|
|
|
|
newLoc = r.getheader('location')
|
|
|
|
if newLoc is not None:
|
|
|
|
urlString = newLoc
|
|
|
|
else:
|
|
|
|
break
|
|
|
|
|
|
|
|
links = []
|
2012-09-24 08:31:22 -04:00
|
|
|
try:
|
|
|
|
html = urllib.request.urlopen(urlString).read().decode('UTF-8')
|
|
|
|
except:
|
|
|
|
print('\nFAILED to open url %s' % urlString)
|
2012-09-24 11:25:13 -04:00
|
|
|
traceback.print_exc()
|
2012-09-24 08:31:22 -04:00
|
|
|
raise
|
|
|
|
|
|
|
|
for subUrl, text in reHREF.findall(html):
|
2012-08-03 17:18:14 -04:00
|
|
|
fullURL = urllib.parse.urljoin(urlString, subUrl)
|
2011-06-04 06:37:48 -04:00
|
|
|
links.append((text, fullURL))
|
|
|
|
return links
|
|
|
|
|
2012-03-19 13:36:27 -04:00
|
|
|
def download(name, urlString, tmpDir, quiet=False):
|
2011-06-04 06:37:48 -04:00
|
|
|
fileName = '%s/%s' % (tmpDir, name)
|
2012-09-26 14:33:46 -04:00
|
|
|
if not FORCE_CLEAN and os.path.exists(fileName):
|
2012-03-19 13:36:27 -04:00
|
|
|
if not quiet and fileName.find('.asc') == -1:
|
2012-08-03 17:18:14 -04:00
|
|
|
print(' already done: %.1f MB' % (os.path.getsize(fileName)/1024./1024.))
|
2011-06-04 06:37:48 -04:00
|
|
|
return
|
2012-08-03 17:18:14 -04:00
|
|
|
fIn = urllib.request.urlopen(urlString)
|
2011-06-04 06:37:48 -04:00
|
|
|
fOut = open(fileName, 'wb')
|
|
|
|
success = False
|
|
|
|
try:
|
|
|
|
while True:
|
|
|
|
s = fIn.read(65536)
|
2012-08-03 17:18:14 -04:00
|
|
|
if s == b'':
|
2011-06-04 06:37:48 -04:00
|
|
|
break
|
|
|
|
fOut.write(s)
|
|
|
|
fOut.close()
|
|
|
|
fIn.close()
|
|
|
|
success = True
|
|
|
|
finally:
|
|
|
|
fIn.close()
|
|
|
|
fOut.close()
|
|
|
|
if not success:
|
|
|
|
os.remove(fileName)
|
2012-03-19 13:36:27 -04:00
|
|
|
if not quiet and fileName.find('.asc') == -1:
|
2012-08-03 17:18:14 -04:00
|
|
|
print(' %.1f MB' % (os.path.getsize(fileName)/1024./1024.))
|
2011-06-04 06:37:48 -04:00
|
|
|
|
|
|
|
def load(urlString):
|
2012-08-03 17:49:24 -04:00
|
|
|
return urllib.request.urlopen(urlString).read().decode('utf-8')
|
2012-09-25 17:08:51 -04:00
|
|
|
|
|
|
|
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/')):
|
2012-09-26 10:51:36 -04:00
|
|
|
raise RuntimeError('%s contains sheisty class "%s"' % (desc, name2))
|
2012-09-25 17:08:51 -04:00
|
|
|
|
2012-09-26 14:33:46 -04:00
|
|
|
def decodeUTF8(bytes):
|
|
|
|
return codecs.getdecoder('UTF-8')(bytes)[0]
|
|
|
|
|
|
|
|
MANIFEST_FILE_NAME = 'META-INF/MANIFEST.MF'
|
|
|
|
NOTICE_FILE_NAME = 'META-INF/NOTICE.txt'
|
|
|
|
LICENSE_FILE_NAME = 'META-INF/LICENSE.txt'
|
|
|
|
|
|
|
|
def checkJARMetaData(desc, jarFile, version):
|
|
|
|
|
|
|
|
with zipfile.ZipFile(jarFile, 'r') as z:
|
|
|
|
for name in (MANIFEST_FILE_NAME, NOTICE_FILE_NAME, LICENSE_FILE_NAME):
|
|
|
|
try:
|
|
|
|
# The Python docs state a KeyError is raised ... so this None
|
|
|
|
# check is just defensive:
|
|
|
|
if z.getinfo(name) is None:
|
|
|
|
raise RuntimeError('%s is missing %s' % (desc, name))
|
|
|
|
except KeyError:
|
|
|
|
raise RuntimeError('%s is missing %s' % (desc, name))
|
|
|
|
|
|
|
|
s = decodeUTF8(z.read(MANIFEST_FILE_NAME))
|
|
|
|
|
|
|
|
for verify in (
|
|
|
|
'Implementation-Vendor: The Apache Software Foundation',
|
|
|
|
# Make sure 1.6 compiler was used to build release bits:
|
|
|
|
'X-Compile-Source-JDK: 1.6',
|
|
|
|
# Make sure .class files are 1.6 format:
|
|
|
|
'X-Compile-Target-JDK: 1.6',
|
|
|
|
# Make sure this matches the version we think we are releasing:
|
|
|
|
'Specification-Version: %s' % version):
|
|
|
|
if s.find(verify) == -1:
|
|
|
|
raise RuntimeError('%s is missing "%s" inside its META-INF/MANIFES.MF' % \
|
|
|
|
(desc, verify))
|
|
|
|
|
|
|
|
notice = decodeUTF8(z.read(NOTICE_FILE_NAME))
|
|
|
|
license = decodeUTF8(z.read(LICENSE_FILE_NAME))
|
|
|
|
|
|
|
|
idx = desc.find('inside WAR file')
|
|
|
|
if idx != -1:
|
|
|
|
desc2 = desc[:idx]
|
|
|
|
else:
|
|
|
|
desc2 = desc
|
|
|
|
|
|
|
|
justFileName = os.path.split(desc2)[1]
|
|
|
|
|
|
|
|
if justFileName.lower().find('solr') != -1:
|
|
|
|
if SOLR_LICENSE is None:
|
|
|
|
raise RuntimeError('BUG in smokeTestRelease!')
|
|
|
|
if SOLR_NOTICE is None:
|
|
|
|
raise RuntimeError('BUG in smokeTestRelease!')
|
|
|
|
if notice != SOLR_NOTICE:
|
|
|
|
raise RuntimeError('%s: %s contents doesn\'t match main NOTICE.txt' % \
|
|
|
|
(desc, NOTICE_FILE_NAME))
|
|
|
|
if license != SOLR_LICENSE:
|
|
|
|
raise RuntimeError('%s: %s contents doesn\'t match main LICENSE.txt' % \
|
|
|
|
(desc, LICENSE_FILE_NAME))
|
|
|
|
else:
|
|
|
|
if LUCENE_LICENSE is None:
|
|
|
|
raise RuntimeError('BUG in smokeTestRelease!')
|
|
|
|
if LUCENE_NOTICE is None:
|
|
|
|
raise RuntimeError('BUG in smokeTestRelease!')
|
|
|
|
if notice != LUCENE_NOTICE:
|
|
|
|
raise RuntimeError('%s: %s contents doesn\'t match main NOTICE.txt' % \
|
|
|
|
(desc, NOTICE_FILE_NAME))
|
|
|
|
if license != LUCENE_LICENSE:
|
|
|
|
raise RuntimeError('%s: %s contents doesn\'t match main LICENSE.txt' % \
|
|
|
|
(desc, LICENSE_FILE_NAME))
|
|
|
|
|
2012-09-26 10:51:36 -04:00
|
|
|
def normSlashes(path):
|
|
|
|
return path.replace(os.sep, '/')
|
|
|
|
|
2012-09-26 14:33:46 -04:00
|
|
|
def checkAllJARs(topDir, project, version):
|
|
|
|
print(' verify JAR/WAR metadata...')
|
2012-09-26 10:51:36 -04:00
|
|
|
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
|
|
|
|
|
2012-09-25 17:08:51 -04:00
|
|
|
for file in files:
|
|
|
|
if file.lower().endswith('.jar'):
|
2012-09-26 10:51:36 -04:00
|
|
|
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
|
2012-09-25 17:08:51 -04:00
|
|
|
fullPath = '%s/%s' % (root, file)
|
|
|
|
noJavaPackageClasses('JAR file "%s"' % fullPath, fullPath)
|
2012-09-26 14:33:46 -04:00
|
|
|
if file.lower().find('lucene') != -1 or file.lower().find('solr') != -1:
|
|
|
|
checkJARMetaData('JAR file "%s"' % fullPath, fullPath, version)
|
|
|
|
|
2012-09-26 10:51:36 -04:00
|
|
|
|
2012-09-26 14:33:46 -04:00
|
|
|
def checkSolrWAR(warFileName, version):
|
2012-09-25 17:08:51 -04:00
|
|
|
|
|
|
|
"""
|
|
|
|
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...')
|
|
|
|
|
2012-09-26 14:33:46 -04:00
|
|
|
checkJARMetaData(warFileName, warFileName, version)
|
|
|
|
|
2012-09-25 17:08:51 -04:00
|
|
|
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)))
|
2012-09-26 14:33:46 -04:00
|
|
|
if name.lower().find('lucene') != -1 or name.lower().find('solr') != -1:
|
|
|
|
checkJARMetaData('JAR file %s inside WAR file %s' % (name, warFileName),
|
|
|
|
io.BytesIO(z.read(name)),
|
|
|
|
version)
|
2012-09-25 17:08:51 -04:00
|
|
|
|
2012-04-08 14:22:14 -04:00
|
|
|
def checkSigs(project, urlString, version, tmpDir, isSigned):
|
2011-06-04 06:37:48 -04:00
|
|
|
|
2012-08-03 17:18:14 -04:00
|
|
|
print(' test basics...')
|
2011-06-04 06:37:48 -04:00
|
|
|
ents = getDirEntries(urlString)
|
|
|
|
artifact = None
|
|
|
|
keysURL = None
|
|
|
|
changesURL = None
|
|
|
|
mavenURL = None
|
2012-04-08 14:22:14 -04:00
|
|
|
expectedSigs = []
|
|
|
|
if isSigned:
|
|
|
|
expectedSigs.append('asc')
|
|
|
|
expectedSigs.extend(['md5', 'sha1'])
|
|
|
|
|
2011-06-04 06:37:48 -04:00
|
|
|
artifacts = []
|
|
|
|
for text, subURL in ents:
|
|
|
|
if text == 'KEYS':
|
|
|
|
keysURL = subURL
|
|
|
|
elif text == 'maven/':
|
|
|
|
mavenURL = subURL
|
|
|
|
elif text.startswith('changes'):
|
|
|
|
if text not in ('changes/', 'changes-%s/' % version):
|
|
|
|
raise RuntimeError('%s: found %s vs expected changes-%s/' % (project, text, version))
|
|
|
|
changesURL = subURL
|
|
|
|
elif artifact == None:
|
|
|
|
artifact = text
|
|
|
|
artifactURL = subURL
|
|
|
|
if project == 'solr':
|
|
|
|
expected = 'apache-solr-%s' % version
|
|
|
|
else:
|
|
|
|
expected = 'lucene-%s' % version
|
|
|
|
if not artifact.startswith(expected):
|
|
|
|
raise RuntimeError('%s: unknown artifact %s: expected prefix %s' % (project, text, expected))
|
|
|
|
sigs = []
|
|
|
|
elif text.startswith(artifact + '.'):
|
|
|
|
sigs.append(text[len(artifact)+1:])
|
|
|
|
else:
|
|
|
|
if sigs != expectedSigs:
|
|
|
|
raise RuntimeError('%s: artifact %s has wrong sigs: expected %s but got %s' % (project, artifact, expectedSigs, sigs))
|
|
|
|
artifacts.append((artifact, artifactURL))
|
|
|
|
artifact = text
|
|
|
|
artifactURL = subURL
|
|
|
|
sigs = []
|
|
|
|
|
|
|
|
if sigs != []:
|
|
|
|
artifacts.append((artifact, artifactURL))
|
|
|
|
if sigs != expectedSigs:
|
|
|
|
raise RuntimeError('%s: artifact %s has wrong sigs: expected %s but got %s' % (project, artifact, expectedSigs, sigs))
|
|
|
|
|
|
|
|
if project == 'lucene':
|
|
|
|
expected = ['lucene-%s-src.tgz' % version,
|
|
|
|
'lucene-%s.tgz' % version,
|
|
|
|
'lucene-%s.zip' % version]
|
|
|
|
else:
|
|
|
|
expected = ['apache-solr-%s-src.tgz' % version,
|
|
|
|
'apache-solr-%s.tgz' % version,
|
|
|
|
'apache-solr-%s.zip' % version]
|
|
|
|
|
|
|
|
actual = [x[0] for x in artifacts]
|
|
|
|
if expected != actual:
|
|
|
|
raise RuntimeError('%s: wrong artifacts: expected %s but got %s' % (project, expected, actual))
|
|
|
|
|
|
|
|
if keysURL is None:
|
|
|
|
raise RuntimeError('%s is missing KEYS' % project)
|
|
|
|
|
2012-08-03 17:18:14 -04:00
|
|
|
print(' get KEYS')
|
2011-06-04 06:37:48 -04:00
|
|
|
download('%s.KEYS' % project, keysURL, tmpDir)
|
|
|
|
|
|
|
|
keysFile = '%s/%s.KEYS' % (tmpDir, project)
|
|
|
|
|
|
|
|
# Set up clean gpg world; import keys file:
|
|
|
|
gpgHomeDir = '%s/%s.gpg' % (tmpDir, project)
|
|
|
|
if os.path.exists(gpgHomeDir):
|
|
|
|
shutil.rmtree(gpgHomeDir)
|
2012-08-03 17:18:14 -04:00
|
|
|
os.makedirs(gpgHomeDir, 0o700)
|
2011-06-04 06:37:48 -04:00
|
|
|
run('gpg --homedir %s --import %s' % (gpgHomeDir, keysFile),
|
|
|
|
'%s/%s.gpg.import.log 2>&1' % (tmpDir, project))
|
|
|
|
|
|
|
|
if mavenURL is None:
|
|
|
|
raise RuntimeError('%s is missing maven' % project)
|
|
|
|
|
2012-09-24 00:40:14 -04:00
|
|
|
if changesURL is None:
|
|
|
|
raise RuntimeError('%s is missing changes-%s' % (project, version))
|
|
|
|
testChanges(project, version, changesURL)
|
2011-06-04 06:37:48 -04:00
|
|
|
|
|
|
|
for artifact, urlString in artifacts:
|
2012-08-03 17:18:14 -04:00
|
|
|
print(' download %s...' % artifact)
|
2011-06-04 06:37:48 -04:00
|
|
|
download(artifact, urlString, tmpDir)
|
|
|
|
verifyDigests(artifact, urlString, tmpDir)
|
|
|
|
|
2012-04-08 14:22:14 -04:00
|
|
|
if isSigned:
|
2012-08-03 17:18:14 -04:00
|
|
|
print(' verify sig')
|
2012-04-08 14:22:14 -04:00
|
|
|
# Test sig (this is done with a clean brand-new GPG world)
|
|
|
|
download(artifact + '.asc', urlString + '.asc', tmpDir)
|
|
|
|
sigFile = '%s/%s.asc' % (tmpDir, artifact)
|
|
|
|
artifactFile = '%s/%s' % (tmpDir, artifact)
|
|
|
|
logFile = '%s/%s.%s.gpg.verify.log' % (tmpDir, project, artifact)
|
|
|
|
run('gpg --homedir %s --verify %s %s' % (gpgHomeDir, sigFile, artifactFile),
|
|
|
|
logFile)
|
|
|
|
# Forward any GPG warnings, except the expected one (since its a clean world)
|
2012-08-03 17:49:24 -04:00
|
|
|
f = open(logFile, encoding='UTF-8')
|
2012-04-08 14:22:14 -04:00
|
|
|
for line in f.readlines():
|
|
|
|
if line.lower().find('warning') != -1 \
|
|
|
|
and line.find('WARNING: This key is not certified with a trusted signature') == -1:
|
2012-08-03 17:18:14 -04:00
|
|
|
print(' GPG: %s' % line.strip())
|
2012-04-08 14:22:14 -04:00
|
|
|
f.close()
|
2011-11-21 08:54:41 -05:00
|
|
|
|
2012-04-08 14:22:14 -04:00
|
|
|
# Test trust (this is done with the real users config)
|
|
|
|
run('gpg --import %s' % (keysFile),
|
|
|
|
'%s/%s.gpg.trust.import.log 2>&1' % (tmpDir, project))
|
2012-08-03 17:18:14 -04:00
|
|
|
print(' verify trust')
|
2012-04-08 14:22:14 -04:00
|
|
|
logFile = '%s/%s.%s.gpg.trust.log' % (tmpDir, project, artifact)
|
|
|
|
run('gpg --verify %s %s' % (sigFile, artifactFile), logFile)
|
|
|
|
# Forward any GPG warnings:
|
2012-08-03 17:49:24 -04:00
|
|
|
f = open(logFile, encoding='UTF-8')
|
2012-04-08 14:22:14 -04:00
|
|
|
for line in f.readlines():
|
|
|
|
if line.lower().find('warning') != -1:
|
2012-08-03 17:18:14 -04:00
|
|
|
print(' GPG: %s' % line.strip())
|
2012-04-08 14:22:14 -04:00
|
|
|
f.close()
|
2011-06-04 06:37:48 -04:00
|
|
|
|
|
|
|
def testChanges(project, version, changesURLString):
|
2012-08-03 17:18:14 -04:00
|
|
|
print(' check changes HTML...')
|
2011-06-04 06:37:48 -04:00
|
|
|
changesURL = None
|
|
|
|
for text, subURL in getDirEntries(changesURLString):
|
|
|
|
if text == 'Changes.html':
|
|
|
|
changesURL = subURL
|
|
|
|
|
|
|
|
if changesURL is None:
|
|
|
|
raise RuntimeError('did not see Changes.html link from %s' % changesURLString)
|
|
|
|
|
|
|
|
s = load(changesURL)
|
2011-06-28 16:51:05 -04:00
|
|
|
checkChangesContent(s, version, changesURL, project, True)
|
2011-06-04 06:37:48 -04:00
|
|
|
|
2011-06-28 16:51:05 -04:00
|
|
|
def testChangesText(dir, version, project):
|
|
|
|
"Checks all CHANGES.txt under this dir."
|
|
|
|
for root, dirs, files in os.walk(dir):
|
|
|
|
|
|
|
|
# NOTE: O(N) but N should be smallish:
|
|
|
|
if 'CHANGES.txt' in files:
|
|
|
|
fullPath = '%s/CHANGES.txt' % root
|
2012-03-22 11:24:44 -04:00
|
|
|
#print 'CHECK %s' % fullPath
|
2012-08-03 17:49:24 -04:00
|
|
|
checkChangesContent(open(fullPath, encoding='UTF-8').read(), version, fullPath, project, False)
|
2011-06-28 16:51:05 -04:00
|
|
|
|
|
|
|
def checkChangesContent(s, version, name, project, isHTML):
|
|
|
|
|
|
|
|
if isHTML and s.find('Release %s' % version) == -1:
|
|
|
|
raise RuntimeError('did not see "Release %s" in %s' % (version, name))
|
|
|
|
|
|
|
|
if s.lower().find('not yet released') != -1:
|
|
|
|
raise RuntimeError('saw "not yet released" in %s' % name)
|
|
|
|
|
|
|
|
if not isHTML:
|
|
|
|
if project == 'lucene':
|
|
|
|
sub = 'Lucene %s' % version
|
|
|
|
else:
|
|
|
|
sub = version
|
|
|
|
|
|
|
|
if s.find(sub) == -1:
|
2012-06-08 06:18:09 -04:00
|
|
|
# benchmark never seems to include release info:
|
2011-06-28 16:51:05 -04:00
|
|
|
if name.find('/benchmark/') == -1:
|
|
|
|
raise RuntimeError('did not see "%s" in %s' % (sub, name))
|
2012-04-08 13:15:54 -04:00
|
|
|
|
|
|
|
reUnixPath = re.compile(r'\b[a-zA-Z_]+=(?:"(?:\\"|[^"])*"' + '|(?:\\\\.|[^"\'\\s])*' + r"|'(?:\\'|[^'])*')" \
|
|
|
|
+ r'|(/(?:\\.|[^"\'\s])*)' \
|
|
|
|
+ r'|("/(?:\\.|[^"])*")' \
|
|
|
|
+ r"|('/(?:\\.|[^'])*')")
|
|
|
|
|
|
|
|
def unix2win(matchobj):
|
|
|
|
if matchobj.group(1) is not None: return cygwinWindowsRoot + matchobj.group()
|
|
|
|
if matchobj.group(2) is not None: return '"%s%s' % (cygwinWindowsRoot, matchobj.group().lstrip('"'))
|
|
|
|
if matchobj.group(3) is not None: return "'%s%s" % (cygwinWindowsRoot, matchobj.group().lstrip("'"))
|
|
|
|
return matchobj.group()
|
|
|
|
|
|
|
|
def cygwinifyPaths(command):
|
|
|
|
# The problem: Native Windows applications running under Cygwin
|
|
|
|
# (e.g. Ant, which isn't available as a Cygwin package) can't
|
|
|
|
# handle Cygwin's Unix-style paths. However, environment variable
|
|
|
|
# values are automatically converted, so only paths outside of
|
|
|
|
# environment variable values should be converted to Windows paths.
|
|
|
|
# Assumption: all paths will be absolute.
|
|
|
|
if '; ant ' in command: command = reUnixPath.sub(unix2win, command)
|
|
|
|
return command
|
|
|
|
|
2012-11-08 09:00:28 -05:00
|
|
|
def printFileContents(fileName):
|
|
|
|
|
|
|
|
# Assume log file was written in system's default encoding, but
|
|
|
|
# even if we are wrong, we replace errors ... the ASCII chars
|
|
|
|
# (which is what we mostly care about eg for the test seed) should
|
|
|
|
# still survive:
|
|
|
|
txt = codecs.open(fileName, 'r', encoding=sys.getdefaultencoding(), errors='replace').read()
|
|
|
|
|
|
|
|
# Encode to our output encoding (likely also system's default
|
|
|
|
# encoding):
|
|
|
|
bytes = txt.encode(sys.stdout.encoding, errors='replace')
|
|
|
|
|
|
|
|
# Decode back to string and print... we should hit no exception here
|
|
|
|
# since all errors have been replaced:
|
|
|
|
print(codecs.getdecoder(sys.stdout.encoding)(bytes)[0])
|
|
|
|
print()
|
|
|
|
|
2011-06-04 06:37:48 -04:00
|
|
|
def run(command, logFile):
|
2012-04-08 13:15:54 -04:00
|
|
|
if cygwin: command = cygwinifyPaths(command)
|
2011-06-04 06:37:48 -04:00
|
|
|
if os.system('%s > %s 2>&1' % (command, logFile)):
|
2012-03-19 13:36:27 -04:00
|
|
|
logPath = os.path.abspath(logFile)
|
2012-09-26 11:55:27 -04:00
|
|
|
print('\ncommand "%s" failed:' % command)
|
2012-11-08 09:00:28 -05:00
|
|
|
printFileContents(logFile)
|
2012-03-19 13:36:27 -04:00
|
|
|
raise RuntimeError('command "%s" failed; see log file %s' % (command, logPath))
|
2011-06-04 06:37:48 -04:00
|
|
|
|
|
|
|
def verifyDigests(artifact, urlString, tmpDir):
|
2012-08-03 17:18:14 -04:00
|
|
|
print(' verify md5/sha1 digests')
|
2011-06-04 06:37:48 -04:00
|
|
|
md5Expected, t = load(urlString + '.md5').strip().split()
|
|
|
|
if t != '*'+artifact:
|
|
|
|
raise RuntimeError('MD5 %s.md5 lists artifact %s but expected *%s' % (urlString, t, artifact))
|
|
|
|
|
|
|
|
sha1Expected, t = load(urlString + '.sha1').strip().split()
|
|
|
|
if t != '*'+artifact:
|
|
|
|
raise RuntimeError('SHA1 %s.sha1 lists artifact %s but expected *%s' % (urlString, t, artifact))
|
|
|
|
|
|
|
|
m = hashlib.md5()
|
|
|
|
s = hashlib.sha1()
|
2012-08-03 17:49:24 -04:00
|
|
|
f = open('%s/%s' % (tmpDir, artifact), 'rb')
|
2011-06-04 06:37:48 -04:00
|
|
|
while True:
|
|
|
|
x = f.read(65536)
|
2012-08-03 17:49:24 -04:00
|
|
|
if len(x) == 0:
|
2011-06-04 06:37:48 -04:00
|
|
|
break
|
|
|
|
m.update(x)
|
|
|
|
s.update(x)
|
|
|
|
f.close()
|
|
|
|
md5Actual = m.hexdigest()
|
|
|
|
sha1Actual = s.hexdigest()
|
|
|
|
if md5Actual != md5Expected:
|
|
|
|
raise RuntimeError('MD5 digest mismatch for %s: expected %s but got %s' % (artifact, md5Expected, md5Actual))
|
|
|
|
if sha1Actual != sha1Expected:
|
|
|
|
raise RuntimeError('SHA1 digest mismatch for %s: expected %s but got %s' % (artifact, sha1Expected, sha1Actual))
|
2012-03-19 13:36:27 -04:00
|
|
|
|
2011-06-04 06:37:48 -04:00
|
|
|
def getDirEntries(urlString):
|
2012-08-07 16:58:46 -04:00
|
|
|
if urlString.startswith('file:/') and not urlString.startswith('file://'):
|
|
|
|
# stupid bogus ant URI
|
|
|
|
urlString = "file:///" + urlString[6:]
|
|
|
|
|
2012-04-08 14:22:14 -04:00
|
|
|
if urlString.startswith('file://'):
|
|
|
|
path = urlString[7:]
|
|
|
|
if path.endswith('/'):
|
|
|
|
path = path[:-1]
|
2012-09-22 21:28:16 -04:00
|
|
|
if cygwin: # Convert Windows path to Cygwin path
|
|
|
|
path = re.sub(r'^/([A-Za-z]):/', r'/cygdrive/\1/', path)
|
2012-04-08 14:22:14 -04:00
|
|
|
l = []
|
|
|
|
for ent in os.listdir(path):
|
|
|
|
entPath = '%s/%s' % (path, ent)
|
|
|
|
if os.path.isdir(entPath):
|
|
|
|
entPath += '/'
|
|
|
|
ent += '/'
|
|
|
|
l.append((ent, 'file://%s' % entPath))
|
|
|
|
l.sort()
|
|
|
|
return l
|
|
|
|
else:
|
|
|
|
links = getHREFs(urlString)
|
|
|
|
for i, (text, subURL) in enumerate(links):
|
|
|
|
if text == 'Parent Directory' or text == '..':
|
|
|
|
return links[(i+1):]
|
2011-06-04 06:37:48 -04:00
|
|
|
|
2012-09-26 14:33:46 -04:00
|
|
|
def unpackAndVerify(project, tmpDir, artifact, version):
|
2011-06-04 06:37:48 -04:00
|
|
|
destDir = '%s/unpack' % tmpDir
|
|
|
|
if os.path.exists(destDir):
|
|
|
|
shutil.rmtree(destDir)
|
|
|
|
os.makedirs(destDir)
|
|
|
|
os.chdir(destDir)
|
2012-09-25 15:09:58 -04:00
|
|
|
print(' unpack %s...' % artifact)
|
2011-06-04 06:37:48 -04:00
|
|
|
unpackLogFile = '%s/%s-unpack-%s.log' % (tmpDir, project, artifact)
|
|
|
|
if artifact.endswith('.tar.gz') or artifact.endswith('.tgz'):
|
|
|
|
run('tar xzf %s/%s' % (tmpDir, artifact), unpackLogFile)
|
|
|
|
elif artifact.endswith('.zip'):
|
|
|
|
run('unzip %s/%s' % (tmpDir, artifact), unpackLogFile)
|
|
|
|
|
|
|
|
# make sure it unpacks to proper subdir
|
|
|
|
l = os.listdir(destDir)
|
|
|
|
if project == 'solr':
|
|
|
|
expected = 'apache-%s-%s' % (project, version)
|
|
|
|
else:
|
|
|
|
expected = '%s-%s' % (project, version)
|
|
|
|
if l != [expected]:
|
|
|
|
raise RuntimeError('unpack produced entries %s; expected only %s' % (l, expected))
|
|
|
|
|
|
|
|
unpackPath = '%s/%s' % (destDir, expected)
|
2012-04-06 09:33:54 -04:00
|
|
|
verifyUnpacked(project, artifact, unpackPath, version, tmpDir)
|
2011-06-04 06:37:48 -04:00
|
|
|
|
2012-09-26 14:33:46 -04:00
|
|
|
LUCENE_NOTICE = None
|
|
|
|
LUCENE_LICENSE = None
|
|
|
|
SOLR_NOTICE = None
|
|
|
|
SOLR_LICENSE = None
|
|
|
|
|
2012-04-06 09:33:54 -04:00
|
|
|
def verifyUnpacked(project, artifact, unpackPath, version, tmpDir):
|
2012-09-26 14:33:46 -04:00
|
|
|
global LUCENE_NOTICE
|
|
|
|
global LUCENE_LICENSE
|
|
|
|
global SOLR_NOTICE
|
|
|
|
global SOLR_LICENSE
|
|
|
|
|
2011-06-04 06:37:48 -04:00
|
|
|
os.chdir(unpackPath)
|
|
|
|
isSrc = artifact.find('-src') != -1
|
|
|
|
l = os.listdir(unpackPath)
|
2012-10-18 08:34:08 -04:00
|
|
|
textFiles = ['LICENSE', 'NOTICE', 'README']
|
2011-06-04 06:37:48 -04:00
|
|
|
if project == 'lucene':
|
2012-10-18 08:34:08 -04:00
|
|
|
textFiles.extend(('JRE_VERSION_MIGRATION', 'CHANGES', 'MIGRATE', 'SYSTEM_REQUIREMENTS'))
|
2011-06-04 06:37:48 -04:00
|
|
|
if isSrc:
|
|
|
|
textFiles.append('BUILD')
|
2012-10-18 13:31:39 -04:00
|
|
|
elif not isSrc:
|
|
|
|
textFiles.append('SYSTEM_REQUIREMENTS')
|
|
|
|
|
2011-06-04 06:37:48 -04:00
|
|
|
for fileName in textFiles:
|
|
|
|
fileName += '.txt'
|
|
|
|
if fileName not in l:
|
|
|
|
raise RuntimeError('file "%s" is missing from artifact %s' % (fileName, artifact))
|
|
|
|
l.remove(fileName)
|
|
|
|
|
2012-09-26 14:33:46 -04:00
|
|
|
if project == 'lucene':
|
|
|
|
if LUCENE_NOTICE is None:
|
2012-09-29 10:26:53 -04:00
|
|
|
LUCENE_NOTICE = open('%s/NOTICE.txt' % unpackPath, encoding='UTF-8').read()
|
2012-09-26 14:33:46 -04:00
|
|
|
if LUCENE_LICENSE is None:
|
2012-09-29 10:26:53 -04:00
|
|
|
LUCENE_LICENSE = open('%s/LICENSE.txt' % unpackPath, encoding='UTF-8').read()
|
2012-09-26 14:33:46 -04:00
|
|
|
else:
|
|
|
|
if SOLR_NOTICE is None:
|
2012-09-29 10:26:53 -04:00
|
|
|
SOLR_NOTICE = open('%s/NOTICE.txt' % unpackPath, encoding='UTF-8').read()
|
2012-09-26 14:33:46 -04:00
|
|
|
if SOLR_LICENSE is None:
|
2012-09-29 10:26:53 -04:00
|
|
|
SOLR_LICENSE = open('%s/LICENSE.txt' % unpackPath, encoding='UTF-8').read()
|
2012-09-26 14:33:46 -04:00
|
|
|
|
2011-06-04 06:37:48 -04:00
|
|
|
if not isSrc:
|
2012-06-08 05:46:28 -04:00
|
|
|
# TODO: we should add verifyModule/verifySubmodule (e.g. analysis) here and recurse through
|
2011-06-04 06:37:48 -04:00
|
|
|
if project == 'lucene':
|
2012-06-08 05:46:28 -04:00
|
|
|
expectedJARs = ()
|
2011-06-04 06:37:48 -04:00
|
|
|
else:
|
|
|
|
expectedJARs = ()
|
|
|
|
|
|
|
|
for fileName in expectedJARs:
|
|
|
|
fileName += '.jar'
|
|
|
|
if fileName not in l:
|
|
|
|
raise RuntimeError('%s: file "%s" is missing from artifact %s' % (project, fileName, artifact))
|
|
|
|
l.remove(fileName)
|
|
|
|
|
|
|
|
if project == 'lucene':
|
2012-06-08 05:46:28 -04:00
|
|
|
# TODO: clean this up to not be a list of modules that we must maintain
|
2012-09-16 08:11:09 -04:00
|
|
|
extras = ('analysis', 'benchmark', 'classification', 'codecs', 'core', 'demo', 'docs', 'facet', 'grouping', 'highlighter', 'join', 'memory', 'misc', 'queries', 'queryparser', 'sandbox', 'spatial', 'suggest', 'test-framework', 'licenses')
|
2011-06-04 06:37:48 -04:00
|
|
|
if isSrc:
|
2012-06-08 06:43:20 -04:00
|
|
|
extras += ('build.xml', 'common-build.xml', 'module-build.xml', 'ivy-settings.xml', 'backwards', 'tools', 'site')
|
2011-06-04 06:37:48 -04:00
|
|
|
else:
|
|
|
|
extras = ()
|
|
|
|
|
2012-08-03 18:48:27 -04:00
|
|
|
# TODO: if solr, verify lucene/licenses, solr/licenses are present
|
|
|
|
|
2011-06-04 06:37:48 -04:00
|
|
|
for e in extras:
|
|
|
|
if e not in l:
|
|
|
|
raise RuntimeError('%s: %s missing from artifact %s' % (project, e, artifact))
|
|
|
|
l.remove(e)
|
|
|
|
|
|
|
|
if project == 'lucene':
|
|
|
|
if len(l) > 0:
|
|
|
|
raise RuntimeError('%s: unexpected files/dirs in artifact %s: %s' % (project, artifact, l))
|
2012-10-18 13:31:39 -04:00
|
|
|
elif isSrc and not os.path.exists('%s/solr/SYSTEM_REQUIREMENTS.txt' % unpackPath):
|
|
|
|
raise RuntimeError('%s: solr/SYSTEM_REQUIREMENTS.txt does not exist in artifact %s' % (project, artifact))
|
2011-06-04 06:37:48 -04:00
|
|
|
|
|
|
|
if isSrc:
|
2012-08-03 17:18:14 -04:00
|
|
|
print(' make sure no JARs/WARs in src dist...')
|
2012-04-06 09:33:54 -04:00
|
|
|
lines = os.popen('find . -name \\*.jar').readlines()
|
|
|
|
if len(lines) != 0:
|
2012-08-03 17:18:14 -04:00
|
|
|
print(' FAILED:')
|
2012-04-06 09:33:54 -04:00
|
|
|
for line in lines:
|
2012-08-03 17:18:14 -04:00
|
|
|
print(' %s' % line.strip())
|
2012-04-06 09:33:54 -04:00
|
|
|
raise RuntimeError('source release has JARs...')
|
|
|
|
lines = os.popen('find . -name \\*.war').readlines()
|
|
|
|
if len(lines) != 0:
|
2012-08-03 17:18:14 -04:00
|
|
|
print(' FAILED:')
|
2012-04-06 09:33:54 -04:00
|
|
|
for line in lines:
|
2012-08-03 17:18:14 -04:00
|
|
|
print(' %s' % line.strip())
|
2012-04-06 09:33:54 -04:00
|
|
|
raise RuntimeError('source release has WARs...')
|
|
|
|
|
2012-08-03 17:18:14 -04:00
|
|
|
print(' run "ant validate"')
|
2012-04-06 09:33:54 -04:00
|
|
|
run('%s; ant validate' % javaExe('1.7'), '%s/validate.log' % unpackPath)
|
|
|
|
|
2011-06-04 06:37:48 -04:00
|
|
|
if project == 'lucene':
|
2012-08-03 17:18:14 -04:00
|
|
|
print(' run tests w/ Java 6...')
|
2012-06-08 06:18:09 -04:00
|
|
|
run('%s; ant test' % javaExe('1.6'), '%s/test.log' % unpackPath)
|
|
|
|
run('%s; ant jar' % javaExe('1.6'), '%s/compile.log' % unpackPath)
|
2012-10-26 00:53:34 -04:00
|
|
|
testDemo(isSrc, version, '1.6')
|
2011-11-21 10:45:07 -05:00
|
|
|
# test javadocs
|
2012-08-03 17:18:14 -04:00
|
|
|
print(' generate javadocs w/ Java 6...')
|
2012-06-08 09:25:04 -04:00
|
|
|
run('%s; ant javadocs' % javaExe('1.6'), '%s/javadocs.log' % unpackPath)
|
|
|
|
checkJavadocpath('%s/build/docs' % unpackPath)
|
2012-10-26 00:53:34 -04:00
|
|
|
|
|
|
|
print(' run tests w/ Java 7...')
|
|
|
|
run('%s; ant clean test' % javaExe('1.7'), '%s/test.log' % unpackPath)
|
|
|
|
run('%s; ant jar' % javaExe('1.7'), '%s/compile.log' % unpackPath)
|
|
|
|
testDemo(isSrc, version, '1.7')
|
|
|
|
|
|
|
|
print(' generate javadocs w/ Java 7...')
|
|
|
|
run('%s; ant javadocs' % javaExe('1.7'), '%s/javadocs.log' % unpackPath)
|
|
|
|
checkJavadocpathFull('%s/build/docs' % unpackPath)
|
|
|
|
|
2011-06-04 06:37:48 -04:00
|
|
|
else:
|
2012-09-06 18:45:52 -04:00
|
|
|
os.chdir('solr')
|
2012-09-22 09:10:29 -04:00
|
|
|
# DISABLED until solr tests consistently pass
|
|
|
|
#print(' run tests w/ Java 6...')
|
|
|
|
#run('%s; ant test' % javaExe('1.6'), '%s/test.log' % unpackPath)
|
2011-11-21 10:45:07 -05:00
|
|
|
|
|
|
|
# test javadocs
|
2012-08-03 17:18:14 -04:00
|
|
|
print(' generate javadocs w/ Java 6...')
|
2012-06-08 09:25:04 -04:00
|
|
|
run('%s; ant javadocs' % javaExe('1.6'), '%s/javadocs.log' % unpackPath)
|
2012-09-06 18:45:52 -04:00
|
|
|
checkJavadocpath('%s/solr/build/docs' % unpackPath, False)
|
2011-11-21 10:45:07 -05:00
|
|
|
|
2012-09-22 09:10:29 -04:00
|
|
|
# DISABLED until solr tests consistently pass
|
|
|
|
#print(' run tests w/ Java 7...')
|
|
|
|
#run('%s; ant test' % javaExe('1.7'), '%s/test.log' % unpackPath)
|
2011-11-21 10:45:07 -05:00
|
|
|
|
|
|
|
# test javadocs
|
2012-08-03 17:18:14 -04:00
|
|
|
print(' generate javadocs w/ Java 7...')
|
2012-10-26 00:53:34 -04:00
|
|
|
run('%s; ant clean javadocs' % javaExe('1.7'), '%s/javadocs.log' % unpackPath)
|
|
|
|
checkJavadocpathFull('%s/solr/build/docs' % unpackPath, False)
|
2011-11-21 10:45:07 -05:00
|
|
|
|
2012-08-03 17:18:14 -04:00
|
|
|
print(' test solr example w/ Java 6...')
|
2012-04-06 09:33:54 -04:00
|
|
|
run('%s; ant clean example' % javaExe('1.6'), '%s/antexample.log' % unpackPath)
|
|
|
|
testSolrExample(unpackPath, JAVA6_HOME, True)
|
|
|
|
|
2012-08-03 17:18:14 -04:00
|
|
|
print(' test solr example w/ Java 7...')
|
2012-04-06 09:33:54 -04:00
|
|
|
run('%s; ant clean example' % javaExe('1.7'), '%s/antexample.log' % unpackPath)
|
|
|
|
testSolrExample(unpackPath, JAVA7_HOME, True)
|
|
|
|
os.chdir('..')
|
|
|
|
|
2012-08-03 17:18:14 -04:00
|
|
|
print(' check NOTICE')
|
2012-04-06 09:33:54 -04:00
|
|
|
testNotice(unpackPath)
|
|
|
|
|
2011-06-04 06:37:48 -04:00
|
|
|
else:
|
2012-09-26 10:51:36 -04:00
|
|
|
|
2012-09-26 14:33:46 -04:00
|
|
|
checkAllJARs(os.getcwd(), project, version)
|
2012-09-26 10:51:36 -04:00
|
|
|
|
2011-06-04 06:37:48 -04:00
|
|
|
if project == 'lucene':
|
2012-10-26 00:53:34 -04:00
|
|
|
testDemo(isSrc, version, '1.6')
|
|
|
|
testDemo(isSrc, version, '1.7')
|
2012-09-25 17:08:51 -04:00
|
|
|
|
2012-04-06 09:33:54 -04:00
|
|
|
else:
|
2012-09-26 14:33:46 -04:00
|
|
|
checkSolrWAR('%s/example/webapps/solr.war' % unpackPath, version)
|
2012-09-25 17:08:51 -04:00
|
|
|
|
2012-09-25 15:09:58 -04:00
|
|
|
print(' copying unpacked distribution for Java 6 ...')
|
|
|
|
java6UnpackPath = '%s-java6' %unpackPath
|
|
|
|
if os.path.exists(java6UnpackPath):
|
|
|
|
shutil.rmtree(java6UnpackPath)
|
|
|
|
shutil.copytree(unpackPath, java6UnpackPath)
|
|
|
|
os.chdir(java6UnpackPath)
|
2012-08-03 17:18:14 -04:00
|
|
|
print(' test solr example w/ Java 6...')
|
2012-09-25 15:09:58 -04:00
|
|
|
testSolrExample(java6UnpackPath, JAVA6_HOME, False)
|
|
|
|
|
|
|
|
print(' copying unpacked distribution for Java 7 ...')
|
|
|
|
java7UnpackPath = '%s-java7' %unpackPath
|
|
|
|
if os.path.exists(java7UnpackPath):
|
|
|
|
shutil.rmtree(java7UnpackPath)
|
|
|
|
shutil.copytree(unpackPath, java7UnpackPath)
|
|
|
|
os.chdir(java7UnpackPath)
|
2012-08-03 17:18:14 -04:00
|
|
|
print(' test solr example w/ Java 7...')
|
2012-09-25 15:09:58 -04:00
|
|
|
testSolrExample(java7UnpackPath, JAVA7_HOME, False)
|
|
|
|
|
|
|
|
os.chdir(unpackPath)
|
2011-06-04 06:37:48 -04:00
|
|
|
|
2011-06-28 16:51:05 -04:00
|
|
|
testChangesText('.', version, project)
|
|
|
|
|
2012-03-22 11:24:44 -04:00
|
|
|
if project == 'lucene' and not isSrc:
|
2012-08-03 17:18:14 -04:00
|
|
|
print(' check Lucene\'s javadoc JAR')
|
2012-06-08 06:18:09 -04:00
|
|
|
checkJavadocpath('%s/docs' % unpackPath)
|
2012-03-22 11:24:44 -04:00
|
|
|
|
2012-04-06 09:33:54 -04:00
|
|
|
def testNotice(unpackPath):
|
2012-08-03 17:49:24 -04:00
|
|
|
solrNotice = open('%s/NOTICE.txt' % unpackPath, encoding='UTF-8').read()
|
|
|
|
luceneNotice = open('%s/lucene/NOTICE.txt' % unpackPath, encoding='UTF-8').read()
|
2012-04-06 09:33:54 -04:00
|
|
|
|
|
|
|
expected = """
|
|
|
|
=========================================================================
|
|
|
|
== Apache Lucene Notice ==
|
|
|
|
=========================================================================
|
|
|
|
|
|
|
|
""" + luceneNotice + """---
|
|
|
|
"""
|
|
|
|
|
|
|
|
if solrNotice.find(expected) == -1:
|
|
|
|
raise RuntimeError('Solr\'s NOTICE.txt does not have the verbatim copy, plus header/footer, of Lucene\'s NOTICE.txt')
|
|
|
|
|
2012-08-20 20:16:43 -04:00
|
|
|
def readSolrOutput(p, startupEvent, failureEvent, logFile):
|
2012-04-06 09:33:54 -04:00
|
|
|
f = open(logFile, 'wb')
|
|
|
|
try:
|
|
|
|
while True:
|
2012-11-08 09:00:28 -05:00
|
|
|
line = p.stderr.readline()
|
2012-08-03 18:48:27 -04:00
|
|
|
if len(line) == 0:
|
2012-11-08 09:00:28 -05:00
|
|
|
p.poll()
|
|
|
|
if not startupEvent.isSet():
|
|
|
|
failureEvent.set()
|
|
|
|
startupEvent.set()
|
2012-04-06 09:33:54 -04:00
|
|
|
break
|
|
|
|
f.write(line)
|
|
|
|
f.flush()
|
2012-11-08 09:00:28 -05:00
|
|
|
#print('SOLR: %s' % line.strip())
|
|
|
|
if not startupEvent.isSet():
|
|
|
|
if line.find(b'Started SocketConnector@0.0.0.0:8983') != -1:
|
|
|
|
startupEvent.set()
|
|
|
|
elif p.poll() is not None:
|
|
|
|
failureEvent.set()
|
|
|
|
startupEvent.set()
|
|
|
|
break
|
2012-08-20 20:16:43 -04:00
|
|
|
except:
|
|
|
|
print()
|
|
|
|
print('Exception reading Solr output:')
|
|
|
|
traceback.print_exc()
|
|
|
|
failureEvent.set()
|
2012-11-08 09:00:28 -05:00
|
|
|
startupEvent.set()
|
2012-04-06 09:33:54 -04:00
|
|
|
finally:
|
|
|
|
f.close()
|
|
|
|
|
|
|
|
def testSolrExample(unpackPath, javaPath, isSrc):
|
|
|
|
logFile = '%s/solr-example.log' % unpackPath
|
|
|
|
os.chdir('example')
|
2012-08-03 17:18:14 -04:00
|
|
|
print(' start Solr instance (log=%s)...' % logFile)
|
2012-04-06 09:33:54 -04:00
|
|
|
env = {}
|
|
|
|
env.update(os.environ)
|
|
|
|
env['JAVA_HOME'] = javaPath
|
|
|
|
env['PATH'] = '%s/bin:%s' % (javaPath, env['PATH'])
|
2012-11-08 09:00:28 -05:00
|
|
|
server = subprocess.Popen(['java', '-jar', 'start.jar'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE, env=env)
|
2012-04-06 09:33:54 -04:00
|
|
|
|
|
|
|
startupEvent = threading.Event()
|
2012-08-20 20:16:43 -04:00
|
|
|
failureEvent = threading.Event()
|
2012-11-08 09:00:28 -05:00
|
|
|
serverThread = threading.Thread(target=readSolrOutput, args=(server, startupEvent, failureEvent, logFile))
|
2012-04-06 09:33:54 -04:00
|
|
|
serverThread.setDaemon(True)
|
|
|
|
serverThread.start()
|
|
|
|
|
|
|
|
# Make sure Solr finishes startup:
|
2012-11-08 09:00:28 -05:00
|
|
|
if not startupEvent.wait(1800):
|
|
|
|
raise RuntimeError('startup took more than 30 minutes')
|
|
|
|
if failureEvent.isSet():
|
|
|
|
logFile = os.path.abspath(logFile)
|
|
|
|
print
|
|
|
|
print('Startup failed; see log %s' % logFile)
|
|
|
|
printFileContents(logFile)
|
|
|
|
raise RuntimeError('failure on startup; see log %s' % logFile)
|
|
|
|
|
2012-08-03 17:18:14 -04:00
|
|
|
print(' startup done')
|
2012-04-06 09:33:54 -04:00
|
|
|
|
|
|
|
try:
|
2012-08-03 17:18:14 -04:00
|
|
|
print(' test utf8...')
|
2012-04-06 09:33:54 -04:00
|
|
|
run('sh ./exampledocs/test_utf8.sh', 'utf8.log')
|
2012-08-03 17:18:14 -04:00
|
|
|
print(' index example docs...')
|
2012-04-06 09:33:54 -04:00
|
|
|
run('sh ./exampledocs/post.sh ./exampledocs/*.xml', 'post-example-docs.log')
|
2012-08-03 17:18:14 -04:00
|
|
|
print(' run query...')
|
2012-08-03 17:49:24 -04:00
|
|
|
s = urllib.request.urlopen('http://localhost:8983/solr/select/?q=video').read().decode('UTF-8')
|
2012-04-06 09:33:54 -04:00
|
|
|
if s.find('<result name="response" numFound="3" start="0">') == -1:
|
2012-08-03 17:18:14 -04:00
|
|
|
print('FAILED: response is:\n%s' % s)
|
2012-04-06 09:33:54 -04:00
|
|
|
raise RuntimeError('query on solr example instance failed')
|
|
|
|
finally:
|
|
|
|
# Stop server:
|
2012-08-03 17:18:14 -04:00
|
|
|
print(' stop server (SIGINT)...')
|
2012-04-06 09:33:54 -04:00
|
|
|
os.kill(server.pid, signal.SIGINT)
|
|
|
|
|
|
|
|
# Give it 10 seconds to gracefully shut down
|
|
|
|
serverThread.join(10.0)
|
|
|
|
|
|
|
|
if serverThread.isAlive():
|
|
|
|
# Kill server:
|
2012-08-03 17:18:14 -04:00
|
|
|
print('***WARNING***: Solr instance didn\'t respond to SIGINT; using SIGKILL now...')
|
2012-04-06 09:33:54 -04:00
|
|
|
os.kill(server.pid, signal.SIGKILL)
|
|
|
|
|
|
|
|
serverThread.join(10.0)
|
|
|
|
|
|
|
|
if serverThread.isAlive():
|
|
|
|
# Shouldn't happen unless something is seriously wrong...
|
2012-08-03 17:18:14 -04:00
|
|
|
print('***WARNING***: Solr instance didn\'t respond to SIGKILL; ignoring...')
|
2012-04-06 09:33:54 -04:00
|
|
|
|
2012-08-20 20:16:43 -04:00
|
|
|
if failureEvent.isSet():
|
|
|
|
raise RuntimeError('exception while reading Solr output')
|
|
|
|
|
2012-04-06 09:33:54 -04:00
|
|
|
os.chdir('..')
|
|
|
|
|
2012-10-26 00:53:34 -04:00
|
|
|
# the weaker check: we can use this on java6 for some checks,
|
|
|
|
# but its generated HTML is hopelessly broken so we cannot run
|
|
|
|
# the link checking that checkJavadocpathFull does.
|
2012-09-06 18:45:52 -04:00
|
|
|
def checkJavadocpath(path, failOnMissing=True):
|
2012-06-08 06:18:09 -04:00
|
|
|
# check for level='package'
|
|
|
|
# we fail here if its screwed up
|
2012-09-06 18:45:52 -04:00
|
|
|
if failOnMissing and checkJavaDocs.checkPackageSummaries(path, 'package'):
|
2012-06-08 06:18:09 -04:00
|
|
|
raise RuntimeError('missing javadocs package summaries!')
|
|
|
|
|
|
|
|
# now check for level='class'
|
|
|
|
if checkJavaDocs.checkPackageSummaries(path):
|
2012-04-06 09:33:54 -04:00
|
|
|
# disabled: RM cannot fix all this, see LUCENE-3887
|
|
|
|
# raise RuntimeError('javadoc problems')
|
2012-08-03 17:18:14 -04:00
|
|
|
print('\n***WARNING***: javadocs want to fail!\n')
|
2012-06-08 06:18:09 -04:00
|
|
|
|
2012-10-26 00:53:34 -04:00
|
|
|
# full checks
|
|
|
|
def checkJavadocpathFull(path, failOnMissing=True):
|
|
|
|
# check for missing, etc
|
|
|
|
checkJavadocpath(path, failOnMissing)
|
|
|
|
|
|
|
|
# also validate html/check for broken links
|
2012-06-08 06:18:09 -04:00
|
|
|
if checkJavadocLinks.checkAll(path):
|
|
|
|
raise RuntimeError('broken javadocs links found!')
|
2012-03-22 11:24:44 -04:00
|
|
|
|
2012-10-26 00:53:34 -04:00
|
|
|
def testDemo(isSrc, version, jdk):
|
2012-10-27 13:42:45 -04:00
|
|
|
if os.path.exists('index'):
|
2012-10-26 00:53:34 -04:00
|
|
|
shutil.rmtree('index') # nuke any index from any previous iteration
|
|
|
|
|
|
|
|
print(' test demo with %s...' % jdk)
|
2012-04-08 13:15:54 -04:00
|
|
|
sep = ';' if cygwin else ':'
|
2011-06-04 06:37:48 -04:00
|
|
|
if isSrc:
|
2012-06-08 09:25:04 -04:00
|
|
|
cp = 'build/core/classes/java{0}build/demo/classes/java{0}build/analysis/common/classes/java{0}build/queryparser/classes/java'.format(sep)
|
2012-03-19 13:36:27 -04:00
|
|
|
docsDir = 'core/src'
|
2011-06-04 06:37:48 -04:00
|
|
|
else:
|
2012-06-08 06:18:09 -04:00
|
|
|
cp = 'core/lucene-core-{0}.jar{1}demo/lucene-demo-{0}.jar{1}analysis/common/lucene-analyzers-common-{0}.jar{1}queryparser/lucene-queryparser-{0}.jar'.format(version, sep)
|
2011-06-04 06:37:48 -04:00
|
|
|
docsDir = 'docs'
|
2012-10-26 00:53:34 -04:00
|
|
|
run('%s; java -cp "%s" org.apache.lucene.demo.IndexFiles -index index -docs %s' % (javaExe(jdk), cp, docsDir), 'index.log')
|
|
|
|
run('%s; java -cp "%s" org.apache.lucene.demo.SearchFiles -index index -query lucene' % (javaExe(jdk), cp), 'search.log')
|
2011-06-04 06:37:48 -04:00
|
|
|
reMatchingDocs = re.compile('(\d+) total matching documents')
|
2012-08-03 17:49:24 -04:00
|
|
|
m = reMatchingDocs.search(open('search.log', encoding='UTF-8').read())
|
2011-06-04 06:37:48 -04:00
|
|
|
if m is None:
|
|
|
|
raise RuntimeError('lucene demo\'s SearchFiles found no results')
|
|
|
|
else:
|
|
|
|
numHits = int(m.group(1))
|
|
|
|
if numHits < 100:
|
|
|
|
raise RuntimeError('lucene demo\'s SearchFiles found too few results: %s' % numHits)
|
2012-08-03 17:18:14 -04:00
|
|
|
print(' got %d hits for query "lucene"' % numHits)
|
2012-03-19 13:36:27 -04:00
|
|
|
|
2012-04-08 14:22:14 -04:00
|
|
|
def checkMaven(baseURL, tmpDir, version, isSigned):
|
2012-03-19 13:36:27 -04:00
|
|
|
# Locate the release branch in subversion
|
|
|
|
m = re.match('(\d+)\.(\d+)', version) # Get Major.minor version components
|
|
|
|
releaseBranchText = 'lucene_solr_%s_%s/' % (m.group(1), m.group(2))
|
|
|
|
branchesURL = 'http://svn.apache.org/repos/asf/lucene/dev/branches/'
|
|
|
|
releaseBranchSvnURL = None
|
|
|
|
branches = getDirEntries(branchesURL)
|
|
|
|
for text, subURL in branches:
|
|
|
|
if text == releaseBranchText:
|
|
|
|
releaseBranchSvnURL = subURL
|
|
|
|
|
2012-08-03 17:18:14 -04:00
|
|
|
print(' get POM templates', end=' ')
|
2012-03-19 13:36:27 -04:00
|
|
|
POMtemplates = defaultdict()
|
|
|
|
getPOMtemplates(POMtemplates, tmpDir, releaseBranchSvnURL)
|
2012-08-03 17:18:14 -04:00
|
|
|
print()
|
|
|
|
print(' download artifacts', end=' ')
|
2012-03-19 13:36:27 -04:00
|
|
|
artifacts = {'lucene': [], 'solr': []}
|
|
|
|
for project in ('lucene', 'solr'):
|
|
|
|
artifactsURL = '%s/%s/maven/org/apache/%s' % (baseURL, project, project)
|
|
|
|
targetDir = '%s/maven/org/apache/%s' % (tmpDir, project)
|
|
|
|
if not os.path.exists(targetDir):
|
|
|
|
os.makedirs(targetDir)
|
|
|
|
crawl(artifacts[project], artifactsURL, targetDir)
|
2012-08-03 17:18:14 -04:00
|
|
|
print()
|
|
|
|
print(' verify that each binary artifact has a deployed POM...')
|
2012-03-19 13:36:27 -04:00
|
|
|
verifyPOMperBinaryArtifact(artifacts, version)
|
2012-08-03 17:18:14 -04:00
|
|
|
print(' verify that there is an artifact for each POM template...')
|
2012-03-19 13:36:27 -04:00
|
|
|
verifyArtifactPerPOMtemplate(POMtemplates, artifacts, tmpDir, version)
|
2012-08-03 17:18:14 -04:00
|
|
|
print(" verify Maven artifacts' md5/sha1 digests...")
|
2012-03-19 13:36:27 -04:00
|
|
|
verifyMavenDigests(artifacts)
|
2012-08-03 17:18:14 -04:00
|
|
|
print(' verify that all non-Mavenized deps are deployed...')
|
2012-03-19 13:36:27 -04:00
|
|
|
nonMavenizedDeps = dict()
|
|
|
|
checkNonMavenizedDeps(nonMavenizedDeps, POMtemplates, artifacts, tmpDir,
|
|
|
|
version, releaseBranchSvnURL)
|
2012-08-03 17:18:14 -04:00
|
|
|
print(' check for javadoc and sources artifacts...')
|
2012-03-19 13:36:27 -04:00
|
|
|
checkJavadocAndSourceArtifacts(nonMavenizedDeps, artifacts, version)
|
2012-08-03 17:18:14 -04:00
|
|
|
print(" verify deployed POMs' coordinates...")
|
2012-03-19 13:36:27 -04:00
|
|
|
verifyDeployedPOMsCoordinates(artifacts, version)
|
2012-04-08 14:22:14 -04:00
|
|
|
if isSigned:
|
2012-08-03 17:18:14 -04:00
|
|
|
print(' verify maven artifact sigs', end=' ')
|
2012-04-08 14:22:14 -04:00
|
|
|
verifyMavenSigs(baseURL, tmpDir, artifacts)
|
2012-03-19 13:36:27 -04:00
|
|
|
|
|
|
|
distributionFiles = getDistributionsForMavenChecks(tmpDir, version, baseURL)
|
|
|
|
|
2012-08-03 17:18:14 -04:00
|
|
|
print(' verify that non-Mavenized deps are same as in the binary distribution...')
|
2012-03-19 13:36:27 -04:00
|
|
|
checkIdenticalNonMavenizedDeps(distributionFiles, nonMavenizedDeps)
|
2012-08-03 17:18:14 -04:00
|
|
|
print(' verify that Maven artifacts are same as in the binary distribution...')
|
2012-03-19 20:21:13 -04:00
|
|
|
checkIdenticalMavenArtifacts(distributionFiles, nonMavenizedDeps, artifacts, version)
|
2012-03-19 13:36:27 -04:00
|
|
|
|
2012-09-26 14:33:46 -04:00
|
|
|
checkAllJARs('%s/maven/org/apache/lucene' % tmpDir, 'lucene', version)
|
|
|
|
checkAllJARs('%s/maven/org/apache/solr' % tmpDir, 'solr', version)
|
|
|
|
|
2012-03-19 13:36:27 -04:00
|
|
|
def getDistributionsForMavenChecks(tmpDir, version, baseURL):
|
|
|
|
distributionFiles = defaultdict()
|
|
|
|
for project in ('lucene', 'solr'):
|
|
|
|
distribution = '%s-%s.tgz' % (project, version)
|
|
|
|
if project == 'solr': distribution = 'apache-' + distribution
|
|
|
|
if not os.path.exists('%s/%s' % (tmpDir, distribution)):
|
|
|
|
distURL = '%s/%s/%s' % (baseURL, project, distribution)
|
2012-08-03 17:18:14 -04:00
|
|
|
print(' download %s...' % distribution, end=' ')
|
2012-03-19 13:36:27 -04:00
|
|
|
download(distribution, distURL, tmpDir)
|
|
|
|
destDir = '%s/unpack-%s-maven' % (tmpDir, project)
|
|
|
|
if os.path.exists(destDir):
|
|
|
|
shutil.rmtree(destDir)
|
|
|
|
os.makedirs(destDir)
|
|
|
|
os.chdir(destDir)
|
2012-08-03 17:18:14 -04:00
|
|
|
print(' unpack %s...' % distribution)
|
2012-03-19 13:36:27 -04:00
|
|
|
unpackLogFile = '%s/unpack-%s-maven-checks.log' % (tmpDir, distribution)
|
|
|
|
run('tar xzf %s/%s' % (tmpDir, distribution), unpackLogFile)
|
|
|
|
if project == 'solr': # unpack the Solr war
|
|
|
|
unpackLogFile = '%s/unpack-solr-war-maven-checks.log' % tmpDir
|
2012-08-03 17:18:14 -04:00
|
|
|
print(' unpack Solr war...')
|
2012-03-19 13:36:27 -04:00
|
|
|
run('jar xvf */dist/*.war', unpackLogFile)
|
|
|
|
distributionFiles[project] = []
|
|
|
|
for root, dirs, files in os.walk(destDir):
|
|
|
|
distributionFiles[project].extend([os.path.join(root, file) for file in files])
|
|
|
|
return distributionFiles
|
|
|
|
|
|
|
|
def checkJavadocAndSourceArtifacts(nonMavenizedDeps, artifacts, version):
|
|
|
|
for project in ('lucene', 'solr'):
|
|
|
|
for artifact in artifacts[project]:
|
2012-08-03 17:18:14 -04:00
|
|
|
if artifact.endswith(version + '.jar') and artifact not in list(nonMavenizedDeps.keys()):
|
2012-03-19 13:36:27 -04:00
|
|
|
javadocJar = artifact[:-4] + '-javadoc.jar'
|
|
|
|
if javadocJar not in artifacts[project]:
|
|
|
|
raise RuntimeError('missing: %s' % javadocJar)
|
|
|
|
sourcesJar = artifact[:-4] + '-sources.jar'
|
|
|
|
if sourcesJar not in artifacts[project]:
|
|
|
|
raise RuntimeError('missing: %s' % sourcesJar)
|
|
|
|
|
|
|
|
def checkIdenticalNonMavenizedDeps(distributionFiles, nonMavenizedDeps):
|
|
|
|
for project in ('lucene', 'solr'):
|
|
|
|
distFilenames = dict()
|
|
|
|
for file in distributionFiles[project]:
|
|
|
|
distFilenames[os.path.basename(file)] = file
|
2012-08-03 17:18:14 -04:00
|
|
|
for dep in list(nonMavenizedDeps.keys()):
|
2012-03-19 13:36:27 -04:00
|
|
|
if ('/%s/' % project) in dep:
|
|
|
|
depOrigFilename = os.path.basename(nonMavenizedDeps[dep])
|
|
|
|
if not depOrigFilename in distFilenames:
|
|
|
|
raise RuntimeError('missing: non-mavenized dependency %s' % nonMavenizedDeps[dep])
|
|
|
|
identical = filecmp.cmp(dep, distFilenames[depOrigFilename], shallow=False)
|
|
|
|
if not identical:
|
|
|
|
raise RuntimeError('Deployed non-mavenized dep %s differs from distribution dep %s'
|
|
|
|
% (dep, distFilenames[depOrigFilename]))
|
|
|
|
|
2012-03-19 20:21:13 -04:00
|
|
|
def checkIdenticalMavenArtifacts(distributionFiles, nonMavenizedDeps, artifacts, version):
|
|
|
|
reJarWar = re.compile(r'%s\.[wj]ar$' % version) # exclude *-javadoc.jar and *-sources.jar
|
2012-03-19 13:36:27 -04:00
|
|
|
for project in ('lucene', 'solr'):
|
|
|
|
distFilenames = dict()
|
|
|
|
for file in distributionFiles[project]:
|
2012-03-23 19:47:55 -04:00
|
|
|
baseName = os.path.basename(file)
|
|
|
|
if project == 'solr': # Remove 'apache-' prefix to allow comparison to Maven artifacts
|
|
|
|
baseName = baseName.replace('apache-', '')
|
|
|
|
distFilenames[baseName] = file
|
2012-03-19 13:36:27 -04:00
|
|
|
for artifact in artifacts[project]:
|
|
|
|
if reJarWar.search(artifact):
|
2012-08-03 17:18:14 -04:00
|
|
|
if artifact not in list(nonMavenizedDeps.keys()):
|
2012-03-19 13:36:27 -04:00
|
|
|
artifactFilename = os.path.basename(artifact)
|
2012-08-03 17:18:14 -04:00
|
|
|
if artifactFilename not in list(distFilenames.keys()):
|
2012-03-19 13:36:27 -04:00
|
|
|
raise RuntimeError('Maven artifact %s is not present in %s binary distribution'
|
|
|
|
% (artifact, project))
|
2012-03-19 20:21:13 -04:00
|
|
|
# TODO: Either fix the build to ensure that maven artifacts *are* identical, or recursively compare contents
|
|
|
|
# identical = filecmp.cmp(artifact, distFilenames[artifactFilename], shallow=False)
|
|
|
|
# if not identical:
|
|
|
|
# raise RuntimeError('Maven artifact %s is not identical to %s in %s binary distribution'
|
|
|
|
# % (artifact, distFilenames[artifactFilename], project))
|
2012-03-19 13:36:27 -04:00
|
|
|
|
|
|
|
def verifyMavenDigests(artifacts):
|
|
|
|
reJarWarPom = re.compile(r'\.(?:[wj]ar|pom)$')
|
|
|
|
for project in ('lucene', 'solr'):
|
|
|
|
for artifactFile in [a for a in artifacts[project] if reJarWarPom.search(a)]:
|
|
|
|
if artifactFile + '.md5' not in artifacts[project]:
|
|
|
|
raise RuntimeError('missing: MD5 digest for %s' % artifactFile)
|
|
|
|
if artifactFile + '.sha1' not in artifacts[project]:
|
|
|
|
raise RuntimeError('missing: SHA1 digest for %s' % artifactFile)
|
2012-08-03 17:49:24 -04:00
|
|
|
with open(artifactFile + '.md5', encoding='UTF-8') as md5File:
|
2012-03-19 13:36:27 -04:00
|
|
|
md5Expected = md5File.read().strip()
|
2012-08-03 17:49:24 -04:00
|
|
|
with open(artifactFile + '.sha1', encoding='UTF-8') as sha1File:
|
2012-03-19 13:36:27 -04:00
|
|
|
sha1Expected = sha1File.read().strip()
|
|
|
|
md5 = hashlib.md5()
|
|
|
|
sha1 = hashlib.sha1()
|
2012-08-03 17:49:24 -04:00
|
|
|
inputFile = open(artifactFile, 'rb')
|
2012-03-19 13:36:27 -04:00
|
|
|
while True:
|
|
|
|
bytes = inputFile.read(65536)
|
2012-08-03 18:48:27 -04:00
|
|
|
if len(bytes) == 0:
|
|
|
|
break
|
2012-03-19 13:36:27 -04:00
|
|
|
md5.update(bytes)
|
|
|
|
sha1.update(bytes)
|
|
|
|
inputFile.close()
|
|
|
|
md5Actual = md5.hexdigest()
|
|
|
|
sha1Actual = sha1.hexdigest()
|
|
|
|
if md5Actual != md5Expected:
|
|
|
|
raise RuntimeError('MD5 digest mismatch for %s: expected %s but got %s'
|
|
|
|
% (artifactFile, md5Expected, md5Actual))
|
|
|
|
if sha1Actual != sha1Expected:
|
|
|
|
raise RuntimeError('SHA1 digest mismatch for %s: expected %s but got %s'
|
|
|
|
% (artifactFile, sha1Expected, sha1Actual))
|
|
|
|
|
|
|
|
def checkNonMavenizedDeps(nonMavenizedDependencies, POMtemplates, artifacts,
|
|
|
|
tmpDir, version, releaseBranchSvnURL):
|
|
|
|
"""
|
|
|
|
- check for non-mavenized dependencies listed in the grandfather POM template
|
|
|
|
- nonMavenizedDependencies is populated with a map from non-mavenized dependency
|
|
|
|
artifact path to the original jar path
|
|
|
|
"""
|
|
|
|
namespace = '{http://maven.apache.org/POM/4.0.0}'
|
|
|
|
xpathProfile = '{0}profiles/{0}profile'.format(namespace)
|
|
|
|
xpathPlugin = '{0}build/{0}plugins/{0}plugin'.format(namespace)
|
|
|
|
xpathExecution= '{0}executions/{0}execution'.format(namespace)
|
|
|
|
xpathResourceDir = '{0}configuration/{0}resources/{0}resource/{0}directory'.format(namespace)
|
|
|
|
|
|
|
|
treeRoot = ET.parse(POMtemplates['grandfather'][0]).getroot()
|
|
|
|
for profile in treeRoot.findall(xpathProfile):
|
|
|
|
pomDirs = []
|
|
|
|
profileId = profile.find('%sid' % namespace)
|
|
|
|
if profileId is not None and profileId.text == 'bootstrap':
|
|
|
|
plugins = profile.findall(xpathPlugin)
|
|
|
|
for plugin in plugins:
|
|
|
|
artifactId = plugin.find('%sartifactId' % namespace).text.strip()
|
|
|
|
if artifactId == 'maven-resources-plugin':
|
|
|
|
for config in plugin.findall(xpathExecution):
|
|
|
|
pomDirs.append(config.find(xpathResourceDir).text.strip())
|
|
|
|
for plugin in plugins:
|
|
|
|
artifactId = plugin.find('%sartifactId' % namespace).text.strip()
|
|
|
|
if artifactId == 'maven-install-plugin':
|
|
|
|
for execution in plugin.findall(xpathExecution):
|
|
|
|
groupId, artifactId, file, pomFile = '', '', '', ''
|
|
|
|
for child in execution.find('%sconfiguration' % namespace).getchildren():
|
|
|
|
text = child.text.strip()
|
|
|
|
if child.tag == '%sgroupId' % namespace:
|
|
|
|
groupId = text if text != '${project.groupId}' else 'org.apache.lucene'
|
|
|
|
elif child.tag == '%sartifactId' % namespace: artifactId = text
|
|
|
|
elif child.tag == '%sfile' % namespace: file = text
|
|
|
|
elif child.tag == '%spomFile' % namespace: pomFile = text
|
|
|
|
if groupId in ('org.apache.lucene', 'org.apache.solr'):
|
|
|
|
depJar = '%s/maven/%s/%s/%s/%s-%s.jar' \
|
|
|
|
% (tmpDir, groupId.replace('.', '/'),
|
|
|
|
artifactId, version, artifactId, version)
|
|
|
|
if depJar not in artifacts['lucene'] \
|
|
|
|
and depJar not in artifacts['solr']:
|
|
|
|
raise RuntimeError('Missing non-mavenized dependency %s' % depJar)
|
|
|
|
nonMavenizedDependencies[depJar] = file
|
|
|
|
elif pomFile: # Find non-Mavenized deps with associated POMs
|
|
|
|
pomFile = pomFile.split('/')[-1] # remove path
|
2012-03-19 20:21:13 -04:00
|
|
|
doc2 = None
|
|
|
|
workingCopy = os.path.abspath('%s/../..' % sys.path[0])
|
2012-03-19 13:36:27 -04:00
|
|
|
for pomDir in pomDirs:
|
2012-03-19 20:21:13 -04:00
|
|
|
if releaseBranchSvnURL is None:
|
|
|
|
pomPath = '%s/%s/%s' % (workingCopy, pomDir, pomFile)
|
|
|
|
if os.path.exists(pomPath):
|
2012-08-03 17:49:24 -04:00
|
|
|
doc2 = ET.XML(open(pomPath, encoding='UTF-8').read())
|
2012-03-19 13:36:27 -04:00
|
|
|
break
|
2012-03-19 20:21:13 -04:00
|
|
|
else:
|
|
|
|
entries = getDirEntries('%s/%s' % (releaseBranchSvnURL, pomDir))
|
|
|
|
for text, subURL in entries:
|
|
|
|
if text == pomFile:
|
|
|
|
doc2 = ET.XML(load(subURL))
|
|
|
|
break
|
|
|
|
if doc2 is not None: break
|
|
|
|
|
|
|
|
groupId2, artifactId2, packaging2, POMversion = getPOMcoordinate(doc2)
|
|
|
|
depJar = '%s/maven/%s/%s/%s/%s-%s.jar' \
|
|
|
|
% (tmpDir, groupId2.replace('.', '/'),
|
|
|
|
artifactId2, version, artifactId2, version)
|
|
|
|
if depJar not in artifacts['lucene'] and depJar not in artifacts['solr']:
|
|
|
|
raise RuntimeError('Missing non-mavenized dependency %s' % depJar)
|
|
|
|
nonMavenizedDependencies[depJar] = file
|
2012-03-19 13:36:27 -04:00
|
|
|
|
|
|
|
def getPOMcoordinate(treeRoot):
|
|
|
|
namespace = '{http://maven.apache.org/POM/4.0.0}'
|
|
|
|
groupId = treeRoot.find('%sgroupId' % namespace)
|
|
|
|
if groupId is None:
|
|
|
|
groupId = treeRoot.find('{0}parent/{0}groupId'.format(namespace))
|
|
|
|
groupId = groupId.text.strip()
|
|
|
|
artifactId = treeRoot.find('%sartifactId' % namespace).text.strip()
|
|
|
|
version = treeRoot.find('%sversion' % namespace)
|
|
|
|
if version is None:
|
|
|
|
version = treeRoot.find('{0}parent/{0}version'.format(namespace))
|
|
|
|
version = version.text.strip()
|
|
|
|
packaging = treeRoot.find('%spackaging' % namespace)
|
|
|
|
packaging = 'jar' if packaging is None else packaging.text.strip()
|
|
|
|
return groupId, artifactId, packaging, version
|
|
|
|
|
|
|
|
def verifyMavenSigs(baseURL, tmpDir, artifacts):
|
|
|
|
"""Verify Maven artifact signatures"""
|
|
|
|
for project in ('lucene', 'solr'):
|
|
|
|
keysFile = '%s/%s.KEYS' % (tmpDir, project)
|
|
|
|
if not os.path.exists(keysFile):
|
|
|
|
keysURL = '%s/%s/KEYS' % (baseURL, project)
|
|
|
|
download('%s.KEYS' % project, keysURL, tmpDir, quiet=True)
|
|
|
|
|
|
|
|
# Set up clean gpg world; import keys file:
|
|
|
|
gpgHomeDir = '%s/%s.gpg' % (tmpDir, project)
|
|
|
|
if os.path.exists(gpgHomeDir):
|
|
|
|
shutil.rmtree(gpgHomeDir)
|
2012-08-03 17:18:14 -04:00
|
|
|
os.makedirs(gpgHomeDir, 0o700)
|
2012-03-19 13:36:27 -04:00
|
|
|
run('gpg --homedir %s --import %s' % (gpgHomeDir, keysFile),
|
|
|
|
'%s/%s.gpg.import.log' % (tmpDir, project))
|
|
|
|
|
|
|
|
reArtifacts = re.compile(r'\.(?:pom|[jw]ar)$')
|
|
|
|
for artifactFile in [a for a in artifacts[project] if reArtifacts.search(a)]:
|
|
|
|
artifact = os.path.basename(artifactFile)
|
|
|
|
sigFile = '%s.asc' % artifactFile
|
|
|
|
# Test sig (this is done with a clean brand-new GPG world)
|
|
|
|
logFile = '%s/%s.%s.gpg.verify.log' % (tmpDir, project, artifact)
|
|
|
|
run('gpg --homedir %s --verify %s %s' % (gpgHomeDir, sigFile, artifactFile),
|
|
|
|
logFile)
|
|
|
|
# Forward any GPG warnings, except the expected one (since its a clean world)
|
2012-08-03 17:49:24 -04:00
|
|
|
f = open(logFile, encoding='UTF-8')
|
2012-03-19 13:36:27 -04:00
|
|
|
for line in f.readlines():
|
|
|
|
if line.lower().find('warning') != -1 \
|
|
|
|
and line.find('WARNING: This key is not certified with a trusted signature') == -1 \
|
|
|
|
and line.find('WARNING: using insecure memory') == -1:
|
2012-08-03 17:18:14 -04:00
|
|
|
print(' GPG: %s' % line.strip())
|
2012-03-19 13:36:27 -04:00
|
|
|
f.close()
|
|
|
|
|
|
|
|
# Test trust (this is done with the real users config)
|
|
|
|
run('gpg --import %s' % keysFile,
|
|
|
|
'%s/%s.gpg.trust.import.log' % (tmpDir, project))
|
|
|
|
logFile = '%s/%s.%s.gpg.trust.log' % (tmpDir, project, artifact)
|
|
|
|
run('gpg --verify %s %s' % (sigFile, artifactFile), logFile)
|
|
|
|
# Forward any GPG warnings:
|
2012-08-03 17:49:24 -04:00
|
|
|
f = open(logFile, encoding='UTF-8')
|
2012-03-19 13:36:27 -04:00
|
|
|
for line in f.readlines():
|
|
|
|
if line.lower().find('warning') != -1 \
|
|
|
|
and line.find('WARNING: This key is not certified with a trusted signature') == -1 \
|
|
|
|
and line.find('WARNING: using insecure memory') == -1:
|
2012-08-03 17:18:14 -04:00
|
|
|
print(' GPG: %s' % line.strip())
|
2012-03-19 13:36:27 -04:00
|
|
|
f.close()
|
|
|
|
|
|
|
|
sys.stdout.write('.')
|
2012-08-03 17:18:14 -04:00
|
|
|
print()
|
2012-03-19 13:36:27 -04:00
|
|
|
|
|
|
|
def verifyPOMperBinaryArtifact(artifacts, version):
|
|
|
|
"""verify that each binary jar and war has a corresponding POM file"""
|
|
|
|
reBinaryJarWar = re.compile(r'%s\.[jw]ar$' % re.escape(version))
|
|
|
|
for project in ('lucene', 'solr'):
|
|
|
|
for artifact in [a for a in artifacts[project] if reBinaryJarWar.search(a)]:
|
|
|
|
POM = artifact[:-4] + '.pom'
|
|
|
|
if POM not in artifacts[project]:
|
|
|
|
raise RuntimeError('missing: POM for %s' % artifact)
|
|
|
|
|
|
|
|
def verifyDeployedPOMsCoordinates(artifacts, version):
|
|
|
|
"""
|
|
|
|
verify that each POM's coordinate (drawn from its content) matches
|
|
|
|
its filepath, and verify that the corresponding artifact exists.
|
|
|
|
"""
|
|
|
|
for project in ('lucene', 'solr'):
|
|
|
|
for POM in [a for a in artifacts[project] if a.endswith('.pom')]:
|
|
|
|
treeRoot = ET.parse(POM).getroot()
|
|
|
|
groupId, artifactId, packaging, POMversion = getPOMcoordinate(treeRoot)
|
|
|
|
POMpath = '%s/%s/%s/%s-%s.pom' \
|
|
|
|
% (groupId.replace('.', '/'), artifactId, version, artifactId, version)
|
|
|
|
if not POM.endswith(POMpath):
|
|
|
|
raise RuntimeError("Mismatch between POM coordinate %s:%s:%s and filepath: %s"
|
|
|
|
% (groupId, artifactId, POMversion, POM))
|
|
|
|
# Verify that the corresponding artifact exists
|
|
|
|
artifact = POM[:-3] + packaging
|
|
|
|
if artifact not in artifacts[project]:
|
|
|
|
raise RuntimeError('Missing corresponding .%s artifact for POM %s' % (packaging, POM))
|
|
|
|
|
|
|
|
def verifyArtifactPerPOMtemplate(POMtemplates, artifacts, tmpDir, version):
|
|
|
|
"""verify that each POM template's artifact is present in artifacts"""
|
|
|
|
namespace = '{http://maven.apache.org/POM/4.0.0}'
|
|
|
|
xpathPlugin = '{0}build/{0}plugins/{0}plugin'.format(namespace)
|
|
|
|
xpathSkipConfiguration = '{0}configuration/{0}skip'.format(namespace)
|
|
|
|
for project in ('lucene', 'solr'):
|
|
|
|
for POMtemplate in POMtemplates[project]:
|
|
|
|
treeRoot = ET.parse(POMtemplate).getroot()
|
|
|
|
skipDeploy = False
|
|
|
|
for plugin in treeRoot.findall(xpathPlugin):
|
|
|
|
artifactId = plugin.find('%sartifactId' % namespace).text.strip()
|
|
|
|
if artifactId == 'maven-deploy-plugin':
|
|
|
|
skip = plugin.find(xpathSkipConfiguration)
|
|
|
|
if skip is not None: skipDeploy = (skip.text.strip().lower() == 'true')
|
|
|
|
if not skipDeploy:
|
|
|
|
groupId, artifactId, packaging, POMversion = getPOMcoordinate(treeRoot)
|
|
|
|
# Ignore POMversion, since its value will not have been interpolated
|
|
|
|
artifact = '%s/maven/%s/%s/%s/%s-%s.%s' \
|
|
|
|
% (tmpDir, groupId.replace('.', '/'), artifactId,
|
|
|
|
version, artifactId, version, packaging)
|
|
|
|
if artifact not in artifacts['lucene'] and artifact not in artifacts['solr']:
|
|
|
|
raise RuntimeError('Missing artifact %s' % artifact)
|
|
|
|
|
|
|
|
def getPOMtemplates(POMtemplates, tmpDir, releaseBranchSvnURL):
|
|
|
|
allPOMtemplates = []
|
2012-03-19 20:21:13 -04:00
|
|
|
sourceLocation = releaseBranchSvnURL
|
|
|
|
if sourceLocation is None:
|
|
|
|
# Use the POM templates under dev-tools/maven/ in the local working copy
|
|
|
|
# sys.path[0] is the directory containing this script: dev-tools/scripts/
|
|
|
|
sourceLocation = os.path.abspath('%s/../maven' % sys.path[0])
|
|
|
|
rePOMtemplate = re.compile(r'^pom.xml.template$')
|
|
|
|
for root, dirs, files in os.walk(sourceLocation):
|
|
|
|
allPOMtemplates.extend([os.path.join(root, f) for f in files if rePOMtemplate.search(f)])
|
|
|
|
else:
|
|
|
|
sourceLocation += 'dev-tools/maven/'
|
|
|
|
targetDir = '%s/dev-tools/maven' % tmpDir
|
|
|
|
if not os.path.exists(targetDir):
|
|
|
|
os.makedirs(targetDir)
|
2012-09-22 21:28:16 -04:00
|
|
|
crawl(allPOMtemplates, sourceLocation, targetDir, set(['Apache Subversion', 'maven.testlogging.properties']))
|
2012-03-19 20:21:13 -04:00
|
|
|
|
2012-09-22 21:28:16 -04:00
|
|
|
reLucenePOMtemplate = re.compile(r'.*/maven/lucene.*/pom\.xml\.template$')
|
|
|
|
POMtemplates['lucene'] = [p for p in allPOMtemplates if reLucenePOMtemplate.search(p)]
|
2012-03-19 13:36:27 -04:00
|
|
|
if POMtemplates['lucene'] is None:
|
2012-03-19 20:21:13 -04:00
|
|
|
raise RuntimeError('No Lucene POMs found at %s' % sourceLocation)
|
2012-09-22 21:28:16 -04:00
|
|
|
reSolrPOMtemplate = re.compile(r'.*/maven/solr.*/pom\.xml\.template$')
|
|
|
|
POMtemplates['solr'] = [p for p in allPOMtemplates if reSolrPOMtemplate.search(p)]
|
2012-03-19 13:36:27 -04:00
|
|
|
if POMtemplates['solr'] is None:
|
2012-03-19 20:21:13 -04:00
|
|
|
raise RuntimeError('No Solr POMs found at %s' % sourceLocation)
|
2012-03-19 13:36:27 -04:00
|
|
|
POMtemplates['grandfather'] = [p for p in allPOMtemplates if '/maven/pom.xml.template' in p]
|
2012-04-08 14:22:14 -04:00
|
|
|
if len(POMtemplates['grandfather']) == 0:
|
2012-03-19 20:21:13 -04:00
|
|
|
raise RuntimeError('No Lucene/Solr grandfather POM found at %s' % sourceLocation)
|
2012-03-19 13:36:27 -04:00
|
|
|
|
|
|
|
def crawl(downloadedFiles, urlString, targetDir, exclusions=set()):
|
|
|
|
for text, subURL in getDirEntries(urlString):
|
|
|
|
if text not in exclusions:
|
|
|
|
path = os.path.join(targetDir, text)
|
|
|
|
if text.endswith('/'):
|
|
|
|
if not os.path.exists(path):
|
|
|
|
os.makedirs(path)
|
|
|
|
crawl(downloadedFiles, subURL, path, exclusions)
|
|
|
|
else:
|
2012-09-26 14:33:46 -04:00
|
|
|
if not os.path.exists(path) or FORCE_CLEAN:
|
2012-03-19 13:36:27 -04:00
|
|
|
download(text, subURL, targetDir, quiet=True)
|
|
|
|
downloadedFiles.append(path)
|
|
|
|
sys.stdout.write('.')
|
|
|
|
|
2012-09-25 17:37:31 -04:00
|
|
|
reAllowedVersion = re.compile(r'^\d+\.\d+\.\d+(-ALPHA|-BETA)?$')
|
|
|
|
|
2011-06-04 06:37:48 -04:00
|
|
|
def main():
|
|
|
|
|
2012-08-07 16:58:46 -04:00
|
|
|
if len(sys.argv) < 4:
|
2012-08-03 17:18:14 -04:00
|
|
|
print()
|
|
|
|
print('Usage python -u %s BaseURL version tmpDir' % sys.argv[0])
|
|
|
|
print()
|
2011-06-04 06:37:48 -04:00
|
|
|
sys.exit(1)
|
|
|
|
|
|
|
|
baseURL = sys.argv[1]
|
|
|
|
version = sys.argv[2]
|
2012-09-25 17:37:31 -04:00
|
|
|
|
|
|
|
if not reAllowedVersion.match(version):
|
|
|
|
raise RuntimeError('version "%s" does not match format X.Y.Z[-ALPHA|-BETA]' % version)
|
|
|
|
|
2011-06-04 06:37:48 -04:00
|
|
|
tmpDir = os.path.abspath(sys.argv[3])
|
2012-08-07 16:58:46 -04:00
|
|
|
isSigned = True
|
|
|
|
if len(sys.argv) == 5:
|
|
|
|
isSigned = (sys.argv[4] == "True")
|
2011-06-04 06:37:48 -04:00
|
|
|
|
2012-08-07 16:58:46 -04:00
|
|
|
smokeTest(baseURL, version, tmpDir, isSigned)
|
2012-04-08 14:22:14 -04:00
|
|
|
|
|
|
|
def smokeTest(baseURL, version, tmpDir, isSigned):
|
|
|
|
|
2012-09-26 14:33:46 -04:00
|
|
|
if FORCE_CLEAN:
|
2011-06-04 06:37:48 -04:00
|
|
|
if os.path.exists(tmpDir):
|
|
|
|
raise RuntimeError('temp dir %s exists; please remove first' % tmpDir)
|
2012-04-06 09:33:54 -04:00
|
|
|
|
|
|
|
if not os.path.exists(tmpDir):
|
2011-06-04 06:37:48 -04:00
|
|
|
os.makedirs(tmpDir)
|
|
|
|
|
|
|
|
lucenePath = None
|
|
|
|
solrPath = None
|
2012-08-03 17:18:14 -04:00
|
|
|
print()
|
|
|
|
print('Load release URL "%s"...' % baseURL)
|
2012-04-08 14:22:14 -04:00
|
|
|
newBaseURL = unshortenURL(baseURL)
|
|
|
|
if newBaseURL != baseURL:
|
2012-08-03 17:18:14 -04:00
|
|
|
print(' unshortened: %s' % newBaseURL)
|
2012-04-08 14:22:14 -04:00
|
|
|
baseURL = newBaseURL
|
|
|
|
|
2011-06-04 06:37:48 -04:00
|
|
|
for text, subURL in getDirEntries(baseURL):
|
|
|
|
if text.lower().find('lucene') != -1:
|
|
|
|
lucenePath = subURL
|
|
|
|
elif text.lower().find('solr') != -1:
|
|
|
|
solrPath = subURL
|
|
|
|
|
|
|
|
if lucenePath is None:
|
|
|
|
raise RuntimeError('could not find lucene subdir')
|
|
|
|
if solrPath is None:
|
|
|
|
raise RuntimeError('could not find solr subdir')
|
|
|
|
|
2012-08-03 17:18:14 -04:00
|
|
|
print()
|
|
|
|
print('Test Lucene...')
|
2012-04-08 14:22:14 -04:00
|
|
|
checkSigs('lucene', lucenePath, version, tmpDir, isSigned)
|
2011-06-04 06:37:48 -04:00
|
|
|
for artifact in ('lucene-%s.tgz' % version, 'lucene-%s.zip' % version):
|
2012-09-26 14:33:46 -04:00
|
|
|
unpackAndVerify('lucene', tmpDir, artifact, version)
|
|
|
|
unpackAndVerify('lucene', tmpDir, 'lucene-%s-src.tgz' % version, version)
|
2011-06-04 06:37:48 -04:00
|
|
|
|
2012-08-03 17:18:14 -04:00
|
|
|
print()
|
|
|
|
print('Test Solr...')
|
2012-04-08 14:22:14 -04:00
|
|
|
checkSigs('solr', solrPath, version, tmpDir, isSigned)
|
2011-06-04 06:37:48 -04:00
|
|
|
for artifact in ('apache-solr-%s.tgz' % version, 'apache-solr-%s.zip' % version):
|
2012-09-26 14:33:46 -04:00
|
|
|
unpackAndVerify('solr', tmpDir, artifact, version)
|
|
|
|
unpackAndVerify('solr', tmpDir, 'apache-solr-%s-src.tgz' % version, version)
|
2011-06-04 06:37:48 -04:00
|
|
|
|
2012-09-26 14:33:46 -04:00
|
|
|
print()
|
2012-08-03 17:18:14 -04:00
|
|
|
print('Test Maven artifacts for Lucene and Solr...')
|
2012-04-08 14:22:14 -04:00
|
|
|
checkMaven(baseURL, tmpDir, version, isSigned)
|
2012-03-19 13:36:27 -04:00
|
|
|
|
2012-09-24 15:37:53 -04:00
|
|
|
print('\nSUCCESS!\n')
|
|
|
|
|
2011-06-04 06:37:48 -04:00
|
|
|
if __name__ == '__main__':
|
2012-09-26 11:55:27 -04:00
|
|
|
print('NOTE: output encoding is %s' % sys.stdout.encoding)
|
2012-08-03 18:48:27 -04:00
|
|
|
try:
|
|
|
|
main()
|
|
|
|
except:
|
|
|
|
traceback.print_exc()
|
2012-08-07 16:58:46 -04:00
|
|
|
sys.exit(1)
|
|
|
|
sys.exit(0)
|