[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:38 UTC 2009


The following commit has been merged in the master branch:
commit 0c25b622605b0980b38c67df87f0b0f0142097d2
Author: Sylvain Le Gall <gildor at debian.org>
Date:   Mon Jul 20 14:12:23 2009 +0200

    Error if package re-export unit in ocaml-md5sums.

diff --git a/ocaml-md5sums/ocaml-md5sums b/ocaml-md5sums/ocaml-md5sums
index 9a79f27..77af9a9 100755
--- a/ocaml-md5sums/ocaml-md5sums
+++ b/ocaml-md5sums/ocaml-md5sums
@@ -141,8 +141,15 @@ sub read_dump
   open(FH, $file) || die "Cannot open file $file";
   foreach (<FH>)
   {
-    my ($symbol_table,$md5,$unit_name) = split /\s+/;
-    $self->add_unit($symbol_table, $unit_name, $md5);
+    if (/(dev|runtime|version)\s+(\S+)/)
+    {
+      $self->{$1} = $2;
+    }
+    else
+    {
+      my ($symbol_table,$md5,$unit_name) = split /\s+/;
+      $self->add_unit($symbol_table, $unit_name, $md5);
+    };
   };
   close(FH) || die "Cannot close file $file";
   $self->squeeze_imported();
@@ -155,6 +162,9 @@ sub write_dump
 
   open(FH,">", $file) || die "Cannot open file $file";
   
+  print FH "dev $self->{dev}\n";
+  print FH "runtime $self->{runtime}\n";
+  print FH "version $self->{version}\n";
   foreach my $symbol_table ("imported", "defined")
   {
     my $symbol_table_print = $symbol_table;
@@ -250,33 +260,52 @@ sub add_depends
 {
   my ($self, $other) = @_;
 
-  my $already_depends = 0;
-  foreach (keys(%{$self->{imported}}))
+  if ($other->{dev} ne $self->{dev})
   {
-    if (exists $other->{"defined"}{$_})
+    my $already_depends = 0;
+
+    # Compute depends
+    foreach (keys(%{$self->{imported}}))
     {
-      if (!$already_depends)
+      if (exists $other->{"defined"}{$_})
       {
-        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();
+        if (!$already_depends)
+        {
+          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();
+        };
       };
     };
-  };
 
-  return 0;
+    # Check duplicate export
+    foreach (keys(%{$self->{"defined"}}))
+    {
+      my ($unit_name) = $self->get_unit("defined", $_);
+      die "Error: unit $unit_name exported in ".
+          $self->to_string().
+          " but already exported by ".
+          $other->to_string().
+          "\n"
+        if exists $other->{"defined"}{$_};
+    };
+  }
+  else
+  {
+    main::info "Skip ".$other->to_string();
+  };
 };
 
 sub print_depends
@@ -299,6 +328,11 @@ sub print_depends
   };
 };
 
+sub check_exported
+{
+  my ($self, $other) = @_;
+};
+
 use Digest::MD5 qw/md5_hex/;
 
 sub dump_provides
@@ -384,7 +418,7 @@ if ($print_version)
 
 die "No action\n" unless defined($action);
 
-if ($action eq "compute" || $action eq "dep") 
+if ($action eq "compute" || $action eq "dep" || $action eq "check") 
 {
   my $md5sums = 
     OCamlMD5Sums::File->new 
@@ -398,13 +432,14 @@ if ($action eq "compute" || $action eq "dep")
     $md5sums->add_object($_);
   };
 
+  die "No dev. package defined" unless defined($md5sums->{dev});
+
   if ($action eq "compute")
   {
-    die "No dev. package defined" unless defined($package_dev);
     $md5sums->write_dump($dump_info_fn) if defined($dump_info_fn);
     $md5sums->print();
   }
-  else # dep
+  else # dep 
   {
     foreach my $md5sums_dir (@md5sums_dirs)
     {
@@ -441,9 +476,8 @@ ocaml-md5sum - Use and maintain ocaml md5sums registry files
 
 =head1 SYNOPSIS
 
-ocaml-md5sum compute --package <name> [option ...] file ...
-ocaml-md5sum dep     [option ...] file ...
-ocaml-md5sum update  [option ...]
+ocaml-md5sum (compute|dep) --package <name> [option ...] file ...
+ocaml-md5sum update [option ...]
 
 =head1 OPTIONS
 

-- 
dh-ocaml packaging



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