From b594c0aee0369308810a74630a0ca948b80abef8 Mon Sep 17 00:00:00 2001 From: Peter Scheibel Date: Tue, 11 Oct 2022 10:03:31 -0600 Subject: [PATCH] `spack diff` any specs you want (#32737) Resolves #31782 With this change, if a spec is concrete after parsing (e.g. spec.yaml or /hash-based), then it is not disambiguated (a process which requires (a) that the spec be installed and (b) that it be part of the currently-active environment). This commit allows you to: * Diff specs from an environment regardless of whether they have been installed (more useful for projection/matrix-based envs) * Diff specs read from .yaml files which may or may not be entirely different installations of Spack Co-authored-by: Massimiliano Culpo --- lib/spack/spack/cmd/diff.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/spack/spack/cmd/diff.py b/lib/spack/spack/cmd/diff.py index 0b5318b37d..703fa5c69c 100644 --- a/lib/spack/spack/cmd/diff.py +++ b/lib/spack/spack/cmd/diff.py @@ -198,10 +198,12 @@ def diff(parser, args): if len(args.specs) != 2: tty.die("You must provide two specs to diff.") - specs = [ - spack.cmd.disambiguate_spec(spec, env, first=args.load_first) - for spec in spack.cmd.parse_specs(args.specs) - ] + specs = [] + for spec in spack.cmd.parse_specs(args.specs): + if spec.concrete: + specs.append(spec) + else: + specs.append(spack.cmd.disambiguate_spec(spec, env, first=args.load_first)) # Calculate the comparison (c) color = False if args.dump_json else get_color_when()