diff options
author | Harmen Stoppels <harmenstoppels@gmail.com> | 2023-05-06 06:04:41 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-05 22:04:41 -0600 |
commit | fa7719a031e5da11d0e8f1afad097e2e1d47aae3 (patch) | |
tree | 7223aee9b36ce9c8243a0a5a3696b716d3dfb068 /var | |
parent | f6497972b863f5b5a0c0a774388f3e1404635603 (diff) | |
download | spack-fa7719a031e5da11d0e8f1afad097e2e1d47aae3.tar.gz spack-fa7719a031e5da11d0e8f1afad097e2e1d47aae3.tar.bz2 spack-fa7719a031e5da11d0e8f1afad097e2e1d47aae3.tar.xz spack-fa7719a031e5da11d0e8f1afad097e2e1d47aae3.zip |
Improve version, version range, and version list syntax and behavior (#36273)
## Version types, parsing and printing
- The version classes have changed: `VersionBase` is removed, there is now a
`ConcreteVersion` base class. `StandardVersion` and `GitVersion` both inherit
from this.
- The public api (`Version`, `VersionRange`, `ver`) has changed a bit:
1. `Version` produces either `StandardVersion` or `GitVersion` instances.
2. `VersionRange` produces a `ClosedOpenRange`, but this shouldn't affect the user.
3. `ver` produces any of `VersionList`, `ClosedOpenRange`, `StandardVersion`
or `GitVersion`.
- No unexpected type promotion, so that the following is no longer an identity:
`Version(x) != VersionRange(x, x)`.
- `VersionList.concrete` now returns a version if it contains only a single element
subtyping `ConcreteVersion` (i.e. `StandardVersion(...)` or `GitVersion(...)`)
- In version lists, the parser turns `@x` into `VersionRange(x, x)` instead
of `Version(x)`.
- The above also means that `ver("x")` produces a range, whereas
`ver("=x")` produces a `StandardVersion`. The `=` is part of _VersionList_
syntax.
- `VersionList.__str__` now outputs `=x.y.z` for specific version entries,
and `x.y.z` as a short-hand for ranges `x.y.z:x.y.z`.
- `Spec.format` no longer aliases `{version}` to `{versions}`, but pulls the
concrete version out of the list and prints that -- except when the list is
is not concrete, then is falls back to `{versions}` to avoid a pedantic error.
For projections of concrete specs, `{version}` should be used to render
`1.2.3` instead of `=1.2.3` (which you would get with `{versions}`).
The default `Spec` format string used in `Spec.__str__` now uses
`{versions}` so that `str(Spec(string)) == string` holds.
## Changes to `GitVersion`
- `GitVersion` is a small wrapper around `StandardVersion` which enriches it
with a git ref. It no longer inherits from it.
- `GitVersion` _always_ needs to be able to look up an associated Spack version
if it was not assigned (yet). It throws a `VersionLookupError` whenever `ref_version`
is accessed but it has no means to look up the ref; in the past Spack would
not error and use the commit sha as a literal version, which was incorrect.
- `GitVersion` is never equal to `StandardVersion`, nor is satisfied by it. This
is such that we don't lose transitivity. This fixes the following bug on `develop`
where `git_version_a == standard_version == git_version_b` does not imply
`git_version_a == git_version_b`. It also ensures equality always implies equal
hash, which is also currently broken on develop; inclusion tests of a set of
versions + git versions would behave differently from inclusion tests of a
list of the same objects.
- The above means `ver("ref=1.2.3) != ver("=1.2.3")` could break packages that branch
on specific versions, but that was brittle already, since the same happens with
externals: `pkg@1.2.3-external` suffixes wouldn't be exactly equal either. Instead,
those checks should be `x.satisfies("@1.2.3")` which works both for git versions and
custom version suffixes.
- `GitVersion` from commit will now print as `<hash>=<version>` once the
git ref is resolved to a spack version. This is for reliability -- version is frozen
when added to the database and queried later. It also improves performance
since there is no need to clone all repos of all git versions after `spack clean -m`
is run and something queries the database, triggering version comparison, such
as potentially reuse concretization.
- The "empty VerstionStrComponent trick" for `GitVerison` is dropped since it wasn't
representable as a version string (by design). Instead, it's replaced by `git`,
so you get `1.2.3.git.4` (which reads 4 commits after a tag 1.2.3). This means
that there's an edge case for version schemes `1.1.1`, `1.1.1a`, since the
generated git version `1.1.1.git.1` (1 commit after `1.1.1`) compares larger
than `1.1.1a`, since `a < git` are compared as strings. This is currently a
wont-fix edge case, but if really required, could be fixed by special casing
the `git` string.
- Saved, concrete specs (database, lock file, ...) that only had a git sha as their
version, but have no means to look the effective Spack version anymore, will
now see their version mapped to `hash=develop`. Previously these specs
would always have their sha literally interpreted as a version string (even when
it _could_ be looked up). This only applies to databases, lock files and spec.json
files created before Spack 0.20; after this PR, we always have a Spack version
associated to the relevant GitVersion).
- Fixes a bug where previously `to_dict` / `from_dict` (de)serialization would not
reattach the repo to the GitVersion, causing the git hash to be used as a literal
(bogus) version instead of the resolved version. This was in particularly breaking
version comparison in the build process on macOS/Windows.
## Installing or matching specific versions
- In the past, `spack install pkg@3.2` would install `pkg@=3.2` if it was a
known specific version defined in the package, even when newer patch releases
`3.2.1`, `3.2.2`, `...` were available. This behavior was only there because
there was no syntax to distinguish between `3.2` and `3.2.1`. Since there is
syntax for this now through `pkg@=3.2`, the old exact matching behavior is
removed. This means that `spack install pkg@3.2` constrains the `pkg` version
to the range `3.2`, and `spack install pkg@=3.2` constrains it to the specific
version `3.2`.
- Also in directives such as `depends_on("pkg@2.3")` and their when
conditions `conflicts("...", when="@2.3")` ranges are ranges, and specific
version matches require `@=2.3.`.
- No matching version: in the case `pkg@3.2` matches nothing, concretization
errors. However, if you run `spack install pkg@=3.2` and this version
doesn't exist, Spack will define it; this allows you to install non-registered
versions.
- For consistency, you can now do `%gcc@10` and let it match a configured
`10.x.y` compiler. It errors when there is no matching compiler.
In the past it was interpreted like a specific `gcc@=10` version, which
would get bootstrapped.
- When compiler _bootstrapping_ is enabled, `%gcc@=10.2.0` can be used to
bootstrap a specific compiler version.
## Other changes
- Externals, compilers, and develop spec definitions are backwards compatible.
They are typically defined as `pkg@3.2.1` even though they should be
saying `pkg@=3.2.1`. Spack now transforms `pkg@3` into `pkg@=3` in those cases.
- Finally, fix strictness of `version(...)` directive/declaration. It just does a simple
type check, and now requires strings/integers. Floats are not allowed because
they are ambiguous `str(3.10) == "3.1"`.
Diffstat (limited to 'var')
22 files changed, 35 insertions, 35 deletions
diff --git a/var/spack/repos/builtin.mock/packages/callpath/package.py b/var/spack/repos/builtin.mock/packages/callpath/package.py index 02832fd74d..b3343fb692 100644 --- a/var/spack/repos/builtin.mock/packages/callpath/package.py +++ b/var/spack/repos/builtin.mock/packages/callpath/package.py @@ -10,9 +10,9 @@ class Callpath(Package): homepage = "https://github.com/tgamblin/callpath" url = "http://github.com/tgamblin/callpath-1.0.tar.gz" - version(0.8, md5="0123456789abcdef0123456789abcdef") - version(0.9, md5="0123456789abcdef0123456789abcdef") - version(1.0, md5="0123456789abcdef0123456789abcdef") + version("0.8", md5="0123456789abcdef0123456789abcdef") + version("0.9", md5="0123456789abcdef0123456789abcdef") + version("1.0", md5="0123456789abcdef0123456789abcdef") depends_on("dyninst") depends_on("mpi") diff --git a/var/spack/repos/builtin.mock/packages/conflict-parent/package.py b/var/spack/repos/builtin.mock/packages/conflict-parent/package.py index e922a22a2e..58f581e477 100644 --- a/var/spack/repos/builtin.mock/packages/conflict-parent/package.py +++ b/var/spack/repos/builtin.mock/packages/conflict-parent/package.py @@ -10,9 +10,9 @@ class ConflictParent(Package): homepage = "https://github.com/tgamblin/callpath" url = "http://github.com/tgamblin/callpath-1.0.tar.gz" - version(0.8, md5="0123456789abcdef0123456789abcdef") - version(0.9, md5="0123456789abcdef0123456789abcdef") - version(1.0, md5="0123456789abcdef0123456789abcdef") + version("0.8", md5="0123456789abcdef0123456789abcdef") + version("0.9", md5="0123456789abcdef0123456789abcdef") + version("1.0", md5="0123456789abcdef0123456789abcdef") depends_on("conflict") diff --git a/var/spack/repos/builtin.mock/packages/conflict/package.py b/var/spack/repos/builtin.mock/packages/conflict/package.py index 041a175a7d..9897cec4b3 100644 --- a/var/spack/repos/builtin.mock/packages/conflict/package.py +++ b/var/spack/repos/builtin.mock/packages/conflict/package.py @@ -10,9 +10,9 @@ class Conflict(Package): homepage = "https://github.com/tgamblin/callpath" url = "http://github.com/tgamblin/callpath-1.0.tar.gz" - version(0.8, md5="0123456789abcdef0123456789abcdef") - version(0.9, md5="0123456789abcdef0123456789abcdef") - version(1.0, md5="0123456789abcdef0123456789abcdef") + version("0.8", md5="0123456789abcdef0123456789abcdef") + version("0.9", md5="0123456789abcdef0123456789abcdef") + version("1.0", md5="0123456789abcdef0123456789abcdef") variant("foo", default=True, description="") diff --git a/var/spack/repos/builtin.mock/packages/fftw/package.py b/var/spack/repos/builtin.mock/packages/fftw/package.py index 5e21902eb4..0e25e4de81 100644 --- a/var/spack/repos/builtin.mock/packages/fftw/package.py +++ b/var/spack/repos/builtin.mock/packages/fftw/package.py @@ -14,8 +14,8 @@ class Fftw(Package): homepage = "http://www.example.com" url = "http://www.example.com/fftw-1.0.tar.gz" - version(2.0, md5="abcdef1234567890abcdef1234567890") - version(1.0, md5="1234567890abcdef1234567890abcdef") + version("2.0", md5="abcdef1234567890abcdef1234567890") + version("1.0", md5="1234567890abcdef1234567890abcdef") variant("mpi", default=False, description="Enable MPI") diff --git a/var/spack/repos/builtin.mock/packages/hdf5/package.py b/var/spack/repos/builtin.mock/packages/hdf5/package.py index 6213a285fe..8df155f060 100644 --- a/var/spack/repos/builtin.mock/packages/hdf5/package.py +++ b/var/spack/repos/builtin.mock/packages/hdf5/package.py @@ -11,7 +11,7 @@ class Hdf5(Package): homepage = "http://www.llnl.gov" url = "http://www.llnl.gov/hdf5-1.0.tar.gz" - version(2.3, md5="0123456789abcdef0123456789abcdef") + version("2.3", md5="0123456789abcdef0123456789abcdef") variant("mpi", default=True, description="Enable mpi") diff --git a/var/spack/repos/builtin.mock/packages/impossible-concretization/package.py b/var/spack/repos/builtin.mock/packages/impossible-concretization/package.py index 9981527cef..8d98462a25 100644 --- a/var/spack/repos/builtin.mock/packages/impossible-concretization/package.py +++ b/var/spack/repos/builtin.mock/packages/impossible-concretization/package.py @@ -13,7 +13,7 @@ class ImpossibleConcretization(Package): homepage = "http://www.example.com" url = "http://www.example.com/example-1.0.tar.gz" - version(1.0, md5="0123456789abcdef0123456789abcdef") + version("1.0", md5="0123456789abcdef0123456789abcdef") conflicts("target=x86_64:") conflicts("target=aarch64:") diff --git a/var/spack/repos/builtin.mock/packages/indirect-mpich/package.py b/var/spack/repos/builtin.mock/packages/indirect-mpich/package.py index 5e1213c34e..7454bc45ac 100644 --- a/var/spack/repos/builtin.mock/packages/indirect-mpich/package.py +++ b/var/spack/repos/builtin.mock/packages/indirect-mpich/package.py @@ -14,7 +14,7 @@ class IndirectMpich(Package): homepage = "http://www.example.com" url = "http://www.example.com/indirect_mpich-1.0.tar.gz" - version(1.0, md5="0123456789abcdef0123456789abcdef") + version("1.0", md5="0123456789abcdef0123456789abcdef") depends_on("mpi") depends_on("direct-mpich") diff --git a/var/spack/repos/builtin.mock/packages/libdwarf/package.py b/var/spack/repos/builtin.mock/packages/libdwarf/package.py index 82406dad01..6a904a289c 100644 --- a/var/spack/repos/builtin.mock/packages/libdwarf/package.py +++ b/var/spack/repos/builtin.mock/packages/libdwarf/package.py @@ -14,10 +14,10 @@ class Libdwarf(Package): url = "http://www.prevanders.net/libdwarf-20130729.tar.gz" list_url = homepage - version(20130729, md5="64b42692e947d5180e162e46c689dfbf") - version(20130207, md5="0123456789abcdef0123456789abcdef") - version(20111030, md5="0123456789abcdef0123456789abcdef") - version(20070703, md5="0123456789abcdef0123456789abcdef") + version("20130729", md5="64b42692e947d5180e162e46c689dfbf") + version("20130207", md5="0123456789abcdef0123456789abcdef") + version("20111030", md5="0123456789abcdef0123456789abcdef") + version("20070703", md5="0123456789abcdef0123456789abcdef") depends_on("libelf") diff --git a/var/spack/repos/builtin.mock/packages/module-path-separator/package.py b/var/spack/repos/builtin.mock/packages/module-path-separator/package.py index 4c99b32144..981e909d19 100644 --- a/var/spack/repos/builtin.mock/packages/module-path-separator/package.py +++ b/var/spack/repos/builtin.mock/packages/module-path-separator/package.py @@ -10,7 +10,7 @@ class ModulePathSeparator(Package): homepage = "http://www.llnl.gov" url = "http://www.llnl.gov/module-path-separator-1.0.tar.gz" - version(1.0, md5="0123456789abcdef0123456789abcdef") + version("1.0", md5="0123456789abcdef0123456789abcdef") def setup_run_environment(self, env): env.append_path("COLON", "foo") diff --git a/var/spack/repos/builtin.mock/packages/multivalue-variant/package.py b/var/spack/repos/builtin.mock/packages/multivalue-variant/package.py index 0f7f4bfc06..1366463241 100644 --- a/var/spack/repos/builtin.mock/packages/multivalue-variant/package.py +++ b/var/spack/repos/builtin.mock/packages/multivalue-variant/package.py @@ -10,10 +10,10 @@ class MultivalueVariant(Package): homepage = "http://www.llnl.gov" url = "http://www.llnl.gov/mpileaks-1.0.tar.gz" - version(1.0, md5="0123456789abcdef0123456789abcdef") - version(2.1, md5="0123456789abcdef0123456789abcdef") - version(2.2, md5="0123456789abcdef0123456789abcdef") - version(2.3, md5="0123456789abcdef0123456789abcdef") + version("1.0", md5="0123456789abcdef0123456789abcdef") + version("2.1", md5="0123456789abcdef0123456789abcdef") + version("2.2", md5="0123456789abcdef0123456789abcdef") + version("2.3", md5="0123456789abcdef0123456789abcdef") variant("debug", default=False, description="Debug variant") variant( diff --git a/var/spack/repos/builtin.mock/packages/quantum-espresso/package.py b/var/spack/repos/builtin.mock/packages/quantum-espresso/package.py index 8d5c0af757..6606fb73c3 100644 --- a/var/spack/repos/builtin.mock/packages/quantum-espresso/package.py +++ b/var/spack/repos/builtin.mock/packages/quantum-espresso/package.py @@ -14,7 +14,7 @@ class QuantumEspresso(Package): homepage = "http://www.example.com" url = "http://www.example.com/qe-1.0.tar.gz" - version(1.0, md5="1234567890abcdef1234567890abcdef") + version("1.0", md5="1234567890abcdef1234567890abcdef") variant("invino", default=True, description="?") variant("veritas", default=True, description="?") diff --git a/var/spack/repos/builtin.mock/packages/singlevalue-variant/package.py b/var/spack/repos/builtin.mock/packages/singlevalue-variant/package.py index 615551355b..9a58116f98 100644 --- a/var/spack/repos/builtin.mock/packages/singlevalue-variant/package.py +++ b/var/spack/repos/builtin.mock/packages/singlevalue-variant/package.py @@ -11,7 +11,7 @@ class SinglevalueVariant(Package): homepage = "http://www.llnl.gov" url = "http://www.llnl.gov/mpileaks-1.0.tar.gz" - version(1.0, md5="0123456789abcdef0123456789abcdef") + version("1.0", md5="0123456789abcdef0123456789abcdef") variant( "fum", diff --git a/var/spack/repos/builtin/packages/genie/package.py b/var/spack/repos/builtin/packages/genie/package.py index 21c8310033..5b2de80c9b 100644 --- a/var/spack/repos/builtin/packages/genie/package.py +++ b/var/spack/repos/builtin/packages/genie/package.py @@ -81,7 +81,7 @@ class Genie(Package): def url_for_version(self, version): url = "https://github.com/GENIE-MC/Generator/archive/R-{0}.tar.gz" - if version >= Version(3): + if version >= Version("3"): return url.format("{0}_{1:02d}_{2:02d}".format(*version)) else: return url.format(version.underscored) diff --git a/var/spack/repos/builtin/packages/grackle/package.py b/var/spack/repos/builtin/packages/grackle/package.py index de663605bb..07442dec3a 100644 --- a/var/spack/repos/builtin/packages/grackle/package.py +++ b/var/spack/repos/builtin/packages/grackle/package.py @@ -37,7 +37,7 @@ class Grackle(Package): template_name = "{0.architecture}-{0.compiler.name}" grackle_architecture = template_name.format(spec) link_variables = ( - "MACH_AR = ar" if spec.version < Version(2.2) else "MACH_LIBTOOL = libtool" + "MACH_AR = ar" if spec.version < Version("2.2") else "MACH_LIBTOOL = libtool" ) substitutions = { "@ARCHITECTURE": grackle_architecture, diff --git a/var/spack/repos/builtin/packages/libyogrt/package.py b/var/spack/repos/builtin/packages/libyogrt/package.py index 36ab478156..79d164e326 100644 --- a/var/spack/repos/builtin/packages/libyogrt/package.py +++ b/var/spack/repos/builtin/packages/libyogrt/package.py @@ -54,7 +54,7 @@ class Libyogrt(AutotoolsPackage): variant("static", default="False", description="build static library") def url_for_version(self, version): - if version < Version(1.21): + if version < Version("1.21"): return "https://github.com/LLNL/libyogrt/archive/%s.tar.gz" % version else: return "https://github.com/LLNL/libyogrt/releases/download/{0}/libyogrt-{0}.tar.gz".format( diff --git a/var/spack/repos/builtin/packages/py-apache-beam/package.py b/var/spack/repos/builtin/packages/py-apache-beam/package.py index fcaa454cd3..e3b96bcea0 100644 --- a/var/spack/repos/builtin/packages/py-apache-beam/package.py +++ b/var/spack/repos/builtin/packages/py-apache-beam/package.py @@ -20,7 +20,7 @@ class PyApacheBeam(PythonPackage): depends_on("py-cython@0.28.1:", type="build") depends_on("py-avro-python3@1.8.1:1.9.1,1.9.3:1.9", type=("build", "run")) depends_on("py-crcmod@1.7:1", type=("build", "run")) - depends_on("py-dill@0.3.1.1:0.3.1", type=("build", "run")) + depends_on("py-dill@0.3.1:0.3.1", type=("build", "run")) depends_on("py-fastavro@0.21.4:0.23", type=("build", "run")) depends_on("py-future@0.18.2:0", type=("build", "run")) depends_on("py-grpcio@1.29:1", type=("build", "run")) diff --git a/var/spack/repos/builtin/packages/py-cutadapt/package.py b/var/spack/repos/builtin/packages/py-cutadapt/package.py index c117408010..18cc2a38af 100644 --- a/var/spack/repos/builtin/packages/py-cutadapt/package.py +++ b/var/spack/repos/builtin/packages/py-cutadapt/package.py @@ -36,7 +36,7 @@ class PyCutadapt(PythonPackage): depends_on("py-xopen@0.8.1:0.8", type=("build", "run"), when="@2.5") depends_on("py-xopen@0.8.4:0.8", type=("build", "run"), when="@2.6:2.10") depends_on("py-dnaio@0.3:", type=("build", "run"), when="@2.0:2.4") - depends_on("py-dnaio@0.3.0:0.3", type=("build", "run"), when="@2.5") + depends_on("py-dnaio@0.3", type=("build", "run"), when="@2.5") depends_on("py-dnaio@0.4.0:0.4", type=("build", "run"), when="@2.6") depends_on("py-dnaio@0.4.1:0.4", type=("build", "run"), when="@2.7:2.9") depends_on("py-dnaio@0.4.2:0.4", type=("build", "run"), when="@2.10") diff --git a/var/spack/repos/builtin/packages/py-sphinx-tabs/package.py b/var/spack/repos/builtin/packages/py-sphinx-tabs/package.py index 560ff792b9..fe81e4f61a 100644 --- a/var/spack/repos/builtin/packages/py-sphinx-tabs/package.py +++ b/var/spack/repos/builtin/packages/py-sphinx-tabs/package.py @@ -21,4 +21,4 @@ class PySphinxTabs(PythonPackage): depends_on("py-setuptools", type="build") depends_on("py-sphinx@2:4", type=("build", "run")) depends_on("py-pygments", type=("build", "run")) - depends_on("py-docutils@0.16.0:0.16", type=("build", "run")) + depends_on("py-docutils@0.16", type=("build", "run")) diff --git a/var/spack/repos/builtin/packages/qca/package.py b/var/spack/repos/builtin/packages/qca/package.py index 6a1f9629a8..302416ce94 100644 --- a/var/spack/repos/builtin/packages/qca/package.py +++ b/var/spack/repos/builtin/packages/qca/package.py @@ -33,6 +33,6 @@ class Qca(CMakePackage): def cmake_args(self): args = [] args.append("-DCMAKE_CXX_STANDARD=11") - if self.spec["qt"].version.up_to(1) == Version(4): + if self.spec["qt"].version.up_to(1) == Version("4"): args.append("-DQT4_BUILD=ON") return args diff --git a/var/spack/repos/builtin/packages/qjson/package.py b/var/spack/repos/builtin/packages/qjson/package.py index ff21ea8823..50824207d1 100644 --- a/var/spack/repos/builtin/packages/qjson/package.py +++ b/var/spack/repos/builtin/packages/qjson/package.py @@ -19,6 +19,6 @@ class Qjson(CMakePackage): def cmake_args(self): args = [] - if self.spec["qt"].version.up_to(1) == Version(4): + if self.spec["qt"].version.up_to(1) == Version("4"): args.append("-DQT4_BUILD=ON") return args diff --git a/var/spack/repos/builtin/packages/qtkeychain/package.py b/var/spack/repos/builtin/packages/qtkeychain/package.py index 972c5af51a..0bea065f0b 100644 --- a/var/spack/repos/builtin/packages/qtkeychain/package.py +++ b/var/spack/repos/builtin/packages/qtkeychain/package.py @@ -19,6 +19,6 @@ class Qtkeychain(CMakePackage): def cmake_args(self): args = [] - if self.spec["qt"].version.up_to(1) == Version(4): + if self.spec["qt"].version.up_to(1) == Version("4"): args.append("-DBUILD_WITH_QT4=ON") return args diff --git a/var/spack/repos/builtin/packages/wireshark/package.py b/var/spack/repos/builtin/packages/wireshark/package.py index 798c7e7a04..9114d35ad9 100644 --- a/var/spack/repos/builtin/packages/wireshark/package.py +++ b/var/spack/repos/builtin/packages/wireshark/package.py @@ -68,7 +68,7 @@ class Wireshark(CMakePackage): if self.spec.satisfies("+qt"): args.append("-DBUILD_wireshark=ON") args.append("-DENABLE_APPLICATION_BUNDLE=ON") - if self.spec["qt"].version >= Version(5): + if self.spec["qt"].version >= Version("5"): args.append("-DENABLE_QT5=ON") else: args.append("-DENABLE_QT5=OFF") |