Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package ocaml-pp for openSUSE:Factory 
checked in at 2023-09-22 21:50:09
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ocaml-pp (Old)
 and      /work/SRC/openSUSE:Factory/.ocaml-pp.new.1770 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "ocaml-pp"

Fri Sep 22 21:50:09 2023 rev:5 rq:1112986 version:1.2.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/ocaml-pp/ocaml-pp.changes        2023-05-12 
20:41:28.051245754 +0200
+++ /work/SRC/openSUSE:Factory/.ocaml-pp.new.1770/ocaml-pp.changes      
2023-09-22 21:50:46.532182101 +0200
@@ -1,0 +2,6 @@
+Sat Sep  9 09:09:09 UTC 2023 - oher...@suse.de
+
+- Update to version 1.2.0
+  See included CHANGES.md for details
+
+-------------------------------------------------------------------

Old:
----
  ocaml-pp-1.1.2.tar.xz

New:
----
  ocaml-pp-1.2.0.tar.xz

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

Other differences:
------------------
++++++ ocaml-pp.spec ++++++
--- /var/tmp/diff_new_pack.rvw1dE/_old  2023-09-22 21:50:47.596220729 +0200
+++ /var/tmp/diff_new_pack.rvw1dE/_new  2023-09-22 21:50:47.596220729 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package ocaml-pp
 #
-# Copyright (c) 2022 SUSE LLC
+# Copyright (c) 2023 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -31,7 +31,7 @@
 
 %define     pkg ocaml-pp
 Name:           %pkg%nsuffix
-Version:        1.1.2
+Version:        1.2.0
 Release:        0
 %{?ocaml_preserve_bytecode}
 Summary:        Pretty-printing library
@@ -40,8 +40,8 @@
 BuildRoot:      %_tmppath/%name-%version-build
 URL:            https://opam.ocaml.org/packages/pp
 Source0:        %pkg-%version.tar.xz
-BuildRequires:  ocaml-dune >= 2.0
-BuildRequires:  ocaml-rpm-macros >= 20220409
+BuildRequires:  ocaml-dune >= 2.8
+BuildRequires:  ocaml-rpm-macros >= 20230101
 BuildRequires:  ocaml(ocaml_base_version) >= 4.08
 
 %if "%build_flavor" == "testsuite"

++++++ _service ++++++
--- /var/tmp/diff_new_pack.rvw1dE/_old  2023-09-22 21:50:47.648222617 +0200
+++ /var/tmp/diff_new_pack.rvw1dE/_new  2023-09-22 21:50:47.652222762 +0200
@@ -1,7 +1,7 @@
 <services>
   <service name="tar_scm" mode="disabled">
     <param name="filename">ocaml-pp</param>
-    <param name="revision">5a42badeac6da93c1978ddb6f23d0299eab62312</param>
+    <param name="revision">83b68c740f21acdcfe54436355ab328372871357</param>
     <param name="scm">git</param>
     <param name="submodules">disable</param>
     <param name="url">https://github.com/ocaml-dune/pp.git</param>

++++++ ocaml-pp-1.1.2.tar.xz -> ocaml-pp-1.2.0.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ocaml-pp-1.1.2/.github/workflows/ci.yml 
new/ocaml-pp-1.2.0/.github/workflows/ci.yml
--- old/ocaml-pp-1.1.2/.github/workflows/ci.yml 1970-01-01 01:00:00.000000000 
+0100
+++ new/ocaml-pp-1.2.0/.github/workflows/ci.yml 2023-09-15 10:53:27.000000000 
+0200
@@ -0,0 +1,41 @@
+name: CI
+
+on:
+  pull_request:
+  push:
+
+jobs:
+  build:
+    strategy:
+      fail-fast: false
+      matrix:
+        os:
+          - macos-latest
+          - ubuntu-latest
+          - windows-latest
+        ocaml-compiler:
+          - 4.14.x
+          - 4.08.x
+
+    runs-on: ${{ matrix.os }}
+
+    steps:
+      - name: Set git to use LF
+        run: |
+          git config --global core.autocrlf false
+          git config --global core.eol lf
+          git config --global core.ignorecase false
+
+      - name: Checkout code
+        uses: actions/checkout@v3
+
+      - name: Use OCaml ${{ matrix.ocaml-compiler }}
+        uses: ocaml/setup-ocaml@v2
+        with:
+          ocaml-compiler: ${{ matrix.ocaml-compiler }}
+
+      - run: opam install . --deps-only --with-test
+
+      - run: opam exec -- dune build
+
+      - run: opam exec -- dune runtest
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ocaml-pp-1.1.2/.ocamlformat 
new/ocaml-pp-1.2.0/.ocamlformat
--- old/ocaml-pp-1.1.2/.ocamlformat     2021-03-31 11:39:34.000000000 +0200
+++ new/ocaml-pp-1.2.0/.ocamlformat     2023-09-15 10:53:27.000000000 +0200
@@ -1,4 +1,4 @@
-version=0.17.0
+version=0.26.0
 break-separators=before
 dock-collection-brackets=false
 break-sequences=true
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ocaml-pp-1.1.2/CHANGES.md 
new/ocaml-pp-1.2.0/CHANGES.md
--- old/ocaml-pp-1.1.2/CHANGES.md       2021-03-31 11:39:34.000000000 +0200
+++ new/ocaml-pp-1.2.0/CHANGES.md       2023-09-15 10:53:27.000000000 +0200
@@ -1,3 +1,8 @@
+1.2.0
+-----
+
+- Add `Pp.compare` (#9, @Alizter)
+
 1.1.2
 -----
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ocaml-pp-1.1.2/dune-project 
new/ocaml-pp-1.2.0/dune-project
--- old/ocaml-pp-1.1.2/dune-project     2021-03-31 11:39:34.000000000 +0200
+++ new/ocaml-pp-1.2.0/dune-project     2023-09-15 10:53:27.000000000 +0200
@@ -1,4 +1,4 @@
-(lang dune 2.0)
+(lang dune 2.8)
 (name pp)
 
 (license MIT)
@@ -6,15 +6,15 @@
 (authors
   "Jane Street Group, LLC <opensou...@janestreet.com>"
   "Jeremie Dimino <jere...@dimino.org>")
-(source (github diml/pp))
-(documentation "https://diml.github.io/pp/";)
+(source (github ocaml-dune/pp))
+(documentation "https://ocaml-dune.github.io/pp/";)
 
 (generate_opam_files true)
 
 (package
  (name pp)
  (depends
-   (ocaml (>= 4.04.0))
+   (ocaml (>= 4.08.0))
    (ppx_expect :with-test))
  (synopsis "Pretty-printing library")
  (description "
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ocaml-pp-1.1.2/pp.opam new/ocaml-pp-1.2.0/pp.opam
--- old/ocaml-pp-1.1.2/pp.opam  2021-03-31 11:39:34.000000000 +0200
+++ new/ocaml-pp-1.2.0/pp.opam  2023-09-15 10:53:27.000000000 +0200
@@ -29,12 +29,13 @@
 doc: "https://ocaml-dune.github.io/pp/";
 bug-reports: "https://github.com/ocaml-dune/pp/issues";
 depends: [
-  "dune" {>= "2.0"}
-  "ocaml" {>= "4.04.0"}
+  "dune" {>= "2.8"}
+  "ocaml" {>= "4.08.0"}
   "ppx_expect" {with-test}
+  "odoc" {with-doc}
 ]
 build: [
-  ["dune" "subst"] {pinned}
+  ["dune" "subst"] {dev}
   [
     "dune"
     "build"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ocaml-pp-1.1.2/src/pp.ml new/ocaml-pp-1.2.0/src/pp.ml
--- old/ocaml-pp-1.1.2/src/pp.ml        2021-03-31 11:39:34.000000000 +0200
+++ new/ocaml-pp-1.2.0/src/pp.ml        2023-09-15 10:53:27.000000000 +0200
@@ -161,7 +161,6 @@
   Render.render ppf t ~tag_handler:(fun ppf _tag t -> to_fmt ppf t)
 
 let nop = Nop
-
 let seq a b = Seq (a, b)
 
 let concat ?(sep = Nop) = function
@@ -182,34 +181,22 @@
   | l -> Concat (sep, List.mapi l ~f)
 
 let box ?(indent = 0) t = Box (indent, t)
-
 let vbox ?(indent = 0) t = Vbox (indent, t)
-
 let hbox t = Hbox t
-
 let hvbox ?(indent = 0) t = Hvbox (indent, t)
-
 let hovbox ?(indent = 0) t = Hovbox (indent, t)
-
 let verbatim x = Verbatim x
-
 let char x = Char x
-
 let custom_break ~fits ~breaks = Break (fits, breaks)
 
 let break ~nspaces ~shift =
   custom_break ~fits:("", nspaces, "") ~breaks:("", shift, "")
 
 let space = break ~nspaces:1 ~shift:0
-
 let cut = break ~nspaces:0 ~shift:0
-
 let newline = Newline
-
 let text s = Text s
-
 let textf fmt = Printf.ksprintf text fmt
-
 let tag tag t = Tag (tag, t)
 
 let enumerate l ~f =
@@ -225,9 +212,9 @@
               (seq
                  (verbatim
                     (if i = 0 then
-                      "   "
-                    else
-                      "-> "))
+                       "   "
+                     else
+                       "-> "))
                  (f x)))))
 
 module O = struct
@@ -235,3 +222,85 @@
 end
 
 let of_fmt f x = Format (fun ppf -> f ppf x)
+
+let compare =
+  let compare_both (type a b) (f : a -> a -> int) (g : b -> b -> int) (a, b)
+      (c, d) =
+    let r = f a c in
+    if r <> 0 then
+      r
+    else
+      g b d
+  in
+  (* Due to 4.08 lower bound, we need to define this here. *)
+  let rec compare_list a b ~cmp:f : int =
+    match (a, b) with
+    | [], [] -> 0
+    | [], _ :: _ -> -1
+    | _ :: _, [] -> 1
+    | x :: a, y :: b -> (
+      match (f x y : int) with
+      | 0 -> compare_list a b ~cmp:f
+      | ne -> ne)
+  in
+  fun compare_tag ->
+    let rec compare x y =
+      match (x, y) with
+      | Nop, Nop -> 0
+      | Nop, _ -> -1
+      | _, Nop -> 1
+      | Seq (a, b), Seq (c, d) -> compare_both compare compare (a, b) (c, d)
+      | Seq _, _ -> -1
+      | _, Seq _ -> 1
+      | Concat (a, b), Concat (c, d) ->
+        compare_both compare (compare_list ~cmp:compare) (a, b) (c, d)
+      | Concat _, _ -> -1
+      | _, Concat _ -> 1
+      | Box (a, b), Box (c, d) -> compare_both Int.compare compare (a, b) (c, 
d)
+      | Box _, _ -> -1
+      | _, Box _ -> 1
+      | Vbox (a, b), Vbox (c, d) ->
+        compare_both Int.compare compare (a, b) (c, d)
+      | Vbox _, _ -> -1
+      | _, Vbox _ -> 1
+      | Hbox a, Hbox b -> compare a b
+      | Hbox _, _ -> -1
+      | _, Hbox _ -> 1
+      | Hvbox (a, b), Hvbox (c, d) ->
+        compare_both Int.compare compare (a, b) (c, d)
+      | Hvbox _, _ -> -1
+      | _, Hvbox _ -> 1
+      | Hovbox (a, b), Hovbox (c, d) ->
+        compare_both Int.compare compare (a, b) (c, d)
+      | Hovbox _, _ -> -1
+      | _, Hovbox _ -> 1
+      | Verbatim a, Verbatim b -> String.compare a b
+      | Verbatim _, _ -> -1
+      | _, Verbatim _ -> 1
+      | Char a, Char b -> Char.compare a b
+      | Char _, _ -> -1
+      | _, Char _ -> 1
+      | Break (a, b), Break (c, d) ->
+        let compare (x, y, z) (a, b, c) =
+          compare_both String.compare
+            (compare_both Int.compare String.compare)
+            (x, (y, z))
+            (a, (b, c))
+        in
+        compare_both compare compare (a, b) (c, d)
+      | Break _, _ -> -1
+      | _, Break _ -> 1
+      | Newline, Newline -> 0
+      | Newline, _ -> -1
+      | _, Newline -> 1
+      | Text a, Text b -> String.compare a b
+      | Text _, _ -> -1
+      | _, Text _ -> 1
+      | Tag (a, b), Tag (c, d) -> compare_both compare_tag compare (a, b) (c, 
d)
+      | Format _, Format _ ->
+        raise
+          (Invalid_argument "[Pp.of_fmt] values not supported in [Pp.compare]")
+      | Format _, _ -> -1
+      | _, Format _ -> 1
+    in
+    compare
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ocaml-pp-1.1.2/src/pp.mli 
new/ocaml-pp-1.2.0/src/pp.mli
--- old/ocaml-pp-1.1.2/src/pp.mli       2021-03-31 11:39:34.000000000 +0200
+++ new/ocaml-pp-1.2.0/src/pp.mli       2023-09-15 10:53:27.000000000 +0200
@@ -91,7 +91,9 @@
     And the top left corner of this shape is anchored where the box was
     declared. So for instance, the following document:
 
-    {[ Pp.verbatim "....." ++ Pp.box ~indent:2 (Pp.text "some long ... text") 
]}
+    {[
+      Pp.verbatim "....." ++ Pp.box ~indent:2 (Pp.text "some long ... text")
+    ]}
 
     would produce:
 
@@ -209,3 +211,10 @@
 (** [to_ast t] will try to convert [t] to [Ast.t]. When [t] contains values
     constructed with [of_fmt], this function will fail and return [Error ()] *)
 val to_ast : 'a t -> ('a Ast.t, unit) result
+
+(** {1 Comparison} *)
+
+(** [compare cmp x y] compares [x] and [y] using [cmp] to compare tags.
+
+    @raise Invalid_argument if two [of_fmt] values are compared. *)
+val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ocaml-pp-1.1.2/test/tests.ml 
new/ocaml-pp-1.2.0/test/tests.ml
--- old/ocaml-pp-1.1.2/test/tests.ml    2021-03-31 11:39:34.000000000 +0200
+++ new/ocaml-pp-1.2.0/test/tests.ml    2023-09-15 10:53:27.000000000 +0200
@@ -2,11 +2,8 @@
 open Pp.O
 
 let print pp = Format.printf "%a@." Pp.to_fmt pp
-
 let many n pp = Array.make n pp |> Array.to_list |> Pp.concat ~sep:Pp.space
-
 let xs n = many n (Pp.char 'x')
-
 let ys n = many n (Pp.char 'y')
 
 let%expect_test _ =
@@ -156,31 +153,33 @@
     .....x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x 
x
            x x x x x x x x x x x x x x |}]
 
+let error_example_1 =
+  Pp.vbox
+    (Pp.box (Pp.text "Error: something went wrong!")
+    ++ Pp.cut
+    ++ Pp.box (Pp.text "Here are a few things you can do:")
+    ++ Pp.cut
+    ++ Pp.enumerate
+         ~f:(fun x -> x)
+         [ Pp.text
+             "read the documentation, double check the way you are using this \
+              software to make sure you are not doing something wrong, and \
+              hopefully fix the problem on your side and move on"
+         ; Pp.text
+             "strace furiously the program to try and understand why exactly \
+              it is trying to do what it is doing"
+         ; Pp.text "report an issue upstream"
+         ; Pp.text "if all else fails"
+           ++ Pp.cut
+           ++ Pp.enumerate ~f:Pp.text
+                [ "scream loudly at your computer"
+                ; "take a break from your keyboard"
+                ; "clear your head and try again"
+                ]
+         ])
+
 let%expect_test _ =
-  print
-    (Pp.vbox
-       (Pp.box (Pp.text "Error: something went wrong!")
-       ++ Pp.cut
-       ++ Pp.box (Pp.text "Here are a few things you can do:")
-       ++ Pp.cut
-       ++ Pp.enumerate
-            ~f:(fun x -> x)
-            [ Pp.text
-                "read the documentation, double check the way you are using \
-                 this software to make sure you are not doing something wrong, 
\
-                 and hopefully fix the problem on your side and move on"
-            ; Pp.text
-                "strace furiously the program to try and understand why \
-                 exactly it is trying to do what it is doing"
-            ; Pp.text "report an issue upstream"
-            ; Pp.text "if all else fails"
-              ++ Pp.cut
-              ++ Pp.enumerate ~f:Pp.text
-                   [ "scream loudly at your computer"
-                   ; "take a break from your keyboard"
-                   ; "clear your head and try again"
-                   ]
-            ]));
+  print error_example_1;
   [%expect
     {|
     Error: something went wrong!
@@ -222,3 +221,16 @@
     (1,
     2)
     foo |}]
+
+let%expect_test "comparison" =
+  let x = error_example_1
+  and y = Pp.hovbox ~indent:2 (xs 200) in
+  let print x = Printf.printf "comparison result: %d\n" x in
+  print (Pp.compare (fun _ _ -> 0) x y);
+  print (Pp.compare (fun _ _ -> 0) x x);
+  print (Pp.compare (fun _ _ -> 0) y x);
+  [%expect
+    {|
+    comparison result: -1
+    comparison result: 0
+    comparison result: 1 |}]

Reply via email to