From fbb4827f888b3ab4404508f002f34927a329e7c6f0abc48d8426c2dd4a5acf03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20S=C3=BAkup?= Date: Sun, 17 Jul 2016 00:06:36 +0000 Subject: [PATCH] Accepting request 410591 from devel:languages:haskell:lts:6 See https://lists.opensuse.org/opensuse-haskell/2016-07/msg00000.html for details. OBS-URL: https://build.opensuse.org/request/show/410591 OBS-URL: https://build.opensuse.org/package/show/devel:languages:haskell/ghc-scientific?expand=0&rev=22 --- ghc-scientific.changes | 5 +++ ghc-scientific.spec | 88 +++++++++++++++++++++++++++++++----------- 2 files changed, 70 insertions(+), 23 deletions(-) diff --git a/ghc-scientific.changes b/ghc-scientific.changes index ca6b481..cffc0c8 100644 --- a/ghc-scientific.changes +++ b/ghc-scientific.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Sun Jul 10 16:58:33 UTC 2016 - psimons@suse.com + +- Update to version 0.3.4.8 revision 0 with cabal2obs. + ------------------------------------------------------------------- Sun Jul 3 12:33:17 UTC 2016 - mimi.vx@gmail.com diff --git a/ghc-scientific.spec b/ghc-scientific.spec index d00ccf1..a46502e 100644 --- a/ghc-scientific.spec +++ b/ghc-scientific.spec @@ -17,66 +17,108 @@ %global pkg_name scientific - -Name: ghc-scientific +%bcond_with tests +Name: ghc-%{pkg_name} Version: 0.3.4.8 Release: 0 Summary: Numbers represented using scientific notation License: BSD-3-Clause Group: System/Libraries - -Url: http://hackage.haskell.org/package/%{pkg_name} -Source0: http://hackage.haskell.org/package/%{pkg_name}-%{version}/%{pkg_name}-%{version}.tar.gz -BuildRoot: %{_tmppath}/%{name}-%{version}-build - -BuildRequires: fdupes +Url: https://hackage.haskell.org/package/%{pkg_name} +Source0: https://hackage.haskell.org/package/%{pkg_name}-%{version}/%{pkg_name}-%{version}.tar.gz BuildRequires: ghc-Cabal-devel -BuildRequires: ghc-array-devel +# Begin cabal-rpm deps: +BuildRequires: ghc-binary-devel +BuildRequires: ghc-bytestring-devel +BuildRequires: ghc-containers-devel BuildRequires: ghc-deepseq-devel BuildRequires: ghc-hashable-devel BuildRequires: ghc-rpm-macros BuildRequires: ghc-text-devel BuildRequires: ghc-vector-devel +BuildRoot: %{_tmppath}/%{name}-%{version}-build +%if %{with tests} +BuildRequires: ghc-QuickCheck-devel +BuildRequires: ghc-smallcheck-devel +BuildRequires: ghc-tasty-ant-xml-devel +BuildRequires: ghc-tasty-devel +BuildRequires: ghc-tasty-hunit-devel +BuildRequires: ghc-tasty-quickcheck-devel +BuildRequires: ghc-tasty-smallcheck-devel +%endif +# End cabal-rpm deps %description -Data.Scientific provides a space efficient and arbitrary precision scientific -number type. +'Data.Scientific' provides the number type 'Scientific'. Scientific numbers are +arbitrary precision and space efficient. They are represented using +. +The implementation uses a coefficient 'c :: 'Integer'' and a base-10 exponent +'e :: 'Int''. A scientific number corresponds to the 'Fractional' number: +''fromInteger' c * 10 '^^' e'. -This package provides the Haskell %{pkg_name} libraries. +Note that since we're using an 'Int' to represent the exponent these numbers +aren't truly arbitrary precision. I intend to change the type of the exponent +to 'Integer' in a future release. -%package -n ghc-%{pkg_name}-devel +The main application of 'Scientific' is to be used as the target of parsing +arbitrary precision numbers coming from an untrusted source. The advantages +over using 'Rational' for this are that: + +* A 'Scientific' is more efficient to construct. Rational numbers need to be +constructed using '%' which has to compute the 'gcd' of the 'numerator' and +'denominator'. + +* 'Scientific' is safe against numbers with huge exponents. For example: +'1e1000000000 :: 'Rational'' will fill up all space and crash your program. +Scientific works as expected: + +> > read "1e1000000000" :: Scientific > 1.0e1000000000 + +* Also, the space usage of converting scientific numbers with huge exponents to +''Integral's' (like: 'Int') or ''RealFloat's' (like: 'Double' or 'Float') will +always be bounded by the target type. + +%package devel Summary: Haskell %{pkg_name} library development files Group: Development/Libraries/Other -Provides: %{name}-static = %{version}-%{release} Requires: %{name} = %{version}-%{release} Requires: ghc-compiler = %{ghc_version} +Requires(post): ghc-compiler = %{ghc_version} +Requires(postun): ghc-compiler = %{ghc_version} -%description -n ghc-%{pkg_name}-devel -Data.Scientific provides a space efficient and arbitrary precision scientific -number type. - +%description devel This package provides the Haskell %{pkg_name} library development files. %prep %setup -q -n %{pkg_name}-%{version} + %build %ghc_lib_build + %install %ghc_lib_install -%post -n ghc-%{pkg_name}-devel + +%check +%if %{with tests} +%{cabal} test +%endif + + +%post devel %ghc_pkg_recache -%postun -n ghc-%{pkg_name}-devel +%postun devel %ghc_pkg_recache -%files -f ghc-%{pkg_name}.files -%defattr(-,root,root) +%files -f %{name}.files +%defattr(-,root,root,-) %doc LICENSE -%files -n ghc-%{pkg_name}-devel -f ghc-%{pkg_name}-devel.files +%files devel -f %{name}-devel.files %defattr(-,root,root,-) +%doc changelog %changelog