From 3df638dd41c18ea7b8c7152d3d706b7797c194d7 Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Fri, 7 Feb 2014 10:10:28 -0800 Subject: 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(-) (limited to 'lib') diff --git a/lib/spack/spack/cmd/checksum.py b/lib/spack/spack/cmd/checksum.py index 86bbd90134..abd161182c 100644 --- a/lib/spack/spack/cmd/checksum.py +++ b/lib/spack/spack/cmd/checksum.py @@ -29,6 +29,7 @@ import hashlib 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 @@ description ="Checksum available versions of a package to update a package file. 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 ed454887bf..cf23c4191c 100644 --- a/lib/spack/spack/cmd/create.py +++ b/lib/spack/spack/cmd/create.py @@ -82,6 +82,9 @@ class ${class_name}(Package): 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 a278950546..a03b58c3a0 100644 --- a/lib/spack/spack/stage.py +++ b/lib/spack/spack/stage.py @@ -234,10 +234,9 @@ class Stage(object): 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.""" -- cgit v1.2.3-60-g2f50