buildcache fixes: index.html & unsigned installs

This fixes a syntax error in the index.html file generated by the
"spack buildcache" command when creating build caches. This also
fixes support for installing unsigned binaries.
This commit is contained in:
Patrick Gartung 2017-08-16 21:03:14 -05:00 committed by scheibelp
parent dd790fdaae
commit 1c8bdd7e24

View File

@ -194,15 +194,15 @@ def sign_tarball(yes_to_all, key, force, specfile_path):
def generate_index(outdir, indexfile_path): def generate_index(outdir, indexfile_path):
f = open(indexfile_path, 'w') f = open(indexfile_path, 'w')
header = """<html> header = """<html>\n
<head></head> <head>\n</head>\n
<list>""" <list>\n"""
footer = "</list></html>" footer = "</list>\n</html>\n"
paths = os.listdir(outdir + '/build_cache') paths = os.listdir(outdir + '/build_cache')
f.write(header) f.write(header)
for path in paths: for path in paths:
rel = os.path.basename(path) rel = os.path.basename(path)
f.write('<li><a href="%s" %s</a>' % (rel, rel)) f.write('<li><a href="%s"> %s</a>\n' % (rel, rel))
f.write(footer) f.write(footer)
f.close() f.close()
@ -381,26 +381,27 @@ def extract_tarball(spec, filename, yes_to_all=False, force=False):
with closing(tarfile.open(spackfile_path, 'r')) as tar: with closing(tarfile.open(spackfile_path, 'r')) as tar:
tar.extractall(stagepath) tar.extractall(stagepath)
if os.path.exists('%s.asc' % specfile_path): if not yes_to_all:
Gpg.verify('%s.asc' % specfile_path, specfile_path) if os.path.exists('%s.asc' % specfile_path):
os.remove(specfile_path + '.asc') Gpg.verify('%s.asc' % specfile_path, specfile_path)
else: os.remove(specfile_path + '.asc')
if not yes_to_all: else:
raise NoVerifyException() raise NoVerifyException()
# get the sha256 checksum of the tarball # get the sha256 checksum of the tarball
checksum = checksum_tarball(tarfile_path) checksum = checksum_tarball(tarfile_path)
# get the sha256 checksum recorded at creation if not yes_to_all:
spec_dict = {} # get the sha256 checksum recorded at creation
with open(specfile_path, 'r') as inputfile: spec_dict = {}
content = inputfile.read() with open(specfile_path, 'r') as inputfile:
spec_dict = yaml.load(content) content = inputfile.read()
bchecksum = spec_dict['binary_cache_checksum'] spec_dict = yaml.load(content)
bchecksum = spec_dict['binary_cache_checksum']
# if the checksums don't match don't install # if the checksums don't match don't install
if bchecksum['hash'] != checksum: if bchecksum['hash'] != checksum:
raise NoChecksumException() raise NoChecksumException()
with closing(tarfile.open(tarfile_path, 'r')) as tar: with closing(tarfile.open(tarfile_path, 'r')) as tar:
tar.extractall(path=join_path(installpath, '..')) tar.extractall(path=join_path(installpath, '..'))