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.
This commit is contained in:
Tom Scogland 2015-12-30 11:53:27 -08:00
parent 0840ffa3dd
commit 63f824b218
2 changed files with 13 additions and 3 deletions

View file

@ -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()

View file

@ -709,14 +709,18 @@ def do_fetch(self, mirror_only=False):
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()