diff --git a/lib/spack/spack/cmd/buildcache.py b/lib/spack/spack/cmd/buildcache.py index e82cd0b5641..b66d5a56992 100644 --- a/lib/spack/spack/cmd/buildcache.py +++ b/lib/spack/spack/cmd/buildcache.py @@ -478,11 +478,12 @@ def save_specfile_fn(args): if args.root_specfile: with open(args.root_specfile) as fd: root_spec_as_json = fd.read() + spec_format = 'yaml' if args.root_specfile.endswith('yaml') else 'json' else: root_spec = Spec(args.root_spec) root_spec.concretize() root_spec_as_json = root_spec.to_json(hash=ht.dag_hash) - spec_format = 'yaml' if args.root_specfile.endswith('yaml') else 'json' + spec_format = 'json' save_dependency_specfiles( root_spec_as_json, args.specfile_dir, args.specs.split(), spec_format)