Hello community, here is the log from the commit of package ghc-persistent-template for openSUSE:Factory checked in at 2018-05-30 12:11:37 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-persistent-template (Old) and /work/SRC/openSUSE:Factory/.ghc-persistent-template.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-persistent-template" Wed May 30 12:11:37 2018 rev:12 rq:607858 version:2.5.4 Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-persistent-template/ghc-persistent-template.changes 2017-09-15 22:04:24.854814420 +0200 +++ /work/SRC/openSUSE:Factory/.ghc-persistent-template.new/ghc-persistent-template.changes 2018-05-30 12:26:48.535307543 +0200 @@ -1,0 +2,8 @@ +Mon May 14 17:02:11 UTC 2018 - psim...@suse.com + +- Update persistent-template to version 2.5.4 revision 1. + * [persistent#778](https://github.com/yesodweb/persistent/issues/778): Add `persistManyFileWith`. + * Slight improvement to the error message when a Persistent field can't be parsed from database results + * Exposed `parseReferences` to allow custom QuasiQuoters + +------------------------------------------------------------------- Old: ---- persistent-template-2.5.2.tar.gz New: ---- persistent-template-2.5.4.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-persistent-template.spec ++++++ --- /var/tmp/diff_new_pack.RnHIDc/_old 2018-05-30 12:26:49.791264517 +0200 +++ /var/tmp/diff_new_pack.RnHIDc/_new 2018-05-30 12:26:49.791264517 +0200 @@ -1,7 +1,7 @@ # # spec file for package ghc-persistent-template # -# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -19,7 +19,7 @@ %global pkg_name persistent-template %bcond_with tests Name: ghc-%{pkg_name} -Version: 2.5.2 +Version: 2.5.4 Release: 0 Summary: Type-safe, non-relational, multi-backend persistence License: MIT @@ -84,7 +84,7 @@ %ghc_pkg_recache %files -f %{name}.files -%doc LICENSE +%license LICENSE %files devel -f %{name}-devel.files %doc ChangeLog.md README.md ++++++ persistent-template-2.5.2.tar.gz -> persistent-template-2.5.4.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/persistent-template-2.5.2/ChangeLog.md new/persistent-template-2.5.4/ChangeLog.md --- old/persistent-template-2.5.2/ChangeLog.md 2017-03-01 07:48:55.000000000 +0100 +++ new/persistent-template-2.5.4/ChangeLog.md 2018-03-08 16:56:53.000000000 +0100 @@ -1,3 +1,15 @@ +## 2.5.4 + +* [persistent#778](https://github.com/yesodweb/persistent/issues/778): Add `persistManyFileWith`. + +## 2.5.3.1 + +* Slight improvement to the error message when a Persistent field can't be parsed from database results + +## 2.5.3 + +* Exposed `parseReferences` to allow custom QuasiQuoters + ## 2.5.2 * Fix incorrect `ToJSON`/`FromJSON` instance generation for generic diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/persistent-template-2.5.2/Database/Persist/TH.hs new/persistent-template-2.5.4/Database/Persist/TH.hs --- old/persistent-template-2.5.2/Database/Persist/TH.hs 2017-03-03 10:45:56.000000000 +0100 +++ new/persistent-template-2.5.4/Database/Persist/TH.hs 2018-03-08 16:56:53.000000000 +0100 @@ -22,6 +22,7 @@ , persistUpperCase , persistLowerCase , persistFileWith + , persistManyFileWith -- * Turn @EntityDef@s into types , mkPersist , MkPersistSettings @@ -45,6 +46,7 @@ -- * Internal , packPTH , lensPTH + , parseReferences ) where import Prelude hiding ((++), take, concat, splitAt, exp) @@ -62,6 +64,7 @@ import Control.Monad (forM, (<=<), mzero) import qualified System.IO as SIO import Data.Text (pack, Text, append, unpack, concat, uncons, cons, stripPrefix, stripSuffix) +import qualified Data.Text as T import Data.Text.Encoding (decodeUtf8) import qualified Data.Text.IO as TIO import Data.Int (Int64) @@ -110,17 +113,67 @@ -- | Same as 'persistWith', but uses an external file instead of a -- quasiquotation. persistFileWith :: PersistSettings -> FilePath -> Q Exp -persistFileWith ps fp = do +persistFileWith ps fp = persistManyFileWith ps [fp] + +-- | Same as 'persistFileWith', but uses several external files instead of +-- one. Splitting your Persistent definitions into multiple modules can +-- potentially dramatically speed up compile times. +-- +-- ==== __Examples__ +-- +-- Split your Persistent definitions into multiple files (@models1@, @models2@), +-- then create a new module for each new file and run 'mkPersist' there: +-- +-- @ +-- -- Model1.hs +-- 'share' +-- ['mkPersist' 'sqlSettings'] +-- $('persistFileWith' 'lowerCaseSettings' "models1") +-- @ +-- @ +-- -- Model2.hs +-- 'share' +-- ['mkPersist' 'sqlSettings'] +-- $('persistFileWith' 'lowerCaseSettings' "models2") +-- @ +-- +-- Use 'persistManyFileWith' to create your migrations: +-- +-- @ +-- -- Migrate.hs +-- 'share' +-- ['mkMigrate' "migrateAll"] +-- $('persistManyFileWith' 'lowerCaseSettings' ["models1","models2"]) +-- @ +-- +-- Tip: To get the same import behavior as if you were declaring all your models in +-- one file, import your new files @as Name@ into another file, then export @module Name@. +-- +-- This approach may be used in the future to reduce memory usage during compilation, +-- but so far we've only seen mild reductions. +-- +-- See <https://github.com/yesodweb/persistent/issues/778 persistent#778> and +-- <https://github.com/yesodweb/persistent/pull/791 persistent#791> for more details. +-- +-- @since 2.5.4 +persistManyFileWith :: PersistSettings -> [FilePath] -> Q Exp +persistManyFileWith ps fps = do #ifdef GHC_7_4 - qAddDependentFile fp + mapM_ qAddDependentFile fps #endif - h <- qRunIO $ SIO.openFile fp SIO.ReadMode - qRunIO $ SIO.hSetEncoding h SIO.utf8_bom - s <- qRunIO $ TIO.hGetContents h + ss <- mapM getS fps + let s = T.intercalate "\n" ss -- be tolerant of the user forgetting to put a line-break at EOF. parseReferences ps s + where + getS fp = do + h <- qRunIO $ SIO.openFile fp SIO.ReadMode + qRunIO $ SIO.hSetEncoding h SIO.utf8_bom + s <- qRunIO $ TIO.hGetContents h + return s -- calls parse to Quasi.parse individual entities in isolation -- afterwards, sets references to other entities +-- | @since 2.5.3 parseReferences :: PersistSettings -> Text -> Q Exp parseReferences ps s = lift $ map (mkEntityDefSqlTypeExp embedEntityMap entMap) noCycleEnts @@ -337,7 +390,7 @@ , mpsGeneric :: Bool -- ^ Create generic types that can be used with multiple backends. Good for -- reusable code, but makes error messages harder to understand. Default: - -- True. + -- False. , mpsPrefixFields :: Bool -- ^ Prefix field names with the model name. Default: True. , mpsEntityJSON :: Maybe EntityJSON @@ -355,7 +408,7 @@ -- -- Default: False -- - -- Since 1.3.1 + -- @since 1.3.1 } data EntityJSON = EntityJSON @@ -385,7 +438,7 @@ -- | Same as 'sqlSettings'. -- --- Since 1.1.1 +-- @since 1.1.1 sqlOnlySettings :: MkPersistSettings sqlOnlySettings = sqlSettings {-# DEPRECATED sqlOnlySettings "use sqlSettings" #-} @@ -613,7 +666,7 @@ mapLeft f (Left l) = Left (f l) fieldError :: Text -> Text -> Text -fieldError fieldName err = "field " `mappend` fieldName `mappend` ": " `mappend` err +fieldError fieldName err = "Couldn't parse field `" `mappend` fieldName `mappend` "` from database results: " `mappend` err mkFromPersistValues :: MkPersistSettings -> EntityDef -> Q [Clause] mkFromPersistValues _ t@(EntityDef { entitySum = False }) = diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/persistent-template-2.5.2/persistent-template.cabal new/persistent-template-2.5.4/persistent-template.cabal --- old/persistent-template-2.5.2/persistent-template.cabal 2017-03-01 07:48:55.000000000 +0100 +++ new/persistent-template-2.5.4/persistent-template.cabal 2018-03-08 16:56:53.000000000 +0100 @@ -1,5 +1,5 @@ name: persistent-template -version: 2.5.2 +version: 2.5.4 license: MIT license-file: LICENSE author: Michael Snoyman <mich...@snoyman.com> @@ -23,7 +23,7 @@ , text >= 0.5 , transformers >= 0.2 && < 0.6 , containers - , aeson >= 0.7 && < 1.2 + , aeson >= 0.7 && < 1.3 , aeson-compat >= 0.3.2.0 && < 0.4 , monad-logger , unordered-containers ++++++ persistent-template.cabal ++++++ --- /var/tmp/diff_new_pack.RnHIDc/_old 2018-05-30 12:26:49.867261913 +0200 +++ /var/tmp/diff_new_pack.RnHIDc/_new 2018-05-30 12:26:49.867261913 +0200 @@ -1,5 +1,5 @@ name: persistent-template -version: 2.5.2 +version: 2.5.4 x-revision: 1 license: MIT license-file: LICENSE @@ -24,7 +24,7 @@ , text >= 0.5 , transformers >= 0.2 && < 0.6 , containers - , aeson >= 0.7 && < 1.3 + , aeson >= 0.7 && < 1.4 , aeson-compat >= 0.3.2.0 && < 0.4 , monad-logger , unordered-containers