Hello community,

here is the log from the commit of package ghc-pipes-cacophony for 
openSUSE:Factory checked in at 2017-04-18 13:48:33
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-pipes-cacophony (Old)
 and      /work/SRC/openSUSE:Factory/.ghc-pipes-cacophony.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "ghc-pipes-cacophony"

Tue Apr 18 13:48:33 2017 rev:2 rq:461672 version:0.4.1

Changes:
--------
--- /work/SRC/openSUSE:Factory/ghc-pipes-cacophony/ghc-pipes-cacophony.changes  
2016-10-06 12:41:24.000000000 +0200
+++ 
/work/SRC/openSUSE:Factory/.ghc-pipes-cacophony.new/ghc-pipes-cacophony.changes 
    2017-04-18 13:48:34.569944394 +0200
@@ -1,0 +2,10 @@
+Sun Feb 12 14:20:25 UTC 2017 - psim...@suse.com
+
+- Update to version 0.4.1 with cabal2obs.
+
+-------------------------------------------------------------------
+Thu Sep 15 06:43:53 UTC 2016 - psim...@suse.com
+
+- Update to version 0.4.0 revision 0 with cabal2obs.
+
+-------------------------------------------------------------------

Old:
----
  pipes-cacophony-0.2.1.tar.gz

New:
----
  pipes-cacophony-0.4.1.tar.gz

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

Other differences:
------------------
++++++ ghc-pipes-cacophony.spec ++++++
--- /var/tmp/diff_new_pack.ZrYVdP/_old  2017-04-18 13:48:35.121866276 +0200
+++ /var/tmp/diff_new_pack.ZrYVdP/_new  2017-04-18 13:48:35.129865144 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package ghc-pipes-cacophony
 #
-# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2017 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,24 +19,23 @@
 %global pkg_name pipes-cacophony
 %bcond_with tests
 Name:           ghc-%{pkg_name}
-Version:        0.2.1
+Version:        0.4.1
 Release:        0
 Summary:        Pipes for Noise-secured network connections
 License:        SUSE-Public-Domain
-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
 BuildRequires:  ghc-Cabal-devel
-# Begin cabal-rpm deps:
 BuildRequires:  ghc-bytestring-devel
 BuildRequires:  ghc-cacophony-devel
+BuildRequires:  ghc-memory-devel
 BuildRequires:  ghc-pipes-devel
 BuildRequires:  ghc-rpm-macros
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 %if %{with tests}
 BuildRequires:  ghc-hlint-devel
 %endif
-# End cabal-rpm deps
 
 %description
 A set of pipes to secure network connections with the
@@ -57,20 +56,14 @@
 %prep
 %setup -q -n %{pkg_name}-%{version}
 
-
 %build
 %ghc_lib_build
 
-
 %install
 %ghc_lib_install
 
-
 %check
-%if %{with tests}
-%{cabal} test
-%endif
-
+%cabal_test
 
 %post devel
 %ghc_pkg_recache
@@ -84,6 +77,6 @@
 
 %files devel -f %{name}-devel.files
 %defattr(-,root,root,-)
-%doc README.md changelog.md
+%doc README.md changelog.md examples
 
 %changelog

++++++ pipes-cacophony-0.2.1.tar.gz -> pipes-cacophony-0.4.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pipes-cacophony-0.2.1/.travis.yml 
new/pipes-cacophony-0.4.1/.travis.yml
--- old/pipes-cacophony-0.2.1/.travis.yml       2016-04-06 03:26:38.000000000 
+0200
+++ new/pipes-cacophony-0.4.1/.travis.yml       2016-12-26 17:17:05.000000000 
+0100
@@ -13,26 +13,23 @@
 
 matrix:
   include:
-    - env: CABALVER=1.22 GHCVER=7.10.1
-      compiler: ": #GHC 7.10.1"
-      addons: {apt: {packages: 
[cabal-install-1.22,ghc-7.10.1,alex-3.1.4,happy-1.19.5], sources: [hvr-ghc]}}
-    - env: CABALVER=1.22 GHCVER=7.10.2
-      compiler: ": #GHC 7.10.2"
-      addons: {apt: {packages: 
[cabal-install-1.22,ghc-7.10.2,alex-3.1.4,happy-1.19.5], sources: [hvr-ghc]}}
     - env: CABALVER=1.22 GHCVER=7.10.3
       compiler: ": #GHC 7.10.3"
-      addons: {apt: {packages: 
[cabal-install-1.22,ghc-7.10.3,alex-3.1.4,happy-1.19.5], sources: [hvr-ghc]}}
-    - env: CABALVER=1.22 GHCVER=head
+      addons: {apt: {packages: 
[cabal-install-1.22,ghc-7.10.3,alex-3.1.7,happy-1.19.5], sources: [hvr-ghc]}}
+    - env: CABALVER=1.24 GHCVER=8.0.2
+      compiler: ": #GHC 8.0.2"
+      addons: {apt: {packages: 
[cabal-install-1.24,ghc-8.0.2,alex-3.1.7,happy-1.19.5], sources: [hvr-ghc]}}
+    - env: CABALVER=head GHCVER=head
       compiler: ": #GHC head"
-      addons: {apt: {packages: 
[cabal-install-1.22,ghc-head,alex-3.1.4,happy-1.19.5], sources: [hvr-ghc]}}
+      addons: {apt: {packages: 
[cabal-install-head,ghc-head,alex-3.1.7,happy-1.19.5], sources: [hvr-ghc]}}
 
   allow_failures:
-   - env: CABALVER=1.22 GHCVER=head
+   - env: CABALVER=head GHCVER=head
 
 before_install:
   - unset CC
   - export HAPPYVER=1.19.5
-  - export ALEXVER=3.1.4
+  - export ALEXVER=3.1.7
   - export 
PATH=~/.cabal/bin:/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:/opt/happy/$HAPPYVER/bin:/opt/alex/$ALEXVER/bin:$PATH
 
 install:
@@ -45,7 +42,7 @@
     fi
   - travis_retry cabal update
   - "sed -i  's/^jobs:.*$/jobs: 2/' $HOME/.cabal/config"
-  - cabal install --only-dependencies --enable-tests --dry -v 
pipes-cacophony.cabal > installplan.txt
+  - cabal install --only-dependencies --enable-tests -fbuild-examples --dry -v 
pipes-cacophony.cabal > installplan.txt
   - sed -i -e '1,/^Resolving /d' installplan.txt; cat installplan.txt
 
   # check whether current requested install-plan matches cached package-db 
snapshot
@@ -59,8 +56,7 @@
       echo "cabal build-cache MISS";
       rm -rf $HOME/.cabsnap;
       mkdir -p $HOME/.ghc $HOME/.cabal/lib $HOME/.cabal/share $HOME/.cabal/bin;
-      cabal install --only-dependencies --enable-tests pipes-cacophony.cabal;
-      if [ "$GHCVER" = "7.10.1" ]; then cabal install Cabal-1.22.4.0; fi;
+      cabal install --only-dependencies --enable-tests -fbuild-examples 
pipes-cacophony.cabal;
     fi
 
   # snapshot package-db on cache miss
@@ -72,10 +68,8 @@
       cp -a $HOME/.cabal/lib $HOME/.cabal/share $HOME/.cabal/bin 
installplan.txt $HOME/.cabsnap/;
     fi
 
-  - cabal install
-
 script:
-  - cabal configure --enable-tests -v2  # -v2 provides useful information for 
debugging
+  - cabal configure --enable-tests -fbuild-examples -v2  # -v2 provides useful 
information for debugging
   - cabal build   # this builds all libraries and executables (including tests)
   - cabal test
   - cabal sdist   # tests that a source-distribution can be generated
@@ -84,4 +78,4 @@
   # If there are no other `.tar.gz` files in `dist`, this can be even simpler:
   # `cabal install --force-reinstalls dist/*-*.tar.gz`
   - SRC_TGZ=$(cabal info . | awk '{print $2;exit}').tar.gz &&
-    (cd dist && cabal install --enable-tests -fbuild-examples --run-tests 
--force-reinstalls "$SRC_TGZ")
+    (cd dist && cabal install --enable-tests --run-tests -fbuild-examples 
--force-reinstalls "$SRC_TGZ")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pipes-cacophony-0.2.1/changelog.md 
new/pipes-cacophony-0.4.1/changelog.md
--- old/pipes-cacophony-0.2.1/changelog.md      2016-04-06 03:26:38.000000000 
+0200
+++ new/pipes-cacophony-0.4.1/changelog.md      2016-12-26 17:17:05.000000000 
+0100
@@ -1,9 +1,21 @@
-# 0.2.1
+# 0.4.1
 
-* Removed examples
+* Brought up to date with cacophony API changes
+
+# 0.4.0
+
+* Brought up to date with cacophony API changes
+
+* Updated travis configuration
+
+# 0.3.0
 
 * Brought up to date with cacophony API changes
 
+# 0.2.1
+
+* Removed examples
+
 # 0.2.0
 
 * Removed HandshakePipe due to cacophony API changes
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pipes-cacophony-0.2.1/examples/loopback/Main.hs 
new/pipes-cacophony-0.4.1/examples/loopback/Main.hs
--- old/pipes-cacophony-0.2.1/examples/loopback/Main.hs 1970-01-01 
01:00:00.000000000 +0100
+++ new/pipes-cacophony-0.4.1/examples/loopback/Main.hs 2016-12-26 
17:17:05.000000000 +0100
@@ -0,0 +1,44 @@
+module Main where
+
+import Control.Exception     (SomeException)
+import Control.Lens
+import Control.Monad         (forever)
+import Data.ByteArray        (ScrubbedBytes, convert)
+import Data.ByteString.Char8 (unpack, pack)
+import Pipes
+import qualified Pipes.Prelude as P
+
+import Crypto.Noise
+import Crypto.Noise.Cipher.ChaChaPoly1305
+import Crypto.Noise.DH
+import Crypto.Noise.DH.Curve25519
+import Crypto.Noise.HandshakePatterns (noiseNN)
+import Crypto.Noise.Hash.SHA256
+
+import Pipes.Noise
+
+strToSB :: Pipe String ScrubbedBytes IO (Either SomeException ())
+strToSB = forever $ await >>= yield . convert . pack
+
+sbToStr :: Pipe ScrubbedBytes String IO (Either SomeException ())
+sbToStr = forever $ await >>= yield . unpack . convert
+
+main :: IO ()
+main = do
+  iek <- dhGenKey :: IO (KeyPair Curve25519)
+  rek <- dhGenKey :: IO (KeyPair Curve25519)
+
+  let idho     = defaultHandshakeOpts noiseNN InitiatorRole
+      rdho     = defaultHandshakeOpts noiseNN ResponderRole
+      iho      = idho & hoLocalEphemeral .~ Just iek
+      rho      = rdho & hoLocalEphemeral .~ Just rek
+      ins      = noiseState iho :: NoiseState ChaChaPoly1305 Curve25519 SHA256
+      rns      = noiseState rho :: NoiseState ChaChaPoly1305 Curve25519 SHA256
+
+  (iip, iop) <- mkNoisePipes ins
+  (rip, rop) <- mkNoisePipes rns
+
+  result <- runEffect $ (Right () <$ P.stdinLn) >-> strToSB >-> iop >-> rip 
>-> rop >-> iip >-> sbToStr >-> (Right () <$ P.stdoutLn)
+  case result of
+    Left e  -> print e
+    Right _ -> return ()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pipes-cacophony-0.2.1/pipes-cacophony.cabal 
new/pipes-cacophony-0.4.1/pipes-cacophony.cabal
--- old/pipes-cacophony-0.2.1/pipes-cacophony.cabal     2016-04-06 
03:26:38.000000000 +0200
+++ new/pipes-cacophony-0.4.1/pipes-cacophony.cabal     2016-12-26 
17:17:05.000000000 +0100
@@ -1,5 +1,5 @@
 name:          pipes-cacophony
-version:       0.2.1
+version:       0.4.1
 synopsis:      Pipes for Noise-secured network connections.
 license:       PublicDomain
 license-file:  LICENSE
@@ -10,7 +10,7 @@
 category:      Pipes, Cryptography
 build-type:    Simple
 cabal-version: >=1.10
-tested-with:   GHC == 7.10.1, GHC == 7.10.2, GHC == 7.10.3
+tested-with:   GHC == 7.10.3, GHC == 8.0.2
 description:
   A set of pipes to secure network connections with the
   <https://github.com/trevp/noise/blob/master/noise.md Noise> protocol.
@@ -30,6 +30,12 @@
 -- FLAGS
 
 flag hlint
+  description: Build hlint test
+
+flag build-examples
+  description: Build example executables
+  default: False
+  manual: True
 
 flag llvm
   default: False
@@ -40,15 +46,41 @@
 
 library
   build-depends:
-    base       >=4.8 && <5,
+    base        >=4.8 && <5,
     bytestring,
-    cacophony  >=0.6,
+    cacophony   >=0.9,
+    memory,
     pipes
   hs-source-dirs:   src
   default-language: Haskell2010
   exposed-modules:
     Pipes.Noise
-  ghc-options:      -rtsopts -with-rtsopts=-N -Wall -fwarn-tabs
+  ghc-options:      -Wall -fwarn-tabs
+
+  if flag(llvm)
+    ghc-options: -fllvm
+
+--------------------------------------------------------------------------------
+-- EXAMPLES
+
+executable loopback
+  default-language: Haskell2010
+  hs-source-dirs:   examples/loopback
+  main-is:          Main.hs
+
+  if flag(build-examples)
+    build-depends:
+      base            >=4.8 && <5,
+      bytestring,
+      cacophony       >=0.9,
+      lens,
+      memory,
+      pipes,
+      pipes-cacophony
+  else
+    buildable: False
+
+  ghc-options:      -threaded -O2 -rtsopts -with-rtsopts=-N -Wall -fwarn-tabs
 
   if flag(llvm)
     ghc-options: -fllvm
@@ -67,5 +99,8 @@
     buildable: False
   else
     build-depends:
-      base >=4.8 && <5,
+      base  >=4.8 && <5,
       hlint
+
+  if flag(llvm)
+    ghc-options: -fllvm
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pipes-cacophony-0.2.1/src/Pipes/Noise.hs 
new/pipes-cacophony-0.4.1/src/Pipes/Noise.hs
--- old/pipes-cacophony-0.2.1/src/Pipes/Noise.hs        2016-04-06 
03:26:38.000000000 +0200
+++ new/pipes-cacophony-0.4.1/src/Pipes/Noise.hs        2016-12-26 
17:17:05.000000000 +0100
@@ -8,48 +8,63 @@
 
 module Pipes.Noise
   ( -- * Types
-    MessagePipe,
+    InboundNoisePipe
+  , OutboundNoisePipe
     -- * Pipes
-    messageEncryptPipe,
-    messageDecryptPipe
+  , mkNoisePipes
   ) where
 
-import Control.Concurrent.MVar (MVar, putMVar, takeMVar)
-import Control.Monad           (forever)
+import Control.Concurrent.MVar (MVar, newMVar, putMVar, takeMVar)
+import Control.Exception       (SomeException)
+import Data.ByteArray          (ScrubbedBytes)
 import Data.ByteString         (ByteString)
-import Pipes                   (Pipe, await, yield, lift)
+import Pipes                   (Pipe, MonadIO, await, yield, liftIO)
 
 import Crypto.Noise.Cipher     (Cipher)
-import Crypto.Noise.Handshake
-import Crypto.Noise.Types
-import Data.ByteArray.Extend
-
--- | Message pipes transform ByteStrings.
-type MessagePipe = Pipe ByteString ByteString
-
--- | Creates a new 'MessagePipe' exclusively for encryption.
-messageEncryptPipe :: Cipher c
-                   => MVar (SendingCipherState c)
-                   -> MessagePipe IO r
-messageEncryptPipe csmv = forever $ do
+import Crypto.Noise.DH         (DH)
+import Crypto.Noise.Hash       (Hash)
+import Crypto.Noise
+
+-- | Pipe used for inbound Noise messages.
+type InboundNoisePipe  = Pipe ByteString ScrubbedBytes
+
+-- | Pipe used for outbound Noise messages.
+type OutboundNoisePipe = Pipe ScrubbedBytes ByteString
+
+-- | Creates a pair of Pipes, the first used for inbound messages and the
+--   second used for outbound messages.
+mkNoisePipes :: (MonadIO m, Cipher c, DH d, Hash h)
+             => NoiseState c d h
+             -> IO (InboundNoisePipe  m (Either SomeException ()),
+                    OutboundNoisePipe m (Either SomeException ()))
+mkNoisePipes ns = do
+  nsmv <- liftIO . newMVar $ ns
+  return (inboundPipe nsmv, outboundPipe nsmv)
+
+inboundPipe :: (MonadIO m, Cipher c, DH d, Hash h)
+            => MVar (NoiseState c d h)
+            -> InboundNoisePipe m (Either SomeException ())
+inboundPipe nsmv = do
   msg <- await
 
-  encState <- lift $ takeMVar csmv
-  let pt = Plaintext . bsToSB' $ msg
-      (ct, encState') = encryptPayload pt encState
-  lift $ putMVar csmv encState'
-
-  yield ct
-
--- | Creates a new 'MessagePipe' exclusively for decryption.
-messageDecryptPipe :: Cipher c
-                   => MVar (ReceivingCipherState c)
-                   -> MessagePipe IO r
-messageDecryptPipe csmv = forever $ do
+  ns <- liftIO . takeMVar $ nsmv
+  case readMessage ns msg of
+    Left e -> return . Left $ e
+    Right (pt, ns') -> do
+      liftIO . putMVar nsmv $ ns'
+      yield pt
+      inboundPipe nsmv
+
+outboundPipe :: (MonadIO m, Cipher c, DH d, Hash h)
+             => MVar (NoiseState c d h)
+             -> OutboundNoisePipe m (Either SomeException ())
+outboundPipe nsmv = do
   msg <- await
 
-  decState <- lift $ takeMVar csmv
-  let (Plaintext pt, decState') = decryptPayload msg decState
-  lift $ putMVar csmv decState'
-
-  yield . sbToBS' $ pt
+  ns <- liftIO . takeMVar $ nsmv
+  case writeMessage ns msg of
+    Left e -> return . Left $ e
+    Right (ct, ns') -> do
+      liftIO . putMVar nsmv $ ns'
+      yield ct
+      outboundPipe nsmv


Reply via email to