Hello community,

here is the log from the commit of package ocaml-migrate-parsetree for 
openSUSE:Factory checked in at 2020-03-09 14:13:55
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ocaml-migrate-parsetree (Old)
 and      /work/SRC/openSUSE:Factory/.ocaml-migrate-parsetree.new.26092 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "ocaml-migrate-parsetree"

Mon Mar  9 14:13:55 2020 rev:11 rq:780710 version:1.6.0

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/ocaml-migrate-parsetree/ocaml-migrate-parsetree.changes
  2019-11-27 13:53:59.072338108 +0100
+++ 
/work/SRC/openSUSE:Factory/.ocaml-migrate-parsetree.new.26092/ocaml-migrate-parsetree.changes
       2020-03-09 14:14:01.546531978 +0100
@@ -1,0 +2,10 @@
+Sat Feb 29 20:20:20 UTC 2020 - [email protected]
+
+- New upstream release 1.6.0, for ocaml-4.10
+
+-------------------------------------------------------------------
+Thu Feb 20 20:20:20 UTC 2020 - [email protected]
+
+- Require current ocaml-rpm-macros
+
+-------------------------------------------------------------------

Old:
----
  ocaml-migrate-parsetree-1.5.0.tar.xz

New:
----
  ocaml-migrate-parsetree-1.6.0.tar.xz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ ocaml-migrate-parsetree.spec ++++++
--- /var/tmp/diff_new_pack.pb4iqL/_old  2020-03-09 14:14:02.330532495 +0100
+++ /var/tmp/diff_new_pack.pb4iqL/_new  2020-03-09 14:14:02.334532497 +0100
@@ -17,17 +17,17 @@
 
 
 Name:           ocaml-migrate-parsetree
-Version:        1.5.0
+Version:        1.6.0
 Release:        0
 %{?ocaml_preserve_bytecode}
 Summary:        Library for conversion between different OCaml parsetrees 
versions
 License:        LGPL-2.1-only WITH OCaml-LGPL-linking-exception
 Group:          Development/Languages/OCaml
-URL:            https://github.com/ocaml-ppx/ocaml-migrate-parsetree
+URL:            https://opam.ocaml.org/packages/ocaml-migrate-parsetree
 Source0:        %{name}-%{version}.tar.xz
 BuildRequires:  ocaml
 BuildRequires:  ocaml-dune
-BuildRequires:  ocaml-rpm-macros >= 20191101
+BuildRequires:  ocaml-rpm-macros >= 20200220
 BuildRequires:  ocamlfind(compiler-libs.common)
 BuildRequires:  ocamlfind(ppx_derivers)
 BuildRequires:  ocamlfind(result)

++++++ _service ++++++
--- /var/tmp/diff_new_pack.pb4iqL/_old  2020-03-09 14:14:02.382532529 +0100
+++ /var/tmp/diff_new_pack.pb4iqL/_new  2020-03-09 14:14:02.386532531 +0100
@@ -1,11 +1,13 @@
 <services>
   <service name="tar_scm" mode="disabled">
-    <param 
name="url">https://github.com/ocaml-ppx/ocaml-migrate-parsetree.git</param>
-    <param name="scm">git</param>
-    <param name="versionformat">1.5.0</param>
-    <!-- v1.5.0 -->
-    <param name="revision">940db942838f1811e499e6afd6bbb0ccb0f1763e</param>
     <param name="filename">ocaml-migrate-parsetree</param>
+    <param name="revision">93444dbd6153ec0ef6e9daebef6f1da53927792b</param>
+    <param name="scm">git</param>
+    <param name="submodules">disable</param>
+    <param 
name="url">https://github.com/ocaml-ppx/ocaml-migrate-parsetree.git</param>
+    <param name="versionformat">@PARENT_TAG@</param>
+    <param name="versionrewrite-pattern">[v]?([^+]+)(.*)</param>
+    <param name="versionrewrite-replacement">\1</param>
   </service>
   <service name="recompress" mode="disabled">
     <param name="file">*.tar</param>

++++++ ocaml-migrate-parsetree-1.5.0.tar.xz -> 
ocaml-migrate-parsetree-1.6.0.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ocaml-migrate-parsetree-1.5.0/CHANGES.md 
new/ocaml-migrate-parsetree-1.6.0/CHANGES.md
--- old/ocaml-migrate-parsetree-1.5.0/CHANGES.md        2019-11-18 
13:08:07.000000000 +0100
+++ new/ocaml-migrate-parsetree-1.6.0/CHANGES.md        2020-02-10 
16:49:58.000000000 +0100
@@ -1,8 +1,21 @@
+v1.6.0 2020-02-10 Moscow
+------------------------
+
+- Preserve compiler version of binary ASTs across transformation (#79,
+  @aantron)
+
+- Allow not exiting on error (#83, @aantron)
+
 v1.5.0 2019-11-18
 -----------------
 
 - Add support for 4.10 (#86, @diml)
 
+- Infer file kind (interface or implementation) for binary ASTs that
+  have no extension (#80, @aantron)
+
+- Add ?argv argument to Driver.run_main (#82, @aantron)
+
 v1.4.0 2019-07-04 London
 ------------------------
 
@@ -119,18 +132,18 @@
 
     --embed-errors causes the driver to embed exceptions raised by
     rewriters as extension points in the Ast
-    
+
     --as-pp is a shorthand for: --dump-ast --embed-errors
 
 Expose more primitives for embedding the driver.
 
 Fix bug where `reset_args` functions where not being called.
-Fix "OCaml OCaml" in error messages (contributed by Adrien Guatto). 
+Fix "OCaml OCaml" in error messages (contributed by Adrien Guatto).
 
 v0.7 2017-03-21 Mâcon
 ---------------------
 
-Fix findlib predicates: 
+Fix findlib predicates:
 - replace `omp_driver` by `ppx_driver`
 - replace `-custom_ppx` by `-custom_ppx,-ppx_driver`
 
@@ -162,4 +175,4 @@
 v0.1 2017-02-02 London
 ----------------------
 
-First release. 
+First release.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/ocaml-migrate-parsetree-1.5.0/ocaml-migrate-parsetree.opam 
new/ocaml-migrate-parsetree-1.6.0/ocaml-migrate-parsetree.opam
--- old/ocaml-migrate-parsetree-1.5.0/ocaml-migrate-parsetree.opam      
2019-11-18 13:08:07.000000000 +0100
+++ new/ocaml-migrate-parsetree-1.6.0/ocaml-migrate-parsetree.opam      
2020-02-10 16:49:58.000000000 +0100
@@ -16,7 +16,7 @@
 depends: [
   "result"
   "ppx_derivers"
-  "dune" {build & >= "1.9.0"}
+  "dune" {>= "1.9.0"}
   "ocaml" {>= "4.02.3"}
 ]
 synopsis: "Convert OCaml parsetrees between different versions"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/ocaml-migrate-parsetree-1.5.0/src/migrate_parsetree_driver.ml 
new/ocaml-migrate-parsetree-1.6.0/src/migrate_parsetree_driver.ml
--- old/ocaml-migrate-parsetree-1.5.0/src/migrate_parsetree_driver.ml   
2019-11-18 13:08:07.000000000 +0100
+++ new/ocaml-migrate-parsetree-1.6.0/src/migrate_parsetree_driver.ml   
2020-02-10 16:49:58.000000000 +0100
@@ -258,7 +258,24 @@
   apply_cookies cookies;
   st
 
-let run_as_ast_mapper args =
+let exit_or_raise ~exit_on_error f =
+  if not exit_on_error then
+    f ()
+  else
+    try
+      f ()
+    with
+    | Arg.Help text ->
+      print_string text;
+      exit 0
+    | Arg.Bad text ->
+      prerr_string text;
+      exit 2
+    | exn ->
+      Location.report_exception Format.err_formatter exn;
+      exit 1
+
+let run_as_ast_mapper ?(exit_on_error = true) args =
   let spec = registered_args () in
   let args, usage =
     let me = Filename.basename Sys.executable_name in
@@ -267,26 +284,22 @@
      Printf.sprintf "%s [options] <input ast file> <output ast file>" me)
   in
   reset_args ();
-  match
-    Arg.parse_argv args spec
+  exit_or_raise ~exit_on_error begin fun () ->
+    Arg.parse_argv ~current:(ref 0) args spec
       (fun arg -> raise (Arg.Bad (Printf.sprintf "invalid argument %S" arg)))
-      usage
-  with
-  | exception (Arg.Help msg) ->
-      prerr_endline msg;
-      exit 1
-  | () ->
-      OCaml_current.Ast.make_top_mapper
-        ~signature:(fun sg ->
-            let config = initial_state () in
-            rewrite_signature config (module OCaml_current) sg
-            |> migrate_some_signature (module OCaml_current)
-          )
-        ~structure:(fun str ->
-            let config = initial_state () in
-            rewrite_structure config (module OCaml_current) str
-            |> migrate_some_structure (module OCaml_current)
-          )
+      usage;
+    OCaml_current.Ast.make_top_mapper
+      ~signature:(fun sg ->
+          let config = initial_state () in
+          rewrite_signature config (module OCaml_current) sg
+          |> migrate_some_signature (module OCaml_current)
+        )
+      ~structure:(fun str ->
+          let config = initial_state () in
+          rewrite_structure config (module OCaml_current) str
+          |> migrate_some_structure (module OCaml_current)
+        )
+  end
 
 let protectx x ~finally ~f =
   match f x with
@@ -340,11 +353,23 @@
       Location.input_name := fn;
       (* We need to convert to the current version in order to interpret the 
cookies using
          [Ast_mapper.drop_ppx_context_*] from the compiler *)
-      (fn, Intf ((migrate (module V) (module OCaml_current)).copy_signature 
sg))
+      let sg = (migrate (module V) (module OCaml_current)).copy_signature sg in
+      let migrate_back sg =
+        Ast_io.Intf
+          ((module V),
+           (migrate (module OCaml_current) (module V)).copy_signature sg)
+      in
+      (fn, Intf (sg, migrate_back))
     | Ok (fn, Ast_io.Impl ((module V), st)) ->
       check_kind fn ~expected:kind ~got:Kind_impl;
       Location.input_name := fn;
-      (fn, Impl ((migrate (module V) (module OCaml_current)).copy_structure 
st))
+      let st = (migrate (module V) (module OCaml_current)).copy_structure st in
+      let migrate_back st =
+        Ast_io.Impl
+          ((module V),
+           (migrate (module OCaml_current) (module V)).copy_structure st)
+      in
+      (fn, Impl (st, migrate_back))
     | Error (Ast_io.Unknown_version _) ->
       Location.raise_errorf ~loc:(Location.in_file fn)
         "File is a binary ast for an unknown version of OCaml"
@@ -375,9 +400,11 @@
       in
       match kind with
       | Kind_impl ->
-        (fn, Impl (Parse.implementation lexbuf))
+        let migrate_back st = Ast_io.Impl ((module OCaml_current), st) in
+        (fn, Impl (Parse.implementation lexbuf, migrate_back))
       | Kind_intf ->
-        (fn, Intf (Parse.interface lexbuf))
+        let migrate_back sg = Ast_io.Intf ((module OCaml_current), sg) in
+        (fn, Intf (Parse.interface lexbuf, migrate_back))
       | Kind_unknown ->
         Location.raise_errorf ~loc:(Location.in_file fn)
           "I can't decide whether %s is an implementation or interface file"
@@ -400,9 +427,9 @@
 
 let process_file ~config ~output ~output_mode ~embed_errors file =
   let fn, ast = load_file file in
-  let ast =
+  let ast, binary_ast =
     match ast with
-    | Intf sg ->
+    | Intf (sg, migrate_back) ->
       let sg = Ast_mapper.drop_ppx_context_sig ~restore:true sg in
       let sg =
         try
@@ -415,8 +442,10 @@
           [ Ast_helper.Sig.extension ~loc:Location.none
               (Ast_mapper.extension_of_error error) ]
       in
-      Intf (sg, Ast_mapper.add_ppx_context_sig ~tool_name:config.tool_name sg)
-    | Impl st ->
+      let binary_sg =
+        Ast_mapper.add_ppx_context_sig ~tool_name:config.tool_name sg in
+      (Intf sg, migrate_back binary_sg)
+    | Impl (st, migrate_back) ->
       let st = Ast_mapper.drop_ppx_context_str ~restore:true st in
       let st =
         try
@@ -429,23 +458,20 @@
           [ Ast_helper.Str.extension ~loc:Location.none
               (Ast_mapper.extension_of_error error) ]
       in
-      Impl (st, Ast_mapper.add_ppx_context_str ~tool_name:config.tool_name st)
+      let binary_st =
+        Ast_mapper.add_ppx_context_str ~tool_name:config.tool_name st in
+      (Impl st, migrate_back binary_st)
   in
   match output_mode with
   | Dump_ast ->
     with_output ~bin:true output ~f:(fun oc ->
-      let ast =
-        match ast with
-        | Intf (_, sg) -> Ast_io.Intf ((module OCaml_current), sg)
-        | Impl (_, st) -> Ast_io.Impl ((module OCaml_current), st)
-      in
-      Ast_io.to_channel oc fn ast)
+      Ast_io.to_channel oc fn binary_ast)
   | Pretty_print ->
     with_output output ~f:(fun oc ->
       let ppf = Format.formatter_of_out_channel oc in
       (match ast with
-       | Intf (sg, _) -> Pprintast.signature ppf sg
-       | Impl (st, _) -> Pprintast.structure ppf st);
+       | Intf sg -> Pprintast.signature ppf sg
+       | Impl st -> Pprintast.structure ppf st);
       Format.pp_print_newline ppf ())
   | Null ->
     ()
@@ -466,7 +492,7 @@
   |> print_group "Registered Derivers"
 
 
-let run_as_standalone_driver argv =
+let run_as_standalone_driver ~exit_on_error argv =
   let request_print_transformations = ref false in
   let output = ref None in
   let output_mode = ref Pretty_print in
@@ -528,57 +554,46 @@
   let spec = Arg.align (spec @ registered_args ()) in
   let me = Filename.basename Sys.executable_name in
   let usage = Printf.sprintf "%s [options] [<files>]" me in
-  try
+  exit_or_raise ~exit_on_error begin fun () ->
     reset_args ();
-    Arg.parse_argv argv spec (fun anon ->
+    Arg.parse_argv ~current:(ref 0) argv spec (fun anon ->
       files := (Kind_unknown, anon) :: !files) usage;
-    if !request_print_transformations then begin
-      print_transformations ();
-      exit 0
-    end;
-    let output = !output in
-    let output_mode = !output_mode in
-    let embed_errors = !embed_errors in
-    let config =
-      (* TODO: we could add -I, -L and -g options to populate these fields. *)
-      { tool_name    = "migrate_driver"
-      ; include_dirs = []
-      ; load_path    = []
-      ; debug        = false
-      ; for_package  = None
-      ; extras       = []
-      }
-    in
-    List.iter (process_file ~config ~output ~output_mode ~embed_errors)
-      (List.rev !files)
-  with exn ->
-    Location.report_exception Format.err_formatter exn;
-    exit 1
+    if !request_print_transformations then
+      print_transformations ()
+    else
+      let output = !output in
+      let output_mode = !output_mode in
+      let embed_errors = !embed_errors in
+      let config =
+        (* TODO: we could add -I, -L and -g options to populate these fields. 
*)
+        { tool_name    = "migrate_driver"
+        ; include_dirs = []
+        ; load_path    = []
+        ; debug        = false
+        ; for_package  = None
+        ; extras       = []
+        }
+      in
+      List.iter (process_file ~config ~output ~output_mode ~embed_errors)
+        (List.rev !files)
+  end
 
-let run_as_ppx_rewriter ?(argv = Sys.argv) () =
+let run_as_ppx_rewriter ?(exit_on_error = true) ?(argv = Sys.argv) () =
   let a = argv in
   let n = Array.length a in
-  if n <= 2 then begin
-    let me = Filename.basename Sys.executable_name in
-    Arg.usage (registered_args ())
-      (Printf.sprintf "%s [options] <input ast file> <output ast file>" me);
-    exit 2
-  end;
-  match
+  exit_or_raise ~exit_on_error begin fun () ->
+    if n <= 2 then begin
+      let me = Filename.basename Sys.executable_name in
+      Arg.usage_string (registered_args ())
+        (Printf.sprintf "%s [options] <input ast file> <output ast file>" me);
+      |> fun s -> raise (Arg.Bad s)
+    end;
     Ast_mapper.apply ~source:a.(n - 2) ~target:a.(n - 1)
       (run_as_ast_mapper (Array.to_list (Array.sub a 1 (n - 3))))
-  with
-  | () -> exit 0
-  | exception (Arg.Bad help) ->
-      prerr_endline help;
-      exit 1
-  | exception exn ->
-      Location.report_exception Format.err_formatter exn;
-      exit 1
+  end
 
-let run_main ?(argv = Sys.argv) () =
+let run_main ?(exit_on_error = true) ?(argv = Sys.argv) () =
   if Array.length argv >= 2 && argv.(1) = "--as-ppx" then
-    run_as_ppx_rewriter ~argv ()
+    run_as_ppx_rewriter ~exit_on_error ~argv ()
   else
-    run_as_standalone_driver argv;
-  exit 0
+    run_as_standalone_driver ~exit_on_error argv
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/ocaml-migrate-parsetree-1.5.0/src/migrate_parsetree_driver.mli 
new/ocaml-migrate-parsetree-1.6.0/src/migrate_parsetree_driver.mli
--- old/ocaml-migrate-parsetree-1.5.0/src/migrate_parsetree_driver.mli  
2019-11-18 13:08:07.000000000 +0100
+++ new/ocaml-migrate-parsetree-1.6.0/src/migrate_parsetree_driver.mli  
2020-02-10 16:49:58.000000000 +0100
@@ -73,11 +73,12 @@
 
 (** {1 Running registered rewriters} *)
 
-val run_as_ast_mapper : string list -> Ast_mapper.mapper
+val run_as_ast_mapper : ?exit_on_error:bool -> string list -> Ast_mapper.mapper
 
-val run_as_ppx_rewriter : ?argv:string array -> unit -> 'a
+val run_as_ppx_rewriter :
+  ?exit_on_error:bool -> ?argv:string array -> unit -> unit
 
-val run_main : ?argv:string array -> unit -> 'a
+val run_main : ?exit_on_error:bool -> ?argv:string array -> unit -> unit
 
 (** {1 Manual mapping} *)
 


Reply via email to