- added ocaml-md5sums
authorStefano Zacchiroli <zack@debian.org>
Sat, 9 Jul 2005 18:27:14 +0000 (18:27 +0000)
committerStefano Zacchiroli <zack@debian.org>
Sat, 9 Jul 2005 18:27:14 +0000 (18:27 +0000)
- made repo compatible with svn-buildpackage
- removed duplicated and out of date copy of README.Debian

15 files changed:
debian/README.Debian [deleted file]
debian/changelog
debian/control
debian/ocaml-base-nox.README.Debian [new file with mode: 0644]
debian/ocaml-compiler-libs.README.Debian [deleted file]
debian/ocaml-compiler-libs.postinst [new file with mode: 0644]
debian/ocaml-compiler-libs.postrm [new file with mode: 0644]
debian/ocaml-nox.postinst
debian/ocaml-nox.postrm
debian/ocaml.postinst
debian/ocaml.postrm [new file with mode: 0644]
debian/patches/00list
debian/patches/ocaml-md5sums.dpatch [new file with mode: 0755]
debian/rules
debian/svn-deblayout [new file with mode: 0644]

diff --git a/debian/README.Debian b/debian/README.Debian
deleted file mode 100644 (file)
index 911b246..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-ocaml for Debian
-----------------
-
-  WARNING !!!
-
-  If you installed this package, and all of a sudden your bytecode program
-  stopped working, then you need to upgrade your ocaml library packages (the
-  libfoo-ocaml ones) to packages rebuilt using ocaml (>= 3.06-13). Normally
-  you should not have been able to upgrade ocaml to 3.06-13 or later if such
-  libraries are still installed on your system, but Bug#170825 in dpkg allowed
-  you to upgrade ocaml without checking that the virtual dependencies are
-  still provided. 
-
-  1) The ocaml package has been split into different binary packages :
-
-  o ocaml : contains the full ocaml suite
-  o ocaml-nox : the full suite except for the graphics(Tk) modules
-  o ocaml-base : contains the rutime stuff (ocamlrun + dlls + Tk)
-  o ocaml-base-nox : contains the rutime stuff (ocamlrun + dlls - Tk)
-
-  o ocaml-native-compilers : contains the native built part of the ocaml suite
-    (ocamlc.opt, ocamlopt.opt, ocamllex.opt, camlp4o.opt and camlp4r.opt)
-  o ocaml-compiler-libs : contains several modules used internally by
-    the ocaml compilers.  They are not needed for normal ocaml
-    development, but may be helpful in the development of certain
-    applications.
-  o ocaml-source : contains the full ocaml source for the (few) package which
-    need them at build time or for personal use (it should _not_ be used to
-    build ocam litself).
-
-  2) The caml include files are found under /usr/lib/ocaml/<ocaml_version>/caml.
-  A symlink is provided from /usr/include/caml for convenience. If
-  /usr/include/caml was previously a directory, for whatever reason, a warning
-  will be isued and the file moved to /usr/include/caml.bad. This can be
-  safely erased later on.
-
-  3) User installed stuff should not go under /usr/lib/ocaml/<ocaml_version>,
-  but rather under /usr/local/lib/ocaml/<ocaml_version>. 
-  I will take no responsability for people who break this rule and mess things
-  up.
-  
-  4) Starting from ocaml 3.05, ocaml now puts all dll.so files into a common
-  stublibs directory, so the ocaml-ldconf tool for handling the ld.conf
-  file is not needed anymore, but we will still keep it aroung until all
-  libraries are ported. As of ocam l3.08, ocaml-ldconf is now deprecated
-  and not available anymore.
-  Notice that user installed dll.so files should go into
-  /usr/local/lib/ocaml/<ocaml_version>/stublibs which is searched before
-  /usr/lib/ocaml/<ocaml_version>/stublibs.
-
- -- Mike Furr <mfurr@debian.org>, Thu Jun 24 14:23:14 2004
index 0fa0e77d0340e26a1209cd775f45693bec3587fd..0e1f3dabfd8c7d400906c89c20f5531c63294940 100644 (file)
@@ -11,7 +11,22 @@ ocaml (3.08.3-3+SVN) UNRELEASED; urgency=low
   * Add patch from Fedora to fix inline i386 assembly in the num library
     to allow building ocaml with gcc-4.0 (Closes: #309317).
 
- -- Julien Cristau <julien.cristau@ens-lyon.org>  Mon, 20 Jun 2005 20:13:17 +0200
+  Changes by Stefano Zacchiroli:
+  * debian/patches/ocaml-md5sums, debian/rules,
+    debian/{ocaml,ocaml-nox,ocaml-compiler-libs}.{postinst,postrm}
+    - added ocaml-md5sums, ocaml md5sum registry handler for the forthcoming
+      dh_ocaml
+  * Removed debian/ocaml-compiler-libs.README.Debian (out of date copy of
+    debian/README.Debian); added symlink from ocaml-base to README.Debian
+  * Added debian/svn-deblayout to make svn structure work with
+    svn-buildpackage
+  * debian/control
+    - bumped Standards-Version to 3.6.2
+  * debian/rules
+    - ignore error on clean target for config.{sub,guess} so that
+      svn-buildpackage does not fail at clean time
+
+ -- Debian OCaml Maintainers <debian-ocaml-maint@lists.debian.org>  Sat, 09 Jul 2005 14:21:31 +0200
 
 ocaml (3.08.3-3) unstable; urgency=medium
 
index 6621ce5ae400948dd3c53fdc9ab7b370ce30903a..fdfae87dded64bb5b49d29d7ca21470eb993d634 100644 (file)
@@ -3,7 +3,7 @@ Section: devel
 Priority: optional
 Maintainer: Sven Luther <luther@debian.org>
 Build-Depends: debhelper (>> 4.0.2), tcl8.4-dev, tk8.4-dev, libncurses5-dev, libgdbm-dev, dpatch, bzip2
-Standards-Version: 3.6.1
+Standards-Version: 3.6.2
 
 Package: ocaml-nox
 Architecture: any
diff --git a/debian/ocaml-base-nox.README.Debian b/debian/ocaml-base-nox.README.Debian
new file mode 100644 (file)
index 0000000..911b246
--- /dev/null
@@ -0,0 +1,51 @@
+ocaml for Debian
+----------------
+
+  WARNING !!!
+
+  If you installed this package, and all of a sudden your bytecode program
+  stopped working, then you need to upgrade your ocaml library packages (the
+  libfoo-ocaml ones) to packages rebuilt using ocaml (>= 3.06-13). Normally
+  you should not have been able to upgrade ocaml to 3.06-13 or later if such
+  libraries are still installed on your system, but Bug#170825 in dpkg allowed
+  you to upgrade ocaml without checking that the virtual dependencies are
+  still provided. 
+
+  1) The ocaml package has been split into different binary packages :
+
+  o ocaml : contains the full ocaml suite
+  o ocaml-nox : the full suite except for the graphics(Tk) modules
+  o ocaml-base : contains the rutime stuff (ocamlrun + dlls + Tk)
+  o ocaml-base-nox : contains the rutime stuff (ocamlrun + dlls - Tk)
+
+  o ocaml-native-compilers : contains the native built part of the ocaml suite
+    (ocamlc.opt, ocamlopt.opt, ocamllex.opt, camlp4o.opt and camlp4r.opt)
+  o ocaml-compiler-libs : contains several modules used internally by
+    the ocaml compilers.  They are not needed for normal ocaml
+    development, but may be helpful in the development of certain
+    applications.
+  o ocaml-source : contains the full ocaml source for the (few) package which
+    need them at build time or for personal use (it should _not_ be used to
+    build ocam litself).
+
+  2) The caml include files are found under /usr/lib/ocaml/<ocaml_version>/caml.
+  A symlink is provided from /usr/include/caml for convenience. If
+  /usr/include/caml was previously a directory, for whatever reason, a warning
+  will be isued and the file moved to /usr/include/caml.bad. This can be
+  safely erased later on.
+
+  3) User installed stuff should not go under /usr/lib/ocaml/<ocaml_version>,
+  but rather under /usr/local/lib/ocaml/<ocaml_version>. 
+  I will take no responsability for people who break this rule and mess things
+  up.
+  
+  4) Starting from ocaml 3.05, ocaml now puts all dll.so files into a common
+  stublibs directory, so the ocaml-ldconf tool for handling the ld.conf
+  file is not needed anymore, but we will still keep it aroung until all
+  libraries are ported. As of ocam l3.08, ocaml-ldconf is now deprecated
+  and not available anymore.
+  Notice that user installed dll.so files should go into
+  /usr/local/lib/ocaml/<ocaml_version>/stublibs which is searched before
+  /usr/lib/ocaml/<ocaml_version>/stublibs.
+
+ -- Mike Furr <mfurr@debian.org>, Thu Jun 24 14:23:14 2004
diff --git a/debian/ocaml-compiler-libs.README.Debian b/debian/ocaml-compiler-libs.README.Debian
deleted file mode 100644 (file)
index 9a58fb0..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-ocaml for Debian
-----------------
-
-  Please note that the copyright of the compiler libs is QPL, not LGPL like
-  the rest of the standard library.  See the copyright file for details.
-
-  WARNING !!!
-
-  If you installed this package, and all of a sudden your bytecode program
-  stopped working, then you need to upgrade your ocaml library packages (the
-  libfoo-ocaml ones) to packages rebuilt using ocaml (>= 3.06-13). Normally
-  you should not have been able to upgrade ocaml to 3.06-13 or later if such
-  libraries are still installed on your system, but Bug#170825 in dpkg allowed
-  you to upgrade ocaml without checking that the virtual dependencies are
-  still provided. 
-
-  1) The ocaml package has been split into different binary packages :
-
-  o ocaml : contains the full ocaml suite
-  o ocaml-nox : the full suite except for the graphics(Tk) modules
-  o ocaml-base : contains the rutime stuff (ocamlrun + dlls + Tk)
-  o ocaml-base-nox : contains the rutime stuff (ocamlrun + dlls - Tk)
-
-  o ocaml-native-compilers : contains the native built part of the ocaml suite
-    (ocamlc.opt, ocamlopt.opt, ocamllex.opt, camlp4o.opt and camlp4r.opt)
-  o ocaml-compiler-libs : contains several modules used internally by
-    the ocaml compilers.  They are not needed for normal ocaml
-    development, but may be helpful in the development of certain
-    applications.
-  o ocaml-source : contains the full ocaml source for the (few) package which
-    need them at build time or for personal use (it should _not_ be used to
-    build ocam litself).
-
-  2) The caml include files are found under /usr/lib/ocaml/<ocaml_version>/caml.
-  A symlink is provided from /usr/include/caml for convenience. If
-  /usr/include/caml was previously a directory, for whatever reason, a warning
-  will be isued and the file moved to /usr/include/caml.bad. This can be
-  safely erased later on.
-
-  3) User installed stuff should not go under /usr/lib/ocaml/<ocaml_version>,
-  but rather under /usr/local/lib/ocaml/<ocaml_version>. 
-  I will take no responsability for people who break this rule and mess things
-  up.
-  
-  4) Starting from ocaml 3.05, ocaml now puts all dll.so files into a common
-  stublibs directory, so the ocaml-ldconf tool for handling the ld.conf
-  file is not needed anymore, but we will still keep it aroung until all
-  libraries are ported. ocaml-ldconf is now declared deprecated, and will
-  be removed in the near future, probably at the time of the ocaml 3.08
-  release, and outputs a warning in this sense when a package still using
-  it get installed.
-  Notice that user installed dll.so files should go into
-  /usr/local/lib/ocaml/<ocaml_version>/stublibs which is searched before
-  /usr/lib/ocaml/<ocaml_version>/stublibs.
-  The older method of using ocaml-ldconf is obsolet now.
-
- -- Mike Furr <mfurr@debian.org>, Thu Jun 24 14:23:14 2004
diff --git a/debian/ocaml-compiler-libs.postinst b/debian/ocaml-compiler-libs.postinst
new file mode 100644 (file)
index 0000000..8b1d7a2
--- /dev/null
@@ -0,0 +1,7 @@
+#!/bin/sh -e
+
+if [ "$1" = "configure" ]; then
+  ocaml-md5sums update
+fi
+
+#DEBHELPER#
diff --git a/debian/ocaml-compiler-libs.postrm b/debian/ocaml-compiler-libs.postrm
new file mode 100644 (file)
index 0000000..80fcec6
--- /dev/null
@@ -0,0 +1,7 @@
+#!/bin/sh -e
+
+if [ "$1" = "remove" ]; then
+  ocaml-md5sums update
+fi
+
+#DEBHELPER#
index 18c61db0b6b9d59cab4f9fbbf868866812030e12..2340095b26e13d93ad0c2a8254eed899495f0cea 100644 (file)
@@ -6,4 +6,8 @@ ln -sf ../ocaml-base-nox/Changes.gz /usr/share/doc/ocaml-nox
 ln -sf ../ocaml-base-nox/README.gz /usr/share/doc/ocaml-nox
 ln -sf ../ocaml-base-nox/ocaml_packaging_policy.gz /usr/share/doc/ocaml-nox
 
+if [ "$1" = "configure" ]; then
+  ocaml-md5sums update
+fi
+
 #DEBHELPER#
index 68856b1d40a8013a46a60776afce53209a1d49b2..3fec175a814dfa4065c53f2e1315db0d6e712243 100644 (file)
@@ -2,4 +2,8 @@
 
 rm -f /usr/include/caml
 
+if [ "$1" = "remove" ]; then
+  ocaml-md5sums update
+fi
+
 #DEBHELPER#
index 8c606d9b420f4ff04db076614de85bc4b8abfe09..68bd4406d79c98b8fd437f5dc85277b4e01d7cff 100644 (file)
@@ -3,5 +3,10 @@
 ln -sf ../ocaml-base-nox/Changes.gz /usr/share/doc/ocaml-base
 ln -sf ../ocaml-base-nox/README.gz /usr/share/doc/ocaml-base
 ln -sf ../ocaml-base-nox/ocaml_packaging_policy.gz /usr/share/doc/ocaml-base
+ln -sf ../ocaml-base-nox/README.Debian.gz /usr/share/doc/ocaml-base
+
+if [ "$1" = "configure" ]; then
+  ocaml-md5sums update
+fi
 
 #DEBHELPER#
diff --git a/debian/ocaml.postrm b/debian/ocaml.postrm
new file mode 100644 (file)
index 0000000..80fcec6
--- /dev/null
@@ -0,0 +1,7 @@
+#!/bin/sh -e
+
+if [ "$1" = "remove" ]; then
+  ocaml-md5sums update
+fi
+
+#DEBHELPER#
index 7856c9e7cbe9f9338d2cebf61c78c1137976c270..8d5ec6829aabbf6711e062a9f3797c9fa72291fd 100644 (file)
@@ -3,3 +3,4 @@ objinfo
 man-ocamlmklib
 asmcomp_amd64_emit.mlp
 fix_i386_gcc4_build
+ocaml-md5sums
diff --git a/debian/patches/ocaml-md5sums.dpatch b/debian/patches/ocaml-md5sums.dpatch
new file mode 100755 (executable)
index 0000000..f99a126
--- /dev/null
@@ -0,0 +1,409 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## ocaml-md5sums.dpatch by  <zack@debian.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: No description.
+
+@DPATCH@
+diff -urNad --exclude=CVS --exclude=.svn ./ocaml-md5sums/configure /tmp/dpep-work.aePevL/trunk/ocaml-md5sums/configure
+--- ./ocaml-md5sums/configure  1970-01-01 01:00:00.000000000 +0100
++++ /tmp/dpep-work.aePevL/trunk/ocaml-md5sums/configure        2005-07-09 19:21:30.979216376 +0200
+@@ -0,0 +1,12 @@
++#!/bin/sh
++DEFAULT="/var/lib/ocaml/3.08.3/md5sums"
++if [ -z "$1" ]; then
++  echo "No dir provided, using default: $DEFAULT"
++  echo "You can override it with: ./configure [ md5sums_dir ]"
++  MD5SUMS_DIR="$DEFAULT"
++else
++  MD5SUMS_DIR="$1"
++fi
++echo -n "Creating ocaml-md5sums.ml ... "
++sed "s:@MD5SUMS_DIR@:$MD5SUMS_DIR:" < ocaml-md5sums.ml.in > ocaml-md5sums.ml
++echo "done."
+diff -urNad --exclude=CVS --exclude=.svn ./ocaml-md5sums/feeding.sh /tmp/dpep-work.aePevL/trunk/ocaml-md5sums/feeding.sh
+--- ./ocaml-md5sums/feeding.sh 1970-01-01 01:00:00.000000000 +0100
++++ /tmp/dpep-work.aePevL/trunk/ocaml-md5sums/feeding.sh       2005-07-09 19:21:30.979216376 +0200
+@@ -0,0 +1,40 @@
++#!/bin/sh
++# Copyright (C) 2005, Stefano Zacchiroli <zack@debian.org>
++#
++# This is free software, you can redistribute it and/or modify it under the
++# terms of the GNU General Public License version 2 as published by the Free
++# Software Foundation.
++
++pkg="$1"
++stdlibdir="$2"
++version="$3"
++rootdir="$4"
++FIND_OBJ="find $rootdir -name *.cm[ao]"
++SORT="sort -k 2"
++if [ -x ./ocaml-md5sums.opt ]; then
++  OCAML_MD5SUMS="./ocaml-md5sums.opt"
++elif [ -x ./ocaml-md5sums ]; then
++  OCAML_MD5SUMS="./ocaml-md5sums"
++else
++  echo "Can't find ocaml-md5sums{.opt,}, aborting."
++  exit 2
++fi
++COMPUTE="./$OCAML_MD5SUMS compute --package $pkg-$version"
++if [ -z "$pkg" -o -z "$stdlibdir" -o -z "$version" -o -z "$rootdir" ]; then
++  echo "Usage: feeding.sh <pkg_name> <stdlib_dir> <ocaml_version> <root_dir>"
++  exit 1
++fi
++case "$pkg" in
++  ocaml-compiler-libs)
++    $FIND_OBJ | $COMPUTE | $SORT
++    ;;
++  *)
++    RUNTIME="`echo $pkg | sed 's/ocaml/ocaml-base/'`-$version"
++    $FIND_OBJ |
++      grep -v $stdlibdir/ocamldoc/ |
++      grep -v $stdlibdir/camlp4/ |
++      $COMPUTE --runtime $RUNTIME |
++      $SORT
++    ;;
++esac
++
+diff -urNad --exclude=CVS --exclude=.svn ./ocaml-md5sums/Makefile /tmp/dpep-work.aePevL/trunk/ocaml-md5sums/Makefile
+--- ./ocaml-md5sums/Makefile   1970-01-01 01:00:00.000000000 +0100
++++ /tmp/dpep-work.aePevL/trunk/ocaml-md5sums/Makefile 2005-07-09 19:21:30.979216376 +0200
+@@ -0,0 +1,30 @@
++
++DESTDIR = /usr/local/bin
++OFLAGS = -I ../otherlibs/unix -I ../otherlibs/str
++OCAMLC = ../ocamlc $(OFLAGS)
++OCAMLOPT = ../ocamlopt $(OFLAGS)
++OCAML_LIBS = unix str
++NAME = ocaml-md5sums
++BYTE = $(NAME)
++OPT = $(NAME).opt
++
++all: $(BYTE)
++opt: $(OPT)
++install:
++      if [ -x "$(OPT)" ]; then                                \
++              cp -a "$(OPT)" $(DESTDIR)/$(NAME);              \
++      elif [ -x "$(BYTE)" ]; then                             \
++              cp -a "$(BYTE)" $(DESTDIR)/$(NAME);             \
++      else                                                    \
++              echo "Nothing to be installed, aborting.";      \
++              exit 2;                                         \
++      fi
++
++$(BYTE): $(NAME).ml
++      $(OCAMLC) $(patsubst %,%.cma,$(OCAML_LIBS)) -o $@ $<
++$(OPT): $(NAME).ml
++      $(OCAMLOPT) $(patsubst %,%.cmxa,$(OCAML_LIBS)) -o $@ $<
++
++clean:
++      rm -f ocaml-md5sums ocaml-md5sums.opt *.cm[aiox] *.cmxa *.[ao]
++
+diff -urNad --exclude=CVS --exclude=.svn ./ocaml-md5sums/ocaml-md5sums.ml.in /tmp/dpep-work.aePevL/trunk/ocaml-md5sums/ocaml-md5sums.ml.in
+--- ./ocaml-md5sums/ocaml-md5sums.ml.in        1970-01-01 01:00:00.000000000 +0100
++++ /tmp/dpep-work.aePevL/trunk/ocaml-md5sums/ocaml-md5sums.ml.in      2005-07-09 19:21:39.420933040 +0200
+@@ -0,0 +1,304 @@
++(*
++ * ocaml-md5sums - use and maintain debian registry of ocaml md5sums
++ *
++ * Copyright (C) 2005, Stefano Zacchiroli <zack@debian.org>
++ *
++ * Created:        Wed, 06 Apr 2005 16:55:39 +0200 zack
++ * Last-Modified:  Sat, 09 Jul 2005 18:43:03 +0200 zack
++ *
++ * This is free software, you can redistribute it and/or modify it under the
++ * terms of the GNU General Public License version 2 as published by the Free
++ * Software Foundation.
++ *
++ * This program is distributed in the hope that it will be useful, but WITHOUT
++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
++ * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
++ * details.
++ *
++ * You should have received a copy of the GNU General Public License along with
++ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
++ * Place, Suite 330, Boston, MA  02111-1307  USA
++ *)
++
++open Printf
++
++(** {2 Constants} *)
++
++let ocamlobjinfo = "/usr/bin/ocamlobjinfo"
++let md5sums_dir = "@MD5SUMS_DIR@"
++let md5sums_index = "MD5SUMS"
++let md5sums_ext = ".md5sums"
++let registry_file = sprintf "%s/%s" md5sums_dir md5sums_index
++
++(** {2 Regular expressions, for parsing purposes} *)
++
++let unit_name_line_RE =
++  Str.regexp "^[ \t]*Unit[ \t]+name[ \t]*:[ \t]*\\([a-zA-Z0-9_]+\\)[ \t]*$"
++let md5sum_line_RE =
++  Str.regexp "^[ \t]*\\([a-f0-9]+\\)[ \t]+\\([a-zA-Z0-9_]+\\)[ \t]*$"
++let blanks_RE = Str.regexp "[ \t]+"
++let ignorable_line_RE = Str.regexp "^[ \t]*\\(#.*\\)?"
++let md5sums_ext_RE = Str.regexp (sprintf "^.*%s$" (Str.quote md5sums_ext))
++
++(** {2 Argument parsing} *)
++
++let objects = ref []
++let dev_dep = ref ""
++let runtime_dep = ref "-"
++let dep_version = ref "-"
++let verbosity = ref 0
++let dump_info_to = ref ""
++let load_info_from = ref ""
++let action = ref None
++
++let usage_msg =
++  "Use and maintain system wide ocaml md5sums registry\n"
++  ^ "Usage:\n"
++  ^ " ocaml-md5sum compute --package <name> [option ...] file ...\n"
++  ^ " ocaml-md5sum dep     [option ...] file ...\n"
++  ^ " ocaml-md5sum update  [option ...]\n"
++  ^ "Options:"
++let cmdline_spec = [
++  "--package", Arg.Set_string dev_dep,
++    "set package name for development dependency";
++  "--runtime", Arg.Set_string runtime_dep,
++    "set package name for runtime dependency";
++  "--version", Arg.Set_string dep_version,
++    "set package version for dependencies";
++  "--dump-info", Arg.Set_string dump_info_to,
++    "dump ocamlobjinfo to file";
++  "--load-info", Arg.Set_string load_info_from,
++    "restore ocamlobjinfo from file";
++  "-v", Arg.Unit (fun () -> incr verbosity), "increase verbosity";
++]
++let die_usage () =
++  Arg.usage cmdline_spec usage_msg;
++  exit 1
++
++(** {2 Helpers} *)
++
++let error   msg = prerr_endline ("Error: " ^ msg); exit 2
++let warning msg = prerr_endline ("Warning: " ^ msg)
++let info ?(level = 1) msg =
++  if !verbosity >= level then prerr_endline ("Info: " ^ msg)
++let iter_in f ic =
++  try while true do f (input_line ic) done with End_of_file -> ()
++let iter_file f fname =
++  let ic = open_in fname in
++  iter_in f ic;
++  close_in ic
++let iter_table f = iter_file (fun line -> f (Str.split blanks_RE line))
++
++module Strings = Set.Make (String)
++
++(** read until the end of standard input
++ * @return the list of lines read from stdin, without trailing "\n" *)
++let read_stdin () =
++  let lines = ref [] in
++  iter_in (fun s -> lines := s :: !lines) stdin;
++  List.rev !lines
++
++let is_empty fname = (Unix.stat fname).Unix.st_size = 0
++
++(** {2 Auxiliary functions} *)
++
++(** loads info previously stored in a file using --dump-info and stores them in
++ * two hashtables
++ * @param defined hashtable for md5sums of defined units
++ * @param imported hashtable for md5sums of imported units
++ * @param fname file where the dump has been saved *)
++let load_info ~defined ~imported fname =
++  info ("loading ocamlobjinfo information from " ^ fname);
++  let lineno = ref 0 in
++  iter_table
++    (fun fields ->
++      incr lineno;
++      match fields with
++      | [ "defined"; md5; unit_name ] ->
++          info ~level:2 (String.concat " " fields);
++          Hashtbl.replace defined unit_name md5
++      | [ "imported"; md5; unit_name ] ->
++          info ~level:2 (String.concat " " fields);
++          Hashtbl.replace imported unit_name md5
++      | _ ->
++          warning (sprintf "ignoring dump entry (%s, line %d)" fname !lineno))
++    fname
++
++(** dumps ocamlobjinfo to file
++ * @param defined hashtable containing md5sums of defined units
++ * @param imported hashtable containing md5sums of imported units
++ * @param fname file where to dump ocamlobjinfo *)
++let dump_info ~defined ~imported fname =
++  info ("dumping ocamlobjinfo information to " ^ fname);
++  let oc = open_out fname in
++  Hashtbl.iter
++    (fun unit_name md5sum -> fprintf oc "defined  %s %s\n" md5sum unit_name)
++    defined;
++  Hashtbl.iter
++    (fun unit_name md5sum -> fprintf oc "imported %s %s\n" md5sum unit_name)
++    imported;
++  close_out oc
++
++(** @param fnames list of *.cm[ao] file names
++ * @return a pair of hash tables <defined_units, imported_units>. Both tables
++ * contains mappings <unit_name, md5sum>. defined_units lists units defined in
++ * given files while imported_units imported ones *)
++let unit_info fnames =
++  let (defined, imported) = (Hashtbl.create 1024, Hashtbl.create 1024) in
++  if !load_info_from <> "" then
++    load_info ~defined ~imported !load_info_from;
++  List.iter
++    (fun fname ->
++      info ("getting unit info from " ^ fname);
++      let current_unit = ref "" in
++      let ic = Unix.open_process_in (sprintf "%s %s" ocamlobjinfo fname) in
++      iter_in
++        (fun line ->
++          if Str.string_match unit_name_line_RE line 0 then
++            current_unit := Str.matched_group 1 line
++          else if Str.string_match md5sum_line_RE line 0 then
++            let md5sum = Str.matched_group 1 line in
++            let unit_name = Str.matched_group 2 line in
++            if unit_name = !current_unit then begin (* defined unit *)
++              let dump_entry = sprintf "defined %s %s" md5sum unit_name in
++              info ~level:2 dump_entry;
++              Hashtbl.replace defined unit_name md5sum
++            end else begin  (* imported unit *)
++              let dump_entry = sprintf "imported %s %s" md5sum unit_name in
++              info ~level:2 dump_entry;
++              Hashtbl.replace imported unit_name md5sum
++            end)
++        ic;
++      close_in ic)
++    fnames;
++  Hashtbl.iter  (* imported := imported - defined *)
++    (fun unit_name _ -> Hashtbl.remove imported unit_name)
++    defined;
++  if !dump_info_to <> "" then
++    dump_info ~defined ~imported !dump_info_to;
++  (defined, imported)
++
++(** pretty print a registry entry sending output to an output channel *)
++let pp_entry outchan ~md5sum ~unit_name ~dev_dep ~runtime_dep ~dep_version =
++  fprintf outchan "%s %s %s %s %s\n"
++    md5sum unit_name dev_dep runtime_dep dep_version
++
++(** iter a function over the entries of a registry file
++ * @param f function to be executed for each entries, it takes 4 labeled
++ * arguments: ~md5sum ~unit_name ~package ?version
++ * @param fname file containining the registry *)
++let iter_registry f fname =
++  info ("processing registry " ^ fname);
++  let lineno = ref 0 in
++  iter_file
++    (fun line ->
++      incr lineno;
++      (match Str.split blanks_RE line with
++      | [ md5sum; unit_name; dev_dep; runtime_dep; dep_version ] ->
++          f ~md5sum ~unit_name ~dev_dep ~runtime_dep ~dep_version
++      | _ when Str.string_match ignorable_line_RE line 0 -> ()
++      | _ ->
++          warning (sprintf "ignoring registry entry (%s, line %d)"
++            fname !lineno)))
++    fname
++
++(** @param fname file name of the registry file, if fname does not exists an
++ * empty registry will be returned
++ * @return an hashtbl mapping pairs <unit_name, md5sum> to pairs <package_name,
++ * version_info>. E.g. ("Foo_bar", "74be7fa4320ebd9415f1c7cfc04c2d7b") ->
++ * ("libfoo-ocaml-dev", ">= 1.2.3-4") *)
++let parse_registry fname =
++  let registry = Hashtbl.create 1024 in
++  if Sys.file_exists fname then
++    iter_registry
++      (fun ~md5sum ~unit_name ~dev_dep ~runtime_dep ~dep_version ->
++        Hashtbl.replace registry (unit_name, md5sum)
++          (dev_dep, runtime_dep, dep_version))
++      fname;
++  registry
++
++(** {2 Main functions, one for each command line action} *)
++
++(** compute registry entry for a set of ocaml objects *)
++let compute dev_dep runtime_dep dep_version objects () =
++  let defined, _ = unit_info objects in
++  Hashtbl.iter
++    (fun unit_name md5sum ->
++       pp_entry stdout ~md5sum ~unit_name ~dev_dep ~runtime_dep ~dep_version)
++    defined
++
++(** compute package dependencies for a set of ocaml objects *)
++let dep objects () =
++  let _, imported = unit_info objects in
++  let registry = parse_registry registry_file in
++  let deps =
++    Hashtbl.fold
++      (fun unit_name md5sum deps ->
++        try
++          let (dev_dep, runtime_dep, dep_version) =
++            Hashtbl.find registry (unit_name, md5sum)
++          in
++          Strings.add (sprintf "%s %s %s" dev_dep runtime_dep dep_version) deps
++        with Not_found -> deps)
++      imported
++      Strings.empty
++  in
++  Strings.iter print_endline deps
++
++(** update debian registry of ocaml md5sums *)
++let update () =
++  info (sprintf "updating registry %s using info from %s/"
++    registry_file md5sums_dir);
++  let keys = Hashtbl.create 1024 in (* history of seen registry keys *)
++  let dir = Unix.opendir md5sums_dir in
++  let registry = open_out registry_file in
++  try
++    while true do
++      let fname = sprintf "%s/%s" md5sums_dir (Unix.readdir dir) in
++      if (Str.string_match md5sums_ext_RE fname 0)
++        && ((Unix.stat fname).Unix.st_kind = Unix.S_REG)
++      then
++        iter_registry
++          (fun ~md5sum ~unit_name ~dev_dep ~runtime_dep ~dep_version ->
++             if Hashtbl.mem keys (unit_name, md5sum) then
++               error (sprintf "duplicate entry %s %s in registry" unit_name
++                          md5sum);
++             Hashtbl.replace keys (unit_name, md5sum) ();
++             pp_entry registry ~md5sum ~unit_name ~dev_dep ~runtime_dep
++               ~dep_version)
++          fname
++    done
++  with End_of_file ->
++    Unix.closedir dir;
++    close_out registry;
++    if is_empty registry_file then Sys.remove registry_file
++
++(** {2 Main} *)
++
++(** main *)
++let main () =
++  Arg.parse cmdline_spec
++    (fun s ->
++      if !action = None then
++        action := Some s
++      else
++        objects := s :: !objects)
++    usage_msg;
++  match !action with
++  | Some "update" -> update ()
++  | Some action ->
++      let objects =
++        match !objects with
++        | [] when !load_info_from = "" -> read_stdin ()
++        | objects -> List.rev objects
++      in
++      (match action with
++      | "compute" ->
++          if !dev_dep = "" then die_usage ();
++          compute !dev_dep !runtime_dep !dep_version objects ()
++      | "dep" -> dep objects ()
++      | _ -> die_usage ())
++  | None -> die_usage ()
++
++let _ = Unix.handle_unix_error main ()
++
index 616a24770d58fd06d10a970e7ad23245d6dcf9b7..606b701a3e17f97e88e821b93c73485514e76c43 100755 (executable)
@@ -9,6 +9,8 @@
 include /usr/share/dpatch/dpatch.make
 PACKAGE = ocaml
 VERSION = 3.08.3
+STDLIBDIR = /usr/lib/ocaml/$(VERSION)
+MD5SUMSDIR = /var/lib/ocaml/md5sums
 
 # Uncomment this to turn on verbose mode.
 #export DH_VERBOSE=1
@@ -49,6 +51,7 @@ config-stamp: configure
                echo "Aborting.";                                       \
                exit 1;                                                 \
        fi
+       (cd ocaml-md5sums/ && chmod +x configure && ./configure $(MD5SUMSDIR))
        touch config-stamp
 
 
@@ -68,6 +71,11 @@ build-arch-stamp: patch-stamp config-stamp
                $(MAKE) opt opt.opt;                                    \
                touch opt-built-stamp;                                  \
        fi
+       if [ -x ./ocamlopt ]; then                                      \
+               $(MAKE) -C ocaml-md5sums/ opt;                          \
+       else                                                            \
+               $(MAKE) -C ocaml-md5sums/ all;                          \
+       fi
        touch build-arch-stamp
 
 build-indep: build-indep-stamp
@@ -88,11 +96,12 @@ clean: unpatch
                mv boot.debian boot;    \
        fi
        -$(MAKE) -C emacs clean
+       -$(MAKE) -C ocaml-md5sums/ distclean
 ifneq "$(wildcard /usr/share/misc/config.sub)" ""
-       cp -f /usr/share/misc/config.sub config/gnu/config.sub
+       -cp -f /usr/share/misc/config.sub config/gnu/config.sub
 endif
 ifneq "$(wildcard /usr/share/misc/config.guess)" ""
-       cp -f /usr/share/misc/config.guess config/gnu/config.guess
+       -cp -f /usr/share/misc/config.guess config/gnu/config.guess
 endif
        
        dh_clean debian/README.labltk camlp4/config/Makefile.cnf camlp4/config/Makefile config/m.h config/s.h config/Makefile
@@ -182,6 +191,17 @@ install-arch:
                        $(CURDIR)/debian/ocaml-compiler-libs/usr/lib/ocaml/$(VERSION)/compiler-libs; \
        fi
 
+       # install ocaml-md5sums
+       $(MAKE) -C ocaml-md5sums/ install DESTDIR=$(CURDIR)/debian/ocaml-base-nox/usr/bin
+
+       # compute core entries of the ocaml md5sums registry and install them
+       (cd ocaml-md5sums/ &&                                                                   \
+        chmod +x feeding.sh &&                                                                 \
+        for pkg in ocaml-nox ocaml ocaml-compiler-libs; do                                     \
+               mkdir -p ../debian/$$pkg$(MD5SUMSDIR);                                          \
+               ./feeding.sh $$pkg $(STDLIBDIR) $(VERSION) ../debian/$$pkg$(STDLIBDIR)/ >       \
+                       ../debian/$$pkg$(MD5SUMSDIR)/$$pkg.md5sums;                             \
+        done)
 
        dh_install -a
 
diff --git a/debian/svn-deblayout b/debian/svn-deblayout
new file mode 100644 (file)
index 0000000..f7696e3
--- /dev/null
@@ -0,0 +1,3 @@
+origDir=../upstream
+origUrl=svn+ssh://svn.debian.org/svn/pkg-ocaml-maint/trunk/packages/ocaml/upstream
+tagsUrl=svn+ssh://svn.debian.org/svn/pkg-ocaml-maint/tags/packages/ocaml