revert bumping specfile version

Signed-off-by: Gregory Becker <becker33@llnl.gov>
This commit is contained in:
Gregory Becker 2025-03-31 17:27:41 -07:00 committed by Harmen Stoppels
parent d7b9e73e12
commit 307009f939
3 changed files with 5 additions and 20 deletions

View File

@ -543,14 +543,6 @@
}, },
} }
} }
Version 7
---------
Version 7 does not change the lockfile format itself, but reflects
a change in the specfile format. This adds the ``direct`` key for
direct dependency edges. These are not relevant for environment
behavior and merely require a change of specfile reader.
""" """
from .environment import ( from .environment import (

View File

@ -129,7 +129,7 @@ def default_manifest_yaml():
valid_environment_name_re = r"^\w[\w-]*$" valid_environment_name_re = r"^\w[\w-]*$"
#: version of the lockfile format. Must increase monotonically. #: version of the lockfile format. Must increase monotonically.
lockfile_format_version = 7 lockfile_format_version = 6
READER_CLS = { READER_CLS = {
@ -139,7 +139,6 @@ def default_manifest_yaml():
4: spack.spec.SpecfileV3, 4: spack.spec.SpecfileV3,
5: spack.spec.SpecfileV4, 5: spack.spec.SpecfileV4,
6: spack.spec.SpecfileV5, 6: spack.spec.SpecfileV5,
7: spack.spec.SpecfileV6,
} }

View File

@ -187,7 +187,7 @@
) )
#: specfile format version. Must increase monotonically #: specfile format version. Must increase monotonically
SPECFILE_FORMAT_VERSION = 6 SPECFILE_FORMAT_VERSION = 5
class InstallStatus(enum.Enum): class InstallStatus(enum.Enum):
@ -2728,10 +2728,8 @@ def from_dict(data) -> "Spec":
spec = SpecfileV3.load(data) spec = SpecfileV3.load(data)
elif int(data["spec"]["_meta"]["version"]) == 4: elif int(data["spec"]["_meta"]["version"]) == 4:
spec = SpecfileV4.load(data) spec = SpecfileV4.load(data)
elif int(data["spec"]["_meta"]["version"]) == 5:
spec = SpecfileV5.load(data)
else: else:
spec = SpecfileV6.load(data) spec = SpecfileV5.load(data)
# Any git version should # Any git version should
for s in spec.traverse(): for s in spec.traverse():
@ -5100,22 +5098,18 @@ class SpecfileV5(SpecfileV4):
def legacy_compiler(cls, node): def legacy_compiler(cls, node):
raise RuntimeError("The 'compiler' option is unexpected in specfiles at v5 or greater") raise RuntimeError("The 'compiler' option is unexpected in specfiles at v5 or greater")
class SpecfileV6(SpecfileV5):
SPEC_VERSION = 6
@classmethod @classmethod
def extract_info_from_dep(cls, elt, hash): def extract_info_from_dep(cls, elt, hash):
dep_hash = elt[hash.name] dep_hash = elt[hash.name]
deptypes = elt["parameters"]["deptypes"] deptypes = elt["parameters"]["deptypes"]
hash_type = hash.name hash_type = hash.name
virtuals = elt["parameters"]["virtuals"] virtuals = elt["parameters"]["virtuals"]
direct = elt["parameters"]["direct"] direct = elt["parameters"].get("direct", True)
return dep_hash, deptypes, hash_type, virtuals, direct return dep_hash, deptypes, hash_type, virtuals, direct
#: Alias to the latest version of specfiles #: Alias to the latest version of specfiles
SpecfileLatest = SpecfileV6 SpecfileLatest = SpecfileV5
class LazySpecCache(collections.defaultdict): class LazySpecCache(collections.defaultdict):