Travis, subpackages and pins

Hi,

I’ve been trying to split the kafka package in kafka and kafka_lwt to make it possible to chose between concurrency backends. But when I attempt to run this thing through Travis it fails:

[ERROR] No solution for kafka_lwt: The following dependencies couldn't be met:
          - kafka_lwt → kafka < 0.2
              no matching version

kafka_lwt depends on "kafka" {= version} which should be correct, but if I specify to pin both these packages I get this:

opam pin add kafka_lwt --kind=path . -n
[NOTE] Package kafka_lwt is already pinned to
       file:///home/travis/build/Leonidas-from-XIV/ocaml-kafka (version ~dev).
[kafka_lwt.~dev] synchronised from file:///home/travis/build/Leonidas-from-XIV/ocaml-kafka
kafka_lwt is now pinned to file:///home/travis/build/Leonidas-from-XIV/ocaml-kafka (version ~dev)
opam pin add kafka --kind=path . -n
[NOTE] Package kafka is already pinned to
       file:///home/travis/build/Leonidas-from-XIV/ocaml-kafka (version 0.4).
[kafka.0.4] synchronised from file:///home/travis/build/Leonidas-from-XIV/ocaml-kafka
kafka is now pinned to file:///home/travis/build/Leonidas-from-XIV/ocaml-kafka (version 0.4)

In particular, I am confused why it picks 0.4 as version for kafka and ~dev as version for kafka_lwt. The only place I can imagine it could pick 0.4 is the git tag, but that’s quite weird, since the build scripts to path-pinning so opam shouldn’t really be aware of the tags.

Seems like something strange is going on, and I can’t really figure out how to build & test split packages on Travis CI.

With multiple opam subpackages, you need to set PINS to an appropriate version. It’s worth opening an issue on the opam tracker to have the ability to override the version detection with a directory-based pin (as you can do for an individual pin), but for now, you can find an example of this in cohttp:

1 Like

Thanks @avsm, this was exactly the issue! Pinning them to dev works perfectly fine and the opam files can just continue to use {= version} as appropriate for a future release to opam-repository.

I’ll adapt this solution to all the other repos I maintain, then :slight_smile: