Re: [Pkg-xen-devel] [patch] Packages ocaml libraries
On 09/01/2011 12:28 AM, Mehdi Dogguy wrote:
> + export OCAMLINIT_SED="-e
> s%@XenBuildOcamlLibsDir@%debian/build/build-utils_$(ARCH)/tools/ocaml/libs%"
> && dh_ocamlinit
>
> I think that the following is enough.
Done as suggested.
> I guess the dependency on "libxen-ocaml (= ${binary:Version})" is not
> necessary since it will be detected by dh_ocaml.
I tried to do that, but it didn't work (eg: a quick check to the
resulting packages with "mc" showed that the dependency were missing),
even after the correct files were sent to the correct packages. So I
just left it in the debian/templates/control.main.in file.
The way I did, at least I'm sure the dependency will be there! If
someone wants to investigate the issue further, that'd be great.
> The build-dependency on dh-ocaml should be versioned since all those
> dh_ocaml* scripts have been added in 0.9.0. I think you should turn that
> into something like "dh-ocaml (>= 0.9~), ocaml-nox (>= 3.11.1-3~)".
> Lintian should warn about that though.
Done as suggested as well.
New patch is attached.
Thomas
diff -u -N -r old/xen-4.1.1/debian/find_ocaml_libs new/xen-4.1.1/debian/find_ocaml_libs
--- old/xen-4.1.1/debian/find_ocaml_libs 1970-01-01 00:00:00.000000000 +0000
+++ new/xen-4.1.1/debian/find_ocaml_libs 2011-08-31 15:23:35.000000000 +0000
@@ -0,0 +1,63 @@
+#!/bin/sh
+
+# This small helper is writing the libxen-ocaml.install.in and libxen-ocaml-dev.install.in
+# automatically. It's not meant to be fool proof, so please check for the results before
+# using it's results.
+
+OCAML_LIBS_PATH=build/build-utils_i386/tools/ocaml/libs
+echo "Will search in ${OCAML_LIBS_PATH}"
+
+if ! [ -d ${OCAML_LIBS_PATH} ] ; then
+ echo "Please build Xen first!"
+ exit 1
+fi
+
+CWD=`pwd`
+cd ${OCAML_LIBS_PATH}
+FOLDERS=`find . -maxdepth 1 -mindepth 1 -type d | cut -d'/' -f2`
+
+LIBXEN_OCAML_INSTALL=""
+LIBXEN_OCAML_DEV_INSTALL=""
+
+for folder in ${FOLDERS} ; do
+ echo "===> Searching in ${folder}"
+ cd ${folder}
+ # Do the DLL thing
+ OCAML_DLL=`find . -iname 'dll*.so' | cut -d'/' -f2`
+ if [ -n "${OCAML_DLL}" ] ; then
+ echo "Found DLL: \"${OCAML_DLL}\""
+ LIBXEN_OCAML_INSTALL=${LIBXEN_OCAML_INSTALL}"\n"@XenBuildOcamlLibsDir@/${folder}/${OCAML_DLL}"\t"@OCamlDllDir@
+ fi
+ # Do the .cma and META
+ FOUND=""
+ for ext in META .cma ; do
+ MY_OCAML_FILES=`find . -iname '*'${ext} | cut -d'/' -f2`
+ if [ -n "${MY_OCAML_FILES}" ] ; then
+ for j in ${MY_OCAML_FILES} ; do
+ LIBXEN_OCAML_INSTALL=${LIBXEN_OCAML_INSTALL}"\n"@XenBuildOcamlLibsDir@/${folder}/${j}"\t"@OCamlStdlibDir@/${folder}
+ FOUND="${FOUND} ${j}"
+ done
+ fi
+ done
+ echo "Found for libxen-ocaml: ${FOUND}"
+
+ # All the other files will go in the -dev package
+ FOUND=""
+ for ext in a cmi cmxa mli cmx cmo ; do
+ MY_OCAML_FILES=`find . -iname '*.'${ext} | cut -d'/' -f2`
+ if [ -n "${MY_OCAML_FILES}" ] ; then
+ for j in ${MY_OCAML_FILES} ; do
+ LIBXEN_OCAML_DEV_INSTALL=${LIBXEN_OCAML_DEV_INSTALL}"\n"@XenBuildOcamlLibsDir@/${folder}/${j}"\t"@OCamlStdlibDir@/${folder}
+ FOUND="${FOUND} ${j}"
+ done
+ fi
+ done
+ echo "Found for libxen-ocaml-dev: ${FOUND}"
+ #LIBXEN_OCAML_INSTALL=${LIBXEN_OCAML_INSTALL}"\n"
+ cd ..
+done
+
+echo "Content of the libxen-ocaml.install.in is:"
+echo ${LIBXEN_OCAML_INSTALL}
+echo "Content for the libxen-ocaml-dev.install.in is:"
+echo ${LIBXEN_OCAML_DEV_INSTALL}
diff -u -N -r old/xen-4.1.1/debian/libxen-ocaml-dev.install.in new/xen-4.1.1/debian/libxen-ocaml-dev.install.in
--- old/xen-4.1.1/debian/libxen-ocaml-dev.install.in 1970-01-01 00:00:00.000000000 +0000
+++ new/xen-4.1.1/debian/libxen-ocaml-dev.install.in 2011-08-31 11:33:20.000000000 +0000
@@ -0,0 +1,85 @@
+@XenBuildOcamlLibsDir@/mmap/mmap.a @OCamlStdlibDir@/mmap
+@XenBuildOcamlLibsDir@/mmap/libmmap_stubs.a @OCamlStdlibDir@/mmap
+@XenBuildOcamlLibsDir@/mmap/mmap.cmi @OCamlStdlibDir@/mmap
+@XenBuildOcamlLibsDir@/mmap/mmap.cmxa @OCamlStdlibDir@/mmap
+@XenBuildOcamlLibsDir@/mmap/mmap.mli @OCamlStdlibDir@/mmap
+@XenBuildOcamlLibsDir@/mmap/mmap.cmx @OCamlStdlibDir@/mmap
+@XenBuildOcamlLibsDir@/mmap/mmap.cmo @OCamlStdlibDir@/mmap
+@XenBuildOcamlLibsDir@/eventchn/libeventchn_stubs.a @OCamlStdlibDir@/eventchn
+@XenBuildOcamlLibsDir@/eventchn/eventchn.a @OCamlStdlibDir@/eventchn
+@XenBuildOcamlLibsDir@/eventchn/eventchn.cmi @OCamlStdlibDir@/eventchn
+@XenBuildOcamlLibsDir@/eventchn/eventchn.cmxa @OCamlStdlibDir@/eventchn
+@XenBuildOcamlLibsDir@/eventchn/eventchn.mli @OCamlStdlibDir@/eventchn
+@XenBuildOcamlLibsDir@/eventchn/eventchn.cmx @OCamlStdlibDir@/eventchn
+@XenBuildOcamlLibsDir@/eventchn/eventchn.cmo @OCamlStdlibDir@/eventchn
+@XenBuildOcamlLibsDir@/xl/xl.a @OCamlStdlibDir@/xl
+@XenBuildOcamlLibsDir@/xl/libxl_stubs.a @OCamlStdlibDir@/xl
+@XenBuildOcamlLibsDir@/xl/xl.cmi @OCamlStdlibDir@/xl
+@XenBuildOcamlLibsDir@/xl/xl.cmxa @OCamlStdlibDir@/xl
+@XenBuildOcamlLibsDir@/xl/xl.mli @OCamlStdlibDir@/xl
+@XenBuildOcamlLibsDir@/xl/xl.cmx @OCamlStdlibDir@/xl
+@XenBuildOcamlLibsDir@/xl/xl.cmo @OCamlStdlibDir@/xl
+@XenBuildOcamlLibsDir@/xb/xb.a @OCamlStdlibDir@/xb
+@XenBuildOcamlLibsDir@/xb/libxb_stubs.a @OCamlStdlibDir@/xb
+@XenBuildOcamlLibsDir@/xb/packet.cmi @OCamlStdlibDir@/xb
+@XenBuildOcamlLibsDir@/xb/op.cmi @OCamlStdlibDir@/xb
+@XenBuildOcamlLibsDir@/xb/xs_ring.cmi @OCamlStdlibDir@/xb
+@XenBuildOcamlLibsDir@/xb/partial.cmi @OCamlStdlibDir@/xb
+@XenBuildOcamlLibsDir@/xb/xb.cmi @OCamlStdlibDir@/xb
+@XenBuildOcamlLibsDir@/xb/xb.cmxa @OCamlStdlibDir@/xb
+@XenBuildOcamlLibsDir@/xb/xb.mli @OCamlStdlibDir@/xb
+@XenBuildOcamlLibsDir@/xb/partial.cmx @OCamlStdlibDir@/xb
+@XenBuildOcamlLibsDir@/xb/xs_ring.cmx @OCamlStdlibDir@/xb
+@XenBuildOcamlLibsDir@/xb/xb.cmx @OCamlStdlibDir@/xb
+@XenBuildOcamlLibsDir@/xb/op.cmx @OCamlStdlibDir@/xb
+@XenBuildOcamlLibsDir@/xb/packet.cmx @OCamlStdlibDir@/xb
+@XenBuildOcamlLibsDir@/xb/op.cmo @OCamlStdlibDir@/xb
+@XenBuildOcamlLibsDir@/xb/xb.cmo @OCamlStdlibDir@/xb
+@XenBuildOcamlLibsDir@/xb/partial.cmo @OCamlStdlibDir@/xb
+@XenBuildOcamlLibsDir@/xb/xs_ring.cmo @OCamlStdlibDir@/xb
+@XenBuildOcamlLibsDir@/xb/packet.cmo @OCamlStdlibDir@/xb
+@XenBuildOcamlLibsDir@/log/libsyslog_stubs.a @OCamlStdlibDir@/log
+@XenBuildOcamlLibsDir@/log/log.a @OCamlStdlibDir@/log
+@XenBuildOcamlLibsDir@/log/logs.cmi @OCamlStdlibDir@/log
+@XenBuildOcamlLibsDir@/log/log.cmi @OCamlStdlibDir@/log
+@XenBuildOcamlLibsDir@/log/syslog.cmi @OCamlStdlibDir@/log
+@XenBuildOcamlLibsDir@/log/log.cmxa @OCamlStdlibDir@/log
+@XenBuildOcamlLibsDir@/log/logs.mli @OCamlStdlibDir@/log
+@XenBuildOcamlLibsDir@/log/log.mli @OCamlStdlibDir@/log
+@XenBuildOcamlLibsDir@/log/syslog.mli @OCamlStdlibDir@/log
+@XenBuildOcamlLibsDir@/log/log.cmx @OCamlStdlibDir@/log
+@XenBuildOcamlLibsDir@/log/logs.cmx @OCamlStdlibDir@/log
+@XenBuildOcamlLibsDir@/log/syslog.cmx @OCamlStdlibDir@/log
+@XenBuildOcamlLibsDir@/log/logs.cmo @OCamlStdlibDir@/log
+@XenBuildOcamlLibsDir@/log/log.cmo @OCamlStdlibDir@/log
+@XenBuildOcamlLibsDir@/log/syslog.cmo @OCamlStdlibDir@/log
+@XenBuildOcamlLibsDir@/xc/xc.a @OCamlStdlibDir@/xc
+@XenBuildOcamlLibsDir@/xc/libxc_stubs.a @OCamlStdlibDir@/xc
+@XenBuildOcamlLibsDir@/xc/xc.cmi @OCamlStdlibDir@/xc
+@XenBuildOcamlLibsDir@/xc/xc.cmxa @OCamlStdlibDir@/xc
+@XenBuildOcamlLibsDir@/xc/xc.mli @OCamlStdlibDir@/xc
+@XenBuildOcamlLibsDir@/xc/xc.cmx @OCamlStdlibDir@/xc
+@XenBuildOcamlLibsDir@/xc/xc.cmo @OCamlStdlibDir@/xc
+@XenBuildOcamlLibsDir@/uuid/uuid.a @OCamlStdlibDir@/uuid
+@XenBuildOcamlLibsDir@/uuid/uuid.cmi @OCamlStdlibDir@/uuid
+@XenBuildOcamlLibsDir@/uuid/uuid.cmxa @OCamlStdlibDir@/uuid
+@XenBuildOcamlLibsDir@/uuid/uuid.mli @OCamlStdlibDir@/uuid
+@XenBuildOcamlLibsDir@/uuid/uuid.cmx @OCamlStdlibDir@/uuid
+@XenBuildOcamlLibsDir@/uuid/uuid.cmo @OCamlStdlibDir@/uuid
+@XenBuildOcamlLibsDir@/xs/xs.a @OCamlStdlibDir@/xs
+@XenBuildOcamlLibsDir@/xs/xs.cmi @OCamlStdlibDir@/xs
+@XenBuildOcamlLibsDir@/xs/queueop.cmi @OCamlStdlibDir@/xs
+@XenBuildOcamlLibsDir@/xs/xsraw.cmi @OCamlStdlibDir@/xs
+@XenBuildOcamlLibsDir@/xs/xst.cmi @OCamlStdlibDir@/xs
+@XenBuildOcamlLibsDir@/xs/xs.cmxa @OCamlStdlibDir@/xs
+@XenBuildOcamlLibsDir@/xs/xsraw.mli @OCamlStdlibDir@/xs
+@XenBuildOcamlLibsDir@/xs/xs.mli @OCamlStdlibDir@/xs
+@XenBuildOcamlLibsDir@/xs/xst.mli @OCamlStdlibDir@/xs
+@XenBuildOcamlLibsDir@/xs/queueop.cmx @OCamlStdlibDir@/xs
+@XenBuildOcamlLibsDir@/xs/xs.cmx @OCamlStdlibDir@/xs
+@XenBuildOcamlLibsDir@/xs/xst.cmx @OCamlStdlibDir@/xs
+@XenBuildOcamlLibsDir@/xs/xsraw.cmx @OCamlStdlibDir@/xs
+@XenBuildOcamlLibsDir@/xs/xst.cmo @OCamlStdlibDir@/xs
+@XenBuildOcamlLibsDir@/xs/xs.cmo @OCamlStdlibDir@/xs
+@XenBuildOcamlLibsDir@/xs/xsraw.cmo @OCamlStdlibDir@/xs
+@XenBuildOcamlLibsDir@/xs/queueop.cmo @OCamlStdlibDir@/xs
diff -u -N -r old/xen-4.1.1/debian/libxen-ocaml.install.in new/xen-4.1.1/debian/libxen-ocaml.install.in
--- old/xen-4.1.1/debian/libxen-ocaml.install.in 1970-01-01 00:00:00.000000000 +0000
+++ new/xen-4.1.1/debian/libxen-ocaml.install.in 2011-08-31 11:34:02.000000000 +0000
@@ -0,0 +1,22 @@
+@XenBuildOcamlLibsDir@/mmap/dllmmap_stubs.so @OCamlDllDir@
+@XenBuildOcamlLibsDir@/mmap/META @OCamlStdlibDir@/mmap
+@XenBuildOcamlLibsDir@/mmap/mmap.cma @OCamlStdlibDir@/mmap
+@XenBuildOcamlLibsDir@/eventchn/dlleventchn_stubs.so @OCamlDllDir@
+@XenBuildOcamlLibsDir@/eventchn/META @OCamlStdlibDir@/eventchn
+@XenBuildOcamlLibsDir@/eventchn/eventchn.cma @OCamlStdlibDir@/eventchn
+@XenBuildOcamlLibsDir@/xl/dllxl_stubs.so @OCamlDllDir@
+@XenBuildOcamlLibsDir@/xl/META @OCamlStdlibDir@/xl
+@XenBuildOcamlLibsDir@/xl/xl.cma @OCamlStdlibDir@/xl
+@XenBuildOcamlLibsDir@/xb/dllxb_stubs.so @OCamlDllDir@
+@XenBuildOcamlLibsDir@/xb/META @OCamlStdlibDir@/xb
+@XenBuildOcamlLibsDir@/xb/xb.cma @OCamlStdlibDir@/xb
+@XenBuildOcamlLibsDir@/log/dllsyslog_stubs.so @OCamlDllDir@
+@XenBuildOcamlLibsDir@/log/META @OCamlStdlibDir@/log
+@XenBuildOcamlLibsDir@/log/log.cma @OCamlStdlibDir@/log
+@XenBuildOcamlLibsDir@/xc/dllxc_stubs.so @OCamlDllDir@
+@XenBuildOcamlLibsDir@/xc/META @OCamlStdlibDir@/xc
+@XenBuildOcamlLibsDir@/xc/xc.cma @OCamlStdlibDir@/xc
+@XenBuildOcamlLibsDir@/uuid/META @OCamlStdlibDir@/uuid
+@XenBuildOcamlLibsDir@/uuid/uuid.cma @OCamlStdlibDir@/uuid
+@XenBuildOcamlLibsDir@/xs/META @OCamlStdlibDir@/xs
+@XenBuildOcamlLibsDir@/xs/xs.cma @OCamlStdlibDir@/xs
diff -u -N -r old/xen-4.1.1/debian/rules new/xen-4.1.1/debian/rules
--- old/xen-4.1.1/debian/rules 2011-04-11 20:01:54.000000000 +0000
+++ new/xen-4.1.1/debian/rules 2011-08-30 16:28:11.000000000 +0000
@@ -34,6 +34,7 @@
clean: debian/control
dh_testdir
rm -rf $(BUILD_DIR) $(STAMPS_DIR) debian/lib/python/debian_xen/*.pyc
+ dh_ocamlinit -d
dh_clean
binary-indep:
diff -u -N -r old/xen-4.1.1/debian/rules.real new/xen-4.1.1/debian/rules.real
--- old/xen-4.1.1/debian/rules.real 2011-07-18 16:48:10.000000000 +0000
+++ new/xen-4.1.1/debian/rules.real 2011-09-01 03:53:48.000000000 +0000
@@ -1,3 +1,5 @@
+include /usr/share/ocaml/ocamlvars.mk
+
DEB_HOST_ARCH := $(shell dpkg-architecture -a$(ARCH) -qDEB_HOST_ARCH)
DEB_HOST_GNU_TYPE := $(shell dpkg-architecture -a$(ARCH) -qDEB_HOST_GNU_TYPE)
DEB_BUILD_ARCH := $(shell dpkg-architecture -a$(ARCH) -qDEB_BUILD_ARCH)
@@ -17,6 +19,8 @@
binary-arch-arch: install-libxenstore_$(ARCH)
binary-arch-arch: install-utils_$(ARCH)
binary-arch-arch: install-xenstore-utils_$(ARCH)
+binary-arch-arch: install-lib-ocaml-dev_$(ARCH)
+binary-arch-arch: install-lib-ocaml_$(ARCH)
binary-arch-flavour: install-hypervisor_$(ARCH)_$(FLAVOUR)
binary-indep: install-docs
@@ -92,6 +96,7 @@
dh_compress
dh_fixperms
dh_installdeb
+ dh_ocaml
dh_gencontrol -- $(GENCONTROL_ARGS)
dh_md5sums
dh_builddeb
@@ -130,6 +135,34 @@
dh_strip
dh_shlibdeps
+$(MAKE_SELF) install-base
+
+install-lib-ocaml_$(ARCH): DIR = $(BUILD_DIR)/install-utils_$(ARCH)
+install-lib-ocaml_$(ARCH): PACKAGE_NAME = libxen-ocaml
+install-lib-ocaml_$(ARCH): DH_OPTIONS = -p$(PACKAGE_NAME)
+install-lib-ocaml_$(ARCH): $(STAMPS_DIR)/install-utils_$(ARCH)
+ dh_testdir
+ dh_testroot
+ dh_prep
+ make -C $(BUILD_DIR)/build-utils_$(ARCH)/tools/ocaml/libs
+ OCAMLINIT_SED="-e s%@XenBuildOcamlLibsDir@%debian/build/build-utils_$(ARCH)/tools/ocaml/libs%" dh_ocamlinit
+ dh_install
+ dh_strip
+ dh_shlibdeps
+ +$(MAKE_SELF) install-base
+
+install-lib-ocaml-dev_$(ARCH): DIR = $(BUILD_DIR)/install-utils_$(ARCH)
+install-lib-ocaml-dev_$(ARCH): PACKAGE_NAME = libxen-ocaml-dev
+install-lib-ocaml-dev_$(ARCH): DH_OPTIONS = -p$(PACKAGE_NAME)
+install-lib-ocaml-dev_$(ARCH): $(STAMPS_DIR)/install-utils_$(ARCH)
+ dh_testdir
+ dh_testroot
+ dh_prep
+ make -C $(BUILD_DIR)/build-utils_$(ARCH)/tools/ocaml/libs
+ OCAMLINIT_SED="-e s%@XenBuildOcamlLibsDir@%debian/build/build-utils_$(ARCH)/tools/ocaml/libs%" dh_ocamlinit
+ dh_install
+ dh_strip
+ dh_shlibdeps
+ +$(MAKE_SELF) install-base
install-libxenstore_$(ARCH): DIR = $(BUILD_DIR)/install-utils_$(ARCH)
install-libxenstore_$(ARCH): PACKAGE_NAME = libxenstore3.0
diff -u -N -r old/xen-4.1.1/debian/templates/control.main.in new/xen-4.1.1/debian/templates/control.main.in
--- old/xen-4.1.1/debian/templates/control.main.in 2010-03-01 18:29:00.000000000 +0000
+++ new/xen-4.1.1/debian/templates/control.main.in 2011-08-31 11:43:43.000000000 +0000
@@ -7,6 +7,26 @@
includes a description interface (both the API, and a nice explanation of
how XEN works).
+Package: libxen-ocaml
+Architecture: any
+Section: ocaml
+Depends: ${shlibs:Depends}, ${misc:Depends}, ${ocaml:Depends}
+Provides: ${ocaml:Provides}
+Description: interface for remotely configuring and controlling guests (runtime)
+ The Xen Management API is an interface for remotely configuring and
+ controlling virtualised guests running on a Xen-enabled host. This package
+ containst the runtime OCaml library.
+
+Package: libxen-ocaml-dev
+Architecture: any
+Section: ocaml
+Depends: libxen-ocaml (= ${binary:Version}), ${shlibs:Depends}, ocaml-findlib (>= 1.1), ${misc:Depends}, ${ocaml:Depends}
+Provides: ${ocaml:Provides}
+Description: interface for remotely configuring and controlling guests (development files)
+ The Xen Management API is an interface for remotely configuring and
+ controlling virtualised guests running on a Xen-enabled host. This package
+ containst the development files for the OCaml library.
+
Package: libxenstore3.0
Section: libs
Architecture: any
diff -u -N -r old/xen-4.1.1/debian/templates/control.source.in new/xen-4.1.1/debian/templates/control.source.in
--- old/xen-4.1.1/debian/templates/control.source.in 2011-07-18 16:48:10.000000000 +0000
+++ new/xen-4.1.1/debian/templates/control.source.in 2011-09-01 03:55:01.000000000 +0000
@@ -15,7 +15,8 @@
libncurses5-dev,
libpci-dev,
uuid-dev,
- zlib1g-dev
+ zlib1g-dev,
+ ocaml-nox (>= 3.11.1-3~), dh-ocaml (>= 0.9~), ocaml-findlib
Build-Depends-Indep:
graphviz,
ghostscript,
Reply to: