summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatoro <matoro@users.noreply.github.com>2022-09-13 21:55:50 -0400
committerJakov Smolić <jsmolic@gentoo.org>2022-10-06 08:07:04 +0200
commit99f4150d9fb5cc0c62cb533895d240e4176003ce (patch)
treea456edbd14a8129f8aaad4a6b5197c1fd59558bb /dev-haskell/time-compat
parentdev-haskell/text-short: keyword 0.1.5 for ~riscv (diff)
downloadgentoo-99f4150d9fb5cc0c62cb533895d240e4176003ce.tar.gz
gentoo-99f4150d9fb5cc0c62cb533895d240e4176003ce.tar.bz2
gentoo-99f4150d9fb5cc0c62cb533895d240e4176003ce.zip
dev-haskell/time-compat: keyword 1.9.6.1 for ~riscv
See: https://github.com/haskellari/time-compat/pull/33 Signed-off-by: Jakov Smolić <jsmolic@gentoo.org>
Diffstat (limited to 'dev-haskell/time-compat')
-rw-r--r--dev-haskell/time-compat/files/fix-resolution-test.patch49
-rw-r--r--dev-haskell/time-compat/time-compat-1.9.6.1.ebuild4
2 files changed, 52 insertions, 1 deletions
diff --git a/dev-haskell/time-compat/files/fix-resolution-test.patch b/dev-haskell/time-compat/files/fix-resolution-test.patch
new file mode 100644
index 000000000000..918bd488dbc9
--- /dev/null
+++ b/dev-haskell/time-compat/files/fix-resolution-test.patch
@@ -0,0 +1,49 @@
+https://github.com/haskellari/time-compat/pull/33
+
+From 9f7aa0a5937b800402359c3e82f4bee296ae8e06 Mon Sep 17 00:00:00 2001
+From: matoro <matoro@users.noreply.github.com>
+Date: Fri, 16 Sep 2022 11:19:20 -0400
+Subject: [PATCH] Backport 6516a35 "fix resolution test" from time
+
+The upstream version of time was incorrect in newer versions until
+https://github.com/haskell/time/commit/6516a35b3d8cad14a21a559a5d2fc22ddda32fcc.
+Because the compat implementation was correct and the upstream version
+of time is now logically identical, simply replace both versions with
+the current upstream time implementation.
+
+See https://github.com/haskellari/time-compat/issues/31 for details on
+which platforms the distinction matters. Does NOT close that issue
+though, because the original issue is for platforms on which the actual
+resolution is less precise than the expected, and this will only fix
+platforms on which the actual resolution is more precise.
+---
+ test/main/Test/Clock/Resolution.hs | 9 +++------
+ 1 file changed, 3 insertions(+), 6 deletions(-)
+
+diff --git a/test/main/Test/Clock/Resolution.hs b/test/main/Test/Clock/Resolution.hs
+index aab756b..4c0b1dd 100644
+--- a/test/main/Test/Clock/Resolution.hs
++++ b/test/main/Test/Clock/Resolution.hs
+@@ -25,7 +25,7 @@ gcdAll :: Real a => [a] -> a
+ gcdAll = foldr gcd' 0
+
+ testResolution :: (Show dt, Real dt) => String -> (at -> at -> dt) -> (dt, IO at) -> TestTree
+-testResolution name timeDiff (res, getTime) =
++testResolution name timeDiff (reportedRes, getTime) =
+ testCase name $ do
+ t0 <- getTime
+ times0 <-
+@@ -53,11 +53,8 @@ testResolution name timeDiff (res, getTime) =
+ threadDelay 1000 -- 1ms
+ getTime
+ let times = fmap (\t -> timeDiff t t0) $ times0 ++ times1 ++ times2 ++ times3 ++ times4
+-#if MIN_VERSION_time(1,8,0)
+- assertEqual "resolution" res $ gcdAll times
+-#else
+- assertBool ("resolution " ++ show (res, gcdAll times)) (res >= gcdAll times)
+-#endif
++ foundGrid = gcdAll times
++ assertBool ("resolution " ++ show (reportedRes, foundGrid)) (foundGrid <= reportedRes)
+
+ testResolutions :: TestTree
+ testResolutions =
diff --git a/dev-haskell/time-compat/time-compat-1.9.6.1.ebuild b/dev-haskell/time-compat/time-compat-1.9.6.1.ebuild
index 9c9036fee7e0..be1cc3bdd89b 100644
--- a/dev-haskell/time-compat/time-compat-1.9.6.1.ebuild
+++ b/dev-haskell/time-compat/time-compat-1.9.6.1.ebuild
@@ -16,7 +16,7 @@ SRC_URI="https://hackage.haskell.org/package/${P}/${P}.tar.gz
LICENSE="BSD"
SLOT="0/${PV}"
-KEYWORDS="~amd64 ~arm64 ~ppc64 ~x86"
+KEYWORDS="~amd64 ~arm64 ~ppc64 ~riscv ~x86"
RDEPEND=">=dev-haskell/base-orphans-0.8.4:=[profile?] <dev-haskell/base-orphans-0.9:=[profile?]
>=dev-haskell/hashable-1.3.2.0:=[profile?] <dev-haskell/hashable-1.5:=[profile?]
@@ -35,6 +35,8 @@ DEPEND="${RDEPEND}
"
BDEPEND="app-text/dos2unix"
+PATCHES=( "${FILESDIR}/fix-resolution-test.patch" )
+
src_prepare() {
# pull revised cabal from upstream
cp "${DISTDIR}/${PF}.cabal" "${S}/${PN}.cabal" || die