diff options
author | Peter Scheibel <scheibel1@llnl.gov> | 2022-10-11 10:03:31 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-11 10:03:31 -0600 |
commit | b594c0aee0369308810a74630a0ca948b80abef8 (patch) | |
tree | 7d793d84c2317c623aece03e0e8a4b28c314122e | |
parent | 8e3c088a7ad587b2f028a1fabea67a331ef96847 (diff) | |
download | spack-b594c0aee0369308810a74630a0ca948b80abef8.tar.gz spack-b594c0aee0369308810a74630a0ca948b80abef8.tar.bz2 spack-b594c0aee0369308810a74630a0ca948b80abef8.tar.xz spack-b594c0aee0369308810a74630a0ca948b80abef8.zip |
`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 <massimiliano.culpo@gmail.com>
-rw-r--r-- | lib/spack/spack/cmd/diff.py | 10 |
1 files 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() |