diff options
Diffstat (limited to 'standalone/android')
-rw-r--r-- | standalone/android/haskell-patches/dns_use-android-net.dns1-command-instead-of-resolv.conf.patch | 36 | ||||
-rw-r--r-- | standalone/android/haskell-patches/unix-time_hack-for-Bionic.patch | 22 |
2 files changed, 28 insertions, 30 deletions
diff --git a/standalone/android/haskell-patches/dns_use-android-net.dns1-command-instead-of-resolv.conf.patch b/standalone/android/haskell-patches/dns_use-android-net.dns1-command-instead-of-resolv.conf.patch index f510b0d8d..a00338fab 100644 --- a/standalone/android/haskell-patches/dns_use-android-net.dns1-command-instead-of-resolv.conf.patch +++ b/standalone/android/haskell-patches/dns_use-android-net.dns1-command-instead-of-resolv.conf.patch @@ -1,6 +1,6 @@ -From 3f72e299c50476c270c5187092d6e8b13ddfbf1e Mon Sep 17 00:00:00 2001 +From aaef1aadb21a198475a656132ef4488b85b8fd1b Mon Sep 17 00:00:00 2001 From: dummy <dummy@example.com> -Date: Mon, 26 May 2014 01:53:13 +0000 +Date: Thu, 3 Jul 2014 23:22:47 +0000 Subject: [PATCH] use android net.dns1 command instead of resolv.conf file Android has no /etc/resolv.conf. Some might have /system/etc/resolv.conf, @@ -9,12 +9,12 @@ but even that does not seem likely. This is likely a little slow, but is at least fine for git-annex's uses, since it only uses this library for occasional SRV lookups. --- - Network/DNS/Resolver.hs | 13 ++++++++----- + Network/DNS/Resolver.hs | 11 +++++++++-- dns.cabal | 1 + - 2 files changed, 9 insertions(+), 5 deletions(-) + 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Network/DNS/Resolver.hs b/Network/DNS/Resolver.hs -index 5721e03..c4400d1 100644 +index e4124b8..7aca431 100644 --- a/Network/DNS/Resolver.hs +++ b/Network/DNS/Resolver.hs @@ -19,7 +19,7 @@ module Network.DNS.Resolver ( @@ -26,7 +26,7 @@ index 5721e03..c4400d1 100644 import qualified Data.ByteString.Char8 as BS import Data.Char (isSpace) import Data.List (isPrefixOf) -@@ -32,6 +32,7 @@ import Network.Socket (AddrInfoFlag(..), AddrInfo(..), defaultHints, getAddrInfo +@@ -32,6 +32,7 @@ import Network.Socket (AddrInfoFlag(..), AddrInfo(..), SockAddr(..), PortNumber( import Prelude hiding (lookup) import System.Random (getStdRandom, randomR) import System.Timeout (timeout) @@ -34,28 +34,26 @@ index 5721e03..c4400d1 100644 #if mingw32_HOST_OS == 1 import Network.Socket (send) -@@ -130,10 +131,12 @@ makeResolvSeed conf = ResolvSeed <$> addr - where +@@ -132,7 +133,13 @@ makeResolvSeed conf = ResolvSeed <$> addr addr = case resolvInfo conf of - RCHostName numhost -> makeAddrInfo numhost -- RCFilePath file -> toAddr <$> readFile file >>= makeAddrInfo -- toAddr cs = let l:_ = filter ("nameserver" `isPrefixOf`) $ lines cs -- in extract l -- extract = reverse . dropWhile isSpace . reverse . dropWhile isSpace . drop 11 + RCHostName numhost -> makeAddrInfo numhost Nothing + RCHostPort numhost mport -> makeAddrInfo numhost $ Just mport +- RCFilePath file -> toAddr <$> readFile file >>= \i -> makeAddrInfo i Nothing + RCFilePath file -> do + -- Android has no /etc/resolv.conf; use getprop command. + ls <- catch (lines <$> readProcess "getprop" ["net.dns1"] []) (const (return []) :: IOException -> IO [String]) -+ makeAddrInfo $ case ls of ++ let addr = case ls of + [] -> "8.8.8.8" -- google public dns as a fallback only + (l:_) -> l - - makeAddrInfo :: HostName -> IO AddrInfo - makeAddrInfo addr = do ++ makeAddrInfo addr Nothing + toAddr cs = let l:_ = filter ("nameserver" `isPrefixOf`) $ lines cs + in extract l + extract = reverse . dropWhile isSpace . reverse . dropWhile isSpace . drop 11 diff --git a/dns.cabal b/dns.cabal -index ceaf5f4..cd15e61 100644 +index 0a08a9e..724a3e0 100644 --- a/dns.cabal +++ b/dns.cabal -@@ -37,6 +37,7 @@ Library +@@ -38,6 +38,7 @@ Library , network >= 2.3 , random , resourcet diff --git a/standalone/android/haskell-patches/unix-time_hack-for-Bionic.patch b/standalone/android/haskell-patches/unix-time_hack-for-Bionic.patch index be7956bea..da5fbf8ad 100644 --- a/standalone/android/haskell-patches/unix-time_hack-for-Bionic.patch +++ b/standalone/android/haskell-patches/unix-time_hack-for-Bionic.patch @@ -1,7 +1,7 @@ -From e6d5c141186dbdbe97c698294485ffc4dcd3a843 Mon Sep 17 00:00:00 2001 +From 5433c4f62b1818e09682a64dee229142f88f17d9 Mon Sep 17 00:00:00 2001 From: dummy <dummy@example.com> -Date: Fri, 18 Oct 2013 16:45:50 +0000 -Subject: [PATCH] hack for bionic + cross build +Date: Thu, 3 Jul 2014 20:48:02 +0000 +Subject: [PATCH] ihack for bionic and cross build --- Data/UnixTime/Types.hsc | 12 ------------ @@ -9,10 +9,10 @@ Subject: [PATCH] hack for bionic + cross build 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/Data/UnixTime/Types.hsc b/Data/UnixTime/Types.hsc -index d30f39b..ec7ca4c 100644 +index 403daa6..4e66880 100644 --- a/Data/UnixTime/Types.hsc +++ b/Data/UnixTime/Types.hsc -@@ -9,8 +9,6 @@ import Foreign.Storable +@@ -10,8 +10,6 @@ import Data.Binary #include <sys/time.h> @@ -21,7 +21,7 @@ index d30f39b..ec7ca4c 100644 -- | -- Data structure for Unix time. data UnixTime = UnixTime { -@@ -20,16 +18,6 @@ data UnixTime = UnixTime { +@@ -21,16 +19,6 @@ data UnixTime = UnixTime { , utMicroSeconds :: {-# UNPACK #-} !Int32 } deriving (Eq,Ord,Show) @@ -35,14 +35,14 @@ index d30f39b..ec7ca4c 100644 - (#poke struct timeval, tv_sec) ptr (utSeconds ut) - (#poke struct timeval, tv_usec) ptr (utMicroSeconds ut) - - -- | - -- Format of the strptime()/strftime() style. - type Format = ByteString + instance Binary UnixTime where + put (UnixTime (CTime sec) msec) = do + put sec diff --git a/cbits/conv.c b/cbits/conv.c -index 7ff7b87..2e4c870 100644 +index ec31fef..b7bc0f9 100644 --- a/cbits/conv.c +++ b/cbits/conv.c -@@ -55,7 +55,7 @@ time_t c_parse_unix_time_gmt(char *fmt, char *src) { +@@ -96,7 +96,7 @@ time_t c_parse_unix_time_gmt(char *fmt, char *src) { #else strptime(src, fmt, &dst); #endif |