spack install: add --reuse argument

This commit is contained in:
Massimiliano Culpo 2021-11-03 18:28:03 +01:00 committed by Todd Gamblin
parent e2744fafa1
commit 31dfad9c16
3 changed files with 7 additions and 5 deletions

View File

@ -153,6 +153,7 @@ def parse_specs(args, **kwargs):
concretize = kwargs.get('concretize', False) concretize = kwargs.get('concretize', False)
normalize = kwargs.get('normalize', False) normalize = kwargs.get('normalize', False)
tests = kwargs.get('tests', False) tests = kwargs.get('tests', False)
reuse = kwargs.get('reuse', False)
try: try:
sargs = args sargs = args
@ -161,7 +162,7 @@ def parse_specs(args, **kwargs):
specs = spack.spec.parse(sargs) specs = spack.spec.parse(sargs)
for spec in specs: for spec in specs:
if concretize: if concretize:
spec.concretize(tests=tests) # implies normalize spec.concretize(tests=tests, reuse=reuse) # implies normalize
elif normalize: elif normalize:
spec.normalize(tests=tests) spec.normalize(tests=tests)

View File

@ -78,7 +78,7 @@ def setup_parser(subparser):
subparser.add_argument( subparser.add_argument(
'-u', '--until', type=str, dest='until', default=None, '-u', '--until', type=str, dest='until', default=None,
help="phase to stop after when installing (default None)") help="phase to stop after when installing (default None)")
arguments.add_common_arguments(subparser, ['jobs']) arguments.add_common_arguments(subparser, ['jobs', 'reuse'])
subparser.add_argument( subparser.add_argument(
'--overwrite', action='store_true', '--overwrite', action='store_true',
help="reinstall an existing spec, even if it has dependents") help="reinstall an existing spec, even if it has dependents")
@ -338,7 +338,7 @@ def get_tests(specs):
if not args.only_concrete: if not args.only_concrete:
with env.write_transaction(): with env.write_transaction():
concretized_specs = env.concretize(tests=tests) concretized_specs = env.concretize(tests=tests, reuse=args.reuse)
ev.display_specs(concretized_specs) ev.display_specs(concretized_specs)
# save view regeneration for later, so that we only do it # save view regeneration for later, so that we only do it
@ -392,7 +392,8 @@ def get_tests(specs):
try: try:
specs = spack.cmd.parse_specs( specs = spack.cmd.parse_specs(
args.spec, concretize=True, tests=tests) args.spec, concretize=True, tests=tests, reuse=args.reuse
)
except SpackError as e: except SpackError as e:
tty.debug(e) tty.debug(e)
reporter.concretization_report(e.message) reporter.concretization_report(e.message)

View File

@ -1176,7 +1176,7 @@ _spack_info() {
_spack_install() { _spack_install() {
if $list_options if $list_options
then then
SPACK_COMPREPLY="-h --help --only -u --until -j --jobs --overwrite --fail-fast --keep-prefix --keep-stage --dont-restage --use-cache --no-cache --cache-only --monitor --monitor-save-local --monitor-no-auth --monitor-tags --monitor-keep-going --monitor-host --monitor-prefix --include-build-deps --no-check-signature --require-full-hash-match --show-log-on-error --source -n --no-checksum --deprecated -v --verbose --fake --only-concrete --no-add -f --file --clean --dirty --test --run-tests --log-format --log-file --help-cdash --cdash-upload-url --cdash-build --cdash-site --cdash-track --cdash-buildstamp -y --yes-to-all" SPACK_COMPREPLY="-h --help --only -u --until -j --jobs --reuse --overwrite --fail-fast --keep-prefix --keep-stage --dont-restage --use-cache --no-cache --cache-only --monitor --monitor-save-local --monitor-no-auth --monitor-tags --monitor-keep-going --monitor-host --monitor-prefix --include-build-deps --no-check-signature --require-full-hash-match --show-log-on-error --source -n --no-checksum --deprecated -v --verbose --fake --only-concrete --no-add -f --file --clean --dirty --test --run-tests --log-format --log-file --help-cdash --cdash-upload-url --cdash-build --cdash-site --cdash-track --cdash-buildstamp -y --yes-to-all"
else else
_all_packages _all_packages
fi fi