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

Stephane Glondu steph at glondu.net
Mon Jul 27 14:34:10 UTC 2009


The following commit has been merged in the master branch:
commit 093daf898bf7ada8f4c5e4f49bfdd89f7a97f128
Author: Stephane Glondu <steph at glondu.net>
Date:   Mon Jul 27 16:12:25 2009 +0200

    Generate doc for .ml only if .mli is missing, and sort modules

diff --git a/debhelper/dh_ocamldoc b/debhelper/dh_ocamldoc
index ae805c2..b21c402 100755
--- a/debhelper/dh_ocamldoc
+++ b/debhelper/dh_ocamldoc
@@ -24,6 +24,7 @@ dh_ocamldoc - Generates documentation for OCaml libraries
 
 use strict;
 use Debian::Debhelper::Dh_Lib;
+use File::Find;
 init();
 
 =head1 SYNOPSIS
@@ -134,14 +135,22 @@ sub read_ocamldoc_file($) {
         if (/^--include +(.+)$/) {
             foreach my $dir (split/ /, $1) {
                 if (-d $dir) {
-                    $content .= `find $dir -type d -printf ' -I %p'`;
-                    $content .= `find $dir -type f -name '*.mli' -or -name '*.ml' -printf ' %p'`;
+                    find sub {
+                        $content .= " -I $File::Find::name " if -d $_;
+                    }, $dir;
+                    my @files;
+                    find sub {
+                        push @files, $File::Find::name
+                            if /^.*\.mli\z/s && -f $_
+                            || /^.*\ml\z/s && ! -f $_.'i';
+                    }, $dir;
+                    $content .= join(' ', sort @files);
                 } else {
                     die "$dir doesn't exist, but is referenced from $file";
                 }
             }
         } else {
-            $content .= " $_";
+            $content .= " $_ ";
         }
     }
     close OCAMLDOC;
@@ -172,7 +181,13 @@ sub do_doc_package($@) {
         $ocamldoc = "ocamlfind ocamldoc" if $use_ocamlfind;
         my $doc_files = "";
         if (-d $search_dir) {
-            $doc_files .= `find $search_dir -type f -name '*.mli' -or -name '*.ml' -printf ' %p'`;
+            my @files;
+            find sub {
+                push @files, $File::Find::name
+                    if /^.*\.mli\z/s && -f $_
+                    || /^.*\ml\z/s && ! -f $_.'i';
+            }, $search_dir;
+            $doc_files .= join(' ', sort @files);
         }
         # Don't generate documentation when there is no source file nor included directories
         if (!($doc_files eq "") or ($ocamldoc_flags =~ /-I .*/)) {

-- 
dh-ocaml packaging



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