From aa4be47c15fda732034b4942c229913c6241ea11 Mon Sep 17 00:00:00 2001 From: Michel Alexandre Salim Date: Feb 11 2014 17:03:14 +0000 Subject: Initial import --- diff --git a/.gitignore b/.gitignore index e69de29..2e2a57c 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +/xmlm-1.2.0.tbz diff --git a/ocaml-xmlm.spec b/ocaml-xmlm.spec new file mode 100644 index 0000000..d79e48f --- /dev/null +++ b/ocaml-xmlm.spec @@ -0,0 +1,109 @@ +%global opt %(test -x %{_bindir}/ocamlopt && echo 1 || echo 0) +%if !%{opt} +%global debug_package %{nil} +%endif + +Name: ocaml-xmlm +Version: 1.2.0 +Release: 2%{?dist} +Summary: A streaming XML codec + +License: BSD +URL: http://erratique.ch/software/xmlm +Source0: http://erratique.ch/software/xmlm/releases/xmlm-%{version}.tbz +# Example XML files for testing +Source1: test-valid.xml +Source2: test-invalid.xml + +ExclusiveArch: %{ocaml_arches} + +BuildRequires: ocaml >= 3.10.0 +BuildRequires: ocaml-findlib + +%global libname %(sed -e 's/^ocaml-//' <<< %{name}) + +%description +Xmlm is an OCaml streaming codec to decode and encode the XML data +format. It can process XML documents without a complete in-memory +representation of the data. + + +%package devel +Summary: Development files for %{name} +Requires: %{name}%{?_isa} = %{version}-%{release} + +%description devel +The %{name}-devel package contains libraries and signature files for +developing applications that use %{name}. + + +%prep +%setup -q -n %{libname}-%{version} + + +%build +%if %{opt} +./pkg/build true +%else +./pkg/build false +%endif + + +%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 $RPM_BUILD_ROOT%{_bindir} +mkdir -p $OCAMLFIND_DESTDIR/%{libname} + +%if %{opt} +install -m 755 -p _build/test/xmltrip.native $RPM_BUILD_ROOT%{_bindir}/xmltrip +install -m 644 -p _build/src/xmlm.{a,cmxa} $OCAMLFIND_DESTDIR/%{libname}/ +install -m 755 -p _build/src/xmlm.cmxs $OCAMLFIND_DESTDIR/%{libname}/ +%else +install -m 755 -p _build/test/xmltrip.byte $RPM_BUILD_ROOT%{_bindir}/xmltrip +%endif +install -m 644 -p _build/pkg/META _build/src/xmlm.{cm?,mli} $OCAMLFIND_DESTDIR/%{libname}/ + + +%check +# Against valid XML +$RPM_BUILD_ROOT%{_bindir}/xmltrip -p %{SOURCE1} 2>valid-err.log +[ -z "$(cat valid-err.log)" ] + +# Against invalid XML - stderr should contain the word expected +$RPM_BUILD_ROOT%{_bindir}/xmltrip -p %{SOURCE2} 2>invalid-err.log +grep expected invalid-err.log >/dev/null + +%files +# LICENSE not bundled +%doc README.md +%{_bindir}/xmltrip +%{_libdir}/ocaml/xmlm/ +%if %opt +%exclude %{_libdir}/ocaml/*/*.a +%exclude %{_libdir}/ocaml/*/*.cmxa +%exclude %{_libdir}/ocaml/*/*.cmxs +%exclude %{_libdir}/ocaml/*/*.cmx +%endif +%exclude %{_libdir}/ocaml/*/*.mli + + +%files devel +# LICENSE not bundled +%doc CHANGES.md _build/test/examples.ml _build/test/xhtml.ml doc +%if %opt +%{_libdir}/ocaml/*/*.a +%{_libdir}/ocaml/*/*.cmxa +%{_libdir}/ocaml/*/*.cmxs +%{_libdir}/ocaml/*/*.cmx +%endif +%{_libdir}/ocaml/*/*.mli + + +%changelog +* Sat Feb 8 2014 Michel Salim - 1.2.0-2 +- Incorporate review feedback + +* Mon Jan 20 2014 Michel Salim - 1.2.0-1 +- Initial package diff --git a/sources b/sources index e69de29..a0bdd26 100644 --- a/sources +++ b/sources @@ -0,0 +1 @@ +7e6d3363c2395d84274f1b480e4b6003 xmlm-1.2.0.tbz diff --git a/test-invalid.xml b/test-invalid.xml new file mode 100644 index 0000000..7dd00b2 --- /dev/null +++ b/test-invalid.xml @@ -0,0 +1,4 @@ + + + + diff --git a/test-valid.xml b/test-valid.xml new file mode 100644 index 0000000..2315e37 --- /dev/null +++ b/test-valid.xml @@ -0,0 +1,4 @@ + + + +