Minor changes/bugfixes on md5/checksum PR

This commit is contained in:
Todd Gamblin 2016-03-08 10:39:46 -08:00
parent 747855b960
commit a4861a3072
4 changed files with 6 additions and 9 deletions

View file

@ -56,8 +56,7 @@ def get_checksums(versions, urls, **kwargs):
i = 0 i = 0
for url, version in zip(urls, versions): for url, version in zip(urls, versions):
try: try:
with Stage(url) as stage: with Stage(url, keep=keep_stage) as stage:
stage.delete_on_exit = not keep_stage
stage.fetch() stage.fetch()
if i == 0 and first_stage_function: if i == 0 and first_stage_function:
first_stage_function(stage) first_stage_function(stage)
@ -96,7 +95,7 @@ def checksum(parser, args):
tty.msg("Found %s versions of %s" % (len(versions), pkg.name), tty.msg("Found %s versions of %s" % (len(versions), pkg.name),
*spack.cmd.elide_list( *spack.cmd.elide_list(
["%-10s%s" % (v, versions[v]) for v in sorted_versions])) ["%-10s%s" % (v, versions[v]) for v in sorted_versions]))
print() print
archives_to_fetch = tty.get_number( archives_to_fetch = tty.get_number(
"How many would you like to checksum?", default=5, abort='q') "How many would you like to checksum?", default=5, abort='q')

View file

@ -67,6 +67,6 @@ def md5(parser, args):
tty.warn("%s" % e) tty.warn("%s" % e)
# Dump the MD5s at last without interleaving them with downloads # Dump the MD5s at last without interleaving them with downloads
tty.msg("Number of MD5 check-sums computed: %s " % len(results)) tty.msg("%d MD5 checksums:" % len(results))
for checksum, url in results: for checksum, url in results:
tty.msg("%s %s" % (checksum, url)) print "%s %s" % (checksum, url)

View file

@ -50,6 +50,4 @@ def stage(parser, args):
specs = spack.cmd.parse_specs(args.specs, concretize=True) specs = spack.cmd.parse_specs(args.specs, concretize=True)
for spec in specs: for spec in specs:
package = spack.repo.get(spec) package = spack.repo.get(spec)
with package.stage as stage:
stage.delete_on_exit = False
package.do_stage() package.do_stage()

View file

@ -441,7 +441,7 @@ def __enter__(self):
def __exit__(self, exc_type, exc_val, exc_tb): def __exit__(self, exc_type, exc_val, exc_tb):
for item in reversed(self): for item in reversed(self):
item.delete_on_exit = getattr(self, 'delete_on_exit', True) item.keep = getattr(self, 'keep', None)
item.__exit__(exc_type, exc_val, exc_tb) item.__exit__(exc_type, exc_val, exc_tb)
# #