diff options
author | Michel Alexandre Salim <salimma@fedoraproject.org> | 2014-02-08 10:11:55 +0700 |
---|---|---|
committer | Michel Alexandre Salim <salimma@fedoraproject.org> | 2014-02-08 10:11:55 +0700 |
commit | 17d3a2aed0c36874be17a8e80c68eceac1653225 (patch) | |
tree | 12a7c5f92585555092aa8b838384d70ecdec4f83 | |
parent | 909231dcc8efa408ce462afd5efc27e2c37af219 (diff) | |
download | specs-17d3a2aed0c36874be17a8e80c68eceac1653225.tar.gz specs-17d3a2aed0c36874be17a8e80c68eceac1653225.tar.xz specs-17d3a2aed0c36874be17a8e80c68eceac1653225.zip |
ocaml-xmlm: with review feedbacks
-rw-r--r-- | ocaml/ocaml-xmlm.spec | 56 |
1 files changed, 40 insertions, 16 deletions
diff --git a/ocaml/ocaml-xmlm.spec b/ocaml/ocaml-xmlm.spec index 294372e..d79e48f 100644 --- a/ocaml/ocaml-xmlm.spec +++ b/ocaml/ocaml-xmlm.spec @@ -1,22 +1,26 @@ %global opt %(test -x %{_bindir}/ocamlopt && echo 1 || echo 0) +%if !%{opt} %global debug_package %{nil} -%global _use_internal_dependency_generator 0 -%global __find_requires /usr/lib/rpm/ocaml-find-requires.sh -%global __find_provides /usr/lib/rpm/ocaml-find-provides.sh -%define libname %(echo %{name} | sed -e 's/^ocaml-//') +%endif Name: ocaml-xmlm Version: 1.2.0 -Release: 1%{?dist} +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-devel -BuildRequires: ocaml-ocamldoc +BuildRequires: ocaml-findlib + +%global libname %(sed -e 's/^ocaml-//' <<< %{name}) %description Xmlm is an OCaml streaming codec to decode and encode the XML data @@ -26,7 +30,7 @@ representation of the data. %package devel Summary: Development files for %{name} -Requires: %{name} = %{version}-%{release} +Requires: %{name}%{?_isa} = %{version}-%{release} %description devel The %{name}-devel package contains libraries and signature files for @@ -34,36 +38,52 @@ developing applications that use %{name}. %prep -%setup -q -n xmlm-%{version} +%setup -q -n %{libname}-%{version} %build +%if %{opt} ./pkg/build true +%else +./pkg/build false +%endif %install -rm -rf $RPM_BUILD_ROOT # 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} -cp -p _build/test/xmltrip.native $RPM_BUILD_ROOT%{_bindir}/xmltrip -cp -p _build/pkg/META _build/src/xmlm.{a,cm*,mli} $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}/ + -strip $RPM_BUILD_ROOT%{_bindir}/xmltrip -strip $OCAMLFIND_DESTDIR/%{libname}/xmlm.cmxs +%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 LICENSE +%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 @@ -71,15 +91,19 @@ strip $OCAMLFIND_DESTDIR/%{libname}/xmlm.cmxs %files devel # LICENSE not bundled -%doc README.md CHANGES.md _build/test/examples.ml _build/test/xhtml.ml +%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 <salimma@fedoraproject.org> - 1.2.0-2 +- Incorporate review feedback + * Mon Jan 20 2014 Michel Salim <salimma@fedoraproject.org> - 1.2.0-1 - Initial package |