Skip to content

Commit

Permalink
spack install: make restaging the default (spack#6465)
Browse files Browse the repository at this point in the history
Fixes spack#5940

This PR changes the option '--restage' of 'spack install' to
'--dont-restage', inverting its meaning and the default behavior
of the command.
  • Loading branch information
alalazo authored and scheibelp committed Dec 19, 2017
1 parent 36fa574 commit 0192455
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/spack/spack/cmd/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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,
Expand Down
6 changes: 6 additions & 0 deletions lib/spack/spack/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 0192455

Please sign in to comment.