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


The following commit has been merged in the master branch:
commit ba8513719e90ead8c72ae5f0fb7479809b75f141
Author: Sylvain Le Gall <gildor at debian.org>
Date:   Mon Jul 27 21:56:34 2009 +0000

    Better error reporting for debhelper suite.
    
    * Use W: and E: in front of warning and error.
    * Report consistent error when failing due to missing
      directory of dh_ocaml

diff --git a/debhelper/dh_ocaml b/debhelper/dh_ocaml
index 99d526e..0996a00 100755
--- a/debhelper/dh_ocaml
+++ b/debhelper/dh_ocaml
@@ -7,7 +7,7 @@
 # Copyright © 2005-2006 Stefano Zacchiroli <zack at debian.org>
 #                       Samuel Mimram <smimram at debian.org>
 # Copyright © 2009      Mehdi Dogguy <mehdi at dogguy.org>
-#                       Sylvian Le Gall <gildor at debian.org>
+#                       Sylvain Le Gall <gildor at debian.org>
 #
 # Created:        Fri, 01 Apr 2005 19:50:48 +0200 zack
 #
@@ -337,26 +337,33 @@ foreach my $package (keys(%dev_packages), @binary_packages)
 
     open(OLIST, ">", $olist_fn) unless $dh{NO_ACT};
     # Search for OCaml bytecode binaries
-    {
-      find
-        sub {
-          (-f $_ && -x $_)
-          &&
-          !excludefile($File::Find::name)
-          &&
-          test_bytecode($_)
-          &&
-          (!$dh{NO_ACT})
-          &&
-          (print OLIST $File::Find::name."\n")
-        }, @search_path;
+    foreach (@search_path)
+    { 
+      die "E: $_ directory must exist when invoking dh_ocaml\n" unless -d $_;
     };
+    find
+      sub {
+        (-f $_ && -x $_)
+        &&
+        !excludefile($File::Find::name)
+        &&
+        test_bytecode($_)
+        &&
+        (!$dh{NO_ACT})
+        &&
+        (print OLIST $File::Find::name."\n")
+      }, @search_path;
 
     # Search for OCaml objects
     if ($is_dev)
     {
       my @paths = map {"$_/usr/lib" if -e "$_/usr/lib"} @search_path;
 
+      foreach (@paths)
+      { 
+        die "E: $_ directory must exist when invoking dh_ocaml\n" unless -d $_;
+      };
+
       find 
         sub {
           ($_ =~ /\.cm([iaox]|x[as])$/)
@@ -423,7 +430,7 @@ foreach my $package (keys(%dev_packages)) {
 
   if (!$dh{NO_ACT})
   {
-    open (FH, "<", $oprovides_fn) || die "Cannot open $oprovides_fn";
+    open (FH, "<", $oprovides_fn) || die "E: Cannot open $oprovides_fn";
     foreach (<FH>)
     {
       my ($prov_dev, $prov_run, $version, $ck) = parse_provides($_);
@@ -463,7 +470,7 @@ foreach my $package (keys(%dev_packages)) {
       addsubstvar $package, "ocaml:Depends", "$dep_dev-$ck";
       addsubstvar $runtime, "ocaml:Depends", "$dep_run-$ck" if $runtime && $dep_run ne "-";
     }
-    die "Error running $cmd" if $?;
+    die "E: Error running $cmd" if $?;
   }
 }
 
@@ -483,7 +490,7 @@ foreach my $package (@binary_packages) {
       # matched groups: dev_dep, runtime_dep, dep_version
       addsubstvar $package, "ocaml:Depends", "$dep_run-$ck" if $dep_run ne "-";
     }
-    die "Error running $cmd" if $?;
+    die "E: Error running $cmd" if $?;
   }
 }
 
diff --git a/debhelper/dh_ocamldoc b/debhelper/dh_ocamldoc
index b21c402..aca558c 100755
--- a/debhelper/dh_ocamldoc
+++ b/debhelper/dh_ocamldoc
@@ -146,7 +146,7 @@ sub read_ocamldoc_file($) {
                     }, $dir;
                     $content .= join(' ', sort @files);
                 } else {
-                    die "$dir doesn't exist, but is referenced from $file";
+                    die "E: $dir doesn't exist, but is referenced from $file";
                 }
             }
         } else {
diff --git a/debhelper/ocaml-lintian b/debhelper/ocaml-lintian
index 63210b2..c1e42be 100755
--- a/debhelper/ocaml-lintian
+++ b/debhelper/ocaml-lintian
@@ -60,7 +60,7 @@ foreach my $obj_file (get_objects())
         print "$1:$2\n"
       };
     };
-    die "Error running $ocamlobjinfo" if $?;
+    die "E: Error running $ocamlobjinfo" if $?;
   }
 };
 
diff --git a/debhelper/ocaml-md5sums b/debhelper/ocaml-md5sums
index b38435f..307e004 100755
--- a/debhelper/ocaml-md5sums
+++ b/debhelper/ocaml-md5sums
@@ -82,7 +82,7 @@ sub get_unit
 {
   my ($self, $symbol_table, $key) = @_;
   return ($2, $1) if /([^+]*)\+(.*)/;
-  die "$key doesn't have the right format";
+  die "E: $key doesn't have the right format";
 };
 
 sub squeeze_imported
@@ -126,7 +126,7 @@ sub add_object
         $self->add_unit($symbol_table, $2, $1);
       };
     };
-    die "Error running $ocamlobjinfo" if $?;
+    die "E: Error running $ocamlobjinfo" if $?;
   }
   elsif ($obj_file =~ /.*\.(cmx|cmxa|cmxs)$/)
   {
@@ -152,7 +152,7 @@ sub add_object
         $self->add_unit("imported", $1, $2);
       };
     };
-    die "Error running $command" if $?;
+    die "E: Error running $command" if $?;
   }
   else
   {
@@ -166,8 +166,8 @@ sub add_object
         $self->add_unit("imported", $2, $1);
       };
     };
-    die "Error running $ocamlobjinfo" if $?;
-    die "Don't know how to process $obj_file\n" unless $processed;
+    die "E: Error running $ocamlobjinfo" if $?;
+    die "E: Don't know how to process $obj_file\n" unless $processed;
   };
 
   $self->squeeze_imported();
@@ -180,7 +180,7 @@ sub read_dump
   my $symbol_table = undef;
 
   main::info "Load from dump $file";
-  open(FH, $file) || die "Cannot open file $file";
+  open(FH, $file) || die "E: Cannot open file $file";
   foreach (<FH>)
   {
     if (/(dev|runtime|version)\s+(\S+)/)
@@ -193,7 +193,7 @@ sub read_dump
       $self->add_unit($symbol_table, $unit_name, $md5);
     };
   };
-  close(FH) || die "Cannot close file $file";
+  close(FH) || die "E: Cannot close file $file";
   $self->squeeze_imported();
   $self->{file} = $file;
 };
@@ -202,7 +202,7 @@ sub write_dump
 {
   my ($self, $file) = @_;
 
-  open(FH,">", $file) || die "Cannot open file $file";
+  open(FH,">", $file) || die "E: Cannot open file $file";
 
   print FH "dev $self->{dev}\n";
   print FH "runtime $self->{runtime}\n";
@@ -255,7 +255,7 @@ sub load_assign
   }
   else
   {
-    warn "$key is already defined as $a but trying to use $b instead";
+    warn "W: $key is already defined as $a but trying to use $b instead";
   };
 };
 
@@ -263,7 +263,7 @@ sub load
 {
   my ($self, $file) = @_;
   main::debug "Load $file";
-  open(FH, "<", $file) || die "Cannot open file $file";
+  open(FH, "<", $file) || die "E: Cannot open file $file";
   foreach (<FH>)
   {
     my ($md5, $unit_name, $dev, $runtime, $version, $ck) = split /\s+/;
@@ -319,7 +319,7 @@ sub add_depends
         $already_depends = 1;
         if ($self->{imported}{$_} ne "none")
         {
-          warn "Unit $unit_name already defined in ".
+          warn "W: Unit $unit_name already defined in ".
                $self->{imported}{$_}.
                " and defined again in ".
                $other->to_string().
@@ -336,7 +336,7 @@ sub add_depends
     foreach (keys(%{$self->{"defined"}}))
     {
       my ($unit_name) = $self->get_unit("defined", $_);
-      die "Error: unit $unit_name exported in ".
+      die "E: Error: unit $unit_name exported in ".
           $self->to_string().
           " but already exported by ".
           $other->to_string().
@@ -357,7 +357,7 @@ sub print_depends
     if ($self->{imported}{$_} eq "none")
     {
       my ($unit_name, $md5) = $self->get_unit("imported", $_);
-      warn $self->to_string().
+      warn "W: ".$self->to_string().
            " doesn't resolve dependency on unit ".
            $unit_name.
            "\n"
@@ -403,7 +403,7 @@ sub dump_provides
 {
   my ($self, $file) = @_;
   my $ck = $self->compute_provides();
-  open(FH, ">", $file) || die "Cannot open file $file";
+  open(FH, ">", $file) || die "E: Cannot open file $file";
   print FH ($self->compute_provides());
   close(FH);
 };
@@ -474,7 +474,7 @@ if ($print_version)
   exit 0;
 };
 
-die "No action\n" unless defined($action);
+die "E: No action\n" unless defined($action);
 
 if ($action eq "compute" || $action eq "dep")
 {
@@ -492,7 +492,7 @@ if ($action eq "compute" || $action eq "dep")
     $md5sums->add_object($_);
   };
 
-  die "No dev. package defined" unless defined($md5sums->{dev});
+  die "E: No dev. package defined" unless defined($md5sums->{dev});
 
   $md5sums->write_dump($dump_info_fn) if defined($dump_info_fn);
 
@@ -523,7 +523,7 @@ elsif ($action eq "update")
 }
 else
 {
-  die "Unknown action $action\n";
+  die "E: Unknown action $action\n";
 };
 
 __END__

-- 
dh-ocaml packaging



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