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

Sylvain Le Gall gildor at debian.org
Tue Jul 21 14:42:52 UTC 2009


The following commit has been merged in the master branch:
commit 2649f1ef6f714c64f18edd8ba30e5838644ee740
Author: Sylvain Le Gall <gildor at debian.org>
Date:   Mon Jul 20 23:10:35 2009 +0000

    Manage .cmxs in ocaml-md5sums.
    
    Use ocamlplugininfo to dump .cmxs information. Take into account unit
    defined in self when computing depends.

diff --git a/ocaml-md5sums/ocaml-md5sums b/ocaml-md5sums/ocaml-md5sums
index e8fb166..a63785f 100755
--- a/ocaml-md5sums/ocaml-md5sums
+++ b/ocaml-md5sums/ocaml-md5sums
@@ -10,6 +10,10 @@ my $ocamlobjinfo=$ENV{OCAMLOBJINFO};
 $ocamlobjinfo="ocamlobjinfo" unless defined($ocamlobjinfo);
 my $ocamldumpapprox=$ENV{OCAMLDUMPAPPROX};
 $ocamldumpapprox="ocamldumpapprox" unless defined($ocamldumpapprox);
+my $ocamlbyteinfo=$ENV{OCAMLBYTEINFO};
+$ocamlbyteinfo="ocamlbyteinfo" unless defined($ocamlbyteinfo);
+my $ocamlplugininfo=$ENV{OCAMLPLUGININFO};
+$ocamlplugininfo="ocamlplugininfo" unless defined($ocamlplugininfo);
 
 use constant VERSION => "0.1";
 
@@ -116,11 +120,13 @@ sub add_object
       };
     };
   }
-  elsif ($obj_file =~ /.*\.(cmx|cmxa)/)
+  elsif ($obj_file =~ /.*\.(cmx|cmxa|cmxs)$/)
   {
-    main::info "Execute $ocamldumpapprox $obj_file";
+    my $command = $ocamldumpapprox;
+    $command = $ocamlplugininfo if $1 eq "cmxs";
+    main::info "Execute $command $obj_file";
     my $interface;
-    foreach (`$ocamldumpapprox $obj_file`)
+    foreach (`$command $obj_file`)
     {
       chomp $_;
       main::debug "Input line: $_";
@@ -141,7 +147,17 @@ sub add_object
   }
   else
   {
-    die "Don't know how to process $obj_file";
+    main::info "Execute $ocamlbyteinfo $obj_file";
+    my $processed = 0;
+    foreach (`$ocamlbyteinfo $obj_file`)
+    {
+      $processed = 1;
+      if (/UNIT ([A-Fa-f0-9]+) (\S+)/)
+      {
+        $self->add_unit("imported", $2, $1);
+      };
+    };
+    die "Don't know how to process $obj_file\n" unless $processed;
   };
 
   $self->squeeze_imported();
@@ -276,37 +292,39 @@ sub add_depends
 {
   my ($self, $other) = @_;
 
-  if ($other->{dev} ne $self->{dev})
-  {
-    my $already_depends = 0;
+  my $already_depends = 0;
 
-    # Compute depends
-    foreach (keys(%{$self->{imported}}))
+  # Compute depends
+  foreach (keys(%{$self->{imported}}))
+  {
+    if (exists $other->{"defined"}{$_})
     {
-      if (exists $other->{"defined"}{$_})
+      if ($other->{dev} ne $self->{dev})
       {
+        my ($unit_name, $md5) = $self->get_unit("imported", $_);
         if (!$already_depends)
         {
+          main::info($self->to_string()." depends on ".
+            $other->to_string()." through ".$unit_name);
           push(@{$self->{depends}}, $other);
         };
         $already_depends = 1;
         if ($self->{imported}{$_} ne "none")
         {
-          my ($unit_name,$md5) = $self->get_unit("imported", $_);
           warn "Unit $unit_name already defined in ".
                $self->{imported}{$_}.
                " and defined again in ".
                $other->to_string().
                "\n";
-        }
-        else
-        {
-          $self->{imported}{$_} = $other->to_string();
         };
       };
+      $self->{imported}{$_} = $other->to_string();
     };
+  };
 
-    # Check duplicate export
+  # Check duplicate export
+  if ($self->{dev} ne $other->{dev})
+  {
     foreach (keys(%{$self->{"defined"}}))
     {
       my ($unit_name) = $self->get_unit("defined", $_);
@@ -317,10 +335,6 @@ sub add_depends
           "\n"
         if exists $other->{"defined"}{$_};
     };
-  }
-  else
-  {
-    main::info "Skip ".$other->to_string();
   };
 };
 

-- 
dh-ocaml packaging



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