From 26f659e65f326b9f134e625dadcfa0881ec4e545 Mon Sep 17 00:00:00 2001 From: sternenseemann Date: Tue, 22 Nov 2022 19:25:02 +0100 Subject: haskellPackages.mbox: fix build for time >= 1.10 Patch proposed to upstream via email, using a trivial replacement as suggested in the time documentation. --- .../haskell-modules/configuration-common.nix | 4 ++ .../haskell-modules/patches/mbox-time-1.10.patch | 52 ++++++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 pkgs/development/haskell-modules/patches/mbox-time-1.10.patch (limited to 'pkgs/development/haskell-modules') diff --git a/pkgs/development/haskell-modules/configuration-common.nix b/pkgs/development/haskell-modules/configuration-common.nix index f805427036a6..56e4ecccceee 100644 --- a/pkgs/development/haskell-modules/configuration-common.nix +++ b/pkgs/development/haskell-modules/configuration-common.nix @@ -170,6 +170,10 @@ self: super: { hoodle-core = dontHaddock super.hoodle-core; hsc3-db = dontHaddock super.hsc3-db; + # Fix build with time >= 1.10 while retaining compat with time < 1.9 + mbox = appendPatch ./patches/mbox-time-1.10.patch + (overrideCabal { editedCabalFile = null; revision = null; } super.mbox); + # Too strict bounds on base, optparse-applicative: https://github.com/edsko/friendly/issues/5 friendly = doJailbreak super.friendly; diff --git a/pkgs/development/haskell-modules/patches/mbox-time-1.10.patch b/pkgs/development/haskell-modules/patches/mbox-time-1.10.patch new file mode 100644 index 000000000000..f72b8483b339 --- /dev/null +++ b/pkgs/development/haskell-modules/patches/mbox-time-1.10.patch @@ -0,0 +1,52 @@ +diff -rN -u old-mbox/Data/MBox/String.hs new-mbox/Data/MBox/String.hs +--- old-mbox/Data/MBox/String.hs 2022-11-22 19:14:52.332543098 +0100 ++++ new-mbox/Data/MBox/String.hs 2022-11-22 19:14:52.332543098 +0100 +@@ -1,3 +1,4 @@ ++{-# LANGUAGE CPP #-} + + ----------------------------------------------------------------------------- + {- | +@@ -31,7 +32,11 @@ + -- | Reads a date header as a UTCTime + parseDateHeader :: String -> Maybe UTCTime + parseDateHeader header = listToMaybe . catMaybes $ map tryParse formats where ++#if MIN_VERSION_time(1,9,0) ++ tryParse f = parseTimeM True LC.defaultTimeLocale f header ++#else + tryParse f = parseTime LC.defaultTimeLocale f header ++#endif + formats = + [ "%a, %_d %b %Y %T %z" + , "%a, %_d %b %Y %T %Z" +diff -rN -u old-mbox/Data/MBox.hs new-mbox/Data/MBox.hs +--- old-mbox/Data/MBox.hs 2022-11-22 19:14:52.332543098 +0100 ++++ new-mbox/Data/MBox.hs 2022-11-22 19:14:52.332543098 +0100 +@@ -1,3 +1,4 @@ ++{-# LANGUAGE CPP #-} + {-# LANGUAGE ViewPatterns #-} + + ----------------------------------------------------------------------------- +@@ -34,7 +35,11 @@ + parseDateHeader :: T.Text -> Maybe UTCTime + parseDateHeader txt = listToMaybe . catMaybes $ map tryParse formats where + header = T.unpack txt ++#if MIN_VERSION_time(1,9,0) ++ tryParse f = parseTimeM True LC.defaultTimeLocale f header ++#else + tryParse f = parseTime LC.defaultTimeLocale f header ++#endif + formats = + [ "%a, %_d %b %Y %T %z" + , "%a, %_d %b %Y %T %Z" +diff -rN -u old-mbox/mbox.cabal new-mbox/mbox.cabal +--- old-mbox/mbox.cabal 2022-11-22 19:14:52.332543098 +0100 ++++ new-mbox/mbox.cabal 2022-11-22 19:14:52.332543098 +0100 +@@ -13,7 +13,7 @@ + Cabal-Version: >= 1.6 + + library +- build-depends: base >= 4, base < 6, safe, time < 1.9, time-locale-compat, text ++ build-depends: base >= 4, base < 6, safe, time, time-locale-compat, text + exposed-modules: Data.MBox, Data.MBox.String + ghc-options: -Wall + -- cgit 1.4.1