The following commit has been merged in the master branch:
commit 3685d29d603e8c441c84a8980db34f8cee5345f2
Author: Sylvain Le Gall <gil...@debian.org>
Date:   Mon Mar 25 01:16:36 2013 +0100

    Don't use dch for changelog, override warnings when no ITP set for new 
package.

diff --git a/INSTALL.txt b/INSTALL.txt
index 2b72919..a5cfa12 100644
--- a/INSTALL.txt
+++ b/INSTALL.txt
@@ -1,5 +1,5 @@
 (* OASIS_START *)
-(* DO NOT EDIT (digest: b83bfe827d8d8aad6e30959d0c601d33) *)
+(* DO NOT EDIT (digest: 22e1a572dc120ddf5d09e000ae553339) *)
 This is the INSTALL file for the oasis2debian distribution.
 
 This package uses OASIS to generate its build system. See section OASIS for
@@ -18,6 +18,7 @@ In order to compile this package, you will need:
 * debian-formats (>= 0.0.1) for executable oasis2debian
 * xdg-basedir (>= 0.0.1) for executable oasis2debian
 * inifiles (>= 1.2) for executable oasis2debian
+* calendar for executable oasis2debian
 * oUnit (>= 2.0.0) for executable test
 * tar for test main
 * ocamlmod for test main
diff --git a/_oasis b/_oasis
index fc604f6..befe9a9 100644
--- a/_oasis
+++ b/_oasis
@@ -18,7 +18,8 @@ Executable oasis2debian
                 pcre, 
                 debian-formats (>= 0.0.1), 
                 xdg-basedir (>= 0.0.1), 
-                inifiles (>= 1.2)
+                inifiles (>= 1.2),
+                calendar 
   
 Executable test
   Path:         test
diff --git a/_tags b/_tags
index 51e7d7a..7c8b2e1 100644
--- a/_tags
+++ b/_tags
@@ -20,7 +20,7 @@
 
################################################################################
 
 # OASIS_START
-# DO NOT EDIT (digest: d161ee651e970b488f7fbdded448d3cb)
+# DO NOT EDIT (digest: c932dfb6daa5bda5609b5c58855b5e6e)
 # Ignore VCS directories, you can use the same kind of rule outside 
 # OASIS_START/STOP if you want to exclude directories that contains 
 # useless stuff for the build process
@@ -43,6 +43,7 @@
 "src/Main.byte": pkg_debian-formats
 "src/Main.byte": pkg_xdg-basedir
 "src/Main.byte": pkg_inifiles
+"src/Main.byte": pkg_calendar
 <src/*.ml{,i}>: pkg_fileutils
 <src/*.ml{,i}>: pkg_oasis
 <src/*.ml{,i}>: pkg_oasis.base
@@ -51,6 +52,7 @@
 <src/*.ml{,i}>: pkg_debian-formats
 <src/*.ml{,i}>: pkg_xdg-basedir
 <src/*.ml{,i}>: pkg_inifiles
+<src/*.ml{,i}>: pkg_calendar
 # Executable test
 "test/test.byte": pkg_oUnit
 "test/test.byte": pkg_fileutils
@@ -64,6 +66,7 @@
 
 "src/ActInit.ml": syntax_camlp4o
 "src/Control.ml": syntax_camlp4o
+"src/Changelog.ml": syntax_camlp4o
 "src/Copyright.ml": syntax_camlp4o
 "src/Rules.ml": syntax_camlp4o
 "src/DhFiles.ml": syntax_camlp4o
diff --git a/setup.ml b/setup.ml
index 10f535f..bc5aa6d 100644
--- a/setup.ml
+++ b/setup.ml
@@ -22,7 +22,7 @@
 (* setup.ml generated for the first time by OASIS v0.2.0 *)
 
 (* OASIS_START *)
-(* DO NOT EDIT (digest: 462168c2fc1d5b1fe5aa9f976b82e9c4) *)
+(* DO NOT EDIT (digest: 17801e9964c4ceb7fb46226b5d4cb080) *)
 (*
    Regenerated by OASIS v0.3.1
    Visit http://oasis.forge.ocamlcore.org for more information and
@@ -6109,7 +6109,8 @@ let setup_t =
                                Some (OASISVersion.VGreaterEqual "0.0.1"));
                            FindlibPackage
                              ("inifiles",
-                               Some (OASISVersion.VGreaterEqual "1.2"))
+                               Some (OASISVersion.VGreaterEqual "1.2"));
+                           FindlibPackage ("calendar", None)
                         ];
                       bs_build_tools = [ExternalTool "ocamlbuild"];
                       bs_c_sources = [];
@@ -6200,7 +6201,7 @@ let setup_t =
           };
      oasis_fn = Some "_oasis";
      oasis_version = "0.3.1";
-     oasis_digest = Some "\141�Y�\129��=��ծ%\026�\031";
+     oasis_digest = Some "��FD�\026�\145K����z�!";
      oasis_exec = None;
      oasis_setup_args = ["-setup-update"; "weak"];
      setup_update = true;
@@ -6208,6 +6209,6 @@ let setup_t =
 
 let setup () = BaseSetup.setup setup_t;;
 
-# 6191 "setup.ml"
+# 6192 "setup.ml"
 (* OASIS_STOP *)
 let () = setup ();;
diff --git a/src/ActInit.ml b/src/ActInit.ml
index 87d1a77..096103b 100644
--- a/src/ActInit.ml
+++ b/src/ActInit.ml
@@ -27,25 +27,6 @@ open OASISMessage
 open FileUtil
 open Common
 
-let itp =
-  Conf.create
-    ~cli:"--itp"
-    "int Bug number of the ITP for the package."
-    Conf.ShortInput
-
-let bts_query =
-  Conf.create_full 
-    ~cli:"--bts-query"
-    bool_of_string
-    "bool Query the BTS for ITP (true/false)."
-    (Conf.Value true)
-
-let distribution =
-  Conf.create
-    ~cli:"--distribution"
-    "str Distribution for the package."
-    Conf.ShortInput
-
 let dh_compat = "7"
 
 let run ~ctxt args = 
@@ -76,42 +57,8 @@ let run ~ctxt args =
       (output_content "3.0 (quilt)")
   in
 
-  (* Create debian/changelog *)
-  let () = 
-    let pkg_version = 
-      OASISVersion.string_of_version t.pkg.version
-    in
-
-    if debian_not_exist "changelog" then
-      begin
-        let opts =
-          ""
-        in
-        let opts = 
-          if Conf.is_set itp then
-            opts^" --closes "^(Conf.get ~ctxt itp)
-          else
-            opts^" 'Initial release.'"
-        in
-        let opts =
-          if Conf.get ~ctxt bts_query then
-            opts
-          else
-            opts^" --no-query"
-        in
-        let opts =
-          if Conf.is_set distribution then
-            opts^" --distribution "^(Conf.get ~ctxt distribution)
-          else 
-            opts
-        in
-          assert_command ~ctxt  
-            (interpolate 
-               "dch --create --package $t.deb_name --newversion $pkg_version-1 
$opts")
-      end
-  in
-
   let () = 
+    Changelog.create ~ctxt t;
     Control.create ~ctxt t;
     Copyright.create ~ctxt t;
     Rules.create t;
diff --git a/src/Changelog.ml b/src/Changelog.ml
new file mode 100644
index 0000000..10a619d
--- /dev/null
+++ b/src/Changelog.ml
@@ -0,0 +1,51 @@
+
+open Common
+open OASISTypes
+
+let itp =
+  Conf.create
+    ~cli:"--itp"
+    "int Bug number of the ITP for the package."
+    Conf.ShortInput
+
+let distribution =
+  Conf.create
+    ~cli:"--distribution"
+    "str Distribution for the package."
+    (Conf.Value "UNRELEASED")
+
+let create ~ctxt t =
+  let pkg_version = 
+    OASISVersion.string_of_version t.pkg.version
+  in
+  let date =
+    CalendarLib.Printer.Calendar.sprint "%a, %d %b %Y %T %z" 
(CalendarLib.Calendar.now ())
+  in
+  let distribution = Conf.get ~ctxt distribution in
+  let closes =
+    if Conf.is_set itp then
+      Printf.sprintf " (Closes: #%s)" (Conf.get ~ctxt itp)
+    else
+      ""
+  in
+  let author =
+    try
+      Printf.sprintf "%s <%s>"
+        (Sys.getenv "DEBFULLNAME")
+        (Sys.getenv "DEBEMAIL")
+    with Not_found ->
+      failwith 
+        "Set author using DEBFULLNAME and DEBEMAIL environment variables."
+  in
+    debian_with_fn 
+      "changelog"
+      (output_content
+         (interpolate "\
+$t.pkg.name ($pkg_version-1) $distribution; urgency=low
+
+  * Initial release.$closes
+  * Generated with oasis2debian v${Version.ver}.
+
+ -- $author  ${date}"))
+
+
diff --git a/src/Common.ml b/src/Common.ml
index 6b62d80..e50f219 100644
--- a/src/Common.ml
+++ b/src/Common.ml
@@ -24,6 +24,8 @@ open OASISUtils
 open OASISMessage
 open OASISTypes
 
+exception ExitCode of int (** Exit with this exit code. *)
+
 type deb_pkg =
     {
       name: string;
diff --git a/src/LintianOverrides.ml b/src/LintianOverrides.ml
index d15b704..b722ca3 100644
--- a/src/LintianOverrides.ml
+++ b/src/LintianOverrides.ml
@@ -9,10 +9,53 @@ let no_manpage =
       "exec Disable lintian warning for the given exec without a manpage."
       (Conf.Value !lst)
 
-let add lintian_id arg = 
+let add pkg lintian_id arg_opt = 
   debian_with_append_fn
-    "lintian-overrides"
-    (output_content (Printf.sprintf "%s %s" lintian_id arg))
+    (pkg^".lintian-overrides")
+    (output_content 
+       (match arg_opt with 
+          | Some arg -> Printf.sprintf "%s %s" lintian_id arg
+          | None -> lintian_id))
 
 let create ~ctxt t =
-  List.iter (add "binary-without-manpage") (Conf.get ~ctxt no_manpage)
+  List.iter 
+    (fun arg ->
+       match t.deb_exec with
+         | Some {Common.name = pkg} ->
+             add pkg "binary-without-manpage" (Some arg)
+         | None ->
+             failwith "--no-manpage require a -bin package.")
+    (Conf.get ~ctxt no_manpage);
+  if not (Conf.is_set Changelog.itp) then
+    begin
+      (* TODO: don't do that if the package is not new. *)
+      let packages = 
+        List.flatten 
+          [
+            begin
+              match t.deb_exec with 
+                | Some {Common.name = name} -> [name]
+                | None -> []
+            end;
+
+            begin
+              match t.deb_dev with 
+                | Some ({Common.name = name_dev},
+                        {Common.name = name_runtime}) ->
+                    [name_dev; name_runtime]
+                | None ->
+                    []
+            end;
+
+            begin
+              match t.deb_doc with 
+                | Some {Common.name = name} -> [name]
+                | None -> []
+            end;
+          ]
+      in
+        List.iter 
+          (fun pkg ->
+             add pkg "new-package-should-close-itp-bug" None)
+          packages
+    end
diff --git a/src/Load.ml b/src/Load.ml
index 8479080..b547d47 100644
--- a/src/Load.ml
+++ b/src/Load.ml
@@ -105,18 +105,22 @@ let load ~ctxt args =
   in
 
   let () = 
-    Arg.parse_argv
-      ~current:(ref 0)
-      args
-      (Arg.align !Conf.all_args)
-      (fun s -> 
-         failwith 
-           (Printf.sprintf
-              "Don't know what to do with '%s'"
-              s))
-      (Printf.sprintf 
-         "oasis2debian v%s by Sylvain Le Gall"
-         Version.ver)
+    try 
+      Arg.parse_argv
+        ~current:(ref 0)
+        args
+        (Arg.align !Conf.all_args)
+        (fun s -> 
+           failwith 
+             (Printf.sprintf
+                "Don't know what to do with '%s'"
+                s))
+        (Printf.sprintf 
+           "oasis2debian v%s by Sylvain Le Gall"
+           Version.ver)
+    with Arg.Help str ->
+      print_endline str;
+      raise (ExitCode 0)
   in
 
   let t = 
diff --git a/src/Main.ml b/src/Main.ml
index 8684801..e616169 100644
--- a/src/Main.ml
+++ b/src/Main.ml
@@ -21,6 +21,7 @@
 
 
 open OASISMessage
+open Common
 
 let () = 
   let () = 
@@ -33,33 +34,39 @@ let () =
     {(!OASISContext.default) with 
          OASISContext.ignore_plugins = true}
   in
-
-    if Array.length Sys.argv >= 2 then
-      begin
-        let args = 
-          Array.sub Sys.argv 1 ((Array.length Sys.argv) - 1)
-        in
-        let run =
-          match Sys.argv.(1) with 
-            | "init" ->
-                ActInit.run
-            | "get" ->
-                ActGet.run
-            | "update" ->
-                ActUpdate.run
-            | "help" ->
-                ActHelp.run
-            | str ->
-                ActHelp.display ~ctxt stderr;
-                error ~ctxt "No action %s defined.  Try \"help\"." str;
-                exit 2
-        in
-          run ~ctxt args
-      end
-    else
-      begin
-        ActHelp.display ~ctxt stderr;
-        error ~ctxt "Not enough arguments";
-        exit 2
-      end
+    try
+      if Array.length Sys.argv >= 2 then
+        begin
+          let args = 
+            Array.sub Sys.argv 1 ((Array.length Sys.argv) - 1)
+          in
+          let run =
+            match Sys.argv.(1) with 
+              | "init" ->
+                  ActInit.run
+              | "get" ->
+                  ActGet.run
+              | "update" ->
+                  ActUpdate.run
+              | "help" ->
+                  ActHelp.run
+              | str ->
+                  ActHelp.display ~ctxt stderr;
+                  error ~ctxt "No action %s defined.  Try \"help\"." str;
+                  exit 2
+          in
+            run ~ctxt args
+        end
+      else
+        begin
+          ActHelp.display ~ctxt stderr;
+          error ~ctxt "Not enough arguments";
+          exit 2
+        end
+    with 
+      | Failure str ->
+          error ~ctxt "%s" str;
+          exit 1
+      | ExitCode i ->
+          exit i
 
diff --git a/test/test.ml b/test/test.ml
index e6fabf7..7ee9e55 100644
--- a/test/test.ml
+++ b/test/test.ml
@@ -29,7 +29,8 @@ let oasis2debian =
 let args_for_tarball =
   ["ocamlify-0.0.1.tar.gz", 
    ["--homepage"; "http://forge.ocamlcore.org/projects/ocamlify";;
-    "--no-manpage"; "usr/bin/ocamlify"];
+    "--no-manpage"; "usr/bin/ocamlify";
+    "--description"; "Extended description of ocamlify."];
   
    "ocamlmod-0.0.3.tar.gz",
    ["--homepage"; "http://forge.ocamlcore.org/projects/ocamlmod";];

-- 
oasis2debian project

_______________________________________________
Pkg-ocaml-maint-commits mailing list
Pkg-ocaml-maint-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-ocaml-maint-commits

Reply via email to