Blob Blame History Raw
# The latest release, 1.4.1, is incompatible with ocaml 4.09 and the latest
# version of ocaml-migrate-parsetree.  Furthermore, the license has changed in
# git.  Until the next release, we check out from git.
%global gittag   b2661bf40d9c53f5adef382423faa00c3d59cf65
%global shorttag %(cut -b -7 <<< %{gittag})
%global gitdate  20200106

%ifnarch %{ocaml_native_compiler}
%global debug_package %{nil}
%endif

%global srcname bisect-ppx
%global upname  bisect_ppx

# Running the tests requires ocaml-ounit, which introduces a circular
# dependency (also involving ocaml-lwt).  By disabling the tests we
# can break this cycle.
%bcond_with tests

Name:           ocaml-%{srcname}
Version:        1.4.1
Release:        4.%{gitdate}.%{shorttag}%{?dist}.1
Summary:        Code coverage for OCaml and Reason

License:        MIT
URL:            http://aantron.github.io/bisect_ppx/
Source0:        https://github.com/aantron/%{upname}/archive/%{gittag}/%{upname}-%{shorttag}.tar.gz

BuildRequires:  git-core
BuildRequires:  ocaml >= 4.02.0
BuildRequires:  ocaml-cmdliner-devel >= 1.0.0
BuildRequires:  ocaml-dune
BuildRequires:  ocaml-findlib
BuildRequires:  ocaml-migrate-parsetree-devel >= 1.4.0
BuildRequires:  ocaml-ocamldoc
%if %{with tests}
BuildRequires:  ocaml-ounit-devel
%endif
BuildRequires:  ocaml-ppx-derivers-devel
BuildRequires:  ocaml-ppx-tools-versioned-devel >= 5.2.3
BuildRequires:  ocaml-result-devel

%description
Bisect_ppx is a code coverage tool for OCaml.  It helps you test
thoroughly by showing which parts of your code are *not* tested.  It is
a small preprocessor that inserts instrumentation at places in your
code, such as if-then-else and match expressions.  After you run tests,
Bisect_ppx gives a nice HTML report showing which places were visited
and which were missed.

Usage is simple - add package bisect_ppx when building tests, run your
tests, then run the Bisect_ppx report tool on the generated visitation
files.

%package        devel
Summary:        Development files for %{name}
Requires:       %{name}%{?_isa} = %{version}-%{release}
Requires:       ocaml-migrate-parsetree-devel%{?_isa}
Requires:       ocaml-ppx-derivers-devel%{?_isa}
Requires:       ocaml-ppx-tools-versioned-devel%{?_isa}

%description    devel
The %{name}-devel package contains libraries and signature files for
developing applications that use %{name}.

%prep
%autosetup -n %{upname}-%{gittag}

%build
dune build %{?_smp_mflags}

# The dune rule for building documentation requires odoc.  However, odoc
# transitively depends on this package, so we build documentation manually.
mkdir html
ocamldoc -html -d html \
  -I _build/default/src/report/.report.eobjs/byte \
  -I +ppx_tools_versioned \
  _build/default/src/common/*.mli \
  _build/default/src/runtime/native/*.mli \
  _build/default/src/ppx/{exclude,exclusions,instrument}.mli \
  _build/default/src/report/*.mli

%install
dune install --destdir=%{buildroot}

# Install the man page
mkdir -p %{buildroot}%{_mandir}/man1
_build/install/default/bin/bisect-ppx-report --help groff > \
  %{buildroot}%{_mandir}/man1/bisect-ppx-report.1

# We install the documentation with the doc macro
rm -fr %{buildroot}%{_prefix}/doc

%ifarch %{ocaml_native_compiler}
# Add missing executable bits
find %{buildroot}%{_libdir}/ocaml -name \*.cmxs -exec chmod 0755 {} \+
%endif

%if %{with tests}
%check
make test
%endif

%files
%doc doc/advanced.md doc/CHANGES README.md
%license LICENSE.md
%{_bindir}/bisect-ppx-report
%{_mandir}/man1/bisect-ppx-report.1*
%dir %{_libdir}/ocaml/%{upname}/
%dir %{_libdir}/ocaml/%{upname}/common/
%dir %{_libdir}/ocaml/%{upname}/runtime/
%{_libdir}/ocaml/%{upname}/META
%{_libdir}/ocaml/%{upname}/ppx.exe
%{_libdir}/ocaml/%{upname}/%{upname}.cma
%{_libdir}/ocaml/%{upname}/%{upname}*.cmi
%{_libdir}/ocaml/%{upname}/common/bisect_common.cma
%{_libdir}/ocaml/%{upname}/common/bisect_common.cmi
%{_libdir}/ocaml/%{upname}/runtime/bisect.cma
%{_libdir}/ocaml/%{upname}/runtime/bisect*.cmi
%ifarch %{ocaml_native_compiler}
%{_libdir}/ocaml/%{upname}/%{upname}.cmxs
%{_libdir}/ocaml/%{upname}/common/bisect_common.cmxs
%{_libdir}/ocaml/%{upname}/runtime/bisect.cmxs
%endif

%files devel
%doc html
%{_libdir}/ocaml/%{upname}/dune-package
%{_libdir}/ocaml/%{upname}/opam
%ifarch %{ocaml_native_compiler}
%{_libdir}/ocaml/%{upname}/%{upname}.a
%{_libdir}/ocaml/%{upname}/%{upname}*.cmx
%{_libdir}/ocaml/%{upname}/%{upname}.cmxa
%{_libdir}/ocaml/%{upname}/common/bisect_common.a
%{_libdir}/ocaml/%{upname}/common/bisect_common.cmx
%{_libdir}/ocaml/%{upname}/common/bisect_common.cmxa
%{_libdir}/ocaml/%{upname}/runtime/bisect.a
%{_libdir}/ocaml/%{upname}/runtime/bisect*.cmx
%{_libdir}/ocaml/%{upname}/runtime/bisect.cmxa
%endif
%{_libdir}/ocaml/%{upname}/%{upname}*.cmt
%{_libdir}/ocaml/%{upname}/%{upname}*.cmti
%{_libdir}/ocaml/%{upname}/*.ml
%{_libdir}/ocaml/%{upname}/*.mli
%{_libdir}/ocaml/%{upname}/common/bisect_common.cmt
%{_libdir}/ocaml/%{upname}/common/bisect_common.cmti
%{_libdir}/ocaml/%{upname}/common/bisect_common.ml
%{_libdir}/ocaml/%{upname}/common/bisect_common.mli
%{_libdir}/ocaml/%{upname}/runtime/bisect*.cmt
%{_libdir}/ocaml/%{upname}/runtime/bisect*.cmti
%{_libdir}/ocaml/%{upname}/runtime/*.ml
%{_libdir}/ocaml/%{upname}/runtime/*.mli

%changelog
* Fri Feb 28 2020 Richard W.M. Jones <rjones@redhat.com> - 1.4.1-4.20200106.b2661bf.1
- OCaml 4.10.0 final (Fedora 32).

* Wed Feb 26 2020 Richard W.M. Jones <rjones@redhat.com> - 1.4.1-4.20200106.b2661bf
- OCaml 4.10.0 final.
- Disable the tests to avoid circular dependency.

* Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.4.1-3.20200106.b2661bf
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild

* Sun Jan 19 2020 Richard W.M. Jones <rjones@redhat.com> - 1.4.1-2.20200106.b2661bf
- OCaml 4.10.0+beta1 rebuild.

* Wed Jan  8 2020 Jerry James <loganjerry@gmail.com> - 1.4.1-1.20200106.b2661bf
- Initial RPM