summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2015-05-07 18:07:13 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2015-05-07 18:07:13 -0400
commitb116facc4a99ee63c82fa2ecec0de634c908c236 (patch)
treea9e6642e6c4077880cb894270f858f0e376fdbc2
parent6585821a3528b29a0e75b461d429eba54dae12b5 (diff)
remaining dataenc to sandi conversions
I've tested all the dataenc to sandi conversions except Assistant.XMPP, and all have unchanged behavior, including behavior on large unicode code points.
-rw-r--r--Assistant/XMPP.hs7
-rw-r--r--Remote/Helper/Encryptable.hs9
-rw-r--r--debian/changelog2
-rw-r--r--debian/control2
-rw-r--r--doc/todo/replace_dataenc_with_sandi.mdwn2
-rw-r--r--standalone/android/cabal.config2
6 files changed, 15 insertions, 9 deletions
diff --git a/Assistant/XMPP.hs b/Assistant/XMPP.hs
index b9ae50e27..52cd31939 100644
--- a/Assistant/XMPP.hs
+++ b/Assistant/XMPP.hs
@@ -22,7 +22,8 @@ import qualified Data.Map as M
import Data.ByteString (ByteString)
import qualified Data.ByteString as B
import Data.XML.Types
-import qualified "dataenc" Codec.Binary.Base64 as B64
+import qualified "sandi" Codec.Binary.Base64 as B64
+import Data.Bits.Utils
{- Name of the git-annex tag, in our own XML namespace.
- (Not using a namespace URL to avoid unnecessary bloat.) -}
@@ -212,10 +213,10 @@ encodeExitCode (ExitFailure n) = n
{- Base 64 encoding a ByteString to use as the content of a tag. -}
encodeTagContent :: ByteString -> [Node]
-encodeTagContent b = [NodeContent $ ContentText $ T.pack $ B64.encode $ B.unpack b]
+encodeTagContent b = [NodeContent $ ContentText $ T.pack $ w82s $ B.unpack $ B64.encode b]
decodeTagContent :: Element -> Maybe ByteString
-decodeTagContent elt = B.pack <$> B64.decode s
+decodeTagContent elt = either (const Nothing) Just (B64.decode $ B.pack $ s2w8 s)
where
s = T.unpack $ T.concat $ elementText elt
diff --git a/Remote/Helper/Encryptable.hs b/Remote/Helper/Encryptable.hs
index 2c1935ba9..3395db978 100644
--- a/Remote/Helper/Encryptable.hs
+++ b/Remote/Helper/Encryptable.hs
@@ -20,7 +20,8 @@ module Remote.Helper.Encryptable (
) where
import qualified Data.Map as M
-import qualified "dataenc" Codec.Binary.Base64 as B64
+import qualified "sandi" Codec.Binary.Base64 as B64
+import qualified Data.ByteString as B
import Data.Bits.Utils
import Common.Annex
@@ -172,12 +173,12 @@ describeEncryption c = case extractCipher c of
]
{- Not using Utility.Base64 because these "Strings" are really
- - bags of bytes and that would convert to unicode and not roung-trip
+ - bags of bytes and that would convert to unicode and not round-trip
- cleanly. -}
toB64bs :: String -> String
-toB64bs = B64.encode . s2w8
+toB64bs = w82s . B.unpack . B64.encode . B.pack . s2w8
fromB64bs :: String -> String
-fromB64bs s = fromMaybe bad $ w82s <$> B64.decode s
+fromB64bs s = either (const bad) (w82s . B.unpack) (B64.decode $ B.pack $ s2w8 s)
where
bad = error "bad base64 encoded data"
diff --git a/debian/changelog b/debian/changelog
index e5e7ed13e..932b022fc 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -40,6 +40,8 @@ git-annex (5.20150421) UNRELEASED; urgency=medium
honoring the setting of HOME. Instead, copy msysgit's ssh into PATH.
* Windows: Roll back to an older version of rsync from cygwin.
The newer version has some dependency on a newer ssh from cygwin.
+ * Switch from the obsolete dataenc library for base64 encoding to sandi.
+ (Thanks, Magnus Therning)
-- Joey Hess <id@joeyh.name> Tue, 21 Apr 2015 15:54:10 -0400
diff --git a/debian/control b/debian/control
index ce7ce7504..133c2ee49 100644
--- a/debian/control
+++ b/debian/control
@@ -11,7 +11,7 @@ Build-Depends:
libghc-hslogger-dev,
libghc-pcre-light-dev,
libghc-cryptohash-dev (>= 0.11.0),
- libghc-dataenc-dev,
+ libghc-sandi-dev,
libghc-utf8-string-dev,
libghc-aws-dev (>= 0.9.2-2~),
libghc-conduit-dev,
diff --git a/doc/todo/replace_dataenc_with_sandi.mdwn b/doc/todo/replace_dataenc_with_sandi.mdwn
index a35e54efd..9ce29663b 100644
--- a/doc/todo/replace_dataenc_with_sandi.mdwn
+++ b/doc/todo/replace_dataenc_with_sandi.mdwn
@@ -2,3 +2,5 @@
sandi is available in jessie, but not wheezy, so this is pending
EOL of wheezy support. --[[Joey]]
+
+> [[fixed|done]] --[[Joey]]
diff --git a/standalone/android/cabal.config b/standalone/android/cabal.config
index f39dee91f..de7d72dc0 100644
--- a/standalone/android/cabal.config
+++ b/standalone/android/cabal.config
@@ -54,7 +54,7 @@ constraints: Crypto ==4.2.5.1,
data-default-instances-containers ==0.0.1,
data-default-instances-dlist ==0.0.1,
data-default-instances-old-locale ==0.0.1,
- dataenc ==0.14.0.7,
+ sandi ==0.3.0.1,
dbus ==0.10.8,
distributive ==0.4.4,
dlist ==0.7.0.1,