[Pkg-ocaml-maint-commits] [SCM] oasis2debian project branch, master, updated. 7aaf2c71f59cdeee1754531bbf9062dcafa7f5e1

Sylvain Le Gall gildor at debian.org
Thu Apr 19 23:14:34 UTC 2012


The following commit has been merged in the master branch:
commit 7aaf2c71f59cdeee1754531bbf9062dcafa7f5e1
Author: Sylvain Le Gall <gildor at debian.org>
Date:   Thu Apr 19 23:14:23 2012 +0000

    Use oasis v0.3 new API.

diff --git a/src/BuildDepends.ml b/src/BuildDepends.ml
index b81f2fc..7706679 100644
--- a/src/BuildDepends.ml
+++ b/src/BuildDepends.ml
@@ -265,7 +265,7 @@ let get ~ctxt pkg =
               hd
 
           | [] ->
-              failwithf1
+              failwithf
                 "Cannot find file '%s'"
                 fn
     in
diff --git a/src/Common.ml b/src/Common.ml
index 8354ccf..7c0cc69 100644
--- a/src/Common.ml
+++ b/src/Common.ml
@@ -97,7 +97,7 @@ let assert_command ~ctxt cmd =
   match Sys.command cmd with 
     | 0 -> ()
     | n -> 
-        failwithf2
+        failwithf
           "Command '%s' exited with code %d" 
           cmd n
 
@@ -123,7 +123,7 @@ let assert_command_output ~ctxt cmd =
       | Unix.WEXITED 0 ->
           res
       | _ ->
-          failwithf1
+          failwithf
             "Command '%s' exited with non-zero exit code"
             cmd
 
diff --git a/src/Copyright.ml b/src/Copyright.ml
index 8fe44e8..c5d9094 100644
--- a/src/Copyright.ml
+++ b/src/Copyright.ml
@@ -74,59 +74,53 @@ let license_full ~ctxt t =
          (OASISLicense.to_string 
             t.pkg.OASISTypes.license))
   in
+  let debian_licenses = 
+    [
+      apache, 
+      [`Ver "2.0", "Aparche-2.0"];
+      artistic, 
+      [`Any, "Artistic"];
+      bsd3, 
+      [`Any, "BSD"];
+      gpl,
+      [`Ver "1", "GPL-1";
+       `Ver "2", "GPL-2";
+       `Ver "3", "GPL-3";
+       `None, "GPL"];
+      gfdl,
+      [`Ver "1.2", "GFDL-1.2";
+       `Ver "1.3", "GFDL-1.3";
+       `None, "GFDL"];
+      lgpl,
+      [`Ver "2", "LGPL-2";
+       `Ver "2.1", "LGPL-2.1";
+       `Ver "3", "LGPL-3";
+       `None, "LGPL"]
+    ]
+  in
     match t.pkg.OASISTypes.license with 
       | DEP5License l ->
           begin
-            let license = 
-              l.OASISLicense.license
-            in
-              if license = apache then
-                begin
-                  match min_ver l.version with 
-                    | Some "2.0" -> see_common "Apache-2.0"
-                    | _ -> todo ()
-                end
-
-              else if license = artistic then
-                begin
-                  see_common "Artistic"
-                end
-
-              else if license = bsd3 then 
-                begin
-                  see_common "BSD"
-                end
-
-              else if license = gpl then
+            let process_one l = 
+              try
                 begin
-                  match min_ver l.version with 
-                    | Some "1" -> see_common "GPL-1"
-                    | Some "2" -> see_common "GPL-2"
-                    | Some "3" -> see_common "GPL-3"
-                    | None -> see_common "GPL"
-                    | Some _ -> todo ()
+                  let vers = List.assoc l.license debian_licenses in
+                    try 
+                      let ver = min_ver l.version in
+                      let _, debian_common = 
+                        List.find
+                          (fun (ver', _) ->
+                             match ver, ver' with 
+                               | Some v, `Ver v' -> v = v'
+                               | None, `None | _, `Any -> true
+                               | None, `Ver _ | Some _, `None -> false)
+                          vers
+                      in
+                        see_common debian_common
+                    with Not_found ->
+                      todo ()
                 end
-
-              else if license = gfdl then
-                begin
-                  match min_ver l.version with 
-                    | Some "1.2" -> see_common "GFDL-1.2"
-                    | Some "1.3" -> see_common "GFDL-1.3"
-                    | None -> see_common "GFDL"
-                    | Some _ -> todo ()
-                end
-
-              else if license = lgpl then
-                begin
-                  match min_ver l.version with 
-                    | Some "2" -> see_common "LGPL-2"
-                    | Some "2.1" -> see_common "LGPL-2.1"
-                    | Some "3" -> see_common "LGPL-3"
-                    | None -> see_common "LGPL"
-                    | Some _ -> todo ()
-                end
-
-              else
+              with Not_found ->
                 begin
                   match t.pkg.OASISTypes.license_file with 
                     | Some fn when Sys.file_exists fn ->
@@ -151,6 +145,15 @@ let license_full ~ctxt t =
                     | _ ->
                         todo ()
                 end
+            in
+            let rec process acc =
+              function
+                | DEP5Unit l ->
+                    (process_one l) :: acc
+                | DEP5Or lst | DEP5And lst ->
+                    List.fold_left process acc lst
+            in
+              String.concat "\n" (List.rev (process [] l))
           end
 
       | OtherLicense _ ->
@@ -183,11 +186,29 @@ let create ~ctxt t =
 
   let license_exception =
     match t.pkg.OASISTypes.license with 
-      | DEP5License {exceptions = lst} when lst <> [] ->
+      | DEP5License l ->
+          let lst = 
+            let rec collect_excpt acc =
+              function 
+                | DEP5Unit {excption = Some e} ->
+                    if not (List.mem e acc) then
+                      e :: acc
+                    else 
+                      acc
+                | DEP5Unit _ ->
+                    acc
+                | DEP5Or lst | DEP5And lst ->
+                    List.fold_left collect_excpt acc lst
+            in
+              collect_excpt [] l
+          in
           let sep  = 
             "\n\n"
           in
-            sep ^ (String.concat sep (List.map (license_exception ~ctxt) lst))
+            if lst <> [] then
+              sep ^ (String.concat sep (List.map (license_exception ~ctxt) lst))
+            else 
+              ""
 
       | _ ->
           ""
diff --git a/src/DhFiles.ml b/src/DhFiles.ml
index fe25b00..f981b30 100644
--- a/src/DhFiles.ml
+++ b/src/DhFiles.ml
@@ -34,6 +34,7 @@ type t =
     has_native:   bool;
     has_dll:      bool;
     has_cmi:      bool;
+    (* TODO: dynlink *)
   }
 
 let create ~ctxt t = 
@@ -74,11 +75,12 @@ let create ~ctxt t =
                      let fns = 
                        OASISLibrary.generated_unix_files
                          ~ctxt
+                         ~source_file_exists:Sys.file_exists
+                         ~is_native:true
+                         ~has_native_dynlink:true
+                         ~ext_lib:".a"
+                         ~ext_dll:".so"
                          e
-                         Sys.file_exists
-                         (fun () -> true)
-                         (fun () -> ".a")
-                         (fun () -> ".so")
                      in
                        fns :: acc) 
                   []

-- 
oasis2debian project



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