diff options
author | Mark Wright <gienah@gentoo.org> | 2012-06-02 05:56:44 +0000 |
---|---|---|
committer | Mark Wright <gienah@gentoo.org> | 2012-06-02 05:56:44 +0000 |
commit | eb768bc74251ec4ff3701486e13b8817e662464d (patch) | |
tree | 3a88a31bd7969559958c4809ab3ca2681e40dacb /dev-haskell/hdbc-sqlite | |
parent | EAPI=4 on line 5, [profile?] on haskell library deps (part of fix for bug #34... (diff) | |
download | gentoo-2-eb768bc74251ec4ff3701486e13b8817e662464d.tar.gz gentoo-2-eb768bc74251ec4ff3701486e13b8817e662464d.tar.bz2 gentoo-2-eb768bc74251ec4ff3701486e13b8817e662464d.zip |
Bump hdbc-sqlite to 2.3.3.0
(Portage version: 2.1.10.63/cvs/Linux x86_64)
Diffstat (limited to 'dev-haskell/hdbc-sqlite')
-rw-r--r-- | dev-haskell/hdbc-sqlite/ChangeLog | 10 | ||||
-rw-r--r-- | dev-haskell/hdbc-sqlite/files/TestTime.hs | 100 | ||||
-rw-r--r-- | dev-haskell/hdbc-sqlite/hdbc-sqlite-2.3.3.0.ebuild | 62 | ||||
-rw-r--r-- | dev-haskell/hdbc-sqlite/metadata.xml | 12 |
4 files changed, 178 insertions, 6 deletions
diff --git a/dev-haskell/hdbc-sqlite/ChangeLog b/dev-haskell/hdbc-sqlite/ChangeLog index 282894b1fc25..541bed7370b3 100644 --- a/dev-haskell/hdbc-sqlite/ChangeLog +++ b/dev-haskell/hdbc-sqlite/ChangeLog @@ -1,6 +1,12 @@ # ChangeLog for dev-haskell/hdbc-sqlite -# Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/dev-haskell/hdbc-sqlite/ChangeLog,v 1.13 2011/06/12 19:52:57 slyfox Exp $ +# Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2 +# $Header: /var/cvsroot/gentoo-x86/dev-haskell/hdbc-sqlite/ChangeLog,v 1.14 2012/06/02 05:56:44 gienah Exp $ + +*hdbc-sqlite-2.3.3.0 (02 Jun 2012) + + 02 Jun 2012; Mark Wright <gienah@gentoo.org> +files/TestTime.hs, + +hdbc-sqlite-2.3.3.0.ebuild, metadata.xml: + Bump hdbc-sqlite to 2.3.3.0 *hdbc-sqlite-2.3.0.0 (12 Jun 2011) diff --git a/dev-haskell/hdbc-sqlite/files/TestTime.hs b/dev-haskell/hdbc-sqlite/files/TestTime.hs new file mode 100644 index 000000000000..5fd77da61058 --- /dev/null +++ b/dev-haskell/hdbc-sqlite/files/TestTime.hs @@ -0,0 +1,100 @@ +module TestTime(tests) where +import Test.HUnit +import Database.HDBC +import TestUtils +import Control.Exception +import Data.Time +import Data.Time.LocalTime +import Data.Time.Clock.POSIX +import Data.Maybe +import Data.Convertible +import SpecificDB +import System.Locale(defaultTimeLocale) +import Database.HDBC.Locale (iso8601DateFormat) +import qualified System.Time as ST + +instance Eq ZonedTime where + a == b = zonedTimeToUTC a == zonedTimeToUTC b && + zonedTimeZone a == zonedTimeZone b + +testZonedTime :: ZonedTime +testZonedTime = fromJust $ parseTime defaultTimeLocale (iso8601DateFormat (Just "%T %z")) + "1989-08-01 15:33:01 -0500" + +testZonedTimeFrac :: ZonedTime +testZonedTimeFrac = fromJust $ parseTime defaultTimeLocale (iso8601DateFormat (Just "%T%Q %z")) + "1989-08-01 15:33:01.536 -0500" + + +rowdata t = [[SqlInt32 100, toSql t, SqlNull]] + +testDTType inputdata convToSqlValue = dbTestCase $ \dbh -> + do run dbh ("CREATE TABLE hdbctesttime (testid INTEGER PRIMARY KEY NOT NULL, \ + \testvalue " ++ dateTimeTypeOfSqlValue value ++ ")") [] + finally (testIt dbh) (do commit dbh + run dbh "DROP TABLE hdbctesttime" [] + commit dbh + ) + where testIt dbh = + do run dbh "INSERT INTO hdbctesttime (testid, testvalue) VALUES (?, ?)" + [iToSql 5, value] + commit dbh + r <- quickQuery' dbh "SELECT testid, testvalue FROM hdbctesttime" [] + case r of + [[testidsv, testvaluesv]] -> + do assertEqual "testid" (5::Int) (fromSql testidsv) + assertEqual "testvalue" inputdata (fromSql testvaluesv) + value = convToSqlValue inputdata + +mkTest label inputdata convfunc = + TestLabel label (testDTType inputdata convfunc) + +tests = TestList $ + ((TestLabel "Non-frac" $ testIt testZonedTime) : + if supportsFracTime then [TestLabel "Frac" $ testIt testZonedTimeFrac] else []) + +testIt baseZonedTime = + TestList [mkTest "Day" baseDay toSql, + mkTest "TimeOfDay" baseTimeOfDay toSql, + mkTest "ZonedTimeOfDay" baseZonedTimeOfDay toSql, + mkTest "LocalTime" baseLocalTime toSql, + mkTest "ZonedTime" baseZonedTime toSql, + mkTest "UTCTime" baseUTCTime toSql, + mkTest "DiffTime" baseDiffTime toSql, + mkTest "POSIXTime" basePOSIXTime posixToSql, + mkTest "ClockTime" baseClockTime toSql, + mkTest "CalendarTime" baseCalendarTime toSql, + mkTest "TimeDiff" baseTimeDiff toSql + ] + where + baseDay :: Day + baseDay = localDay baseLocalTime + + baseTimeOfDay :: TimeOfDay + baseTimeOfDay = localTimeOfDay baseLocalTime + + baseZonedTimeOfDay :: (TimeOfDay, TimeZone) + baseZonedTimeOfDay = fromSql (SqlZonedTime baseZonedTime) + + baseLocalTime :: LocalTime + baseLocalTime = zonedTimeToLocalTime baseZonedTime + + baseUTCTime :: UTCTime + baseUTCTime = convert baseZonedTime + + baseDiffTime :: NominalDiffTime + baseDiffTime = basePOSIXTime + + basePOSIXTime :: POSIXTime + basePOSIXTime = convert baseZonedTime + + baseTimeDiff :: ST.TimeDiff + baseTimeDiff = convert baseDiffTime + + -- No fractional parts for these two + + baseClockTime :: ST.ClockTime + baseClockTime = convert testZonedTime + + baseCalendarTime :: ST.CalendarTime + baseCalendarTime = convert testZonedTime diff --git a/dev-haskell/hdbc-sqlite/hdbc-sqlite-2.3.3.0.ebuild b/dev-haskell/hdbc-sqlite/hdbc-sqlite-2.3.3.0.ebuild new file mode 100644 index 000000000000..90a88f85fe29 --- /dev/null +++ b/dev-haskell/hdbc-sqlite/hdbc-sqlite-2.3.3.0.ebuild @@ -0,0 +1,62 @@ +# Copyright 1999-2012 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/dev-haskell/hdbc-sqlite/hdbc-sqlite-2.3.3.0.ebuild,v 1.1 2012/06/02 05:56:44 gienah Exp $ + +EAPI=4 + +# ebuild generated by hackport 0.2.18.9999 + +CABAL_FEATURES="bin lib profile haddock hoogle hscolour" +inherit haskell-cabal + +MY_PN="HDBC-sqlite3" +MY_P="${MY_PN}-${PV}" + +DESCRIPTION="Sqlite v3 driver for HDBC" +HOMEPAGE="http://software.complete.org/hdbc-sqlite3" +SRC_URI="http://hackage.haskell.org/packages/archive/${MY_PN}/${PV}/${MY_P}.tar.gz" + +LICENSE="BSD" +SLOT="2" +KEYWORDS="~amd64 ~x86" +IUSE="test" +RESTRICT="test" # not all files are bundled + +RDEPEND=">=dev-haskell/hdbc-2.3.0.0[profile?] + dev-haskell/mtl[profile?] + dev-haskell/utf8-string[profile?] + >=dev-lang/ghc-6.10.1 + >=dev-db/sqlite-3.2" +DEPEND="${RDEPEND} + >=dev-haskell/cabal-1.2.3 + test? ( dev-haskell/convertible + dev-haskell/hunit + dev-haskell/testpack + dev-haskell/time + ) + " + +S="${WORKDIR}/${MY_P}" + +src_prepare() { + cp "${FILESDIR}/TestTime.hs" "${S}/testsrc" +} + +src_configure() { + cabal_src_configure $(cabal_flag test buildtests) +} + +src_test() { + # default tests + haskell-cabal_src_test || die "cabal test failed" + + # built custom tests + "${S}/dist/build/runtests/runtests" || die "unit tests failed" +} + +src_install() { + cabal_src_install + + # if tests were enabled, make sure the unit test driver is deleted + rm -f "${ED}/usr/bin/runtests" +} diff --git a/dev-haskell/hdbc-sqlite/metadata.xml b/dev-haskell/hdbc-sqlite/metadata.xml index 8c66906af531..c8263cd9d3f7 100644 --- a/dev-haskell/hdbc-sqlite/metadata.xml +++ b/dev-haskell/hdbc-sqlite/metadata.xml @@ -1,8 +1,12 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> <pkgmetadata> -<herd>haskell</herd> -<maintainer> - <email>haskell@gentoo.org</email> -</maintainer> + <herd>haskell</herd> + <maintainer> + <email>haskell@gentoo.org</email> + </maintainer> + <longdescription> + This is the Sqlite v3 driver for HDBC, the generic + database access system for Haskell + </longdescription> </pkgmetadata> |