Hello community,
here is the log from the commit of package ghc-persistent-template for
openSUSE:Factory checked in at 2016-10-20 23:08:05
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-persistent-template (Old)
and /work/SRC/openSUSE:Factory/.ghc-persistent-template.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-persistent-template"
Changes:
--------
---
/work/SRC/openSUSE:Factory/ghc-persistent-template/ghc-persistent-template.changes
2016-07-21 08:16:13.000000000 +0200
+++
/work/SRC/openSUSE:Factory/.ghc-persistent-template.new/ghc-persistent-template.changes
2016-10-20 23:08:05.000000000 +0200
@@ -1,0 +2,5 @@
+Thu Sep 15 06:49:07 UTC 2016 - [email protected]
+
+- Update to version 2.5.1.6 revision 1 with cabal2obs.
+
+-------------------------------------------------------------------
Old:
----
persistent-template-2.1.8.1.tar.gz
New:
----
persistent-template-2.5.1.6.tar.gz
persistent-template.cabal
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ ghc-persistent-template.spec ++++++
--- /var/tmp/diff_new_pack.beKlKf/_old 2016-10-20 23:08:06.000000000 +0200
+++ /var/tmp/diff_new_pack.beKlKf/_new 2016-10-20 23:08:06.000000000 +0200
@@ -19,15 +19,15 @@
%global pkg_name persistent-template
%bcond_with tests
Name: ghc-%{pkg_name}
-Version: 2.1.8.1
+Version: 2.5.1.6
Release: 0
Summary: Type-safe, non-relational, multi-backend persistence
License: MIT
-Group: System/Libraries
+Group: Development/Languages/Other
Url: https://hackage.haskell.org/package/%{pkg_name}
Source0:
https://hackage.haskell.org/package/%{pkg_name}-%{version}/%{pkg_name}-%{version}.tar.gz
+Source1:
https://hackage.haskell.org/package/%{pkg_name}-%{version}/revision/1.cabal#/%{pkg_name}.cabal
BuildRequires: ghc-Cabal-devel
-# Begin cabal-rpm deps:
BuildRequires: ghc-aeson-compat-devel
BuildRequires: ghc-aeson-devel
BuildRequires: ghc-bytestring-devel
@@ -48,7 +48,6 @@
BuildRequires: ghc-QuickCheck-devel
BuildRequires: ghc-hspec-devel
%endif
-# End cabal-rpm deps
%description
Hackage documentation generation is not reliable. For up to date documentation,
@@ -68,21 +67,16 @@
%prep
%setup -q -n %{pkg_name}-%{version}
-
+cp -p %{SOURCE1} %{pkg_name}.cabal
%build
%ghc_lib_build
-
%install
%ghc_lib_install
-
%check
-%if %{with tests}
-%{cabal} test
-%endif
-
+%cabal_test
%post devel
%ghc_pkg_recache
@@ -96,6 +90,5 @@
%files devel -f %{name}-devel.files
%defattr(-,root,root,-)
-%doc ChangeLog.md README.md
%changelog
++++++ persistent-template-2.1.8.1.tar.gz -> persistent-template-2.5.1.6.tar.gz
++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/persistent-template-2.1.8.1/ChangeLog.md
new/persistent-template-2.5.1.6/ChangeLog.md
--- old/persistent-template-2.1.8.1/ChangeLog.md 2016-05-14
06:08:26.000000000 +0200
+++ new/persistent-template-2.5.1.6/ChangeLog.md 2016-08-05
07:26:14.000000000 +0200
@@ -1,15 +1,35 @@
-## 2.1.8.1
+## 2.5.1.6
+
+Allow non-null self-references in a list
+
+## 2.5.1.4
+
+* Allow composite Primary keys for tables that contain nullable fields.
+* Support foreign keys to non-integer ids
+
+## 2.5.1.3
+
+* fix GHC 7.8 bug when a field name is "type"
+
+## 2.5.1.2
* fix a bad Eq instance /= definition for Key when mpsGenetric=True
-## 2.1.7
+## 2.5.0.1
+
+* workaround TH bug in GHC 7.10
-* Support for GHC 8 [#556](https://github.com/yesodweb/persistent/issues/556)
+## 2.5
+
+* read/write typeclass split
## 2.1.6
* aeson 0.11
* transformers 0.5
+## 2.1.4
+
+support http-api-data for url serialization
## 2.1.3.3
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/persistent-template-2.1.8.1/Database/Persist/TH.hs
new/persistent-template-2.5.1.6/Database/Persist/TH.hs
--- old/persistent-template-2.1.8.1/Database/Persist/TH.hs 2016-05-14
06:09:06.000000000 +0200
+++ new/persistent-template-2.5.1.6/Database/Persist/TH.hs 2016-08-05
07:23:16.000000000 +0200
@@ -45,6 +45,7 @@
import Prelude hiding ((++), take, concat, splitAt, exp)
import Database.Persist
+import Database.Persist.Class (HasPersistBackend(..), BaseBackend)
import Database.Persist.Sql (Migration, migrate, SqlBackend, PersistFieldSql)
import Database.Persist.Quasi
import Language.Haskell.TH.Lib (
@@ -80,6 +81,14 @@
import GHC.Generics (Generic)
import qualified Data.Text.Encoding as TE
+-- | This special-cases "type_" and strips out its underscore. When
+-- used for JSON serialization and deserialization, it works around
+-- <https://github.com/yesodweb/persistent/issues/412>
+unHaskellNameForJSON :: HaskellName -> Text
+unHaskellNameForJSON = fixTypeUnderscore . unHaskellName
+ where fixTypeUnderscore "type" = "type_"
+ fixTypeUnderscore name = name
+
-- | Converts a quasi-quoted syntax into a list of entity definitions, to be
-- used as input to the template haskell generation code (mkPersist).
persistWith :: PersistSettings -> QuasiQuoter
@@ -244,7 +253,10 @@
then EmbedRef em
else if maybeNullable field
then SelfReference
- else error $ unpack $ unHaskellName entName `mappend` ":
a self reference must be a Maybe"
+ else case fieldType field of
+ FTList _ -> SelfReference
+ _ -> error $ unpack $ unHaskellName entName
+ `mappend` ": a self reference must be a Maybe"
existing@_ -> existing
}
@@ -295,11 +307,12 @@
mkPersist :: MkPersistSettings -> [EntityDef] -> Q [Dec]
mkPersist mps ents' = do
x <- fmap mconcat $ mapM (persistFieldFromEntity mps) ents
- y <- fmap mconcat $ mapM (mkEntity mps) ents
+ y <- fmap mconcat $ mapM (mkEntity entMap mps) ents
z <- fmap mconcat $ mapM (mkJSON mps) ents
return $ mconcat [x, y, z]
where
ents = map fixEntityDef ents'
+ entMap = M.fromList $ map (\ent -> (entityHaskell ent, ent)) ents
-- | Implement special preprocessing on EntityDef as necessary for 'mkPersist'.
-- For example, strip out any fields marked as MigrationOnly.
@@ -924,9 +937,9 @@
mkPersistValue fieldName = [|mapLeft (fieldError fieldName) .
fromPersistValue|]
-mkEntity :: MkPersistSettings -> EntityDef -> Q [Dec]
-mkEntity mps t = do
- t' <- lift t
+mkEntity :: EntityMap -> MkPersistSettings -> EntityDef -> Q [Dec]
+mkEntity entMap mps t = do
+ t' <- liftAndFixKeys entMap t
let nameT = unHaskellName entName
let nameS = unpack nameT
let clazz = ConT ''PersistEntity `AppT` genDataType
@@ -1206,7 +1219,7 @@
return $
instanceD
[ mkClassP ''PersistQuery [backendT]
- , mkEqualP (ConT ''PersistEntityBackend `AppT` entityT) backendT
+ , mkEqualP (ConT ''PersistEntityBackend `AppT` entityT) (ConT
''BaseBackend `AppT` backendT)
]
(ConT ''DeleteCascade `AppT` entityT `AppT` backendT)
[ FunD 'deleteCascade
@@ -1340,6 +1353,7 @@
defs = filter isMigrated allDefs
isMigrated def = not $ "no-migrate" `elem` entityAttrs def
typ = ConT ''Migration
+ entMap = M.fromList $ map (\ent -> (entityHaskell ent, ent)) allDefs
body :: Q Exp
body =
case defs of
@@ -1347,17 +1361,46 @@
_ -> do
defsName <- newName "defs"
defsStmt <- do
- defs' <- mapM lift defs
+ defs' <- mapM (liftAndFixKeys entMap) defs
let defsExp = ListE defs'
return $ LetS [ValD (VarP defsName) (NormalB defsExp) []]
stmts <- mapM (toStmt $ VarE defsName) defs
return (DoE $ defsStmt : stmts)
toStmt :: Exp -> EntityDef -> Q Stmt
toStmt defsExp ed = do
- u <- lift ed
+ u <- liftAndFixKeys entMap ed
m <- [|migrate|]
return $ NoBindS $ m `AppE` defsExp `AppE` u
+liftAndFixKeys :: EntityMap -> EntityDef -> Q Exp
+liftAndFixKeys entMap EntityDef{..} =
+ [|EntityDef
+ entityHaskell
+ entityDB
+ entityId
+ entityAttrs
+ $(ListE <$> mapM (liftAndFixKey entMap) entityFields)
+ entityUniques
+ entityForeigns
+ entityDerives
+ entityExtra
+ entitySum
+ |]
+
+liftAndFixKey :: EntityMap -> FieldDef -> Q Exp
+liftAndFixKey entMap (FieldDef a b c sqlTyp e f fieldRef) =
+ [|FieldDef a b c $(sqlTyp') e f fieldRef'|]
+ where
+ (fieldRef', sqlTyp') = fromMaybe (fieldRef, lift sqlTyp) $
+ case fieldRef of
+ ForeignRef refName ft -> case M.lookup refName entMap of
+ Nothing -> Nothing
+ Just ent ->
+ case fieldReference $ entityId ent of
+ fr@(ForeignRef _Name ft) -> Just (fr, lift $ SqlTypeExp ft)
+ _ -> Nothing
+ _ -> Nothing
+
instance Lift EntityDef where
lift EntityDef{..} =
[|EntityDef
@@ -1519,7 +1562,7 @@
obj <- newName "obj"
mzeroE <- [|mzero|]
- xs <- mapM (newName . unpack . unHaskellName . fieldHaskell)
+ xs <- mapM (newName . unpack . unHaskellNameForJSON . fieldHaskell)
$ entityFields def
let conName = mkName $ unpack $ unHaskellName $ entityHaskell def
@@ -1633,4 +1676,3 @@
-- let x = mkName "x"
-- in normalClause [ConP (mkName constr) [VarP x]]
-- (VarE 'toPersistValue `AppE` VarE x)
-
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/persistent-template-2.1.8.1/persistent-template.cabal
new/persistent-template-2.5.1.6/persistent-template.cabal
--- old/persistent-template-2.1.8.1/persistent-template.cabal 2016-05-14
06:08:17.000000000 +0200
+++ new/persistent-template-2.5.1.6/persistent-template.cabal 2016-08-05
07:25:16.000000000 +0200
@@ -1,5 +1,5 @@
name: persistent-template
-version: 2.1.8.1
+version: 2.5.1.6
license: MIT
license-file: LICENSE
author: Michael Snoyman <[email protected]>
@@ -17,14 +17,14 @@
library
build-depends: base >= 4.6 && < 5
, template-haskell
- , persistent >= 2.2.2 && < 3
+ , persistent >= 2.5 && < 3
, monad-control >= 0.2 && < 1.1
, bytestring >= 0.9
, text >= 0.5
, transformers >= 0.2 && < 0.6
, containers
, aeson >= 0.7 && < 0.12
- , aeson-compat >= 0.3.0.0 && < 0.4
+ , aeson-compat >= 0.3.2.0 && < 0.4
, monad-logger
, unordered-containers
, tagged
++++++ persistent-template.cabal ++++++
name: persistent-template
version: 2.5.1.6
x-revision: 1
license: MIT
license-file: LICENSE
author: Michael Snoyman <[email protected]>
maintainer: Michael Snoyman <[email protected]>, Greg Weber
<[email protected]>
synopsis: Type-safe, non-relational, multi-backend persistence.
description: Hackage documentation generation is not reliable. For up to
date documentation, please see:
<http://www.stackage.org/package/persistent-template>.
category: Database, Yesod
stability: Stable
cabal-version: >= 1.8
build-type: Simple
homepage: http://www.yesodweb.com/book/persistent
bug-reports: https://github.com/yesodweb/persistent/issues
extra-source-files: test/main.hs ChangeLog.md README.md
library
build-depends: base >= 4.6 && < 5
, template-haskell
, persistent >= 2.5 && < 3
, monad-control >= 0.2 && < 1.1
, bytestring >= 0.9
, text >= 0.5
, transformers >= 0.2 && < 0.6
, containers
, aeson >= 0.7 && < 1.1
, aeson-compat >= 0.3.2.0 && < 0.4
, monad-logger
, unordered-containers
, tagged
, path-pieces
, http-api-data >= 0.2 && < 0.4
, ghc-prim
exposed-modules: Database.Persist.TH
ghc-options: -Wall
if impl(ghc >= 7.4)
cpp-options: -DGHC_7_4
test-suite test
type: exitcode-stdio-1.0
main-is: main.hs
hs-source-dirs: test
build-depends: base >= 4.6 && < 5
, persistent-template
, aeson
, hspec >= 1.3
, text
, persistent
, bytestring
, QuickCheck
, transformers
source-repository head
type: git
location: git://github.com/yesodweb/persistent.git