haskellPackages.twitterConduit: New expression

I've had to patch authenticate-oauth to get this working. The patch
comes from a commit that's already in master, so future versions will
have this and it's ok if cabal2nix ends up discarding this information.
This commit is contained in:
Oliver Charles 2014-04-03 14:25:37 +01:00
parent 9a396b3840
commit c4339a029e
5 changed files with 115 additions and 0 deletions

View File

@ -0,0 +1,57 @@
From c401c2c585b5345243211e981c123a92b995b448 Mon Sep 17 00:00:00 2001
From: Sergei Trofimovich <slyfox@gentoo.org>
Date: Sat, 25 Jan 2014 13:35:52 +0300
Subject: [PATCH] authenticate-oauth.cabal: allow RSA-2
The only cosmetic change is rename of 'ha_SHA1' to 'hashSHA1'
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
---
authenticate-oauth/Web/Authenticate/OAuth.hs | 10 ++++++++--
authenticate-oauth/authenticate-oauth.cabal | 2 +-
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/authenticate-oauth/Web/Authenticate/OAuth.hs b/authenticate-oauth/Web/Authenticate/OAuth.hs
index 3f38c8c..eccd0f1 100644
--- a/authenticate-oauth/Web/Authenticate/OAuth.hs
+++ b/authenticate-oauth/Web/Authenticate/OAuth.hs
@@ -21,7 +21,7 @@ module Web.Authenticate.OAuth
paramEncode, addScope, addMaybeProxy
) where
import Blaze.ByteString.Builder (toByteString, Builder)
-import Codec.Crypto.RSA (ha_SHA1, rsassa_pkcs1_v1_5_sign)
+import qualified Codec.Crypto.RSA as RSA
import Control.Exception
import Control.Monad
import Control.Monad.IO.Class (MonadIO, liftIO)
@@ -346,7 +346,13 @@ genSign oa tok req =
PLAINTEXT ->
return $ BS.intercalate "&" $ map paramEncode [oauthConsumerSecret oa, tokenSecret tok]
RSASHA1 pr ->
- liftM (encode . toStrict . rsassa_pkcs1_v1_5_sign ha_SHA1 pr) (getBaseString tok req)
+ liftM (encode . toStrict . RSA.rsassa_pkcs1_v1_5_sign
+#if MIN_VERSION_RSA(2, 0, 0)
+ RSA.hashSHA1
+#else
+ RSA.ha_SHA1
+#endif
+ pr) (getBaseString tok req)
#if MIN_VERSION_http_conduit(2, 0, 0)
addAuthHeader :: BS.ByteString -> Credential -> Request -> Request
diff --git a/authenticate-oauth/authenticate-oauth.cabal b/authenticate-oauth/authenticate-oauth.cabal
index 00507da..e11c3bd 100644
--- a/authenticate-oauth/authenticate-oauth.cabal
+++ b/authenticate-oauth/authenticate-oauth.cabal
@@ -19,7 +19,7 @@ library
, transformers >= 0.1 && < 0.4
, bytestring >= 0.9
, crypto-pubkey-types >= 0.1 && < 0.5
- , RSA >= 1.2 && < 1.3
+ , RSA >= 1.2 && < 2.1
, time
, data-default
, base64-bytestring >= 0.1 && < 1.1
--
1.9.1

View File

@ -7,6 +7,8 @@ cabal.mkDerivation (self: {
pname = "authenticate-oauth";
version = "1.4.0.8";
sha256 = "1mc36d6lkmqywzsxhzwv4445mmwdz0rr5ibd2a1nbgw5c5jw76fy";
patches = [ ./RSA2.patch ];
patchFlags = "-p2";
buildDepends = [
base64Bytestring blazeBuilder blazeBuilderConduit conduit
cryptoPubkeyTypes dataDefault httpConduit httpTypes monadControl
@ -17,5 +19,6 @@ cabal.mkDerivation (self: {
description = "Library to authenticate with OAuth for Haskell web applications";
license = self.stdenv.lib.licenses.bsd3;
platforms = self.ghc.meta.platforms;
maintainers = [ self.stdenv.lib.maintainers.ocharles ];
};
})

View File

@ -0,0 +1,28 @@
{ cabal, aeson, attoparsec, attoparsecConduit, authenticateOauth
, conduit, dataDefault, doctest, failure, filepath, hlint
, httpClientMultipart, httpConduit, httpTypes, lens, liftedBase
, monadControl, monadLogger, resourcet, shakespeareText, text, time
, transformers, transformersBase, twitterTypes
}:
cabal.mkDerivation (self: {
pname = "twitter-conduit";
version = "0.0.2";
sha256 = "1bkn0lfwwr5lnw4xfzdjiad48r1qz6m4z0nq1inz45gflmjwmghj";
isLibrary = true;
isExecutable = true;
buildDepends = [
aeson attoparsec attoparsecConduit authenticateOauth conduit
dataDefault failure httpClientMultipart httpConduit httpTypes lens
liftedBase monadControl monadLogger resourcet shakespeareText text
time transformers transformersBase twitterTypes
];
testDepends = [ doctest filepath hlint ];
meta = {
homepage = "https://github.com/himura/twitter-conduit";
description = "Twitter API package with conduit interface and Streaming API support";
license = self.stdenv.lib.licenses.bsd3;
platforms = self.ghc.meta.platforms;
maintainers = [ self.stdenv.lib.maintainers.ocharles ];
};
})

View File

@ -0,0 +1,23 @@
{ cabal, aeson, attoparsec, httpTypes, HUnit, shakespeareText
, testFramework, testFrameworkHunit, testFrameworkThPrime, text
, unorderedContainers
}:
cabal.mkDerivation (self: {
pname = "twitter-types";
version = "0.2.20130101";
sha256 = "0y7pymwcv8i5f8hqh4h018xp5bd998l8fx9f2a8x6d53c7l34wmd";
buildDepends = [ aeson httpTypes text unorderedContainers ];
testDepends = [
aeson attoparsec httpTypes HUnit shakespeareText testFramework
testFrameworkHunit testFrameworkThPrime text unorderedContainers
];
meta = {
homepage = "https://github.com/himura/twitter-types";
description = "Twitter JSON parser and types";
license = self.stdenv.lib.licenses.bsd3;
platforms = self.ghc.meta.platforms;
maintainers = [ self.stdenv.lib.maintainers.ocharles ];
};
doCheck = false;
})

View File

@ -2522,6 +2522,10 @@ let result = let callPackage = x : y : modifyPrio (newScope result.finalReturn x
tuple = callPackage ../development/libraries/haskell/tuple {};
twitterConduit = callPackage ../development/libraries/haskell/twitter-conduit {};
twitterTypes = callPackage ../development/libraries/haskell/twitter-types {};
TypeCompose = callPackage ../development/libraries/haskell/TypeCompose {};
typeEq = callPackage ../development/libraries/haskell/type-eq {};