From a2afcdfec4ded920e133f28e069275caadc890c0 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Sat, 24 May 2014 12:57:55 -0400 Subject: [PATCH] Bump version to 0.2.1. Update dependencies for ghc-7.8. Require a newer tasty-quickcheck that re-exports Gen. Use lookupRDNS from newer versions of dns instead of a custom implementation. Fix deprecation warnings in shelltests. --- hath.cabal | 26 +++++++++++--------------- src/Cidr.hs | 2 +- src/DNS.hs | 27 ++++----------------------- src/IPv4Address.hs | 2 +- src/Octet.hs | 2 +- test/ShellTests.hs | 2 +- test/ShellTestsNet.hs | 2 +- 7 files changed, 20 insertions(+), 43 deletions(-) diff --git a/hath.cabal b/hath.cabal index dfa55a2..ccaef8a 100644 --- a/hath.cabal +++ b/hath.cabal @@ -1,5 +1,5 @@ name: hath -version: 0.2.0 +version: 0.2.1 cabal-version: >= 1.8 author: Michael Orlitzky maintainer: Michael Orlitzky @@ -135,17 +135,16 @@ executable hath Octet build-depends: - base >= 4.6 && < 4.7, + base >= 4.6 && < 4.8, bytestring == 0.10.*, cmdargs == 0.10.*, dns >= 1.2, MissingH == 1.2.*, parallel-io == 0.3.*, - QuickCheck == 2.7.*, split == 0.2.*, tasty == 0.8.*, tasty-hunit == 0.8.*, - tasty-quickcheck == 0.8.* + tasty-quickcheck >= 0.8.1 ghc-options: -Wall @@ -176,17 +175,16 @@ test-suite testsuite main-is: TestSuite.hs build-depends: - base >= 4.6 && < 4.7, + base >= 4.6 && < 4.8, bytestring == 0.10.*, cmdargs == 0.10.*, dns >= 1.2, MissingH == 1.2.*, parallel-io == 0.3.*, - QuickCheck == 2.7.*, split == 0.2.*, tasty == 0.8.*, tasty-hunit == 0.8.*, - tasty-quickcheck == 0.8.* + tasty-quickcheck >= 0.8.1 -- It's not entirely clear to me why I have to reproduce all of this. @@ -216,18 +214,17 @@ test-suite shelltests main-is: ShellTests.hs build-depends: - base >= 4.6 && < 4.7, + base >= 4.6 && < 4.8, bytestring == 0.10.*, cmdargs == 0.10.*, dns >= 1.2, MissingH == 1.2.*, parallel-io == 0.3.*, - process == 1.1.*, - QuickCheck == 2.7.*, + process < 1.3, split == 0.2.*, tasty == 0.8.*, tasty-hunit == 0.8.*, - tasty-quickcheck == 0.8.* + tasty-quickcheck >= 0.8.1 -- It's not entirely clear to me why I have to reproduce all of this. ghc-options: @@ -254,18 +251,17 @@ test-suite shelltests-net main-is: ShellTestsNet.hs build-depends: - base >= 4.6 && < 4.7, + base >= 4.6 && < 4.8, bytestring == 0.10.*, cmdargs == 0.10.*, dns >= 1.2, MissingH == 1.2.*, parallel-io == 0.3.*, - process == 1.1.*, - QuickCheck == 2.7.*, + process < 1.3, split == 0.2.*, tasty == 0.8.*, tasty-hunit == 0.8.*, - tasty-quickcheck == 0.8.* + tasty-quickcheck >= 0.8.1 -- It's not entirely clear to me why I have to reproduce all of this. ghc-options: diff --git a/src/Cidr.hs b/src/Cidr.hs index 6e75966..9cbf845 100644 --- a/src/Cidr.hs +++ b/src/Cidr.hs @@ -22,11 +22,11 @@ import Data.List (nubBy) import Data.List.Split (splitOneOf) import Data.Maybe (catMaybes, mapMaybe) -import Test.QuickCheck ( Gen ) -- Not re-exported by tasty import Test.Tasty ( TestTree, testGroup ) import Test.Tasty.HUnit ( (@?=), testCase ) import Test.Tasty.QuickCheck ( Arbitrary(..), + Gen, Property, (==>), testProperty ) diff --git a/src/DNS.hs b/src/DNS.hs index 041eeeb..a535de5 100644 --- a/src/DNS.hs +++ b/src/DNS.hs @@ -6,36 +6,20 @@ module DNS ( where import Control.Concurrent.ParallelIO.Global ( parallel ) -import qualified Data.ByteString.Char8 as BS ( - append, - intercalate, - pack, - split ) import Network.DNS ( Domain, DNSError, ResolvConf(..), defaultResolvConf, - lookupPTR, + lookupRDNS, makeResolvSeed, withResolver ) --- The return type of lookupPTR. +-- The return type of lookupRDNS. type PTRResult = Either DNSError [Domain] --- | Convert the given IP address (as a ByteString) to the format --- required for a PTR lookup. For example, "192.168.0.0" should be --- converted to "0.0.168.192.in-addr.arpa". -ip_to_in_addr_arpa :: Domain -> Domain -ip_to_in_addr_arpa ip = - rev_ip `BS.append` suffix - where - dot = BS.pack "." - suffix = BS.pack ".in-addr.arpa" - rev_ip = BS.intercalate dot (reverse (BS.split '.' ip)) - -- | Take the default ResolvConf and increase the timeout to 15 -- seconds. our_resolv_conf :: ResolvConf @@ -49,9 +33,6 @@ lookup_ptrs :: [Domain] -> IO [PTRResult] lookup_ptrs ips = do rs <- makeResolvSeed our_resolv_conf let lookup' addr = withResolver rs $ \resolver -> - lookupPTR resolver addr - - parallel $ map lookup' in_addrs + lookupRDNS resolver addr - where - in_addrs = map ip_to_in_addr_arpa ips + parallel $ map lookup' ips diff --git a/src/IPv4Address.hs b/src/IPv4Address.hs index d262a5c..78bceab 100644 --- a/src/IPv4Address.hs +++ b/src/IPv4Address.hs @@ -6,11 +6,11 @@ module IPv4Address( where -import Test.QuickCheck ( Gen ) -- Not re-exported by tasty import Test.Tasty ( TestTree, testGroup ) import Test.Tasty.HUnit ( (@?=), testCase ) import Test.Tasty.QuickCheck ( Arbitrary(..), + Gen, Property, (==>), testProperty ) diff --git a/src/Octet.hs b/src/Octet.hs index 55f075e..4664d19 100644 --- a/src/Octet.hs +++ b/src/Octet.hs @@ -4,11 +4,11 @@ module Octet ( octet_tests ) where -import Test.QuickCheck ( Gen ) -- Not re-exported by tasty import Test.Tasty ( TestTree, testGroup ) import Test.Tasty.HUnit ( (@?=), testCase ) import Test.Tasty.QuickCheck ( Arbitrary(..), + Gen, Property, (==>), testProperty ) diff --git a/test/ShellTests.hs b/test/ShellTests.hs index 65a10cc..1e884d5 100644 --- a/test/ShellTests.hs +++ b/test/ShellTests.hs @@ -1,7 +1,7 @@ module Main where -import System.Cmd ( system ) +import System.Process ( system ) import System.Exit ( exitWith ) main :: IO () diff --git a/test/ShellTestsNet.hs b/test/ShellTestsNet.hs index b3306d0..7e3a95e 100644 --- a/test/ShellTestsNet.hs +++ b/test/ShellTestsNet.hs @@ -1,7 +1,7 @@ module Main where -import System.Cmd ( system ) +import System.Process ( system ) import System.Exit ( exitWith ) main :: IO () -- 2.44.2