diff options
author | Todd Gamblin <tgamblin@llnl.gov> | 2016-08-12 09:19:36 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-08-12 09:19:36 -0700 |
commit | 483e4116c07c55a6f7e10b405698d8a7041b5461 (patch) | |
tree | 5d5272a3eb0173e20d2c7cd94de658242a8062b2 | |
parent | e1c2ea51231df3293af6724dee85466d43a3384d (diff) | |
parent | c815aed2073b43af81af6d376cd398047f260c6b (diff) | |
download | spack-483e4116c07c55a6f7e10b405698d8a7041b5461.tar.gz spack-483e4116c07c55a6f7e10b405698d8a7041b5461.tar.bz2 spack-483e4116c07c55a6f7e10b405698d8a7041b5461.tar.xz spack-483e4116c07c55a6f7e10b405698d8a7041b5461.zip |
Merge pull request #1509 from adamjstewart/docs/md5
Update documentation for spack md5
-rw-r--r-- | lib/spack/docs/packaging_guide.rst | 21 | ||||
-rw-r--r-- | lib/spack/spack/cmd/md5.py | 5 |
2 files changed, 19 insertions, 7 deletions
diff --git a/lib/spack/docs/packaging_guide.rst b/lib/spack/docs/packaging_guide.rst index 70def5c39a..a082b85efa 100644 --- a/lib/spack/docs/packaging_guide.rst +++ b/lib/spack/docs/packaging_guide.rst @@ -467,14 +467,25 @@ to use based on the hash length. ``spack md5`` ^^^^^^^^^^^^^^^^^^^^^^ -If you have a single file to checksum, you can use the ``spack md5`` -command to do it. Here's how you might download an archive and get a -checksum for it: +If you have one or more files to checksum, you can use the ``spack md5`` +command to do it: .. code-block:: sh - $ curl -O http://exmaple.com/foo-8.2.1.tar.gz' - $ spack md5 foo-8.2.1.tar.gz + $ spack md5 foo-8.2.1.tar.gz foo-8.2.2.tar.gz + ==> 2 MD5 checksums: + 4136d7b4c04df68b686570afa26988ac foo-8.2.1.tar.gz + 1586b70a49dfe05da5fcc29ef239dce0 foo-8.2.2.tar.gz + +``spack md5`` also accepts one or more URLs and automatically downloads +the files for you: + +.. code-block:: sh + + $ spack md5 http://example.com/foo-8.2.1.tar.gz + ==> Trying to fetch from http://example.com/foo-8.2.1.tar.gz + ######################################################################## 100.0% + ==> 1 MD5 checksum: 4136d7b4c04df68b686570afa26988ac foo-8.2.1.tar.gz Doing this for lots of files, or whenever a new package version is diff --git a/lib/spack/spack/cmd/md5.py b/lib/spack/spack/cmd/md5.py index 3ba3c71562..506cf0913f 100644 --- a/lib/spack/spack/cmd/md5.py +++ b/lib/spack/spack/cmd/md5.py @@ -36,7 +36,7 @@ description = "Calculate md5 checksums for files/urls." def setup_parser(subparser): setup_parser.parser = subparser subparser.add_argument('files', nargs=argparse.REMAINDER, - help="Files to checksum.") + help="Files/urls to checksum.") def compute_md5_checksum(url): @@ -67,6 +67,7 @@ def md5(parser, args): tty.warn("%s" % e) # Dump the MD5s at last without interleaving them with downloads - tty.msg("%d MD5 checksums:" % len(results)) + 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) |