diff --git a/fileutils-0.5.2-fix-bytes.patch b/fileutils-0.5.2-fix-bytes.patch new file mode 100644 index 0000000..cd0011d --- /dev/null +++ b/fileutils-0.5.2-fix-bytes.patch @@ -0,0 +1,20 @@ +--- ocaml-fileutils-0.5.2.old/src/FileUtilCP.ml 2017-05-23 21:12:19.000000000 +0100 ++++ ocaml-fileutils-0.5.2/src/FileUtilCP.ml 2017-11-08 17:36:42.271524209 +0000 +@@ -138,7 +138,7 @@ + end + in + +- let buffer = String.make 1024 ' ' in ++ let buffer = Bytes.make 1024 ' ' in + + let cp_file st_src dst_exists fn_src fn_dst = + let mode = int_of_permission st_src.permission in +@@ -176,7 +176,7 @@ + try + while (read := + handle_exception +- (Unix.read fd_src buffer 0) (String.length buffer) ++ (Unix.read fd_src buffer 0) (Bytes.length buffer) + (fun e -> `ErrorRead(fn_src, e)); + !read <> 0) do + let written = diff --git a/ocaml-fileutils.spec b/ocaml-fileutils.spec index 9862385..1669dde 100644 --- a/ocaml-fileutils.spec +++ b/ocaml-fileutils.spec @@ -7,6 +7,8 @@ License: LGPLv2 with exceptions URL: https://forge.ocamlcore.org/projects/ocaml-fileutils/ Source0: http://forge.ocamlcore.org/frs/download.php/1695/ocaml-fileutils-0.5.2.tar.gz +Patch1: fileutils-0.5.2-fix-bytes.patch + BuildRequires: ocaml >= 4.00.1 BuildRequires: ocaml-findlib-devel >= 1.3.3-3 BuildRequires: ocaml-ocamldoc @@ -39,16 +41,17 @@ developing applications that use %{name}. %prep %setup -q - -# Disable the tests (RHEL 7 only) since they require ocaml-ounit. -%if 0%{?rhel} >= 7 -rm test/test.ml -touch test/test.ml -%endif +%autopatch -p1 %build -ocaml setup.ml -configure --prefix %{_prefix} --destdir $RPM_BUILD_ROOT +# Disable the tests (RHEL 7 only) since they require ocaml-ounit. +ocaml setup.ml -configure --prefix %{_prefix} --destdir $RPM_BUILD_ROOT \ +%if 0%{?rhel} >= 7 + --disable-tests +%else + --enable-tests +%endif make @@ -63,7 +66,9 @@ make htmldir=. install %check +%if ! 0%{?rhel} >= 7 make test +%endif %files