summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPeter Scheibel <scheibel1@llnl.gov>2015-10-15 19:22:36 -0700
committerPeter Scheibel <scheibel1@llnl.gov>2015-10-15 19:22:36 -0700
commite451421db32b5e2059d9da293c70baa4b3374449 (patch)
tree9841f8d3f5abe45e79cec4d7a15337bc9838ee62 /lib
parent4997f0fe57e65002d8122da05a4f203f51ac4345 (diff)
downloadspack-e451421db32b5e2059d9da293c70baa4b3374449.tar.gz
spack-e451421db32b5e2059d9da293c70baa4b3374449.tar.bz2
spack-e451421db32b5e2059d9da293c70baa4b3374449.tar.xz
spack-e451421db32b5e2059d9da293c70baa4b3374449.zip
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.
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/cmd/test-install.py32
-rw-r--r--lib/spack/spack/package.py2
2 files changed, 22 insertions, 12 deletions
diff --git a/lib/spack/spack/cmd/test-install.py b/lib/spack/spack/cmd/test-install.py
index 8514042239..e207295810 100644
--- a/lib/spack/spack/cmd/test-install.py
+++ b/lib/spack/spack/cmd/test-install.py
@@ -26,6 +26,7 @@ from external import argparse
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 @@ class JunitResultFormat(object):
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:
@@ -120,22 +121,31 @@ def test_install(parser, args):
if args.no_checksum:
spack.do_checksum = False # TODO: remove this global.
- #TODO: should a single argument be wrapped in a list?
+ # 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)
diff --git a/lib/spack/spack/package.py b/lib/spack/spack/package.py
index da19a7c398..b1257a092f 100644
--- a/lib/spack/spack/package.py
+++ b/lib/spack/spack/package.py
@@ -866,7 +866,7 @@ class Package(object):
@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')