1 |
slyfox 15/08/01 16:07:28 |
2 |
|
3 |
Added: hdbc-2.4.0.0-ghc-7.10-1.patch |
4 |
hdbc-2.4.0.0-ghc-7.10-2.patch |
5 |
Log: |
6 |
Port to ghc-7.10/time-1.5. |
7 |
|
8 |
(Portage version: 2.2.20/cvs/Linux x86_64, signed Manifest commit with key 611FF3AA) |
9 |
|
10 |
Revision Changes Path |
11 |
1.1 dev-haskell/hdbc/files/hdbc-2.4.0.0-ghc-7.10-1.patch |
12 |
|
13 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-haskell/hdbc/files/hdbc-2.4.0.0-ghc-7.10-1.patch?rev=1.1&view=markup |
14 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-haskell/hdbc/files/hdbc-2.4.0.0-ghc-7.10-1.patch?rev=1.1&content-type=text/plain |
15 |
|
16 |
Index: hdbc-2.4.0.0-ghc-7.10-1.patch |
17 |
=================================================================== |
18 |
diff --git a/Database/HDBC/Locale.hs b/Database/HDBC/Locale.hs |
19 |
index e62b1c1..976a6a9 100644 |
20 |
--- a/Database/HDBC/Locale.hs |
21 |
+++ b/Database/HDBC/Locale.hs |
22 |
@@ -1,3 +1,4 @@ |
23 |
+{-# LANGUAGE CPP #-} |
24 |
module Database.HDBC.Locale |
25 |
( |
26 |
defaultTimeLocale, |
27 |
@@ -5,7 +6,12 @@ module Database.HDBC.Locale |
28 |
) |
29 |
|
30 |
where |
31 |
+ |
32 |
+#if MIN_VERSION_time(1,5,0) |
33 |
+import Data.Time.Format (defaultTimeLocale) |
34 |
+#else |
35 |
import System.Locale (defaultTimeLocale) |
36 |
+#endif |
37 |
|
38 |
-- | As the semantic of System.Locale.iso8601DateFormat has changed with |
39 |
-- old-locale-1.0.0.2 in a non-compatible way, we now define our own |
40 |
diff --git a/Database/HDBC/SqlValue.hs b/Database/HDBC/SqlValue.hs |
41 |
index 9724f81..0e278cd 100644 |
42 |
--- a/Database/HDBC/SqlValue.hs |
43 |
+++ b/Database/HDBC/SqlValue.hs |
44 |
@@ -17,7 +17,11 @@ import Data.Char(ord,toUpper) |
45 |
import Data.Word |
46 |
import Data.Int |
47 |
import qualified System.Time as ST |
48 |
-import Data.Time |
49 |
+import Data.Time ( Day (ModifiedJulianDay), DiffTime, LocalTime, NominalDiffTime, ParseTime |
50 |
+ , TimeOfDay, TimeZone, UTCTime, ZonedTime, formatTime, localDay, localTimeOfDay |
51 |
+ , parseTime, timeOfDayToTime, timeToTimeOfDay, toModifiedJulianDay, utc |
52 |
+ , utcToZonedTime, zonedTimeToLocalTime, zonedTimeToUTC, zonedTimeZone |
53 |
+ ) |
54 |
import Data.Time.Clock.POSIX |
55 |
import Database.HDBC.Locale (defaultTimeLocale, iso8601DateFormat) |
56 |
import Data.Ratio |
57 |
|
58 |
|
59 |
|
60 |
1.1 dev-haskell/hdbc/files/hdbc-2.4.0.0-ghc-7.10-2.patch |
61 |
|
62 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-haskell/hdbc/files/hdbc-2.4.0.0-ghc-7.10-2.patch?rev=1.1&view=markup |
63 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-haskell/hdbc/files/hdbc-2.4.0.0-ghc-7.10-2.patch?rev=1.1&content-type=text/plain |
64 |
|
65 |
Index: hdbc-2.4.0.0-ghc-7.10-2.patch |
66 |
=================================================================== |
67 |
diff --git a/Database/HDBC/SqlValue.hs b/Database/HDBC/SqlValue.hs |
68 |
index 0e278cd..1ebf114 100644 |
69 |
--- a/Database/HDBC/SqlValue.hs |
70 |
+++ b/Database/HDBC/SqlValue.hs |
71 |
@@ -19,8 +19,13 @@ import Data.Int |
72 |
import qualified System.Time as ST |
73 |
import Data.Time ( Day (ModifiedJulianDay), DiffTime, LocalTime, NominalDiffTime, ParseTime |
74 |
, TimeOfDay, TimeZone, UTCTime, ZonedTime, formatTime, localDay, localTimeOfDay |
75 |
- , parseTime, timeOfDayToTime, timeToTimeOfDay, toModifiedJulianDay, utc |
76 |
+ , timeOfDayToTime, timeToTimeOfDay, toModifiedJulianDay, utc |
77 |
, utcToZonedTime, zonedTimeToLocalTime, zonedTimeToUTC, zonedTimeZone |
78 |
+#if MIN_VERSION_time(1,5,0) |
79 |
+ , parseTimeM |
80 |
+#else |
81 |
+ , parseTime |
82 |
+#endif |
83 |
) |
84 |
import Data.Time.Clock.POSIX |
85 |
import Database.HDBC.Locale (defaultTimeLocale, iso8601DateFormat) |
86 |
@@ -665,7 +670,11 @@ instance Convertible (TimeOfDay, TimeZone) SqlValue where |
87 |
instance Convertible SqlValue (TimeOfDay, TimeZone) where |
88 |
safeConvert (SqlString x) = |
89 |
do tod <- parseTime' "%T%Q %z" x |
90 |
+#if MIN_VERSION_time(1,5,0) |
91 |
+ tz <- case parseTimeM True defaultTimeLocale "%T%Q %z" x of |
92 |
+#else |
93 |
tz <- case parseTime defaultTimeLocale "%T%Q %z" x of |
94 |
+#endif |
95 |
Nothing -> convError "Couldn't extract timezone in" (SqlString x) |
96 |
Just y -> Right y |
97 |
return (tod, tz) |
98 |
@@ -939,7 +948,11 @@ parseTime' _ inpstr = |
99 |
#else |
100 |
parseTime' :: (Typeable t, Convertible SqlValue t, ParseTime t) => String -> String -> ConvertResult t |
101 |
parseTime' fmtstr inpstr = |
102 |
+#if MIN_VERSION_time(1,5,0) |
103 |
+ case parseTimeM True defaultTimeLocale fmtstr inpstr of |
104 |
+#else |
105 |
case parseTime defaultTimeLocale fmtstr inpstr of |
106 |
+#endif |
107 |
Nothing -> convError ("Cannot parse using default format string " ++ show fmtstr) |
108 |
(SqlString inpstr) |
109 |
Just x -> Right x |