3. Versions
The lab improves kinds: version 1.1.0 adds a single-precision kind and changes nothing else, version 2.0.0 renames the kinds after their digits. The versions are only git tags:
$ fobis info lab:kinds
kinds (file://~/remotes/kinds.git)
index : lab
summary : Portable real kinds
license : MIT
build : fobis
versions : v2.0.0, v1.1.0, v1.0.0
modules : kindsMove within the range
solver asked for kinds = ... :: semver=^1.0.0: any 1.x.y from 1.0.0 on, never 2.0.0, which may break it. fetch --update moves to the newest version within the range:
$ fobis fetch --update
Resolving semver '^1.0.0' for kinds...
Resolved kinds semver '^1.0.0' → v1.1.0
Updating kinds
Checking out v1.1.0 for kinds
Resolving semver '^0.1.0' for vectors...
Resolved vectors semver '^0.1.0' → v0.1.0
Updating vectors
Checking out v0.1.0 for vectors
Saved deps config to .fobis_deps/.deps_config.ini
Saved lock file to .fobis_deps/fobos.lockThe lock records what was checked out, with the commit and the tree hash of its content:
$ grep -A3 "^\[kinds\]" .fobis_deps/fobos.lock
[kinds]
url = file://~/remotes/kinds.git
commit = 46a1fb569bcb3c164a05d76628a03ec9cb55f432
tree = 08e12355c5fd9358b2711d33563bfa84e0a58476Cross the range, deliberately
A new range is written by adding the package again, with --force:
$ fobis add lab:kinds --semver "^2.0.0" --force
Replaced kinds = file://~/remotes/kinds.git :: semver=^2.0.0
Run 'fobis fetch' to fetch it.After fetch --update, 2.0.0 is checked out, and vectors, still written for the old names, no longer compiles:
$ fobis build --quiet
Building src/solver.f90
Compiling .fobis_deps/kinds/src/kinds.f90 serially
Compiling .fobis_deps/vectors/src/vectors.f90 serially
.fobis_deps/vectors/src/vectors.f90:3:17:
3 | use kinds, only : R8P
| 1
Error: Symbol 'r8p' referenced at (1) not found in module 'kinds'
.fobis_deps/vectors/src/vectors.f90:10:11:
10 | real(R8P), intent(in) :: v(:) !< Vector.
| 1
Error: Symbol 'r8p' at (1) has no IMPLICIT type
.fobis_deps/vectors/src/vectors.f90:11:11:
11 | real(R8P) :: n !< Its norm.
| 1
Error: Symbol 'r8p' at (1) has no IMPLICIT type
.fobis_deps/vectors/src/vectors.f90:8:34:
8 | pure function norm(v) result(n)
| 1
Error: Function result 'n' at (1) has no IMPLICIT type
.fobis_deps/vectors/src/vectors.f90:8:23:
8 | pure function norm(v) result(n)
| 1
Error: Symbol 'v' at (1) has no IMPLICIT type
.fobis_deps/vectors/src/vectors.f90:8:23:
8 | pure function norm(v) result(n)
| 1
Error: Argument 'v' of pure function 'norm' at (1) must be INTENT(IN) or VALUE
[exit status 1]That is what a new major version means. solver goes back to the 1.x range:
$ fobis add lab:kinds --semver "^1.0.0" --force
Replaced kinds = file://~/remotes/kinds.git :: semver=^1.0.0
Run 'fobis fetch' to fetch it.What the dependencies require
vectors 0.2.0 requires kinds 1.1.0 or newer in 1.x. solver moves to vectors 0.2.0 and lets fetch read what its dependencies require, with transitive = true:
[dependencies]
# added by fobis add from index lab
kinds = file://~/remotes/kinds.git :: semver=^1.0.0
# added by fobis add from index lab
vectors = file://~/remotes/vectors.git :: semver=^0.2.0
transitive = true$ fobis fetch --update
Dependency kinds already fetched (use --update to refresh)
Checking out v1.0.0 for kinds
Dependency vectors already fetched (use --update to refresh)
Fetching vectors: v0.2.0 is not in its clone yet
Checking out v0.2.0 for vectors
Dependency kinds already fetched (use --update to refresh)
Checking out v1.1.0 for kinds
Updating kinds
Checking out v1.1.0 for kinds
Updating vectors
Checking out v0.2.0 for vectors
Saved deps config to .fobis_deps/.deps_config.ini
Saved lock file to .fobis_deps/fobos.lock$ grep -E "^\[|resolved|required_by" .fobis_deps/fobos.lock
[kinds]
resolved = v1.1.0
[vectors]
resolved = v0.2.0solver asks for kinds 1.0.0 or newer, vectors for 1.1.0 or newer: fetch takes the highest of these minimums, 1.1.0, the lowest version that satisfies both, not the newest one. This is minimal version selection: the answer depends only on the fobos files, so it is the same tomorrow, whatever kinds publishes meanwhile.
$ fobis build --quiet && ./build/solver
Building src/solver.f90
Compiling .fobis_deps/kinds/src/kinds.f90 serially
Compiling .fobis_deps/vectors/src/vectors.f90 serially
Compiling src/solver.f90 serially
Linking build/solver
Target src/solver.f90 has been successfully built
5.000A range no version can satisfy is an error that names both sides:
$ fobis add lab:kinds --semver "^2.0.0" --force && fobis fetch --update
Replaced kinds = file://~/remotes/kinds.git :: semver=^2.0.0
Run 'fobis fetch' to fetch it.
Dependency kinds already fetched (use --update to refresh)
Checking out v2.0.0 for kinds
Dependency vectors already fetched (use --update to refresh)
Checking out v0.2.0 for vectors
Error: dependency resolution: kinds: (project) needs at least v2.0.0, but vectors requires ^1.1.0
[exit status 1]What you learned
Version tags, semver=^X.Y.Z ranges, fetch --update, fobis add --semver --force, the lock, major versions, transitive = true and minimal version selection. Reference: versions and ranges, dependencies of dependencies.
Next: install for your compiler.