spack install: make restaging the default (#6465)

Fixes #5940

This PR changes the option '--restage' of 'spack install' to
'--dont-restage', inverting its meaning and the default behavior
of the command.
This commit is contained in:
Massimiliano Culpo 2017-12-19 03:50:02 +01:00 committed by scheibelp
parent 36fa574779
commit 0192455885
2 changed files with 9 additions and 3 deletions

View File

@ -71,8 +71,8 @@ def setup_parser(subparser):
'--keep-stage', action='store_true',
help="don't remove the build stage if installation succeeds")
subparser.add_argument(
'--restage', action='store_true',
help="if a partial install is detected, delete prior state")
'--dont-restage', action='store_true',
help="if a partial install is detected, don't delete prior state")
subparser.add_argument(
'--use-cache', action='store_true', dest='use_cache',
help="check for pre-built Spack packages in mirrors")
@ -392,7 +392,7 @@ def install(parser, args, **kwargs):
kwargs.update({
'keep_prefix': args.keep_prefix,
'keep_stage': args.keep_stage,
'restage': args.restage,
'restage': not args.dont_restage,
'install_source': args.install_source,
'install_deps': 'dependencies' in args.things_to_install,
'make_jobs': args.jobs,

View File

@ -1343,6 +1343,12 @@ def do_install(self,
msg = '{0.name} is already installed in {0.prefix}'
tty.msg(msg.format(self))
rec = spack.store.db.get_record(self.spec)
# In case the stage directory has already been created,
# this ensures it's removed after we checked that the spec
# is installed
if keep_stage is False:
self.stage.destroy()
return self._update_explicit_entry_in_db(rec, explicit)
self._do_install_pop_kwargs(kwargs)