dev-haskell/hdbc: add 2.4.0.4

Signed-off-by: hololeap <hololeap@protonmail.com>
Signed-off-by: Sam James <sam@gentoo.org>
This commit is contained in:
hololeap
2023-10-02 23:07:44 -06:00
committed by Sam James
parent d47dcf8b1c
commit 35c2e685fb
4 changed files with 172 additions and 6 deletions

View File

@@ -1 +1,2 @@
DIST HDBC-2.4.0.3.tar.gz 23489 BLAKE2B 23de627666bc4a03c5f3ec93607641c539c1652a4fa9b798dbfd1f9c09ebcffc562bda88e45a522e38753177d69ee0585c9536ab6b6c353747373b751ead7f2a SHA512 394a74e69ff854e657f66f1fe25ff4d2de33bf4410d560454ec7a2cd3e383586acc34eb694a7d1d70005871240417ee32d4163af9e33978921bfbcfcfe23fe43
DIST hdbc-2.4.0.4.tar.gz 23756 BLAKE2B 5711f68c212194915895392139544c401981d46672f969fdc453deb01611826f536fefcc989edb1a723ccf9b385c6934d0f7102ded3d3fba17e494faad341a73 SHA512 16bdd35b8b2491ead171f4920133025ac6bc2cf47f8ea9c0ed684107ad576f757badeabc4e789f976948d96a47dafa638f907d9a534bce7bcd54b1d406fb001a

View File

@@ -0,0 +1,127 @@
From cea6c0ebde0c3c7a0a0976fd9a0e745ccad9dec4 Mon Sep 17 00:00:00 2001
From: hololeap <hololeap@users.noreply.github.com>
Date: Mon, 27 Feb 2023 07:54:10 -0700
Subject: [PATCH] Fix tests
Fix tests for modern 'time' and turn 'runtests' into a proper test
suite.
Signed-off-by: hololeap <hololeap@users.noreply.github.com>
---
HDBC.cabal | 40 +++++++++++++++++-----------------------
testsrc/TestSqlValue.hs | 16 +++++++++++++++-
2 files changed, 32 insertions(+), 24 deletions(-)
diff --git a/HDBC.cabal b/HDBC.cabal
index e189f9a..15d0c15 100644
--- a/HDBC.cabal
+++ b/HDBC.cabal
@@ -24,9 +24,6 @@ source-repository head
flag splitBase
description: Choose the new smaller, split-up base package.
-flag buildtests
- description: Build the executable to run unit tests
- default: False
flag minTime15
description: Use time 1.5 or higher.
default: True
@@ -59,28 +56,25 @@ library
FlexibleInstances, DeriveDataTypeable
Default-Language: Haskell2010
-Executable runtests
- if flag(buildtests)
- Buildable: True
- Build-Depends: HUnit, QuickCheck >= 2.0
+Test-Suite runtests
+ Build-Depends: HUnit, QuickCheck >= 2.0
- if flag(splitBase)
- Build-Depends: base>=3 && <5, old-time, bytestring, containers
- if flag(minTime15)
- Build-Depends: time >= 1.5 && < 1.14
- CPP-Options: -DMIN_TIME_15
- else
- Build-Depends: time >= 1.2 && < 1.5, old-locale
- else
- Build-Depends: base<3
- Build-Depends: mtl, convertible >= 1.1.0.0, utf8-string, text
-
- -- Hack for cabal-install weirdness. cabal-install forces base 3,
- -- though it works fine for Setup.lhs manually. Fix.
- if impl(ghc >= 6.9)
- build-depends: base >= 4
+ if flag(splitBase)
+ Build-Depends: base>=3 && <5, old-time, bytestring, containers
+ if flag(minTime15)
+ Build-Depends: time >= 1.5 && < 1.14
+ CPP-Options: -DMIN_TIME_15
+ else
+ Build-Depends: time >= 1.2 && < 1.5, old-locale
else
- Buildable: False
+ Build-Depends: base<3
+ Build-Depends: mtl, convertible >= 1.1.0.0, utf8-string, text
+
+ -- Hack for cabal-install weirdness. cabal-install forces base 3,
+ -- though it works fine for Setup.lhs manually. Fix.
+ if impl(ghc >= 6.9)
+ build-depends: base >= 4
+ Type: exitcode-stdio-1.0
Main-Is: runtests.hs
Other-Modules: TestSqlValue
Hs-Source-Dirs: ., testsrc
diff --git a/testsrc/TestSqlValue.hs b/testsrc/TestSqlValue.hs
index 7d29453..e6161e8 100644
--- a/testsrc/TestSqlValue.hs
+++ b/testsrc/TestSqlValue.hs
@@ -6,12 +6,18 @@ All rights reserved.
For license and copyright information, see the file COPYRIGHT
-}
+{-# LANGUAGE CPP #-}
+
module TestSqlValue where
import Test.QuickCheck hiding (Result)
import Test.QuickCheck.Property (Result)
import qualified Test.HUnit as HU
import Database.HDBC
+#if MIN_VERSION_time(0,10,0)
+import Data.Time.Format (parseTimeM)
+#else
import Data.Time.Format (parseTime)
+#endif
import Data.Time.LocalTime
import Database.HDBC.Locale (defaultTimeLocale, iso8601DateFormat, oldIso8601DateFormat)
import Data.Maybe
@@ -29,17 +35,25 @@ fromSql_Int x =
testZonedTimeStr = "1989-08-01 15:33:01 -0500"
testZonedTime :: ZonedTime
-testZonedTime = fromJust $ parseTime defaultTimeLocale (iso8601DateFormat (Just "%T %z"))
+testZonedTime = fromJust $ parseTimeM False defaultTimeLocale (iso8601DateFormat (Just "%T %z"))
testZonedTimeStr
testZonedTimeFracStr = "1989-08-01 15:33:01.536 -0500"
testZonedTimeFrac :: ZonedTime
+#if MIN_VERSION_time(0,10,0)
+testZonedTimeFrac = fromJust $ parseTimeM False defaultTimeLocale (iso8601DateFormat (Just "%T%Q %z"))
+#else
testZonedTimeFrac = fromJust $ parseTime defaultTimeLocale (iso8601DateFormat (Just "%T%Q %z"))
+#endif
testZonedTimeFracStr
testZonedTimeTwoDigitYearStr = "89-08-01 15:33:01 -0500"
testZonedTimeTwoDigitYear :: ZonedTime
+#if MIN_VERSION_time(0,10,0)
+testZonedTimeTwoDigitYear = fromJust $ parseTimeM False defaultTimeLocale (oldIso8601DateFormat (Just "%T %z"))
+#else
testZonedTimeTwoDigitYear = fromJust $ parseTime defaultTimeLocale (oldIso8601DateFormat (Just "%T %z"))
+#endif
testZonedTimeTwoDigitYearStr
ztparsenf =
--
2.39.2

View File

@@ -0,0 +1,43 @@
# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
# ebuild generated by hackport 0.8.1.0.9999
#hackport: flags: +minTime15,+splitBase
CABAL_PN="HDBC"
CABAL_FEATURES="lib profile haddock hoogle hscolour test-suite"
inherit haskell-cabal
DESCRIPTION="Haskell Database Connectivity"
HOMEPAGE="https://github.com/hdbc/hdbc"
LICENSE="BSD"
SLOT="2/${PV}"
KEYWORDS="~amd64 ~arm64 ~ppc64 ~riscv ~x86"
PATCHES=(
"${FILESDIR}/${PN}-2.4.0.4-fix-tests.patch"
)
RDEPEND="
>=dev-haskell/convertible-1.1.0.0:=[profile?]
dev-haskell/old-time:=[profile?]
dev-haskell/utf8-string:=[profile?]
>=dev-lang/ghc-8.4.3:=
"
DEPEND="${RDEPEND}
>=dev-haskell/cabal-2.2.0.1
test? (
dev-haskell/hunit
>=dev-haskell/quickcheck-2.0
)
"
src_configure() {
haskell-cabal_src_configure \
--flag=minTime15 \
--flag=splitBase
}

View File

@@ -5,13 +5,8 @@
<email>haskell@gentoo.org</email>
<name>Gentoo Haskell</name>
</maintainer>
<longdescription>
HDBC provides an abstraction layer between Haskell programs and SQL
relational databases. This lets you write database code once, in
Haskell, and have it work with any number of backend SQL databases
(MySQL, Oracle, PostgreSQL, ODBC-compliant databases, etc.)
</longdescription>
<upstream>
<remote-id type="hackage">HDBC</remote-id>
<remote-id type="github">hdbc/hdbc</remote-id>
</upstream>
</pkgmetadata>