summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTom Scogland <scogland1@llnl.gov>2015-12-30 11:53:27 -0800
committerTom Scogland <scogland1@llnl.gov>2016-03-31 09:56:26 -0700
commit63f824b218af9fcea4c13d7bef8b1d8ff31d09b2 (patch)
tree081df1d4bd3782cf5c191d30b09657f2aae4af00 /lib
parent0840ffa3ddbc58ae729cfe6f8d71707d5090460f (diff)
downloadspack-63f824b218af9fcea4c13d7bef8b1d8ff31d09b2.tar.gz
spack-63f824b218af9fcea4c13d7bef8b1d8ff31d09b2.tar.bz2
spack-63f824b218af9fcea4c13d7bef8b1d8ff31d09b2.tar.xz
spack-63f824b218af9fcea4c13d7bef8b1d8ff31d09b2.zip
add a path argument to the stage command
Allow users to use spack to stage a, potentially complex, package into a given path. This is nice for packages with multiple resources that must be placed, for example LLVM with all sub-projects.
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/cmd/stage.py8
-rw-r--r--lib/spack/spack/package.py8
2 files changed, 13 insertions, 3 deletions
diff --git a/lib/spack/spack/cmd/stage.py b/lib/spack/spack/cmd/stage.py
index 5786780efb..749fa90868 100644
--- a/lib/spack/spack/cmd/stage.py
+++ b/lib/spack/spack/cmd/stage.py
@@ -35,6 +35,9 @@ def setup_parser(subparser):
subparser.add_argument(
'-n', '--no-checksum', action='store_true', dest='no_checksum',
help="Do not check downloaded packages against checksum")
+ subparser.add_argument(
+ '-p', '--path', dest='path',
+ help="Path to stage package, does not add to spack tree")
subparser.add_argument(
'specs', nargs=argparse.REMAINDER, help="specs of packages to stage")
@@ -50,4 +53,7 @@ def stage(parser, args):
specs = spack.cmd.parse_specs(args.specs, concretize=True)
for spec in specs:
package = spack.repo.get(spec)
- package.do_stage()
+ if args.path:
+ package.do_stage(path=args.path)
+ else:
+ package.do_stage()
diff --git a/lib/spack/spack/package.py b/lib/spack/spack/package.py
index 9af3221837..ce314b7b0a 100644
--- a/lib/spack/spack/package.py
+++ b/lib/spack/spack/package.py
@@ -709,14 +709,18 @@ class Package(object):
if spack.do_checksum and self.version in self.versions:
self.stage.check()
-
- def do_stage(self, mirror_only=False):
+ def do_stage(self, mirror_only=False, path=None):
"""Unpacks the fetched tarball, then changes into the expanded tarball
directory."""
+
if not self.spec.concrete:
raise ValueError("Can only stage concrete packages.")
self.do_fetch(mirror_only)
+
+ if path is not None:
+ self.stage.path = path
+
self.stage.expand_archive()
self.stage.chdir_to_source()