[Pkg-ocaml-maint-commits] [SCM] dh-ocaml packaging branch, master, updated. debian/0.5.0-51-gba85137

Sylvain Le Gall gildor at debian.org
Mon Jul 27 22:11:28 UTC 2009


The following commit has been merged in the master branch:
commit 4eeb505b1bae6b25426cef2ad1599bab71c845aa
Author: Sylvain Le Gall <gildor at debian.org>
Date:   Mon Jul 27 16:16:51 2009 +0000

    Add test for ocaml-md5sums.

diff --git a/debhelper/test/Makefile b/debhelper/test/Makefile
new file mode 100644
index 0000000..5a89606
--- /dev/null
+++ b/debhelper/test/Makefile
@@ -0,0 +1,53 @@
+
+ALL_PKG:=$(shell find `ocamlc -where` /usr/lib/ocsigen \
+  -name "*.cma" -o -name "*.cmo" -o -name "*.cmi" -o -name "*.cmxa" -o -name "*.cmx" -o -name "*.cmxs" | \
+  xargs dpkg -S | cut -f 1-1 -d: | sort -u | \
+  grep -v -E "(ocaml-base-nox|camlp4-extra|ocaml-interp|ocsigen$$)")
+
+OCAML_MD5SUMS=../../ocaml-md5sums --md5sums-dir ./
+
+all: $(foreach ext,.md5sums .dump .provides .dep,$(addsuffix $(ext),$(ALL_PKG))) 
+
+clean:
+	-$(RM) *.md5sums
+	-$(RM) *.dump
+	-$(RM) *.provides
+	-$(RM) *.dep
+
+ALL_SUFFIX=.md5sums .dump .provides .dep
+
+$(addprefix libfileutils-ocaml-dev,$(ALL_SUFFIX)): FLAGS=\
+  --nodefined Unix --nodefined UnixLabels --nodefined Str
+$(addprefix libvorbis-ocaml-dev,$(ALL_SUFFIX)): FLAGS=\
+  --nodefined Unix --nodefined UnixLabels --nodefined Str
+$(addprefix libmad-ocaml-dev,$(ALL_SUFFIX)): FLAGS=\
+  --nodefined Unix --nodefined UnixLabels
+$(addprefix libcothreads-ocaml-dev,$(ALL_SUFFIX)): FLAGS=\
+  --nodefined Thread --nodefined ThreadUnix --nodefined Event \
+  --nodefined Condition --nodefined Mutex
+$(addprefix ocsigen-dev,$(ALL_SUFFIX)): RUNTIME=ocsigen
+
+ocaml-nox.md5sums ocaml-nox.dump ocaml-nox.provides:
+	version=$$(apt-cache show ocaml-nox | sed -n "s/Version: //p" | head -n1); \
+	dpkg -L ocaml-nox ocaml-base-nox | grep -E '.*\.cm[iaox][as]?$$' | \
+    	$(OCAML_MD5SUMS) compute \
+	--package ocaml-nox --runtime ocaml-base-nox --version $$version \
+	--dump-info ocaml-nox.dump --dump-provides ocaml-nox.provides \
+	$(FLAGS) | sort > ocaml-nox.md5sums;
+	sort -o ocaml-nox.dump ocaml-nox.dump
+
+FILES=$(shell dpkg -L $1 | grep -E '.*\.cm[aox][as]?$$')
+
+%.md5sums %.dump %.provides:
+	version=$$(apt-cache show $* | sed -n "s/Version: //p" | head -n1); \
+    	$(OCAML_MD5SUMS) compute \
+	  --package $* \
+	  $(if $(RUNTIME),--runtime $(RUNTIME)) \
+	  --version $$version \
+	  --dump-info $*.dump --dump-provides $*.provides \
+	  $(FLAGS) $(call FILES,$(EXTRA_PKG) $(RUNTIME) $*) > $*.md5sums;
+
+%.dep: %.dump $(addsuffix .md5sums,$(ALL_PKG))
+	$(OCAML_MD5SUMS) dep --load-info $< | sort > $@
+
+
diff --git a/debhelper/test/compare-deps.pl b/debhelper/test/compare-deps.pl
new file mode 100755
index 0000000..29d6ea6
--- /dev/null
+++ b/debhelper/test/compare-deps.pl
@@ -0,0 +1,79 @@
+#!/usr/bin/perl 
+
+# compare-deps.pl: 
+# Copyright (C) 2009 Sylvain Le Gall <gildor at debian.org>
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2, or (at
+# your option) any later version.
+#
+# 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., 51 Franklin St, Fifth Floor, Boston,
+# MA 02110-1301, USA.
+
+use strict;
+use warnings;
+
+my $pkg_list = "/var/lib/apt/lists/ftp.debian.org_debian_dists_unstable_main_binary-i386_Packages";
+my $pkgname;
+
+foreach (`grep-dctrl -F Package -e "lib.*-ocaml-dev" -s Package,Depends $pkg_list`) 
+{
+  if (/Package: (.*)/)
+  {
+    $pkgname = $1;
+  }
+  elsif (/Depends: (.*)/)
+  {
+    # Extract real dependencies
+    my %ocamldeps_real;
+    foreach (split /\s*,\s*/)
+    {
+      if (/(\S*ocaml\S*)/)
+      {
+        if ($1 =~ /(ocaml-findlib|lib.*-ocaml)$/)
+        {
+        }
+        elsif ($1 =~ /ocaml(-base)?-nox/)
+        {
+          $ocamldeps_real{"ocaml-nox"} = 1;
+        }
+        else
+        {
+          $ocamldeps_real{$1} = 1;
+        }
+      };
+    };
+
+    # Extract computed dependencies
+    my %ocamldeps_computed;
+    open(FH,"<","$pkgname.dep") || warn "Cannot open $pkgname.dep";
+    foreach(<FH>)
+    {
+      if (/(\S+)/)
+      {
+        $ocamldeps_computed{$1} = 1 unless ($1 =~ /(lib.*-ocaml$|fileutils|mad|vorbis|ocaml-base-nox|cothreads)/);
+      };
+    };
+
+    # Diff 
+    foreach (keys %ocamldeps_real)
+    {
+      if (exists $ocamldeps_computed{$_})
+      {
+        delete($ocamldeps_real{$_});
+        delete($ocamldeps_computed{$_});
+      };
+    };
+
+    # Print difference
+    my @diff = ((map { "-$_" } keys(%ocamldeps_real)), (map { "+$_" } keys(%ocamldeps_computed)));
+    print (join (" ", "$pkgname:", @diff), "\n") if @diff > 0;
+  };
+};

-- 
dh-ocaml packaging



More information about the Pkg-ocaml-maint-commits mailing list