Hello community, here is the log from the commit of package ghc-ipynb for openSUSE:Factory checked in at 2020-05-11 13:35:20 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-ipynb (Old) and /work/SRC/openSUSE:Factory/.ghc-ipynb.new.2738 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-ipynb" Mon May 11 13:35:20 2020 rev:3 rq:801029 version:0.1.0.1 Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-ipynb/ghc-ipynb.changes 2019-12-27 13:54:35.812693916 +0100 +++ /work/SRC/openSUSE:Factory/.ghc-ipynb.new.2738/ghc-ipynb.changes 2020-05-11 13:35:43.168408923 +0200 @@ -1,0 +2,8 @@ +Wed May 6 06:54:11 UTC 2020 - psim...@suse.com + +- Update ipynb to version 0.1.0.1. + ## 0.1.0.1 -- 2020-04-25 + + * Fixed to build with base64-bytestring 1.1. + +------------------------------------------------------------------- Old: ---- ipynb-0.1.tar.gz New: ---- ipynb-0.1.0.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-ipynb.spec ++++++ --- /var/tmp/diff_new_pack.kJbIxJ/_old 2020-05-11 13:35:44.444411598 +0200 +++ /var/tmp/diff_new_pack.kJbIxJ/_new 2020-05-11 13:35:44.444411598 +0200 @@ -1,7 +1,7 @@ # # spec file for package ghc-ipynb # -# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2020 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 ipynb %bcond_with tests Name: ghc-%{pkg_name} -Version: 0.1 +Version: 0.1.0.1 Release: 0 Summary: Data structure for working with Jupyter notebooks (ipynb) License: BSD-3-Clause ++++++ ipynb-0.1.tar.gz -> ipynb-0.1.0.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ipynb-0.1/Changelog.md new/ipynb-0.1.0.1/Changelog.md --- old/ipynb-0.1/Changelog.md 2019-01-23 06:37:40.000000000 +0100 +++ new/ipynb-0.1.0.1/Changelog.md 2001-09-09 03:46:40.000000000 +0200 @@ -1,5 +1,9 @@ # Revision history for ipynb +## 0.1.0.1 -- 2020-04-25 + +* Fixed to build with base64-bytestring 1.1. + ## 0.1.0.0 -- 2019-01-22 * Initial release. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ipynb-0.1/ipynb.cabal new/ipynb-0.1.0.1/ipynb.cabal --- old/ipynb-0.1/ipynb.cabal 2019-01-23 06:37:40.000000000 +0100 +++ new/ipynb-0.1.0.1/ipynb.cabal 2001-09-09 03:46:40.000000000 +0200 @@ -1,5 +1,5 @@ name: ipynb -version: 0.1 +version: 0.1.0.1 synopsis: Data structure for working with Jupyter notebooks (ipynb). description: ipynb defines a data structure for representing Jupyter notebooks, along with ToJSON and FromJSON instances diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ipynb-0.1/src/Data/Ipynb.hs new/ipynb-0.1.0.1/src/Data/Ipynb.hs --- old/ipynb-0.1/src/Data/Ipynb.hs 2019-01-23 06:37:40.000000000 +0100 +++ new/ipynb-0.1.0.1/src/Data/Ipynb.hs 2001-09-09 03:46:40.000000000 +0200 @@ -45,6 +45,7 @@ import Data.Aeson as Aeson import qualified Data.Aeson.Types as Aeson import Data.ByteString (ByteString) +import qualified Data.ByteString as B import qualified Data.ByteString.Base64 as Base64 import Data.Char (isSpace) import qualified Data.HashMap.Strict as HM @@ -483,11 +484,23 @@ instance ToJSON MimeBundle where toJSON (MimeBundle m) = let mimeBundleToValue (BinaryData bs) = - toJSON $ TE.decodeUtf8 . Base64.joinWith "\n" 76 . Base64.encode $ bs + toJSON . + TE.decodeUtf8 . + (<> "\n") . + B.intercalate "\n" . chunksOf 76 . + Base64.encode + $ bs mimeBundleToValue (JsonData v) = v mimeBundleToValue (TextualData t) = toJSON (breakLines t) in toJSON $ M.map mimeBundleToValue m +chunksOf :: Int -> ByteString -> [ByteString] +chunksOf k s + | B.null s = [] + | otherwise = + let (h,t) = B.splitAt k s + in h : chunksOf k t + -- | Break up a string into a list of strings, each representing -- one line of the string (including trailing newline if any). breakLines :: Text -> [Text] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ipynb-0.1/test/roundtrip.hs new/ipynb-0.1.0.1/test/roundtrip.hs --- old/ipynb-0.1/test/roundtrip.hs 2019-01-23 06:37:40.000000000 +0100 +++ new/ipynb-0.1.0.1/test/roundtrip.hs 2001-09-09 03:46:40.000000000 +0200 @@ -2,9 +2,10 @@ {-# LANGUAGE ScopedTypeVariables #-} import Data.Aeson (Value (..), eitherDecode, encode) -import Data.Aeson.Diff +import Data.Aeson.Diff as AesonDiff import qualified Data.ByteString.Base64 as Base64 import qualified Data.ByteString.Lazy as BL +import qualified Data.ByteString as B import qualified Data.HashMap.Strict as HM import Data.Ipynb import qualified Data.Text as T @@ -16,6 +17,7 @@ import System.FilePath import Test.Tasty import Test.Tasty.HUnit +import Data.Monoid main :: IO () main = do @@ -49,9 +51,18 @@ case Base64.decode (TE.encodeUtf8 (T.filter (/='\n') t)) of Left _ -> String t -- textual Right b -> String $ - TE.decodeUtf8 . Base64.joinWith "\n" 76 . Base64.encode $ b + TE.decodeUtf8 . (<> "\n") . + B.intercalate "\n" . chunksOf 76 . + Base64.encode $ b go v = v +chunksOf :: Int -> B.ByteString -> [B.ByteString] +chunksOf k s + | B.null s = [] + | otherwise = + let (h,t) = B.splitAt k s + in h : chunksOf k t + rtTest :: FilePath -> TestTree rtTest fp = testCase fp $ do inRaw <- BL.readFile fp @@ -68,7 +79,8 @@ (nb' :: Notebook NbV3) <- either error return $ eitherDecode outRaw (outJSON :: Value) <- either error return $ eitherDecode outRaw -- test that (read . write) == id - let patch' = diff (normalizeBase64 inJSON) (normalizeBase64 outJSON) + let patch' = AesonDiff.diff + (normalizeBase64 inJSON) (normalizeBase64 outJSON) assertBool (show patch') (patch' == Patch []) -- now test that (write . read) == id assertEqual "write . read != read" nb nb' @@ -81,7 +93,8 @@ (nb' :: Notebook NbV4) <- either error return $ eitherDecode outRaw (outJSON :: Value) <- either error return $ eitherDecode outRaw -- test that (read . write) == id - let patch' = diff (normalizeBase64 inJSON) (normalizeBase64 outJSON) + let patch' = AesonDiff.diff + (normalizeBase64 inJSON) (normalizeBase64 outJSON) assertBool (show patch') (patch' == Patch []) -- now test that (write . read) == id assertEqual "write . read != read" nb nb'