Version 2.2.0. Drop cmdliner patch.

This commit is contained in:
Jerry James 2023-01-09 12:23:39 -07:00
parent 77b6a5c5ef
commit b12f58aded
3 changed files with 8 additions and 272 deletions

View File

@ -1,258 +0,0 @@
--- mdx-2.1.0/bin/cli.ml.orig 2022-01-28 04:32:36.000000000 -0700
+++ mdx-2.1.0/bin/cli.ml 2022-09-15 15:55:07.018063580 -0600
@@ -5,7 +5,7 @@ let named wrapper = Term.(app (const wra
let non_deterministic =
let doc = "Run non-deterministic tests." in
- let env = Arg.env_var ~doc "MDX_RUN_NON_DETERMINISTIC" in
+ let env = Cmd.Env.info ~doc "MDX_RUN_NON_DETERMINISTIC" in
named
(fun x -> `Non_deterministic x)
Arg.(value & flag & info [ "non-deterministic"; "n" ] ~env ~doc)
--- mdx-2.1.0/bin/deps.ml.orig 2022-01-28 04:32:36.000000000 -0700
+++ mdx-2.1.0/bin/deps.ml 2022-09-15 15:55:48.578172860 -0600
@@ -33,10 +33,11 @@ let run (`Setup ()) (`Syntax syntax) (`F
Printf.printf "%s" (Mdx.Util.Csexp.to_string (List deps));
0
-let cmd =
- let open Cmdliner in
- let doc =
- "List the dependencies of the input file. This command is meant to be used \
- by dune only. There are no stability guarantees."
- in
- (Term.(pure run $ Cli.setup $ Cli.syntax $ Cli.file), Term.info "deps" ~doc)
+let term = Cmdliner.Term.(const run $ Cli.setup $ Cli.syntax $ Cli.file)
+
+let doc =
+ "List the dependencies of the input file. This command is meant to be used \
+ by dune only. There are no stability guarantees."
+
+let info = Cmdliner.Cmd.info "deps" ~doc
+let cmd = Cmdliner.Cmd.v info term
--- mdx-2.1.0/bin/deps.mli.orig 2022-01-28 04:32:36.000000000 -0700
+++ mdx-2.1.0/bin/deps.mli 2022-09-15 15:56:11.034231908 -0600
@@ -14,6 +14,4 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*)
-open Cmdliner
-
-val cmd : int Term.t * Term.info
+val cmd : int Cmdliner.Cmd.t
--- mdx-2.1.0/bin/dune_gen.ml.orig 2022-01-28 04:32:36.000000000 -0700
+++ mdx-2.1.0/bin/dune_gen.ml 2022-09-15 15:56:39.290306213 -0600
@@ -56,11 +56,11 @@ let run (`Setup ()) (`Prelude prelude) (
Buffer.output_buffer stdout buffer;
0
-let cmd =
- let open Cmdliner in
- let doc =
- "Generate the source for a specialized testing binary. This command is \
- meant to be used by dune only. There are no stability guarantees."
- in
- ( Term.(pure run $ Cli.setup $ Cli.prelude $ Cli.directories),
- Term.info "dune-gen" ~doc )
+let term = Cmdliner.Term.(const run $ Cli.setup $ Cli.prelude $ Cli.directories)
+
+let doc =
+ "Generate the source for a specialized testing binary. This command is meant \
+ to be used by dune only. There are no stability guarantees."
+
+let info = Cmdliner.Cmd.info "dune-gen" ~doc
+let cmd = Cmdliner.Cmd.v info term
--- mdx-2.1.0/bin/dune_gen.mli.orig 2022-01-28 04:32:36.000000000 -0700
+++ mdx-2.1.0/bin/dune_gen.mli 2022-09-15 15:57:00.658362404 -0600
@@ -14,6 +14,4 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*)
-open Cmdliner
-
-val cmd : int Term.t * Term.info
+val cmd : int Cmdliner.Cmd.t
--- mdx-2.1.0/bin/main.ml.orig 2022-01-28 04:32:36.000000000 -0700
+++ mdx-2.1.0/bin/main.ml 2022-09-15 16:05:36.283718254 -0600
@@ -19,11 +19,11 @@ open Cmdliner
let cmds = [ Test.cmd; Pp.cmd; Deps.cmd; Dune_gen.cmd ]
let main (`Setup ()) = `Help (`Pager, None)
-let main =
+let info =
let doc = "Execute markdown files." in
- let exits = Term.default_exits in
let man = [] in
- ( Term.(ret (const main $ Cli.setup)),
- Term.info "ocaml-mdx" ~version:"2.1.0" ~doc ~exits ~man )
+ Cmd.info "ocaml-mdx" ~version:"%%VERSION%%" ~doc ~man
-let () = Term.(exit_status @@ eval_choice main cmds)
+let default = Term.(ret (const main $ Cli.setup))
+let group = Cmd.group ~default info cmds
+let () = Stdlib.exit @@ Cmd.eval' group
--- mdx-2.1.0/bin/pp.ml.orig 2022-01-28 04:32:36.000000000 -0700
+++ mdx-2.1.0/bin/pp.ml 2022-09-15 15:58:24.650583246 -0600
@@ -62,8 +62,7 @@ let run (`Setup ()) (`File file) (`Secti
open Cmdliner
-let cmd =
- let doc = "Pre-process markdown files to produce OCaml code." in
- let exits = Term.default_exits in
- ( Term.(pure run $ Cli.setup $ Cli.file $ Cli.section),
- Term.info "pp" ~doc ~exits )
+let term = Term.(const run $ Cli.setup $ Cli.file $ Cli.section)
+let doc = "Pre-process markdown files to produce OCaml code."
+let info = Cmd.info "pp" ~doc
+let cmd = Cmd.v info term
--- mdx-2.1.0/bin/pp.mli.orig 2022-01-28 04:32:36.000000000 -0700
+++ mdx-2.1.0/bin/pp.mli 2022-09-15 15:58:49.602648845 -0600
@@ -14,6 +14,4 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*)
-open Cmdliner
-
-val cmd : int Term.t * Term.info
+val cmd : int Cmdliner.Cmd.t
--- mdx-2.1.0/bin/test/main.ml.orig 2022-01-28 04:32:36.000000000 -0700
+++ mdx-2.1.0/bin/test/main.ml 2022-09-15 16:01:07.227010752 -0600
@@ -73,16 +73,18 @@ let run setup non_deterministic silent_e
open Cmdliner
-let cmd =
- let exits = Term.default_exits in
+let term =
+ Term.(
+ const run $ Cli.setup $ Cli.non_deterministic $ Cli.silent_eval
+ $ Cli.record_backtrace $ Cli.syntax $ Cli.silent $ Cli.verbose_findlib
+ $ Cli.prelude $ Cli.prelude_str $ Cli.file $ Cli.section $ Cli.root
+ $ Cli.force_output $ Cli.output)
+
+let info =
let man = [] in
let doc = "Test markdown files." in
- ( Term.(
- pure run $ Cli.setup $ Cli.non_deterministic $ Cli.silent_eval
- $ Cli.record_backtrace $ Cli.syntax $ Cli.silent $ Cli.verbose_findlib
- $ Cli.prelude $ Cli.prelude_str $ Cli.file $ Cli.section $ Cli.root
- $ Cli.force_output $ Cli.output),
- Term.info "ocaml-mdx-test" ~version:"2.1.0" ~doc ~exits ~man )
+ Cmd.info "ocaml-mdx-test" ~version:"%%VERSION%%" ~doc ~man
-let main () = Term.(exit_status @@ eval cmd)
+let cmd = Cmd.v info term
+let main () = Stdlib.exit @@ Cmd.eval' cmd
let () = main ()
--- mdx-2.1.0/bin/test.ml.orig 2022-01-28 04:32:36.000000000 -0700
+++ mdx-2.1.0/bin/test.ml 2022-09-15 15:59:33.185763445 -0600
@@ -47,11 +47,12 @@ let run (`Setup ()) _ _ _ _ _ _ _ _ _ _
open Cmdliner
-let cmd : int Term.t * Term.info =
- let doc = "Test markdown files." in
- ( Term.(
- pure run $ Cli.setup $ Cli.non_deterministic $ Cli.silent_eval
- $ Cli.syntax $ Cli.silent $ Cli.verbose_findlib $ Cli.prelude
- $ Cli.prelude_str $ Cli.file $ Cli.section $ Cli.root $ Cli.force_output
- $ Cli.output),
- Term.info "test" ~doc )
+let term =
+ Term.(
+ const run $ Cli.setup $ Cli.non_deterministic $ Cli.silent_eval $ Cli.syntax
+ $ Cli.silent $ Cli.verbose_findlib $ Cli.prelude $ Cli.prelude_str
+ $ Cli.file $ Cli.section $ Cli.root $ Cli.force_output $ Cli.output)
+
+let doc = "Test markdown files."
+let info = Cmd.info "test" ~doc
+let cmd = Cmd.v info term
--- mdx-2.1.0/bin/test.mli.orig 2022-01-28 04:32:36.000000000 -0700
+++ mdx-2.1.0/bin/test.mli 2022-09-15 15:59:52.369813894 -0600
@@ -14,6 +14,4 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*)
-open Cmdliner
-
-val cmd : int Term.t * Term.info
+val cmd : int Cmdliner.Cmd.t
--- mdx-2.1.0/dune-project.orig 2022-01-28 04:32:36.000000000 -0700
+++ mdx-2.1.0/dune-project 2022-09-15 16:01:29.339068903 -0600
@@ -30,7 +30,7 @@
astring
(logs (>= 0.7.0))
(cmdliner
- (>= 1.0.0))
+ (>= 1.1.0))
(re
(>= 1.7.2))
result
--- mdx-2.1.0/mdx.opam.orig 2022-01-28 04:32:36.000000000 -0700
+++ mdx-2.1.0/mdx.opam 2022-09-15 16:01:49.291121378 -0600
@@ -27,7 +27,7 @@ depends: [
"csexp" {>= "1.3.2"}
"astring"
"logs" {>= "0.7.0"}
- "cmdliner" {>= "1.0.0"}
+ "cmdliner" {>= "1.1.0"}
"re" {>= "1.7.2"}
"result"
"ocaml-version" {>= "2.3.0"}
@@ -50,4 +50,4 @@ build: [
"@doc" {with-doc}
]
]
-dev-repo: "git+https://github.com/realworldocaml/mdx.git"
\ No newline at end of file
+dev-repo: "git+https://github.com/realworldocaml/mdx.git"
--- mdx-2.1.0/test/bin/gen_rule_helpers/gen_rule_helpers.ml.orig 2022-01-28 04:32:36.000000000 -0700
+++ mdx-2.1.0/test/bin/gen_rule_helpers/gen_rule_helpers.ml 2022-09-15 16:06:04.275791867 -0600
@@ -144,16 +144,19 @@ let run generator =
let cmds =
Term.
[
- (const (rule_gen generator `Test_expect) $ const (), info "test_expect");
- ( const (rule_gen generator `Test_failure) $ const (),
- info "test_failure" );
+ (let term = const (rule_gen generator `Test_expect) $ const () in
+ let info = Cmd.info "test_expect" in
+ Cmd.v info term);
+ (let term = const (rule_gen generator `Test_failure) $ const () in
+ let info = Cmd.info "test_failure" in
+ Cmd.v info term);
]
in
- let default =
+ let info =
let doc = "Generate dune files for the binary tests." in
- let exits = Term.default_exits in
let man = [] in
- Term.
- (ret (const (`Help (`Auto, None))), info "gen_dune_rules" ~doc ~exits ~man)
+ Cmd.info "gen_dune_rules" ~doc ~man
in
- Term.exit (Term.eval_choice default cmds)
+ let default = Term.(ret (const (`Help (`Auto, None)))) in
+ let group = Cmd.group ~default info cmds in
+ Stdlib.exit @@ Cmd.eval group
--- mdx-2.1.0/test/bin/mdx-test/misc/no-such-file/test.expected.orig 2022-01-28 04:32:36.000000000 -0700
+++ mdx-2.1.0/test/bin/mdx-test/misc/no-such-file/test.expected 2022-02-10 21:19:58.145280205 -0700
@@ -1,3 +1,3 @@
-ocaml-mdx: FILE argument: no `foo' file
-Usage: ocaml-mdx test [OPTION]... FILE
-Try `ocaml-mdx test --help' or `ocaml-mdx --help' for more information.
+ocaml-mdx: FILE argument: no 'foo' file
+Usage: ocaml-mdx test [OPTION]… FILE
+Try 'ocaml-mdx test --help' or 'ocaml-mdx --help' for more information.
--- mdx-2.1.0/test/bin/mdx-test/misc/no-such-prelude/test.expected.orig 2022-01-28 04:32:36.000000000 -0700
+++ mdx-2.1.0/test/bin/mdx-test/misc/no-such-prelude/test.expected 2022-02-10 21:20:38.128323836 -0700
@@ -1,3 +1,3 @@
-ocaml-mdx: option `--prelude': no `foo' file
-Usage: ocaml-mdx test [OPTION]... FILE
-Try `ocaml-mdx test --help' or `ocaml-mdx --help' for more information.
+ocaml-mdx: option '--prelude': no 'foo' file
+Usage: ocaml-mdx test [OPTION]… FILE
+Try 'ocaml-mdx test --help' or 'ocaml-mdx --help' for more information.

View File

@ -5,18 +5,13 @@
%endif
Name: ocaml-mdx
Version: 2.1.0
Release: 7%{?dist}
Version: 2.2.0
Release: 1%{?dist}
Summary: Executable code blocks inside markdown files
License: ISC
URL: https://realworldocaml.github.io/mdx/
Source0: https://github.com/realworldocaml/mdx/releases/download/%{version}/mdx-%{version}.tbz
# Update to cmdliner 1.1.0. See:
# https://github.com/realworldocaml/mdx/commit/18481d8a48204b95ce66c0ce88cec416530fc6f5
# https://github.com/realworldocaml/mdx/commit/85654df98e3a1f5821a22f12836555b47ea2ed93
# https://github.com/realworldocaml/mdx/commit/b714cb6a9357d119185753bc59108e169d8bf246
Patch0: %{name}-cmdliner.patch
BuildRequires: ocaml >= 4.08.0
BuildRequires: ocaml-alcotest-devel
@ -24,14 +19,13 @@ BuildRequires: ocaml-astring-devel
BuildRequires: ocaml-cmdliner-devel >= 1.1.0
BuildRequires: ocaml-cppo >= 1.1.0
BuildRequires: ocaml-csexp-devel >= 1.3.2
BuildRequires: ocaml-dune >= 2.7
BuildRequires: ocaml-dune >= 3.5
BuildRequires: ocaml-fmt-devel >= 0.8.7
BuildRequires: ocaml-findlib
BuildRequires: ocaml-logs-devel >= 0.7.0
BuildRequires: ocaml-lwt-devel
BuildRequires: ocaml-odoc-parser-devel >= 1.0.0
BuildRequires: ocaml-re-devel >= 1.7.2
BuildRequires: ocaml-result-devel
BuildRequires: ocaml-version-devel >= 2.3.0
%description
@ -60,7 +54,6 @@ Requires: ocaml-fmt-devel%{?_isa}
Requires: ocaml-logs-devel%{?_isa}
Requires: ocaml-odoc-parser-devel%{?_isa}
Requires: ocaml-re-devel%{?_isa}
Requires: ocaml-result-devel%{?_isa}
Requires: ocaml-version-devel%{?_isa}
%description devel
@ -70,9 +63,6 @@ files for developing applications that use %{name}.
%prep
%autosetup -n mdx-%{version} -p1
# Adapt to grep 3.8
sed -i 's/egrep/grep -E/' test/bin/mdx-test/expect/padding/test-case.md
%build
%dune_build
@ -89,6 +79,10 @@ sed -i 's/egrep/grep -E/' test/bin/mdx-test/expect/padding/test-case.md
%files devel -f .ofiles-devel
%changelog
* Mon Jan 9 2023 Jerry James <loganjerry@gmail.com> - 2.2.0-1
- Version 2.2.0
- Drop cmdliner patch
* Tue Sep 20 2022 Jerry James <loganjerry@gmail.com> - 2.1.0-7
- Add patch to adapt tests to cmdliner 1.1.0

View File

@ -1 +1 @@
SHA512 (mdx-2.1.0.tbz) = 05e86a3a4513299433583b8c7cd482edfc513b08002825ae8ec390e537139eb7dd7b9131679d181e62147f9ff0d1814a1936d2e2983fc7530dcb85e347d4b603
SHA512 (mdx-2.2.0.tbz) = 1cbbeb7889d0931189c7fc22fe90310ae6c49b9f8a56cbd131e6e1a5045383c4d075f4acb9b60501dfe59c66e4f9ac02b5a07ed5fba6fce9d1ce9ea01e59a1c0