Roll the dns build flag into the assistant build flag.
This commit is contained in:
parent
65f44423d1
commit
dcfb038cd2
4 changed files with 3 additions and 52 deletions
|
@ -73,9 +73,6 @@ buildFlags = filter (not . null)
|
|||
#else
|
||||
#warning Building without ConcurrentOutput
|
||||
#endif
|
||||
#ifdef WITH_DNS
|
||||
, "DNS"
|
||||
#endif
|
||||
#ifdef WITH_TDFA
|
||||
, "TDFA"
|
||||
#endif
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
{- SRV record lookup
|
||||
-
|
||||
- Uses either the the standalone Haskell DNS package, or the host command.
|
||||
-
|
||||
- Copyright 2012 Joey Hess <id@joeyh.name>
|
||||
-
|
||||
|
@ -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)
|
||||
|
|
1
debian/changelog
vendored
1
debian/changelog
vendored
|
@ -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 <id@joeyh.name> Fri, 15 Jan 2016 14:05:01 -0400
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
@ -224,10 +222,6 @@ Executable git-annex
|
|||
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)
|
||||
CPP-Options: -DWITH_TORRENTPARSER
|
||||
|
|
Loading…
Reference in a new issue