Hello community,

here is the log from the commit of package ghc-persistent for openSUSE:Factory 
checked in at 2019-12-27 13:56:13
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-persistent (Old)
 and      /work/SRC/openSUSE:Factory/.ghc-persistent.new.6675 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "ghc-persistent"

Fri Dec 27 13:56:13 2019 rev:17 rq:759475 version:2.10.4

Changes:
--------
--- /work/SRC/openSUSE:Factory/ghc-persistent/ghc-persistent.changes    
2019-08-13 20:44:49.423052789 +0200
+++ /work/SRC/openSUSE:Factory/.ghc-persistent.new.6675/ghc-persistent.changes  
2019-12-27 13:56:14.860741776 +0100
@@ -1,0 +2,31 @@
+Fri Nov  8 16:14:26 UTC 2019 - Peter Simons <[email protected]>
+
+- Drop obsolete group attributes.
+
+-------------------------------------------------------------------
+Thu Oct 31 15:58:04 UTC 2019 - [email protected]
+
+- Update persistent to version 2.10.4.
+  ## 2.10.4
+
+  * Log exceptions when closing a connection fails. See point 1 in [yesod 
#1635](https://github.com/yesodweb/yesod/issues/1635#issuecomment-547300856). 
[#978](https://github.com/yesodweb/persistent/pull/978)
+
+-------------------------------------------------------------------
+Tue Oct 29 07:32:13 UTC 2019 - [email protected]
+
+- Update persistent to version 2.10.3.
+  ## 2.10.3
+
+  * Added support for GHC 8.8 about MonadFail changes 
[#976](https://github.com/yesodweb/persistent/pull/976)
+
+-------------------------------------------------------------------
+Thu Oct 24 02:03:00 UTC 2019 - [email protected]
+
+- Update persistent to version 2.10.2.
+  ## 2.10.2
+
+  * Added `runMigrationQuiet` and `runMigrationUnsafeQuiet` to 
`Database.Persist.Sql.Migration` as safer alternatives to `runMigrationSilent`. 
[#971](https://github.com/yesodweb/persistent/pull/971)
+    This functions as workaround/fix for: 
[#966](https://github.com/yesodweb/persistent/issues/966), 
[#948](https://github.com/yesodweb/persistent/issues/948), 
[#640](https://github.com/yesodweb/persistent/issues/640), and 
[#474](https://github.com/yesodweb/persistent/issues/474)
+  * Added RawSql instances for 9, 10, 11 and 12-column results. 
[#961](https://github.com/yesodweb/persistent/pull/961)
+
+-------------------------------------------------------------------

Old:
----
  persistent-2.10.1.tar.gz

New:
----
  persistent-2.10.4.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ ghc-persistent.spec ++++++
--- /var/tmp/diff_new_pack.sAzX0e/_old  2019-12-27 13:56:15.376742026 +0100
+++ /var/tmp/diff_new_pack.sAzX0e/_new  2019-12-27 13:56:15.376742026 +0100
@@ -19,11 +19,10 @@
 %global pkg_name persistent
 %bcond_with tests
 Name:           ghc-%{pkg_name}
-Version:        2.10.1
+Version:        2.10.4
 Release:        0
 Summary:        Type-safe, multi-backend data serialization
 License:        MIT
-Group:          Development/Libraries/Haskell
 URL:            https://hackage.haskell.org/package/%{pkg_name}
 Source0:        
https://hackage.haskell.org/package/%{pkg_name}-%{version}/%{pkg_name}-%{version}.tar.gz
 BuildRequires:  ghc-Cabal-devel
@@ -49,6 +48,7 @@
 BuildRequires:  ghc-time-devel
 BuildRequires:  ghc-transformers-devel
 BuildRequires:  ghc-unliftio-core-devel
+BuildRequires:  ghc-unliftio-devel
 BuildRequires:  ghc-unordered-containers-devel
 BuildRequires:  ghc-vector-devel
 %if %{with tests}
@@ -61,7 +61,6 @@
 
 %package devel
 Summary:        Haskell %{pkg_name} library development files
-Group:          Development/Libraries/Haskell
 Requires:       %{name} = %{version}-%{release}
 Requires:       ghc-compiler = %{ghc_version}
 Requires(post): ghc-compiler = %{ghc_version}

++++++ persistent-2.10.1.tar.gz -> persistent-2.10.4.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/persistent-2.10.1/ChangeLog.md 
new/persistent-2.10.4/ChangeLog.md
--- old/persistent-2.10.1/ChangeLog.md  2019-08-08 19:29:15.000000000 +0200
+++ new/persistent-2.10.4/ChangeLog.md  2019-10-29 18:51:02.000000000 +0100
@@ -1,5 +1,19 @@
 # Changelog for persistent
 
+## 2.10.4
+
+* Log exceptions when closing a connection fails. See point 1 in [yesod 
#1635](https://github.com/yesodweb/yesod/issues/1635#issuecomment-547300856). 
[#978](https://github.com/yesodweb/persistent/pull/978)
+
+## 2.10.3
+
+* Added support for GHC 8.8 about MonadFail changes 
[#976](https://github.com/yesodweb/persistent/pull/976)
+
+## 2.10.2
+
+* Added `runMigrationQuiet` and `runMigrationUnsafeQuiet` to 
`Database.Persist.Sql.Migration` as safer alternatives to `runMigrationSilent`. 
[#971](https://github.com/yesodweb/persistent/pull/971)
+  This functions as workaround/fix for: 
[#966](https://github.com/yesodweb/persistent/issues/966), 
[#948](https://github.com/yesodweb/persistent/issues/948), 
[#640](https://github.com/yesodweb/persistent/issues/640), and 
[#474](https://github.com/yesodweb/persistent/issues/474)
+* Added RawSql instances for 9, 10, 11 and 12-column results. 
[#961](https://github.com/yesodweb/persistent/pull/961)
+
 ## 2.10.1
 
 * Added `constraint=` attribute to allow users to specify foreign reference 
constraint names.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/persistent-2.10.1/Database/Persist/Sql/Class.hs 
new/persistent-2.10.4/Database/Persist/Sql/Class.hs
--- old/persistent-2.10.1/Database/Persist/Sql/Class.hs 2019-05-07 
01:24:32.000000000 +0200
+++ new/persistent-2.10.4/Database/Persist/Sql/Class.hs 2019-10-29 
08:41:44.000000000 +0100
@@ -197,6 +197,77 @@
 to8 :: ((a,b),(c,d),(e,f),(g,h)) -> (a,b,c,d,e,f,g,h)
 to8 ((a,b),(c,d),(e,f),(g,h)) = (a,b,c,d,e,f,g,h)
 
+-- | @since 2.10.2
+instance (RawSql a, RawSql b, RawSql c,
+          RawSql d, RawSql e, RawSql f,
+          RawSql g, RawSql h, RawSql i)
+       => RawSql (a, b, c, d, e, f, g, h, i) where
+    rawSqlCols e         = rawSqlCols e         . from9
+    rawSqlColCountReason = rawSqlColCountReason . from9
+    rawSqlProcessRow     = fmap to9 . rawSqlProcessRow
+
+-- | @since 2.10.2
+from9 :: (a,b,c,d,e,f,g,h,i) -> ((a,b),(c,d),(e,f),(g,h),i)
+from9 (a,b,c,d,e,f,g,h,i) = ((a,b),(c,d),(e,f),(g,h),i)
+
+-- | @since 2.10.2
+to9 :: ((a,b),(c,d),(e,f),(g,h),i) -> (a,b,c,d,e,f,g,h,i)
+to9 ((a,b),(c,d),(e,f),(g,h),i) = (a,b,c,d,e,f,g,h,i)
+
+-- | @since 2.10.2
+instance (RawSql a, RawSql b, RawSql c,
+          RawSql d, RawSql e, RawSql f,
+          RawSql g, RawSql h, RawSql i,
+          RawSql j)
+       => RawSql (a, b, c, d, e, f, g, h, i, j) where
+    rawSqlCols e         = rawSqlCols e         . from10
+    rawSqlColCountReason = rawSqlColCountReason . from10
+    rawSqlProcessRow     = fmap to10 . rawSqlProcessRow
+
+-- | @since 2.10.2
+from10 :: (a,b,c,d,e,f,g,h,i,j) -> ((a,b),(c,d),(e,f),(g,h),(i,j))
+from10 (a,b,c,d,e,f,g,h,i,j) = ((a,b),(c,d),(e,f),(g,h),(i,j))
+
+-- | @since 2.10.2
+to10 :: ((a,b),(c,d),(e,f),(g,h),(i,j)) -> (a,b,c,d,e,f,g,h,i,j)
+to10 ((a,b),(c,d),(e,f),(g,h),(i,j)) = (a,b,c,d,e,f,g,h,i,j)
+
+-- | @since 2.10.2
+instance (RawSql a, RawSql b, RawSql c,
+          RawSql d, RawSql e, RawSql f,
+          RawSql g, RawSql h, RawSql i,
+          RawSql j, RawSql k)
+       => RawSql (a, b, c, d, e, f, g, h, i, j, k) where
+    rawSqlCols e         = rawSqlCols e         . from11
+    rawSqlColCountReason = rawSqlColCountReason . from11
+    rawSqlProcessRow     = fmap to11 . rawSqlProcessRow
+
+-- | @since 2.10.2
+from11 :: (a,b,c,d,e,f,g,h,i,j,k) -> ((a,b),(c,d),(e,f),(g,h),(i,j),k)
+from11 (a,b,c,d,e,f,g,h,i,j,k) = ((a,b),(c,d),(e,f),(g,h),(i,j),k)
+
+-- | @since 2.10.2
+to11 :: ((a,b),(c,d),(e,f),(g,h),(i,j),k) -> (a,b,c,d,e,f,g,h,i,j,k)
+to11 ((a,b),(c,d),(e,f),(g,h),(i,j),k) = (a,b,c,d,e,f,g,h,i,j,k)
+
+-- | @since 2.10.2
+instance (RawSql a, RawSql b, RawSql c,
+          RawSql d, RawSql e, RawSql f,
+          RawSql g, RawSql h, RawSql i,
+          RawSql j, RawSql k, RawSql l)
+       => RawSql (a, b, c, d, e, f, g, h, i, j, k, l) where
+    rawSqlCols e         = rawSqlCols e         . from12
+    rawSqlColCountReason = rawSqlColCountReason . from12
+    rawSqlProcessRow     = fmap to12 . rawSqlProcessRow
+
+-- | @since 2.10.2
+from12 :: (a,b,c,d,e,f,g,h,i,j,k,l) -> ((a,b),(c,d),(e,f),(g,h),(i,j),(k,l))
+from12 (a,b,c,d,e,f,g,h,i,j,k,l) = ((a,b),(c,d),(e,f),(g,h),(i,j),(k,l))
+
+-- | @since 2.10.2
+to12 :: ((a,b),(c,d),(e,f),(g,h),(i,j),(k,l)) -> (a,b,c,d,e,f,g,h,i,j,k,l)
+to12 ((a,b),(c,d),(e,f),(g,h),(i,j),(k,l)) = (a,b,c,d,e,f,g,h,i,j,k,l)
+
 extractMaybe :: Maybe a -> a
 extractMaybe = fromMaybe (error "Database.Persist.GenericSql.extractMaybe")
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/persistent-2.10.1/Database/Persist/Sql/Migration.hs 
new/persistent-2.10.4/Database/Persist/Sql/Migration.hs
--- old/persistent-2.10.1/Database/Persist/Sql/Migration.hs     2019-05-07 
01:24:32.000000000 +0200
+++ new/persistent-2.10.4/Database/Persist/Sql/Migration.hs     2019-10-29 
08:41:44.000000000 +0100
@@ -5,8 +5,10 @@
   , showMigration
   , getMigration
   , runMigration
+  , runMigrationQuiet
   , runMigrationSilent
   , runMigrationUnsafe
+  , runMigrationUnsafeQuiet
   , migrate
   -- * Utilities for constructing migrations
   , reportErrors
@@ -16,6 +18,7 @@
   ) where
 
 
+import Control.Exception (throwIO)
 import Control.Monad (liftM, unless)
 import Control.Monad.IO.Unlift
 import Control.Monad.Trans.Class (MonadTrans (..))
@@ -80,8 +83,26 @@
              -> ReaderT SqlBackend m ()
 runMigration m = runMigration' m False >> return ()
 
+-- | Same as 'runMigration', but does not report the individual migrations on
+-- stderr. Instead it returns a list of the executed SQL commands.
+--
+-- This is a safer/more robust alternative to 'runMigrationSilent', but may be
+-- less silent for some persistent implementations, most notably
+-- persistent-postgresql
+--
+-- @since 2.10.2
+runMigrationQuiet :: MonadIO m
+                  => Migration
+                  -> ReaderT SqlBackend m [Text]
+runMigrationQuiet m = runMigration' m True
+
 -- | Same as 'runMigration', but returns a list of the SQL commands executed
 -- instead of printing them to stderr.
+--
+-- This function silences the migration by remapping 'stderr'. As a result, it
+-- is not thread-safe and can clobber output from other parts of the program.
+-- This implementation method was chosen to also silence postgresql migration
+-- output on stderr, but is not recommended!
 runMigrationSilent :: MonadUnliftIO m
                    => Migration
                    -> ReaderT SqlBackend m [Text]
@@ -99,7 +120,7 @@
 runMigration' m silent = do
     mig <- parseMigration' m
     if any fst mig
-        then error $ concat
+        then liftIO . throwIO . PersistError . pack $ concat
                  [ "\n\nDatabase migration: manual intervention required.\n"
                  , "The unsafe actions are prefixed by '***' below:\n\n"
                  , unlines $ map displayMigration mig
@@ -115,9 +136,24 @@
 runMigrationUnsafe :: MonadIO m
                    => Migration
                    -> ReaderT SqlBackend m ()
-runMigrationUnsafe m = do
+runMigrationUnsafe m = runMigrationUnsafe' False m >> return ()
+
+-- | Same as 'runMigrationUnsafe', but returns a list of the SQL commands
+-- executed instead of printing them to stderr.
+--
+-- @since 2.10.2
+runMigrationUnsafeQuiet :: MonadIO m
+                        => Migration
+                        -> ReaderT SqlBackend m [Text]
+runMigrationUnsafeQuiet = runMigrationUnsafe' True
+
+runMigrationUnsafe' :: MonadIO m
+                    => Bool
+                    -> Migration
+                    -> ReaderT SqlBackend m [Text]
+runMigrationUnsafe' silent m = do
     mig <- parseMigration' m
-    mapM_ (executeMigrate False) $ sortMigrations $ allSql mig
+    mapM (executeMigrate silent) $ sortMigrations $ allSql mig
 
 executeMigrate :: MonadIO m => Bool -> Text -> ReaderT SqlBackend m Text
 executeMigrate silent s = do
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/persistent-2.10.1/Database/Persist/Sql/Run.hs 
new/persistent-2.10.4/Database/Persist/Sql/Run.hs
--- old/persistent-2.10.1/Database/Persist/Sql/Run.hs   2019-05-07 
01:24:32.000000000 +0200
+++ new/persistent-2.10.4/Database/Persist/Sql/Run.hs   2019-10-29 
18:51:02.000000000 +0100
@@ -4,12 +4,14 @@
 import Control.Exception (bracket, mask, onException)
 import Control.Monad (liftM)
 import Control.Monad.IO.Unlift
-import Control.Monad.Logger
+import qualified UnliftIO.Exception as UE
+import Control.Monad.Logger.CallStack
 import Control.Monad.Trans.Reader hiding (local)
 import Control.Monad.Trans.Resource
 import Data.IORef (readIORef)
 import Data.Pool as P
 import qualified Data.Map as Map
+import qualified Data.Text as T
 import System.Timeout (timeout)
 
 import Database.Persist.Class.PersistStore
@@ -110,13 +112,19 @@
     (unliftIO u . f)
 
 createSqlPool
-    :: (MonadLogger m, MonadUnliftIO m, BackendCompatible SqlBackend backend)
+    :: forall m backend. (MonadLogger m, MonadUnliftIO m, BackendCompatible 
SqlBackend backend)
     => (LogFunc -> IO backend)
     -> Int
     -> m (Pool backend)
 createSqlPool mkConn size = do
     logFunc <- askLogFunc
-    liftIO $ createPool (mkConn logFunc) close' 1 20 size
+    -- Resource pool will swallow any exceptions from close. We want to log
+    -- them instead.
+    let loggedClose :: backend -> IO ()
+        loggedClose backend = close' backend `UE.catchAny` \e -> runLoggingT
+          (logError $ T.pack $ "Error closing database connection in pool: " 
++ show e)
+          logFunc
+    liftIO $ createPool (mkConn logFunc) loggedClose 1 20 size
 
 -- NOTE: This function is a terrible, ugly hack. It would be much better to
 -- just clean up monad-logger.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/persistent-2.10.1/Database/Persist/Sql.hs 
new/persistent-2.10.4/Database/Persist/Sql.hs
--- old/persistent-2.10.1/Database/Persist/Sql.hs       2019-05-07 
01:24:32.000000000 +0200
+++ new/persistent-2.10.4/Database/Persist/Sql.hs       2019-10-29 
08:41:44.000000000 +0100
@@ -40,6 +40,8 @@
 import Database.Persist.Sql.Orphan.PersistUnique ()
 
 -- | Commit the current transaction and begin a new one.
+-- This is used when a transaction commit is required within the context of 
'runSqlConn'
+-- (which brackets its provided action with a transaction begin/commit pair).
 --
 -- @since 1.2.0
 transactionSave :: MonadIO m => ReaderT SqlBackend m ()
@@ -58,6 +60,8 @@
     liftIO $ connCommit conn getter >> connBegin conn getter (Just isolation)
 
 -- | Roll back the current transaction and begin a new one.
+-- This rolls back to the state of the last call to 'transactionSave' or the 
enclosing
+-- 'runSqlConn' call.
 --
 -- @since 1.2.0
 transactionUndo :: MonadIO m => ReaderT SqlBackend m ()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/persistent-2.10.1/Database/Persist/Types/Base.hs 
new/persistent-2.10.4/Database/Persist/Types/Base.hs
--- old/persistent-2.10.1/Database/Persist/Types/Base.hs        2019-05-07 
01:24:32.000000000 +0200
+++ new/persistent-2.10.4/Database/Persist/Types/Base.hs        2019-10-29 
08:41:44.000000000 +0100
@@ -433,10 +433,10 @@
     parseJSON (A.String t0) =
         case T.uncons t0 of
             Nothing -> fail "Null string"
-            Just ('p', t) -> either (fail "Invalid base64") (return . 
PersistDbSpecific)
+            Just ('p', t) -> either (\_ -> fail "Invalid base64") (return . 
PersistDbSpecific)
                            $ B64.decode $ TE.encodeUtf8 t
             Just ('s', t) -> return $ PersistText t
-            Just ('b', t) -> either (fail "Invalid base64") (return . 
PersistByteString)
+            Just ('b', t) -> either (\_ -> fail "Invalid base64") (return . 
PersistByteString)
                            $ B64.decode $ TE.encodeUtf8 t
             Just ('t', t) -> fmap PersistTimeOfDay $ readMay t
             Just ('u', t) -> fmap PersistUTCTime $ readMay t
@@ -448,7 +448,6 @@
       where
         headMay []    = Nothing
         headMay (x:_) = Just x
-        readMay :: (Read a, Monad m) => T.Text -> m a
         readMay t =
             case reads $ T.unpack t of
                 (x, _):_ -> return x
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/persistent-2.10.1/persistent.cabal 
new/persistent-2.10.4/persistent.cabal
--- old/persistent-2.10.1/persistent.cabal      2019-08-08 19:29:31.000000000 
+0200
+++ new/persistent-2.10.4/persistent.cabal      2019-10-29 18:51:02.000000000 
+0100
@@ -1,5 +1,5 @@
 name:            persistent
-version:         2.10.1
+version:         2.10.4
 license:         MIT
 license-file:    LICENSE
 author:          Michael Snoyman <[email protected]>
@@ -44,6 +44,7 @@
                    , time                     >= 1.6
                    , transformers             >= 0.5
                    , unliftio-core
+                   , unliftio
                    , unordered-containers
                    , vector
 


Reply via email to