Differences between revisions 14 and 16 (spanning 2 versions)
Revision 14 as of 2009-10-08 23:12:33
Size: 4852
Editor: ?Sylvain Le Gall
Comment:
Revision 16 as of 2009-10-16 09:29:31
Size: 4905
Editor: MehdiDogguy
Comment: -dh-ocaml
Deletions are marked like this. Additions are marked like this.
Line 60: Line 60:
 * dh-ocaml (0.9.1)  *  '''DONE''' dh-ocaml (0.9.1)
Line 63: Line 63:
 * pgocaml (waiting for dh-ocaml 0.9.1)

DRAFT NOT YET FINISHED

Migration to dh_ocaml

During DebCamp (and DebConf), we have rewritten dh_ocaml (and ocaml-md5sums) to be able to compute automatically dependencies between OCaml packages. Tests have been performed on some packages (OCaml itself, findlib, camlzip, menhir) and the results were very satisfying. We consider that dh_ocaml (and related tools) are ready to be pushed in Debian. The last step, before uploading the new packages to unstable, is to test more packages and upload them to experimental and observe real results.

How it works ?

dh_ocaml uses some tools to gather informations:

  • Low-level tools to inspect imported interfaces and defined modules:
    • ocamlobjinfo for bytecode interfaces and objects(.cmi, .cmo, .cma)

    • ocamlbyteinfo for bytecode binaries

    • ocamldumpapprox for native objects (.cmx, .cmxa)

    • ocamlplugininfo for native plugins (.cmxs)

  • Higher-level tools:
    • ocaml-md5sums which is a kind of wrapper around the forementioned four tools.

ocaml-md5sums receives a list of files and has to inspect them in order to gather some informations regarding imported interfaces and defined modules and md5sum of each of them. It chooses the correct low-level tool depending on the file extension (and on the file header for bytecode binaries). Gathered informations are then stored in a file (namely, /var/lib/ocaml/md5sums/${source_package}.md5sums) which will be used later to compute dependencies.

dh_ocaml proceeds in several stages:

  • Computes a runtime map (an associative list where keys are the -dev packages and the values are their runtime version)
    • This information can be overridden by using dh_ocaml's option --runtime-map (e.g., dh_ocaml --runtime-map liba1-ocaml-dev:liba1-ocaml,liba2-ocaml-dev:-, where "-" says "no runtime package"). But, you have to be very careful when using it and understand why are you are overriding these values since the runtime package will be a runtime dependency for other packages.

  • Inspects files given to him and look for defined modules
    • This can be overridden with --nodefined-map (Particulary useful with packages like cothreads where it exports modules like Thread and Event)

With CDBS, you can specify additional flags for dh_ocaml using the makefile variable OCAML_DHOCAML_FLAGS.

Steps to convert a package

  • whatever buildystem you use:
    • remove all ocaml-*-${F:OCamlABI}, and replace it by ${ocaml:Depends}, the dependency to ocaml-*-${F:OCamlABI} is enforce by dh_ocaml
    • remove dependency on ocaml interpreter for certain native package with compile to bytecode on non-native arches (e.g. ${F:OCamlInterp}), ${ocaml:Depend} will compute the right dependencies on these arches
    • add a Provides:${ocaml:Provides} to runtime and dev packages (e.g. libzip-ocaml and libzip-ocaml-dev)

    • add ${ocaml:Depends} for all packages
    • build-depends on dh-ocaml >= 0.9

    • don't remove old ocaml dependencies for now, once transition is complete, we will check and remove it
  • if you use ocamlinit.mk:
    • replace ocamlinit.mk by ocamlvars if you still use values from it
    • remove -VF OCamlABI from deb_gencontrol
    • replace ocamldoc-api-ref-config by either debian/libzip-ocaml-dev.ocamldoc if you use autogeneration or ... (TODO)
  • if you use CDBS:
    • replace OCAMLDOC_... by debian/libzip-ocaml-dev.ocamldoc (note: even if no flags are needed for ocamldoc, make sure this file contains at least a comment line, because an empty file will not be represented in the .diff.gz)
    • place ocaml.mk at the head of the include list (TODO: is it really mandatory, this is due to .debhleper.log left in the debian/ after debclean invocation)
    • invoke ... fakeroot debian/rules clean to regenerate debian/control from debian/control.in (handle dh-ocaml >= 0.9 automatically)

  • if you use dh:
    • add "--with ocaml" to dh invocation
  • if you use debhelper < 7:

    • add dh_ocamldoc before dh_installdoc in binary* target
    • add dh_ocaml before dh_gencontrol in binary* target
    • add dh_ocamlinit at the beginning of binary* target
    • add dh_ocamlinit -d before dh_clean in clean target

TODO list

  • DONE dh-ocaml (0.9.1)

  • camlp5 (waiting for dh-ocaml 0.9.1)
  • cothreads (waiting for dh-ocaml 0.9.1)
  • pgocaml (waiting for dh-ocaml 0.9.1)
  • ledit (waiting for camlp5)
  • ocaml-speex (waiting for ocaml-ogg)
  • ocaml-theora (waiting for ocaml-ogg)
  • xmlrpc-light (waiting for xml-light)

Packages with ready build-deps:

  • DONE ocaml-bitstring

  • DONE ocaml-mad

  • json-wheel
  • DONE ocamldap

  • DONE ocurl

  • DONE ocaml-getopt

  • DONE xmlm

  • DONE ocamlcreal

  • ocaml-samplerate
  • ocaml-pulseaudio
  • DONE laby

  • DONE camlimages

  • ocaml-gavl