diff options
author | Todd Gamblin <tgamblin@llnl.gov> | 2014-12-08 22:49:49 -0800 |
---|---|---|
committer | Todd Gamblin <tgamblin@llnl.gov> | 2014-12-08 22:49:49 -0800 |
commit | c3fce7b77fe895307c78676a2692757002199399 (patch) | |
tree | 900e6b081f4385c3dace4f7fd222560faa7fff14 | |
parent | 105420f372c67d0cca8c2b221f4e6a2f4e62e713 (diff) | |
download | spack-c3fce7b77fe895307c78676a2692757002199399.tar.gz spack-c3fce7b77fe895307c78676a2692757002199399.tar.bz2 spack-c3fce7b77fe895307c78676a2692757002199399.tar.xz spack-c3fce7b77fe895307c78676a2692757002199399.zip |
Bugfix in create and checksum
-rw-r--r-- | lib/spack/spack/cmd/checksum.py | 3 | ||||
-rw-r--r-- | lib/spack/spack/cmd/create.py | 37 |
2 files changed, 20 insertions, 20 deletions
diff --git a/lib/spack/spack/cmd/checksum.py b/lib/spack/spack/cmd/checksum.py index 846817b918..8a448450c2 100644 --- a/lib/spack/spack/cmd/checksum.py +++ b/lib/spack/spack/cmd/checksum.py @@ -56,7 +56,6 @@ def get_checksums(versions, urls, **kwargs): first_stage_function = kwargs.get('first_stage_function', None) keep_stage = kwargs.get('keep_stage', False) - tty.msg("Downloading...") hashes = [] for i, (url, version) in enumerate(zip(urls, versions)): @@ -98,7 +97,7 @@ def checksum(parser, args): if not versions: tty.die("Could not fetch any versions for %s." % pkg.name) - sorted_versions = list(reversed(sorted(versions))) + sorted_versions = sorted(versions, reverse=True) tty.msg("Found %s versions of %s." % (len(versions), pkg.name), *spack.cmd.elide_list( diff --git a/lib/spack/spack/cmd/create.py b/lib/spack/spack/cmd/create.py index f0ea867332..c09b9a3e36 100644 --- a/lib/spack/spack/cmd/create.py +++ b/lib/spack/spack/cmd/create.py @@ -28,6 +28,7 @@ import hashlib import re from contextlib import closing +from external.ordereddict import OrderedDict import llnl.util.tty as tty from llnl.util.filesystem import mkdirp @@ -160,32 +161,32 @@ def create(parser, args): mkdirp(os.path.dirname(pkg_path)) versions = spack.package.find_versions_of_archive(url) + rkeys = sorted(versions.keys(), reverse=True) + versions = OrderedDict(zip(rkeys, (versions[v] for v in rkeys))) archives_to_fetch = 1 if not versions: # If the fetch failed for some reason, revert to what the user provided versions = { version : url } - else: - urls = [spack.url.substitute_version(url, v) for v in versions] - if len(urls) > 1: - tty.msg("Found %s versions of %s:" % (len(urls), name), - *spack.cmd.elide_list( - ["%-10s%s" % (v,u) for v, u in zip(versions, urls)])) - print - archives_to_fetch = tty.get_number( - "Include how many checksums in the package file?", - default=5, abort='q') - - if not archives_to_fetch: - tty.msg("Aborted.") - return - - sorted_versions = list(reversed(versions.keys())) + elif len(versions) > 1: + tty.msg("Found %s versions of %s:" % (len(versions), name), + *spack.cmd.elide_list( + ["%-10s%s" % (v,u) for v, u in versions.iteritems()])) + print + archives_to_fetch = tty.get_number( + "Include how many checksums in the package file?", + default=5, abort='q') + + if not archives_to_fetch: + tty.msg("Aborted.") + return guesser = ConfigureGuesser() ver_hash_tuples = spack.cmd.checksum.get_checksums( - sorted_versions[:archives_to_fetch], urls[:archives_to_fetch], - first_stage_function=guesser, keep_stage=args.keep_stage) + versions.keys()[:archives_to_fetch], + [versions[v] for v in versions.keys()[:archives_to_fetch]], + first_stage_function=guesser, + keep_stage=args.keep_stage) if not ver_hash_tuples: tty.die("Could not fetch any tarballs for %s." % name) |