[Pkg-ocaml-maint-commits] [SCM] oasis2debian project branch, master, updated. 37e7e5530e3f26b42f5628706f10b6a0e6c42244

Sylvain Le Gall gildor at debian.org
Tue Dec 14 10:33:59 UTC 2010


The following commit has been merged in the master branch:
commit 88bb513ff733230944a581e9b143d681cd8a5056
Author: Sylvain Le Gall <gildor at debian.org>
Date:   Wed Dec 1 13:42:35 2010 +0000

    Use LicenseFile to copy non common license text.

diff --git a/src/Copyright.ml b/src/Copyright.ml
index f6b7a5e..277af3b 100644
--- a/src/Copyright.ml
+++ b/src/Copyright.ml
@@ -56,7 +56,7 @@ let license_exception ~ctxt exc =
               "License exception '%s' not defined"
               (string_of_license_exception exc)))
 
-let license_full ~ctxt l = 
+let license_full ~ctxt t = 
   let see_common = 
     Printf.sprintf "See '/usr/share/common-licenses/%s'."
   in
@@ -71,9 +71,10 @@ let license_full ~ctxt l =
     todo ~ctxt 
       (Printf.sprintf 
          "License '%s' not defined"
-         (OASISLicense.to_string l))
+         (OASISLicense.to_string 
+            t.pkg.OASISTypes.license))
   in
-    match l with 
+    match t.pkg.OASISTypes.license with 
       | DEP5License l ->
           begin
             let license = 
@@ -125,8 +126,31 @@ let license_full ~ctxt l =
                     | Some _ -> todo ()
                 end
 
-              else 
-                todo ()
+              else
+                begin
+                  match t.pkg.OASISTypes.license_file with 
+                    | Some fn when Sys.file_exists fn ->
+                        begin
+                          let chn = 
+                            open_in fn
+                          in
+                          let lst =
+                            ref []
+                          in
+                          let () = 
+                            try 
+                              while true do 
+                                lst := input_line chn :: !lst
+                              done
+                            with End_of_file ->
+                              close_in chn
+                          in
+                            String.concat "\n " (List.rev !lst)
+                        end
+
+                    | _ ->
+                        todo ()
+                end
           end
 
       | OtherLicense _ ->
@@ -154,7 +178,7 @@ let create ~ctxt t =
   in
 
   let license_full = 
-    license_full ~ctxt t.pkg.OASISTypes.license
+    license_full ~ctxt t
   in
 
   let license_exception =

-- 
oasis2debian project



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