1. Specifying the output file path for test-install is now an option (vs. an
argument). The default path is [package id].xml in the CWD where test-install is called from. 2. Fixed a bug with package.build_log_path (which was added in this branch). 3. keep_stage for package.do_install is now set. This allows uninstalling and reinstalling packages without (re) downloading them.
This commit is contained in:
parent
4997f0fe57
commit
e451421db3
@ -26,6 +26,7 @@
|
||||
import xml.etree.ElementTree as ET
|
||||
import itertools
|
||||
import re
|
||||
import os
|
||||
|
||||
import llnl.util.tty as tty
|
||||
from llnl.util.filesystem import *
|
||||
@ -45,7 +46,7 @@ def setup_parser(subparser):
|
||||
help="Do not check packages against checksum")
|
||||
|
||||
subparser.add_argument(
|
||||
'output', help="test output goes in this file")
|
||||
'-o', '--output', action='store', help="test output goes in this file")
|
||||
|
||||
subparser.add_argument(
|
||||
'package', help="spec of package to install")
|
||||
@ -73,10 +74,10 @@ def write_to(self, stream):
|
||||
|
||||
|
||||
class BuildId(object):
|
||||
def __init__(self, name, version, hashId):
|
||||
self.name = name
|
||||
self.version = version
|
||||
self.hashId = hashId
|
||||
def __init__(self, spec):
|
||||
self.name = spec.name
|
||||
self.version = spec.version
|
||||
self.hashId = spec.dag_hash()
|
||||
|
||||
def stringId(self):
|
||||
return "-".join(str(x) for x in (self.name, self.version, self.hashId))
|
||||
@ -94,7 +95,7 @@ def create_test_output(topSpec, newInstalls, output):
|
||||
#TODO: create a failed test if a dependency didn't install?
|
||||
continue
|
||||
|
||||
bId = BuildId(spec.name, spec.version, spec.dag_hash())
|
||||
bId = BuildId(spec)
|
||||
|
||||
package = spack.db.get(spec)
|
||||
with open(package.build_log_path, 'rb') as F:
|
||||
@ -122,20 +123,29 @@ def test_install(parser, args):
|
||||
|
||||
# TODO: should a single argument be wrapped in a list?
|
||||
specs = spack.cmd.parse_specs(args.package, concretize=True)
|
||||
|
||||
# There is 1 top-level package
|
||||
topSpec = iter(specs).next()
|
||||
|
||||
newInstalls = set()
|
||||
for spec in itertools.chain.from_iterable(spec.traverse()
|
||||
for spec in specs):
|
||||
for spec in topSpec.traverse():
|
||||
package = spack.db.get(spec)
|
||||
if not package.installed:
|
||||
newInstalls.add(spec)
|
||||
|
||||
if not args.output:
|
||||
bId = BuildId(topSpec)
|
||||
outputFpath = join_path(os.getcwd(), "{0}.xml".format(bId.stringId()))
|
||||
else:
|
||||
outputFpath = args.output
|
||||
|
||||
try:
|
||||
for spec in specs:
|
||||
package = spack.db.get(spec)
|
||||
if not package.installed:
|
||||
package.do_install(
|
||||
keep_prefix=False,
|
||||
keep_stage=False,
|
||||
keep_stage=True,
|
||||
ignore_deps=False,
|
||||
make_jobs=args.jobs,
|
||||
verbose=True,
|
||||
@ -146,5 +156,5 @@ def test_install(parser, args):
|
||||
for spec in specs:
|
||||
create_test_output(spec, newInstalls, jrf)
|
||||
|
||||
with open(args.output, 'wb') as F:
|
||||
with open(outputFpath, 'wb') as F:
|
||||
jrf.write_to(F)
|
||||
|
@ -866,7 +866,7 @@ def do_install_dependencies(self, **kwargs):
|
||||
@property
|
||||
def build_log_path(self):
|
||||
if self.installed:
|
||||
return spack.install_layout.build_log_path(spec)
|
||||
return spack.install_layout.build_log_path(self.spec)
|
||||
else:
|
||||
return join_path(self.stage.source_path, 'spack-build.out')
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user