[Pkg-ocaml-maint-commits] [SCM] oasis2debian project branch, master, updated. 502671f239cc83dfbd7531f969a1775862daa762

Sylvain Le Gall gildor at debian.org
Wed Nov 17 21:42:21 UTC 2010


The following commit has been merged in the master branch:
commit 502671f239cc83dfbd7531f969a1775862daa762
Author: Sylvain Le Gall <gildor at debian.org>
Date:   Wed Nov 17 22:37:45 2010 +0100

    Use findlib name for short name of the library

diff --git a/src/Main.ml b/src/Main.ml
index cad18e8..950d295 100644
--- a/src/Main.ml
+++ b/src/Main.ml
@@ -31,6 +31,14 @@ let uploader =
           with _ ->
             failwith "Unable to guess uploader"))
 
+let library_name = 
+  Conf.create 
+    ~cli:"--library-name"
+    "Short name of the library (XXX in libXXX-ocaml-dev)"
+    (Conf.Fun
+       (fun () ->
+          failwith "Not set"))
+
 let () = 
   let () = 
     (* Clean ENV *)
@@ -132,14 +140,29 @@ let () =
   in
 
   let base_name = 
-    (* Try to guess the target name *)
-    List.fold_left
-      (fun name pat -> 
-         Pcre.replace ~pat ~templ:"" name)
-
-      (* Start with the package name *)
-      t.pkg.OASISTypes.name
-      ["^ocaml-?"; "-?ocaml$"]
+    if Conf.is_set library_name then
+      begin
+        Conf.get ~ctxt library_name 
+      end
+    else
+      begin
+        match OASISLibrary.group_libs pkg with 
+          | [hd] ->
+              (* First method: if there is a single findlib library use its name
+               *)
+              OASISLibrary.findlib_of_group hd
+
+          | _ ->
+              (* Default method: try to guess the target name using source name 
+               *)
+              List.fold_left
+                (fun name pat -> 
+                   Pcre.replace ~pat ~templ:"" name)
+
+                (* Start with the package name *)
+                t.pkg.OASISTypes.name
+                ["^ocaml-?"; "-?ocaml$"]
+      end
   in
 
   let spf fmt = 

-- 
oasis2debian project



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