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

Mehdi Dogguy dogguy at pps.jussieu.fr
Fri Jul 24 15:08:39 UTC 2009


The following commit has been merged in the master branch:
commit 6dbf72dea788510f56bc8d88a89a6538c5d163ce
Author: Mehdi Dogguy <dogguy at pps.jussieu.fr>
Date:   Fri Jul 24 13:24:20 2009 +0200

    Various additions and fixes in dh_ocamldoc
    
    * Add -u option to dh_ocamldoc to be able to give him additional flags
    * Auto search for directories for inclusion

diff --git a/debhelper/dh_ocamldoc b/debhelper/dh_ocamldoc
index 8277df8..bdea6ea 100755
--- a/debhelper/dh_ocamldoc
+++ b/debhelper/dh_ocamldoc
@@ -46,7 +46,9 @@ instead of plain « ocamldoc ». Lines starting with « # » are comments.
 
 Exclude files from documentation processing.
 
-Clean files generated from present debian/*.in ones and exit.
+=item B<-u> I<flags>
+
+Additional flags to « ocamldoc » or « ocamlfind ocamldoc ».
 
 =back
 
@@ -57,6 +59,11 @@ my $ocaml_lib_dir = "/usr/lib/ocaml/";
 $odoc = "/usr/bin/ocamldoc.opt" if -x "/usr/bin/ocamldoc.opt";
 $ocaml_lib_dir = `ocamlc -where` if -x "/usr/bin/ocamlc";
 chomp $ocaml_lib_dir;
+my $ocamldoc_flags_global = "";
+$ocamldoc_flags_global = join " ", @{$dh{U_PARAMS}}
+  if defined($dh{U_PARAMS});
+$odoc = "ocamlfind ocamldoc"
+  if $ocamldoc_flags_global =~ / -package | -predicates | -syntax | -ppopt /;
 
 error "$odoc does not exists or is not executable"
     unless -x $odoc;
@@ -76,10 +83,12 @@ sub ocamldoc_destdir_html($$) {
 #        document_name   doc-base document id
 #
 sub generate_docbase($$$) {
+    return if defined($dh{NO_ACT});
     my ($package, $html_dir, $document_name) = @_;
     my $dest_dir = ocamldoc_destdir_html($package, $html_dir);
-    my $file = "debian/${package}.doc-base.apiref${document_name}";
+    my $file = "debian/${package}/usr/share/doc-base/${package}.doc-base.apiref${document_name}";
     verbose_print("Generating doc-base file: $file");
+    complex_doit("mkdir -p debian/${package}/usr/share/doc-base/");
     complex_doit("> $file");
     open(DOC, ">> $file");
     print DOC "Document: ${package}-ocamldoc-api-reference${document_name}\n";
@@ -129,7 +138,7 @@ sub do_doc_package($@) {
         my $ocamldoc = $odoc;
         # Set doc-base document id
         my $document_name = $fdoc;
-        $document_name =~ s/debian\/.*\.ocamldoc//g;
+        $document_name =~ s/debian\/.*(\.)?ocamldoc//g;
         my ($ocamldoc_flags, $html_dir, $use_ocamlfind) = read_ocamldoc_file($fdoc);
         if ($dh{EXCLUDE_FIND}) {
             $ocamldoc_flags .= ' -and ! \( '.$dh{EXCLUDE_FIND}.' \)';
@@ -137,16 +146,20 @@ sub do_doc_package($@) {
         my $dest_dir = ocamldoc_destdir_html($package, $html_dir);
         my $tmpdir = tmpdir($package);
         my $search_dir = "$tmpdir$ocaml_lib_dir";
+        my $include_extra_dirs = "";
+        $include_extra_dirs = `find ${search_dir} -type d -exec echo -I \\{\\} \\;` if -d $search_dir;
+        $include_extra_dirs =~ s/\n/ /g;
         $ocamldoc = "ocamlfind ocamldoc" if $use_ocamlfind;
-        complex_doit("mkdir -p $tmpdir$dest_dir");
-        my $doc_files = `find ${search_dir} -type f -name '*.mli' -or -name '*.ml' | xargs echo || true`;
+        my $doc_files = "";
+        $doc_files = `find ${search_dir} -type f -name '*.mli' -or -name '*.ml' | xargs echo || true` if -d $search_dir;
         # Don't generate documentation when there is no source file nor included directories
-        if (! ($doc_files =~ "" and $ocamldoc_flags =~ /-I .*/)) {
-            $doc_files =~ s/\n//g;
-            complex_doit("$ocamldoc $ocamldoc_flags -html -stars -m A -d $tmpdir$dest_dir $doc_files");
+        if (!($doc_files eq "") or ($ocamldoc_flags =~ /-I .*/)) {
+            complex_doit("mkdir -p $tmpdir$dest_dir");
+            $doc_files =~ s/\n/ /g;
+            complex_doit("$ocamldoc $ocamldoc_flags_global $ocamldoc_flags $include_extra_dirs -html -stars -m A -d $tmpdir$dest_dir $doc_files");
             generate_docbase($package, $html_dir, $document_name);
         } else {
-            warning("No doc files (*.mli or *.ml), nor included directories. Nothing to do...");
+            warning("No doc files (*.mli or *.ml) in $search_dir, nor included directories. Nothing to do...");
         }
     }
 }
@@ -156,11 +169,11 @@ foreach my $pkg (@{$dh{DOPACKAGES}}) {
     my @ocamldoc_files = split /\n/,
     `find debian/ -type f -name "$pkg.ocamldoc*"`;
     if ($pkg =~ $dh{MAINPACKAGE}) {
-      my @list = split /\n/, `find debian -type f -name "ocamldoc*"`;
+      my @list = split /\n/, `find debian -maxdepth 1 -type f -name "ocamldoc*"`;
       # Possible nameclash here but done on purpose since the packager
       # can always have several ocamldoc files but should choose a coherent
       # name convetion.
-      @ocamldoc_file = merge(@ocamldoc_files, @list);
+      @ocamldoc_files = (@ocamldoc_files, @list);
     }
     if (@ocamldoc_files) {
         verbose_print("Generating documentation for $pkg");

-- 
dh-ocaml packaging



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