Skip to content

Commit

Permalink
doc: add note about version ordering and OCaml REPL example
Browse files Browse the repository at this point in the history
This follows a discussion in ocaml#6118

Signed-off-by: Mathieu Barbin <[email protected]>
  • Loading branch information
mbarbin authored and kit-ty-kate committed Jul 26, 2024
1 parent efdc5d5 commit 539a8bc
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,10 @@ that's not an option for you, you can use `git format-patch` and email us.

## Versioning

The release cycle respects [Semantic Versioning](http://semver.org/).
The release cycle of the opam binary respects [Semantic Versioning](http://semver.org/).
Note however that the version ordering used for user packages managed by opam
follows the Debian definition (more details in [this
section](https://opam.ocaml.org/doc/Manual.html#version-ordering) of the user manual).

## Related Repositories

Expand Down
15 changes: 13 additions & 2 deletions doc/pages/Manual.md
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,14 @@ relational operators are `=`, `!=`, `<`, `<=`, `>` and `>=`, and their meaning
is defined by Version Ordering. They always have higher priority than logical
operators.

Here is a full example:

```
"foo" { >= "3.12" } & ("bar" | "baz" { !(> "2" & < "3.5") & != "5.1" })
```

#### Version-ordering

> <a id="version-ordering">**Version Ordering**</a> follows the basics of the
> [Debian definition](https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Version).
>
Expand Down Expand Up @@ -351,10 +359,13 @@ operators.
> Here is an example of an ordered sequence: `~~`, `~`, `~beta2`, `~beta10`,
> `0.1`, `1.0~beta`, `1.0`, `1.0-test`, `1.0.1`, `1.0.10`, `dev`, `trunk`.

Here is a full example:
For quick sanity checks, you can compare package versions using the OCaml REPL:

```
"foo" { >= "3.12" } & ("bar" | "baz" { !(> "2" & < "3.5") & != "5.1" })
#use "topfind";;
#require "opam-core";;
# OpamVersionCompare.compare "1.2.10" "1.2.9";;
- : int = 1
```

### Variables
Expand Down
1 change: 1 addition & 0 deletions master_changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ users)
## Doc
* Remove the ppa from the installation instructions on Ubuntu [#5988 @kit-ty-kate - fix #5987]
* Fix pinning instructions in readme [#5946 @rjbou - fix #5945]
* Add a brief note about version ordering and an OCaml REPL example [#6119 @mbarbin]

## Security fixes

Expand Down

0 comments on commit 539a8bc

Please sign in to comment.