From 3df638dd41c18ea7b8c7152d3d706b7797c194d7 Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Fri, 7 Feb 2014 10:10:28 -0800 Subject: [PATCH] Add dirty options to create and checksum, like install. --- lib/spack/spack/cmd/checksum.py | 9 +++++++-- lib/spack/spack/cmd/create.py | 5 ++++- lib/spack/spack/stage.py | 3 +-- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/lib/spack/spack/cmd/checksum.py b/lib/spack/spack/cmd/checksum.py index 86bbd901343..abd161182ca 100644 --- a/lib/spack/spack/cmd/checksum.py +++ b/lib/spack/spack/cmd/checksum.py @@ -29,6 +29,7 @@ from pprint import pprint from subprocess import CalledProcessError +import spack import spack.cmd import spack.tty as tty import spack.packages as packages @@ -42,6 +43,9 @@ def setup_parser(subparser): subparser.add_argument( 'package', metavar='PACKAGE', help='Package to list versions for') + subparser.add_argument( + '-d', '--dirty', action='store_true', dest='dirty', + help="Don't clean up staging area when command completes.") subparser.add_argument( 'versions', nargs=argparse.REMAINDER, help='Versions to generate checksums for') @@ -67,7 +71,8 @@ def get_checksums(versions, urls, **kwargs): continue finally: - stage.destroy() + if not kwargs.get('dirty', False): + stage.destroy() return zip(versions, hashes) @@ -105,7 +110,7 @@ def checksum(parser, args): return version_hashes = get_checksums( - versions[:archives_to_fetch], urls[:archives_to_fetch]) + versions[:archives_to_fetch], urls[:archives_to_fetch], dirty=args.dirty) if not version_hashes: tty.die("Could not fetch any available versions for %s." % pkg.name) diff --git a/lib/spack/spack/cmd/create.py b/lib/spack/spack/cmd/create.py index ed454887bf6..cf23c4191c2 100644 --- a/lib/spack/spack/cmd/create.py +++ b/lib/spack/spack/cmd/create.py @@ -82,6 +82,9 @@ def install(self, spec, prefix): def setup_parser(subparser): subparser.add_argument('url', nargs='?', help="url of package archive") + subparser.add_argument( + '-d', '--dirty', action='store_true', dest='dirty', + help="Don't clean up staging area when command completes.") subparser.add_argument( '-f', '--force', action='store_true', dest='force', help="Overwrite any existing package file with the same name.") @@ -167,7 +170,7 @@ def create(parser, args): guesser = ConfigureGuesser() ver_hash_tuples = spack.cmd.checksum.get_checksums( versions[:archives_to_fetch], urls[:archives_to_fetch], - first_stage_function=guesser) + first_stage_function=guesser, dirty=args.dirty) if not ver_hash_tuples: tty.die("Could not fetch any tarballs for %s." % name) diff --git a/lib/spack/spack/stage.py b/lib/spack/spack/stage.py index a2789505467..a03b58c3a09 100644 --- a/lib/spack/spack/stage.py +++ b/lib/spack/spack/stage.py @@ -234,10 +234,9 @@ def fetch_from_url(self, url): if content_types and 'text/html' in content_types[-1]: tty.warn("The contents of " + self.archive_file + " look like HTML.", "The checksum will likely be bad. If it is, you can use", - "'spack clean --all' to remove the bad archive, then fix", + "'spack clean --dist' to remove the bad archive, then fix", "your internet gateway issue and install again.") - def fetch(self): """Downloads the file at URL to the stage. Returns true if it was downloaded, false if it already existed."""