Update to 1.3.1 plus fixes from git (bz 1446352). Add -stag patch.

This commit is contained in:
Jerry James 2019-08-01 15:56:10 -06:00
parent 76fb1e138f
commit 7333ed6694
4 changed files with 164 additions and 41 deletions

2
.gitignore vendored
View File

@ -1 +1 @@
/easy-format-1.0.2.tar.gz
/easy-format-*.tar.gz

View File

@ -0,0 +1,109 @@
--- src/easy_format.ml.orig 2019-06-28 17:07:03.000000000 -0600
+++ src/easy_format.ml 2019-07-31 13:34:20.943340446 -0600
@@ -24,7 +24,7 @@ type label_break = [
| `Never
]
-type style_name = string
+type style_name = stag
type style = {
tag_open : string;
tag_close : string
@@ -193,25 +193,25 @@ struct
let rewrite x = propagate_forced_breaks x
(*
- Relies on the fact that mark_open_tag and mark_close_tag
+ Relies on the fact that mark_open_stag and mark_close_stag
are called exactly once before calling pp_output_string once.
It's a reasonable assumption although not guaranteed by the
documentation of the Format module.
*)
let set_escape fmt escape =
let print0, flush0 = pp_get_formatter_output_functions fmt () in
- let tagf0 = pp_get_formatter_tag_functions fmt () in
+ let tagf0 = pp_get_formatter_stag_functions fmt () in
let is_tag = ref false in
let mot tag =
is_tag := true;
- tagf0.mark_open_tag tag
+ tagf0.mark_open_stag tag
in
let mct tag =
is_tag := true;
- tagf0.mark_close_tag tag
+ tagf0.mark_close_stag tag
in
let print s p n =
@@ -224,12 +224,12 @@ struct
let tagf = {
tagf0 with
- mark_open_tag = mot;
- mark_close_tag = mct
+ mark_open_stag = mot;
+ mark_close_stag = mct
}
in
pp_set_formatter_output_functions fmt print flush0;
- pp_set_formatter_tag_functions fmt tagf
+ pp_set_formatter_stag_functions fmt tagf
let set_escape_string fmt esc =
@@ -261,12 +261,12 @@ struct
in
let tagf = {
- (pp_get_formatter_tag_functions fmt ()) with
- mark_open_tag = mark_open_tag;
- mark_close_tag = mark_close_tag
+ (pp_get_formatter_stag_functions fmt ()) with
+ mark_open_stag = mark_open_tag;
+ mark_close_stag = mark_close_tag
}
in
- pp_set_formatter_tag_functions fmt tagf
+ pp_set_formatter_stag_functions fmt tagf
);
(match escape with
@@ -319,19 +319,19 @@ struct
let open_tag fmt = function
None -> ()
- | Some s -> pp_open_tag fmt s
+ | Some s -> pp_open_stag fmt s
let close_tag fmt = function
None -> ()
- | Some _ -> pp_close_tag fmt ()
+ | Some _ -> pp_close_stag fmt ()
let tag_string fmt o s =
match o with
None -> pp_print_string fmt s
| Some tag ->
- pp_open_tag fmt tag;
+ pp_open_stag fmt tag;
pp_print_string fmt s;
- pp_close_tag fmt ()
+ pp_close_stag fmt ()
let rec fprint_t fmt = function
Atom (s, p) ->
--- src/easy_format.mli.orig 2019-06-28 17:07:03.000000000 -0600
+++ src/easy_format.mli 2019-07-31 13:37:55.536878786 -0600
@@ -53,7 +53,7 @@ type label_break = [
- [Never]: never break after the label
*)
-type style_name = string
+type style_name = Format.stag
type style = {
tag_open : string;

View File

@ -1,23 +1,34 @@
%global opt %(test -x %{_bindir}/ocamlopt && echo 1 || echo 0)
%if !%{opt}
%ifnarch %{ocaml_native_compiler}
%global debug_package %{nil}
%endif
Name: ocaml-easy-format
Version: 1.0.2
Release: 32%{?dist}
%global libname easy-format
# After the release of version 1.3.1, changes were checked in that convert
# the build system from jbuilder to dune, and some errors that lead to FTBFS
# were also fixed. Then upstream announced that the project is unmaintained,
# so there will be no new releases with these fixes until a maintainer appears.
# Therefore, we checkout the last git commit.
%global gitdate 20190628
%global commit 76420c5d34448dfca79d47b23bc7cbd7ee5b4bac
%global shortcommit %(c=%{commit}; echo ${c:0:7})
Name: ocaml-%{libname}
Version: 1.3.1
Release: 1.%{gitdate}.%{shortcommit}%{?dist}
Summary: High-level and functional interface to the Format module
License: BSD
URL: http://mjambon.com/easy-format.html
Source0: http://mjambon.com/releases/easy-format/easy-format-%{version}.tar.gz
URL: https://github.com/mjambon/easy-format
Source0: https://github.com/mjambon/easy-format/archive/%{commit}/%{libname}-%{shortcommit}.tar.gz
# Convert from the deprecated tag functions to the stag functions
Patch0: %{name}-stag.patch
BuildRequires: ocaml >= 3.10.0
BuildRequires: ocaml >= 4.02.3
BuildRequires: ocaml-dune
BuildRequires: ocaml-findlib
BuildRequires: ocaml-ocamldoc
%global libname %(sed -e 's/^ocaml-//' <<< %{name})
%description
This module offers a high-level and functional interface to the Format
module of the OCaml standard library. It is a pretty-printing
@ -48,54 +59,57 @@ developing applications that use %{name}.
%prep
%setup -q -n %{libname}-%{version}
sed -i.add-debuginfo 's/ocamlopt/ocamlopt -g/;s/ocamlc \(-[co]\)/ocamlc -g \1/' Makefile
%autosetup -p0 -n %{libname}-%{commit}
%build
# not thread safe - intermittent build failures as per 1.0.2
# see http://www.cmake.org/pipermail/cmake/2010-January/034746.html
# for similar problem
%global _smp_mflags %{nil}
%if %opt
make %{?_smp_mflags}
%else
make %{?_smp_mflags} all
%endif
dune build %{?_smp_mflags}
%install
# These rules work if the library uses 'ocamlfind install' to install itself.
export DESTDIR=$RPM_BUILD_ROOT
export OCAMLFIND_DESTDIR=$RPM_BUILD_ROOT%{_libdir}/ocaml
mkdir -p $OCAMLFIND_DESTDIR
make install
DESTDIR=%{buildroot} dune install
# Fix permissions
chmod 755 %{buildroot}%{_libdir}/ocaml/%{libname}/*.cmxs
# Delete files we do not want or that are in the wrong place
rm -f %{buildroot}%{_libdir}/ocaml/%{libname}/*.ml
rm -fr %{buildroot}%{_prefix}/doc
%check
make test
dune runtest
%files
%doc LICENSE
%{_libdir}/ocaml/%{libname}/
%if %opt
%exclude %{_libdir}/ocaml/*/*.cmx
%exclude %{_libdir}/ocaml/*/*.o
%endif
%exclude %{_libdir}/ocaml/*/*.mli
%license LICENSE
%doc README.md
%dir %{_libdir}/ocaml/%{libname}/
%{_libdir}/ocaml/%{libname}/META
%{_libdir}/ocaml/%{libname}/*.cmi
%{_libdir}/ocaml/%{libname}/*.cmt
%{_libdir}/ocaml/%{libname}/*.cmti
%{_libdir}/ocaml/%{libname}/*.cmxs
%files devel
%doc LICENSE README.md Changes
%if %opt
%{_libdir}/ocaml/*/*.cmx
%{_libdir}/ocaml/*/*.o
%doc Changes
%{_libdir}/ocaml/%{libname}/dune-package
%{_libdir}/ocaml/%{libname}/opam
%{_libdir}/ocaml/%{libname}/*.a
%{_libdir}/ocaml/%{libname}/*.cma
%ifarch %{ocaml_native_compiler}
%{_libdir}/ocaml/%{libname}/*.cmx
%{_libdir}/ocaml/%{libname}/*.cmxa
%endif
%{_libdir}/ocaml/*/*.mli
%{_libdir}/ocaml/%{libname}/*.mli
%changelog
* Thu Aug 1 2019 Jerry James <loganjerry@gmail.com> - 1.3.1-1.20190628.76420c5
- Update to 1.3.1 plus fixes from git (bz 1446352)
- Add -stag patch
* Wed Jul 31 2019 Richard W.M. Jones <rjones@redhat.com> - 1.0.2-32
- OCaml 4.08.1 (rc2) rebuild.

View File

@ -1 +1 @@
82f6db85477831cab11e4cfe80321225 easy-format-1.0.2.tar.gz
SHA512 (easy-format-76420c5.tar.gz) = e8faece3e35234c007e71366bb1fa75422871625dc5ae34110e2ddf9e954ae98c22e3614785f3dbd4f4c7a51c76cd0f30c606a1d97e44c2380ffb5b1aad8f32e