diff options
author | Massimiliano Culpo <massimiliano.culpo@googlemail.com> | 2016-10-11 09:37:29 +0200 |
---|---|---|
committer | Todd Gamblin <tgamblin@llnl.gov> | 2016-10-11 00:37:29 -0700 |
commit | c8bf8a5e6e9858010bfaf47485458f8bf677cea3 (patch) | |
tree | be4f68a22cbb427a6c59b5fa282ba6333522e5f8 | |
parent | afd5d6b5cd45c268d28fa8d661d22ce54bc79e1c (diff) | |
download | spack-c8bf8a5e6e9858010bfaf47485458f8bf677cea3.tar.gz spack-c8bf8a5e6e9858010bfaf47485458f8bf677cea3.tar.bz2 spack-c8bf8a5e6e9858010bfaf47485458f8bf677cea3.tar.xz spack-c8bf8a5e6e9858010bfaf47485458f8bf677cea3.zip |
md5 : normalizes input before computing the md5 fixes #1508 (#1977)
Bottomline :
- fetcher change the current working directory
- relative paths were resolved differently depending on the prder f evaluation
-rw-r--r-- | lib/spack/spack/cmd/md5.py | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/spack/spack/cmd/md5.py b/lib/spack/spack/cmd/md5.py index 506cf0913f..2ae279a41e 100644 --- a/lib/spack/spack/cmd/md5.py +++ b/lib/spack/spack/cmd/md5.py @@ -25,6 +25,7 @@ import argparse import hashlib import os +from urlparse import urlparse import llnl.util.tty as tty import spack.util.crypto @@ -49,13 +50,23 @@ def compute_md5_checksum(url): return value +def normalized(files): + for p in files: + result = urlparse(p) + value = p + if not result.scheme: + value = os.path.abspath(p) + yield value + + def md5(parser, args): if not args.files: setup_parser.parser.print_help() return 1 + urls = [x for x in normalized(args.files)] results = [] - for url in args.files: + for url in urls: try: checksum = compute_md5_checksum(url) results.append((checksum, url)) @@ -70,4 +81,4 @@ def md5(parser, args): checksum = 'checksum' if len(results) == 1 else 'checksums' tty.msg("%d MD5 %s:" % (len(results), checksum)) for checksum, url in results: - print "%s %s" % (checksum, url) + print("{0} {1}".format(checksum, url)) |