|
| 1 | +Repro for https://github.com/ocaml/dune/issues/10592. Creates some packages |
| 2 | +that simulate some of the ocaml compiler packages and test solving a project |
| 3 | +that depends on "ocaml". |
| 4 | + |
| 5 | + $ . ./helpers.sh |
| 6 | + $ mkrepo |
| 7 | + |
| 8 | + $ CURRENT=5.2.0 |
| 9 | + $ NEXT=5.3.0 |
| 10 | + $ NEXT_NEXT=5.3.1 |
| 11 | + |
| 12 | +The vanilla compiler package, intended to be the default compiler package. |
| 13 | + $ mkpkg ocaml-base-compiler $CURRENT |
| 14 | + |
| 15 | +A configurable compiler. It's marked as avoid-version with the intention that |
| 16 | +packages explicitly opt into using it. |
| 17 | + $ mkpkg ocaml-variants $CURRENT+trunk << EOF |
| 18 | + > flags: [avoid-version] |
| 19 | + > EOF |
| 20 | + |
| 21 | +A meta package which depends on a disjunction of different compiler |
| 22 | +implementations. |
| 23 | + $ mkpkg ocaml $CURRENT << EOF |
| 24 | + > depends: [ |
| 25 | + > "ocaml-base-compiler" {>= "$CURRENT~" & < "$NEXT~" } | |
| 26 | + > "ocaml-variants" {>= "$CURRENT~" & < "$NEXT~" } |
| 27 | + > ] |
| 28 | + > EOF |
| 29 | + |
| 30 | +When the latest version of all packages is the same, the ocaml-base-compiler |
| 31 | +package is chosen, which is what we want. |
| 32 | + $ solve ocaml |
| 33 | + Solution for dune.lock: |
| 34 | + - ocaml.5.2.0 |
| 35 | + - ocaml-base-compiler.5.2.0 |
| 36 | + |
| 37 | +Now pretend that there was an alpha release of the current version of the |
| 38 | +compiler also in the repo. |
| 39 | + $ mkpkg ocaml-base-compiler $CURRENT+alpha1 << EOF |
| 40 | + > flags: [avoid-version] |
| 41 | + > EOF |
| 42 | + |
| 43 | +The alpha version of the compiler was chosen instead of the stable version. |
| 44 | +This would ideally be avoided due to the avoid-version flag, but this flag is |
| 45 | +ignored by dune. |
| 46 | + $ solve ocaml |
| 47 | + Solution for dune.lock: |
| 48 | + - ocaml.5.2.0 |
| 49 | + - ocaml-base-compiler.5.2.0+alpha1 |
| 50 | + |
| 51 | +Now release a new version of ocaml-variants and a new version of ocaml that |
| 52 | +uses it. The dependency specification for ocaml is based on how the package is |
| 53 | +organized in the wild. |
| 54 | + $ mkpkg ocaml-variants $NEXT+trunk << EOF |
| 55 | + > flags: [avoid-version] |
| 56 | + > EOF |
| 57 | + $ mkpkg ocaml $NEXT << EOF |
| 58 | + > depends: [ |
| 59 | + > "ocaml-base-compiler" {= "$NEXT" } | |
| 60 | + > "ocaml-variants" {>= "$NEXT~" & < "$NEXT_NEXT~" } |
| 61 | + > ] |
| 62 | + > EOF |
| 63 | + |
| 64 | +Here ocaml-variants is chosen despite its avoid-version flag. This is because |
| 65 | +dune currently ignores this flag. This is a problem because the chosen compiler |
| 66 | +is not officially released and possibly unstable. |
| 67 | + $ solve ocaml |
| 68 | + Solution for dune.lock: |
| 69 | + - ocaml.5.3.0 |
| 70 | + - ocaml-variants.5.3.0+trunk |
0 commit comments