From 24590d731eba893cf11ce5651af6c47cb6f8d93f Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 26 Jan 2016 08:48:14 -0400 Subject: Roll the dns build flag into the assistant build flag. --- BuildFlags.hs | 3 --- Utility/SRV.hs | 43 +------------------------------------------ debian/changelog | 1 + git-annex.cabal | 8 +------- 4 files changed, 3 insertions(+), 52 deletions(-) diff --git a/BuildFlags.hs b/BuildFlags.hs index 764af6df7..906e26270 100644 --- a/BuildFlags.hs +++ b/BuildFlags.hs @@ -73,9 +73,6 @@ buildFlags = filter (not . null) #else #warning Building without ConcurrentOutput #endif -#ifdef WITH_DNS - , "DNS" -#endif #ifdef WITH_TDFA , "TDFA" #endif diff --git a/Utility/SRV.hs b/Utility/SRV.hs index 991f3a3d6..033064a27 100644 --- a/Utility/SRV.hs +++ b/Utility/SRV.hs @@ -1,6 +1,4 @@ {- SRV record lookup - - - - Uses either the the standalone Haskell DNS package, or the host command. - - Copyright 2012 Joey Hess - @@ -13,26 +11,15 @@ module Utility.SRV ( mkSRVTcp, mkSRV, lookupSRV, - lookupSRVHost, HostPort, ) where -import Utility.Process -import Utility.Exception -import Utility.PartialPrelude - -import Network import Data.Function import Data.List -import Data.Maybe -import Control.Applicative -import Prelude - -#ifdef WITH_DNS +import Network import qualified Network.DNS.Lookup as DNS import Network.DNS.Resolver import qualified Data.ByteString.UTF8 as B8 -#endif newtype SRV = SRV String deriving (Show, Eq) @@ -52,7 +39,6 @@ mkSRVTcp = mkSRV "tcp" - - On error, returns an empty list. -} lookupSRV :: SRV -> IO [HostPort] -#ifdef WITH_DNS lookupSRV (SRV srv) = do seed <- makeResolvSeed defaultResolvConf r <- withResolver seed $ flip DNS.lookupSRV $ B8.fromString srv @@ -68,33 +54,6 @@ lookupSRV (SRV srv) = do ( (priority, weight) , (B8.toString hostname, PortNumber $ fromIntegral port) ) -#else -lookupSRV = lookupSRVHost -#endif - -lookupSRVHost :: SRV -> IO [HostPort] -lookupSRVHost (SRV srv) = catchDefaultIO [] $ - parseSrvHost <$> readProcessEnv "host" ["-t", "SRV", "--", srv] - -- clear environment, to avoid LANG affecting output - (Just []) - -parseSrvHost :: String -> [HostPort] -parseSrvHost = orderHosts . catMaybes . map parse . lines - where - parse l = case words l of - [_, _, _, _, spriority, sweight, sport, hostname] -> do - let v = - ( readish sport :: Maybe Int - , readish spriority :: Maybe Int - , readish sweight :: Maybe Int - ) - case v of - (Just port, Just priority, Just weight) -> Just - ( (priority, weight) - , (hostname, PortNumber $ fromIntegral port) - ) - _ -> Nothing - _ -> Nothing orderHosts :: [(PriorityWeight, HostPort)] -> [HostPort] orderHosts = map snd . sortBy (compare `on` fst) diff --git a/debian/changelog b/debian/changelog index e81f4ed6f..43a8863e9 100644 --- a/debian/changelog +++ b/debian/changelog @@ -24,6 +24,7 @@ git-annex (6.20160115) UNRELEASED; urgency=medium the core dependencies. * Removed the feed build flag, which only adds feed to the core dependencies. + * Roll the dns build flag into the assistant build flag. -- Joey Hess Fri, 15 Jan 2016 14:05:01 -0400 diff --git a/git-annex.cabal b/git-annex.cabal index 1b2f82b74..91dc21ee8 100644 --- a/git-annex.cabal +++ b/git-annex.cabal @@ -46,9 +46,6 @@ Flag Webapp Flag Pairing Description: Enable pairing -Flag DNS - Description: Enable the haskell DNS library for DNS lookup - Flag Production Description: Enable production build (slower build; faster binary) @@ -165,6 +162,7 @@ Executable git-annex CPP-Options: -DWITH_WEBDAV if flag(Assistant) && ! os(solaris) + Build-Depends: dns CPP-Options: -DWITH_ASSISTANT if flag(Assistant) @@ -223,10 +221,6 @@ Executable git-annex if (! os(windows)) Build-Depends: network-protocol-xmpp, gnutls (>= 0.1.4), xml-types CPP-Options: -DWITH_XMPP - - if flag(DNS) - Build-Depends: dns - CPP-Options: -DWITH_DNS if flag(TorrentParser) Build-Depends: torrent (>= 10000.0.0) -- cgit v1.2.3