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

Sylvain Le Gall gildor at debian.org
Sun Jul 19 18:05:02 UTC 2009


The following commit has been merged in the master branch:
commit 2c80f72955bb02ae9203599810c5a6e11c5e5ea6
Author: Sylvain Le Gall <gildor at debian.org>
Date:   Sun Jul 19 18:04:05 2009 +0000

    Take into account .cmx and .cmxa in ocaml-md5sums.

diff --git a/ocaml-md5sums/ocaml-md5sums b/ocaml-md5sums/ocaml-md5sums
index 735447b..74c55fc 100755
--- a/ocaml-md5sums/ocaml-md5sums
+++ b/ocaml-md5sums/ocaml-md5sums
@@ -43,8 +43,10 @@ sub new
 sub add_unit 
 {
   my ($self, $symbol_table, $unit_name, $md5) = @_;
-  main::debug "Adding unit $unit_name";
-  $self->{$symbol_table}{"$md5+$unit_name"} = 1;
+  my $key = "$md5+$unit_name";
+  main::debug "Adding unit $unit_name to $symbol_table" 
+    unless exists $self->{$symbol_table}{$key};
+  $self->{$symbol_table}{$key} = 1;
 };
 
 sub get_unit
@@ -61,8 +63,11 @@ sub squeeze_imported
   main::debug "Squeezing imported symbol";
   foreach (keys(%{$self->{"defined"}}))
   {
-    delete($self->{imported}{$_}) 
-      if exists($self->{imported}{$_});
+    if (exists($self->{imported}{$_}))
+    {
+      delete($self->{imported}{$_});
+      main::debug("Removing internal interface $_ from imported");
+    };
   };
 };
 
@@ -73,22 +78,52 @@ sub add_object
   my $interface = undef;
   my $symbol_table = undef;
 
-  main::info "Execute ocamlobjinfo $obj_file";
-  foreach (`ocamlobjinfo $obj_file`)
+  if ($obj_file =~ /.*\.(cmi|cmo|cma)/)
   {
-    chomp $_;
-    main::debug "Input line: $_";
-    if (/^\s*(Unit|Module) name: (\S+)$/)
+    main::info "Execute ocamlobjinfo $obj_file";
+    foreach (`ocamlobjinfo $obj_file`)
     {
-      $interface = $2;
-      main::debug "Interface: $interface";
+      chomp $_;
+      main::debug "Input line: $_";
+      if (/^\s*(Unit|Module) name: (\S+)$/)
+      {
+        $interface = $2;
+        main::debug "Interface: $interface";
+      }
+      elsif (/^\s*([a-fA-F0-9]+)\s+(\S+)$/)
+      {
+        $symbol_table = "imported";
+        $symbol_table = "defined" if defined($interface) && ($interface eq $2);
+        $self->add_unit($symbol_table, $2, $1);
+      };
     };
-    if (/^\s*([a-fA-F0-9]+)\s+(\S+)$/)
+  }
+  elsif ($obj_file =~ /.*\.(cmx|cmxa)/)
+  {
+    main::info "Execute ocamldumpapprox $obj_file";
+    my $interface;
+    foreach (`ocamldumpapprox $obj_file`)
     {
-      $symbol_table = "imported";
-      $symbol_table = "defined" if defined($interface) && ($interface eq $2);
-      $self->add_unit($symbol_table, $2, $1);
+      chomp $_;
+      main::debug "Input line: $_";
+      if (/^Name:\s*(\S+)/)
+      {
+        $interface = $1;
+        main::debug "Interface: $interface";
+      }
+      elsif (/^CRC of implementation:\s+([a-fA-F0-9]+)/)
+      {
+        $self->add_unit("defined", $interface, $1);
+      }
+      elsif (/^\s*(\S+)\s+\(([a-fA-F0-9]+)\)/)
+      {
+        $self->add_unit("imported", $1, $2);
+      };
     };
+  }
+  else
+  {
+    die "Don't know how to process $obj_file";
   };
 
   $self->squeeze_imported();
@@ -100,6 +135,7 @@ sub read_dump
   
   my $symbol_table = undef;
 
+  main::info "Load from dump $file";
   open(FH, $file) || die "Cannot open file $file";
   foreach (<FH>)
   {
@@ -174,6 +210,7 @@ sub load_assign
 sub load 
 {
   my ($self, $file) = @_;
+  main::debug "Load $file";
   open(FH, "<", $file) || die "Cannot open file $file";
   foreach (<FH>)
   {
@@ -212,7 +249,7 @@ use Digest::MD5 qw/md5_hex/;
 sub dump_provides
 {
   my ($self, $file) = @_;
-  my $hex = md5_hex(join("",keys(%{$self->{"defined"}})));
+  my $hex = md5_hex(join("",sort keys(%{$self->{"defined"}})));
   my $sig = hex(substr($hex, 0, 6));
   my $fact;
   my @fact_print;

-- 
dh-ocaml packaging



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