Hello community,

here is the log from the commit of package ghc-cookie for openSUSE:Factory 
checked in at 2018-05-30 12:05:35
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-cookie (Old)
 and      /work/SRC/openSUSE:Factory/.ghc-cookie.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "ghc-cookie"

Wed May 30 12:05:35 2018 rev:7 rq:607774 version:0.4.4

Changes:
--------
--- /work/SRC/openSUSE:Factory/ghc-cookie/ghc-cookie.changes    2017-09-15 
21:28:56.066784148 +0200
+++ /work/SRC/openSUSE:Factory/.ghc-cookie.new/ghc-cookie.changes       
2018-05-30 12:25:17.474357463 +0200
@@ -1,0 +2,8 @@
+Mon May 14 17:02:11 UTC 2018 - [email protected]
+
+- Update cookie to version 0.4.4.
+  * Dropped dependency on blaze-builder
+  * Made cookie text rendering slightly more efficient
+  * Added `defaultSetCookie` [#16](https://github.com/snoyberg/cookie/pull/16)
+
+-------------------------------------------------------------------

Old:
----
  cookie-0.4.2.1.tar.gz

New:
----
  cookie-0.4.4.tar.gz

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

Other differences:
------------------
++++++ ghc-cookie.spec ++++++
--- /var/tmp/diff_new_pack.Ekj8Oi/_old  2018-05-30 12:25:18.122336276 +0200
+++ /var/tmp/diff_new_pack.Ekj8Oi/_new  2018-05-30 12:25:18.126336145 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package ghc-cookie
 #
-# 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 cookie
 %bcond_with tests
 Name:           ghc-%{pkg_name}
-Version:        0.4.2.1
+Version:        0.4.4
 Release:        0
 Summary:        HTTP cookie parsing and rendering
 License:        MIT
@@ -27,11 +27,9 @@
 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
-BuildRequires:  ghc-blaze-builder-devel
 BuildRequires:  ghc-bytestring-devel
 BuildRequires:  ghc-data-default-class-devel
 BuildRequires:  ghc-deepseq-devel
-BuildRequires:  ghc-old-locale-devel
 BuildRequires:  ghc-rpm-macros
 BuildRequires:  ghc-text-devel
 BuildRequires:  ghc-time-devel
@@ -77,7 +75,7 @@
 %ghc_pkg_recache
 
 %files -f %{name}.files
-%doc LICENSE
+%license LICENSE
 
 %files devel -f %{name}-devel.files
 %doc ChangeLog.md README.md

++++++ cookie-0.4.2.1.tar.gz -> cookie-0.4.4.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cookie-0.4.2.1/ChangeLog.md 
new/cookie-0.4.4/ChangeLog.md
--- old/cookie-0.4.2.1/ChangeLog.md     2016-07-07 17:34:11.000000000 +0200
+++ new/cookie-0.4.4/ChangeLog.md       2018-03-11 07:06:16.000000000 +0100
@@ -1,3 +1,12 @@
+## 0.4.4
+
+* Dropped dependency on blaze-builder
+* Made cookie text rendering slightly more efficient
+
+## 0.4.3
+
+* Added `defaultSetCookie` [#16](https://github.com/snoyberg/cookie/pull/16)
+
 ## 0.4.2.1
 
 * Clarified MIT license
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cookie-0.4.2.1/Web/Cookie.hs 
new/cookie-0.4.4/Web/Cookie.hs
--- old/cookie-0.4.2.1/Web/Cookie.hs    2016-07-07 17:34:11.000000000 +0200
+++ new/cookie-0.4.4/Web/Cookie.hs      2018-03-11 07:06:16.000000000 +0100
@@ -1,4 +1,3 @@
-{-# LANGUAGE CPP #-}
 {-# LANGUAGE OverloadedStrings #-}
 module Web.Cookie
     ( -- * Server to client
@@ -19,6 +18,7 @@
       -- ** Functions
     , parseSetCookie
     , renderSetCookie
+    , defaultSetCookie
     , def
       -- * Client to server
     , Cookies
@@ -36,24 +36,18 @@
 
 import qualified Data.ByteString as S
 import qualified Data.ByteString.Char8 as S8
-import Data.Char (toLower)
-import Blaze.ByteString.Builder (Builder, fromByteString, copyByteString)
-import Blaze.ByteString.Builder.Char8 (fromChar)
+import Data.Char (toLower, isDigit)
+import Data.ByteString.Builder (Builder, byteString, char8)
+import Data.ByteString.Builder.Extra (byteStringCopy)
 import Data.Monoid (mempty, mappend, mconcat)
 import Data.Word (Word8)
 import Data.Ratio (numerator, denominator)
-import Data.Time (UTCTime (UTCTime), toGregorian, fromGregorian, formatTime, 
parseTime)
+import Data.Time (UTCTime (UTCTime), toGregorian, fromGregorian, formatTime, 
parseTimeM, defaultTimeLocale)
 import Data.Time.Clock (DiffTime, secondsToDiffTime)
-#if MIN_VERSION_time(1, 5, 0)
-import Data.Time (defaultTimeLocale)
-#else
-import System.Locale (defaultTimeLocale)
-#endif
-import Control.Arrow (first)
+import Control.Arrow (first, (***))
 import Data.Text (Text)
-import Data.Text.Encoding (encodeUtf8, decodeUtf8With)
+import Data.Text.Encoding (encodeUtf8Builder, decodeUtf8With)
 import Data.Text.Encoding.Error (lenientDecode)
-import Control.Arrow ((***))
 import Data.Maybe (isJust)
 import Data.Default.Class (Default (def))
 import Control.DeepSeq (NFData (rnf))
@@ -67,9 +61,8 @@
   where
     go = decodeUtf8With lenientDecode
 
--- FIXME to speed things up, skip encodeUtf8 and use fromText instead
 renderCookiesText :: CookiesText -> Builder
-renderCookiesText = renderCookies . map (encodeUtf8 *** encodeUtf8)
+renderCookiesText = renderCookiesBuilder . map (encodeUtf8Builder *** 
encodeUtf8Builder)
 
 type Cookies = [(S.ByteString, S.ByteString)]
 
@@ -89,29 +82,34 @@
 
 breakDiscard :: Word8 -> S.ByteString -> (S.ByteString, S.ByteString)
 breakDiscard w s =
-    let (x, y) = S.breakByte w s
+    let (x, y) = S.break (== w) s
      in (x, S.drop 1 y)
 
-renderCookies :: Cookies -> Builder
-renderCookies [] = mempty
-renderCookies cs =
+type CookieBuilder = (Builder, Builder)
+
+renderCookiesBuilder :: [CookieBuilder] -> Builder
+renderCookiesBuilder [] = mempty
+renderCookiesBuilder cs =
     foldr1 go $ map renderCookie cs
   where
-    go x y = x `mappend` fromChar ';' `mappend` y
+    go x y = x `mappend` char8 ';' `mappend` y
+
+renderCookie :: CookieBuilder -> Builder
+renderCookie (k, v) = k `mappend` char8 '=' `mappend` v
+
+renderCookies :: Cookies -> Builder
+renderCookies = renderCookiesBuilder . map (byteString *** byteString)
 
-renderCookie :: (S.ByteString, S.ByteString) -> Builder
-renderCookie (k, v) = fromByteString k `mappend` fromChar '='
-                                       `mappend` fromByteString v
 -- | Data type representing the key-value pair to use for a cookie, as well as 
configuration options for it.
 --
 -- ==== Creating a SetCookie
 --
--- 'SetCookie' does not export a constructor; instead, use the 'Default' 
instance to create one and override values (see 
<http://www.yesodweb.com/book/settings-types> for details):
+-- 'SetCookie' does not export a constructor; instead, use 'defaultSetCookie' 
and override values (see <http://www.yesodweb.com/book/settings-types> for 
details):
 --
 -- @
 -- import Web.Cookie
 -- :set -XOverloadedStrings
--- let cookie = 'def' { 'setCookieName' = "cookieName", 'setCookieValue' = 
"cookieValue" }
+-- let cookie = 'defaultSetCookie' { 'setCookieName' = "cookieName", 
'setCookieValue' = "cookieValue" }
 -- @
 --
 -- ==== Cookie Configuration
@@ -130,15 +128,19 @@
     }
     deriving (Eq, Show)
 
--- | Data type representing the options for a SameSite cookie
-data SameSiteOption = Lax | Strict deriving (Show, Eq)
+-- | Data type representing the options for a 
<https://tools.ietf.org/html/draft-west-first-party-cookies-07#section-4.1 
SameSite cookie>
+data SameSiteOption = Lax
+                    | Strict
+                    deriving (Show, Eq)
 
 instance NFData SameSiteOption where
   rnf x = x `seq` ()
 
+-- | Directs the browser to send the cookie for 
<https://tools.ietf.org/html/rfc7231#section-4.2.1 safe requests> (e.g. @GET@), 
but not for unsafe ones (e.g. @POST@)
 sameSiteLax :: SameSiteOption
 sameSiteLax = Lax
 
+-- | Directs the browser to not send the cookie for /any/ cross-site request, 
including e.g. a user clicking a link in their email to open a page on your 
site.
 sameSiteStrict :: SameSiteOption
 sameSiteStrict = Strict
 
@@ -158,50 +160,57 @@
         rnfMBS Nothing = ()
         rnfMBS (Just bs) = bs `seq` ()
 
+-- | @'def' = 'defaultSetCookie'@
 instance Default SetCookie where
-    def = SetCookie
-        { setCookieName     = "name"
-        , setCookieValue    = "value"
-        , setCookiePath     = Nothing
-        , setCookieExpires  = Nothing
-        , setCookieMaxAge   = Nothing
-        , setCookieDomain   = Nothing
-        , setCookieHttpOnly = False
-        , setCookieSecure   = False
-        , setCookieSameSite = Nothing
-        }
+    def = defaultSetCookie
+
+-- | A minimal 'SetCookie'. All fields are 'Nothing' or 'False' except 
@'setCookieName' = "name"@ and @'setCookieValue' = "value"@. You need this to 
construct a 'SetCookie', because it does not export a constructor. 
Equivalently, you may use 'def'.
+--
+-- @since 0.4.2.2
+defaultSetCookie :: SetCookie
+defaultSetCookie = SetCookie
+    { setCookieName     = "name"
+    , setCookieValue    = "value"
+    , setCookiePath     = Nothing
+    , setCookieExpires  = Nothing
+    , setCookieMaxAge   = Nothing
+    , setCookieDomain   = Nothing
+    , setCookieHttpOnly = False
+    , setCookieSecure   = False
+    , setCookieSameSite = Nothing
+    }
 
 renderSetCookie :: SetCookie -> Builder
 renderSetCookie sc = mconcat
-    [ fromByteString (setCookieName sc)
-    , fromChar '='
-    , fromByteString (setCookieValue sc)
+    [ byteString (setCookieName sc)
+    , char8 '='
+    , byteString (setCookieValue sc)
     , case setCookiePath sc of
         Nothing -> mempty
-        Just path -> copyByteString "; Path="
-                     `mappend` fromByteString path
+        Just path -> byteStringCopy "; Path="
+                     `mappend` byteString path
     , case setCookieExpires sc of
         Nothing -> mempty
-        Just e -> copyByteString "; Expires=" `mappend`
-                  fromByteString (formatCookieExpires e)
+        Just e -> byteStringCopy "; Expires=" `mappend`
+                  byteString (formatCookieExpires e)
     , case setCookieMaxAge sc of
         Nothing -> mempty
-        Just ma -> copyByteString"; Max-Age=" `mappend`
-                   fromByteString (formatCookieMaxAge ma)
+        Just ma -> byteStringCopy"; Max-Age=" `mappend`
+                   byteString (formatCookieMaxAge ma)
     , case setCookieDomain sc of
         Nothing -> mempty
-        Just d -> copyByteString "; Domain=" `mappend`
-                  fromByteString d
+        Just d -> byteStringCopy "; Domain=" `mappend`
+                  byteString d
     , if setCookieHttpOnly sc
-        then copyByteString "; HttpOnly"
+        then byteStringCopy "; HttpOnly"
         else mempty
     , if setCookieSecure sc
-        then copyByteString "; Secure"
+        then byteStringCopy "; Secure"
         else mempty
     , case setCookieSameSite sc of
         Nothing -> mempty
-        Just Lax -> copyByteString "; SameSite=Lax"
-        Just Strict -> copyByteString "; SameSite=Strict"
+        Just Lax -> byteStringCopy "; SameSite=Lax"
+        Just Strict -> byteStringCopy "; SameSite=Strict"
     ]
 
 parseSetCookie :: S.ByteString -> SetCookie
@@ -238,7 +247,7 @@
 
 parseCookieExpires :: S.ByteString -> Maybe UTCTime
 parseCookieExpires =
-    fmap fuzzYear . parseTime defaultTimeLocale expiresFormat . S8.unpack
+    fmap fuzzYear . parseTimeM True defaultTimeLocale expiresFormat . S8.unpack
   where
     -- See: https://github.com/snoyberg/cookie/issues/5
     fuzzYear orig@(UTCTime day diff)
@@ -258,6 +267,6 @@
 
 parseCookieMaxAge :: S.ByteString -> Maybe DiffTime
 parseCookieMaxAge bs
-  | all (\ c -> c >= '0' && c <= '9') $ unpacked = Just $ secondsToDiffTime $ 
read unpacked
+  | all isDigit unpacked = Just $ secondsToDiffTime $ read unpacked
   | otherwise = Nothing
   where unpacked = S8.unpack bs
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cookie-0.4.2.1/cookie.cabal 
new/cookie-0.4.4/cookie.cabal
--- old/cookie-0.4.2.1/cookie.cabal     2016-07-07 17:34:11.000000000 +0200
+++ new/cookie-0.4.4/cookie.cabal       2018-03-11 07:06:16.000000000 +0100
@@ -1,5 +1,5 @@
 name:            cookie
-version:         0.4.2.1
+version:         0.4.4
 license:         MIT
 license-file:    LICENSE
 author:          Michael Snoyman <[email protected]>
@@ -15,11 +15,9 @@
 
 library
     build-depends:   base                      >= 4        && < 5
-                   , bytestring                >= 0.9.1.4
-                   , blaze-builder             >= 0.2.1
-                   , old-locale                >= 1
-                   , time                      >= 1.4
-                   , text                      >= 0.7
+                   , bytestring                >= 0.10.2
+                   , time                      >= 1.5
+                   , text                      >= 1.1
                    , data-default-class
                    , deepseq
     exposed-modules: Web.Cookie
@@ -32,16 +30,13 @@
     build-depends: base
                  , HUnit
                  , QuickCheck
-                 , blaze-builder
-                 , bytestring
+                 , bytestring >= 0.10.2
                  , cookie
                  , tasty
                  , tasty-hunit
                  , tasty-quickcheck
-                 , text
-                 -- Bug in time 1.4.0, see:
-                 -- https://github.com/snoyberg/cookie/issues/9
-                 , time >= 1.4.0.2
+                 , text >= 1.1
+                 , time >= 1.5
 
 source-repository head
   type:     git
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cookie-0.4.2.1/test/Spec.hs 
new/cookie-0.4.4/test/Spec.hs
--- old/cookie-0.4.2.1/test/Spec.hs     2016-07-07 17:34:11.000000000 +0200
+++ new/cookie-0.4.4/test/Spec.hs       2018-03-11 07:06:16.000000000 +0100
@@ -5,11 +5,12 @@
 import Test.HUnit ((@=?), Assertion)
 
 import Web.Cookie
-import Blaze.ByteString.Builder (Builder, toLazyByteString)
+import Data.ByteString.Builder (Builder, word8, toLazyByteString)
 import qualified Data.ByteString as S
 import qualified Data.ByteString.Char8 as S8
 import qualified Data.ByteString.Lazy as L
 import Data.Word (Word8)
+import Data.Monoid (mconcat)
 import Control.Arrow ((***))
 import Control.Applicative ((<$>), (<*>))
 import Data.Time (UTCTime (UTCTime), toGregorian)


Reply via email to