diff --git a/Cabal2Ebuild.hs b/Cabal2Ebuild.hs
--- a/Cabal2Ebuild.hs
+++ b/Cabal2Ebuild.hs
@@ -37,6 +37,7 @@
 import Data.Char          (toLower,isUpper)
 
 import Portage.Dependency
+import qualified Portage.Cabal as Portage
 import qualified Portage.PackageId as Portage
 import qualified Portage.EBuild as Portage
 import qualified Portage.GHCCore as Portage
@@ -55,7 +56,7 @@
     E.long_desc       = if null (Cabal.description pkg) then Cabal.synopsis pkg
                                                else Cabal.description pkg,
     E.homepage        = thisHomepage,
-    E.license         = Cabal.license pkg,
+    E.license         = Portage.convertLicense $ Cabal.license pkg,
     E.slot            = (E.slot E.ebuildTemplate) ++ maybe [] (const "/${PV}") (Cabal.library pkg),
     E.my_pn           = if any isUpper cabalPkgName then Just cabalPkgName else Nothing,
     E.features        = E.features E.ebuildTemplate
diff --git a/DistroMap.hs b/DistroMap.hs
--- a/DistroMap.hs
+++ b/DistroMap.hs
@@ -136,7 +136,7 @@
 
 lookupPVU :: PVU_Map -> Cabal.PackageName -> [Cabal.Version] -> [PVU]
 lookupPVU pvu_map pn cvs =
-  case findItems pvu_map (Portage.normalizeCabalPackageName pn) of
+  case findItems (Portage.normalizeCabalPackageName pn) of
     [] -> []
     [item] -> ret item
     items | [item] <- preferableItem items -> ret item
@@ -151,8 +151,8 @@
     [ item
     | item@(Portage.PackageName cat _pn, _vs) <- items
     , cat == Portage.Category "dev-haskell"]
-  findItems pvu_map cpn = Map.toList $ Map.filterWithKey f pvu_map
+  findItems cpn = Map.toList $ Map.filterWithKey f pvu_map
     where
-    f (Portage.PackageName _cat pn) _vs = cpn == pn
+    f (Portage.PackageName _cat _pn) _vs = cpn == pn
 
 
diff --git a/Merge.hs b/Merge.hs
--- a/Merge.hs
+++ b/Merge.hs
@@ -45,6 +45,7 @@
 import System.Cmd (system)
 import System.FilePath ((</>))
 import System.Exit
+import Text.Printf
 
 import qualified Cabal2Ebuild as C2E
 import qualified Portage.EBuild as E
@@ -166,10 +167,19 @@
   overlay <- Overlay.loadLazy overlayPath
   let merged_cabal_pkg_name = Cabal.pkgName (Cabal.package (Cabal.packageDescription pkgGenericDesc))
 
-  let Just (compilerId, ghc_packages, pkgDesc0, _flags, pix) = GHCCore.minimumGHCVersionToBuildPackage pkgGenericDesc
+  (compilerId, ghc_packages, pkgDesc0, _flags, pix) <- case GHCCore.minimumGHCVersionToBuildPackage pkgGenericDesc of
+              Just v  -> return v
+              Nothing -> let cpn = display merged_cabal_pkg_name
+                         in error $ unlines [ "mergeGenericPackageDescription: failed to find suitable GHC for " ++ cpn
+                                            , "  You can try to merge the package manually:"
+                                            , "  $ cabal unpack " ++ cpn
+                                            , "  $ cd " ++ cpn ++ "*/"
+                                            , "  # fix " ++ cpn ++ ".cabal"
+                                            , "  $ hackport make-ebuild dev-haskell " ++ cpn ++ ".cabal"
+                                            ]
 
       -- , Right (pkg_desc, picked_flags) <- return (packageBuildableWithGHCVersion gpd g)]
-      (accepted_deps, skipped_deps, dropped_deps) = genSimple (Cabal.buildDepends pkgDesc0)
+  let (accepted_deps, skipped_deps, dropped_deps) = genSimple (Cabal.buildDepends pkgDesc0)
       pkgDesc = pkgDesc0 { Cabal.buildDepends = accepted_deps }
       aflags = map Cabal.flagName (Cabal.genPackageFlags pkgGenericDesc)
       lflags  :: [Cabal.Flag] -> [Cabal.FlagAssignment]
@@ -271,10 +281,10 @@
             simplifyMore ws = 
                 let us = getMultiFlags ws
                     (u,_) = maximumBy (compare `on` snd) $ getMultiFlags ws
-                    (xs, ls) = (hasFlag u) `partition` ws
+                    (xs', ls) = (hasFlag u) `partition` ws
                 in if null us 
                       then concatMap (\(a, b) -> liftFlags a b) ws
-                      else liftFlags [u] (simplify $ map (\x -> (x,[])) $ dropFlag u xs)++simplifyMore ls
+                      else liftFlags [u] (simplify $ map (\x -> (x,[])) $ dropFlag u xs')++simplifyMore ls
         in (liftFlags fl c) ++ simplifyMore (sd ++ ys)
 
       -- drop selected use flag from a list
@@ -376,33 +386,55 @@
     (\_ -> setCurrentDirectory oldDir)
     (\_ -> action)
 
+-- tries to extract value of variable in var="val" format
+-- There should be exactly one variable assignment in ebuild
+-- It's a bit artificial limitation, but it's common for 'if / else' blocks
+extract_quoted_string :: FilePath -> String -> String -> Maybe String
+extract_quoted_string ebuild_path s_ebuild var_name =
+    case filter (isPrefixOf var_prefix . ltrim) $ lines s_ebuild of
+        []        -> Nothing
+        [kw_line] -> up_to_quote $ skip_prefix $ ltrim kw_line
+        other     -> bail_out $ printf "strange '%s' assignmets:\n%s" var_name (unlines other)
+
+    where ltrim :: String -> String
+          ltrim = dropWhile isSpace
+          var_prefix = var_name ++ "=\""
+          skip_prefix = drop (length var_prefix)
+          up_to_quote l = case break (== '"') l of
+                              ("", _)  -> Nothing -- empty line
+                              (_, "")  -> bail_out $ printf "failed to find closing quote for '%s'" l
+                              (val, _) -> Just val
+          bail_out :: String -> e
+          bail_out msg = error $ printf "%s:extract_quoted_string %s" ebuild_path msg
+
 extractKeywords :: FilePath -> String -> Maybe [String]
 extractKeywords ebuild_path s_ebuild =
-    let ltrim :: String -> String
-        ltrim = dropWhile isSpace
-        lns    = lines s_ebuild
-        -- TODO: nicer pattern match and errno
-    in case (findIndices (isPrefixOf "KEYWORDS=\"" . ltrim) lns) of
-           []      -> Nothing
-           [kw_ln] -> let kw_line  = lns !! kw_ln
-                          kw_str   = (fst . break (== '"') . tail . snd . break (== '"')) kw_line
-                          keywords = words kw_str
-                      in if null keywords
-                             then Nothing
-                             else Just keywords
-           other   -> error $ ebuild_path ++ ": parse_ebuild: strange KEYWORDS lines: " ++ show other
+    words `fmap ` extract_quoted_string ebuild_path s_ebuild "KEYWORDS"
 
-findExistingKeywords :: FilePath -> IO (Maybe [String])
-findExistingKeywords edir =
+extractLicense :: FilePath -> String -> Maybe String
+extractLicense ebuild_path s_ebuild =
+    extract_quoted_string ebuild_path s_ebuild "LICENSE"
+
+-- aggregated (best inferred) metadata for a new ebuild of package
+data EMeta = EMeta { keywords :: Maybe [String]
+                   , license  :: Maybe String
+                   }
+
+findExistingMeta :: FilePath -> IO EMeta
+findExistingMeta edir =
     do ebuilds <- filter (isPrefixOf (reverse ".ebuild") . reverse) `fmap` getDirectoryContents edir
        -- TODO: version sort
-       e_kw_s <- forM ebuilds $ \e ->
-                     do let e_path = edir </> e
-                        e_conts <- readFile e_path
-                        return (e, extractKeywords e_path e_conts)
-       if null e_kw_s
-           then return Nothing
-           else return (snd $ last e_kw_s)
+       e_metas <- forM ebuilds $ \e ->
+                      do let e_path = edir </> e
+                         e_conts <- readFile e_path
+                         return EMeta { keywords = extractKeywords e e_conts
+                                      , license  = extractLicense  e e_conts
+                                      }
+       let get_latest candidates = last (Nothing : filter (/= Nothing) candidates)
+           aggregated_meta = EMeta { keywords = get_latest $ map keywords e_metas
+                                   , license  = get_latest $ map license e_metas
+                                   }
+       return $ aggregated_meta
 
 -- "amd64" -> "~amd64"
 to_unstable :: String -> String
@@ -421,13 +453,22 @@
       mpath = edir </> emeta
       default_meta = BL.pack $ Portage.makeDefaultMetadata (E.long_desc ebuild)
   createDirectoryIfMissing True edir
-  existing_keywords <- findExistingKeywords edir
+  existing_meta <- findExistingMeta edir
 
-  let new_keywords = maybe (E.keywords ebuild) (map to_unstable) (existing_keywords)
-      ebuild'      = ebuild { E.keywords = new_keywords }
+  let (existing_keywords, existing_license)  = (keywords existing_meta, license existing_meta)
+      new_keywords = maybe (E.keywords ebuild) (map to_unstable) existing_keywords
+      new_license  = either (\err -> maybe (Left err)
+                                           Right
+                                           existing_license)
+                            Right
+                            (E.license ebuild)
+      ebuild'      = ebuild { E.keywords = new_keywords
+                            , E.license = new_license
+                            }
       s_ebuild'    = display ebuild'
 
   notice verbosity $ "Current keywords: " ++ show existing_keywords ++ " -> " ++ show new_keywords
+  notice verbosity $ "Current license:  " ++ show existing_license ++ " -> " ++ show new_license
 
   notice verbosity $ "Writing " ++ elocal
   (length s_ebuild') `seq` BL.writeFile epath (BL.pack s_ebuild')
diff --git a/Merge/Dependencies.hs b/Merge/Dependencies.hs
--- a/Merge/Dependencies.hs
+++ b/Merge/Dependencies.hs
@@ -309,8 +309,10 @@
       , ("fuse", any_c_p "sys-fs" "fuse")
       , ("zip", any_c_p "dev-libs" "libzip")
       , ("QtCore", any_c_p "dev-qt" "qtcore")
+      , ("QtDeclarative", any_c_p "dev-qt" "qtdeclarative")
       , ("QtGui", any_c_p "dev-qt" "qtgui")
       , ("QtOpenGL", any_c_p "dev-qt" "qtopengl")
+      , ("QtScript", any_c_p "dev-qt" "qtscript")
       , ("gsl", any_c_p "sci-libs" "gsl")
       , ("gslcblas", any_c_p "sci-libs" "gsl")
       , ("mkl_core", any_c_p "sci-libs" "mkl")
@@ -320,6 +322,16 @@
       , ("Xi", any_c_p "x11-libs" "libXi")
       , ("Xxf86vm", any_c_p "x11-libs" "libXxf86vm")
       , ("pthread", any_c_p "virtual" "libc")
+      , ("panelw", any_c_p "sys-libs" "ncurses")
+      , ("ncursesw", any_c_p "sys-libs" "ncurses")
+      , ("ftgl", any_c_p "media-libs" "ftgl")
+      , ("glpk", any_c_p "sci-mathematics" "glpk")
+      , ("sndfile", any_c_p "media-libs" "libsndfile")
+      , ("portaudio", any_c_p "media-libs" "portaudio")
+      , ("icudata", any_c_p "dev-libs" "icu")
+      , ("icui18n", any_c_p "dev-libs" "icu")
+      , ("icuuc", any_c_p "dev-libs" "icu")
+      , ("chipmunk", any_c_p "sci-physics" "chipmunk")
       ]
 
 ---------------------------------------------------------------
@@ -352,6 +364,7 @@
   , ("gtk2hsC2hs",          any_c_p "dev-haskell" "gtk2hs-buildtools")
   , ("cabal",               any_c_p "dev-haskell" "cabal-install")
   , ("llvm-config",         any_c_p "sys-devel" "llvm")
+  , ("cpphs",               any_c_p "dev-haskell" "cpphs")
   ]
 
 -- tools that are provided by ghc or some other existing program
@@ -453,4 +466,11 @@
   ,("libxml-2.0",                  ("dev-libs", "libxml2", Portage.AnySlot))
   ,("yaml-0.1",                    ("dev-libs", "libyaml", Portage.AnySlot))
   ,("QtCore",                      ("dev-qt", "qtcore", Portage.AnySlot))
+  ,("lua",                         ("dev-lang", "lua", Portage.AnySlot))
+  ,("QtDeclarative",               ("dev-qt", "qtdeclarative", Portage.AnySlot))
+  ,("QtGui",                       ("dev-qt", "qtgui", Portage.AnySlot))
+  ,("QtOpenGL",                    ("dev-qt", "qtopengl", Portage.AnySlot))
+  ,("QtScript",                    ("dev-qt", "qtscript", Portage.AnySlot))
+  ,("ImageMagick",                 ("media-gfx", "imagemagick", Portage.AnySlot))
+  ,("MagickWand",                  ("media-gfx", "imagemagick", Portage.AnySlot))
   ]
diff --git a/Portage/Cabal.hs b/Portage/Cabal.hs
--- a/Portage/Cabal.hs
+++ b/Portage/Cabal.hs
@@ -1,9 +1,13 @@
 module Portage.Cabal
-  (fromOverlay) where
+  ( fromOverlay
+  , convertLicense
+  ) where
 
 import qualified Data.Map as Map
 
 import qualified Distribution.Client.PackageIndex as Cabal
+import qualified Distribution.License             as Cabal
+import qualified Distribution.Text                as Cabal
 
 import qualified Portage.Overlay as Portage
 
@@ -13,3 +17,20 @@
   | (_pn, ebuilds) <- Map.toAscList (Portage.overlayMap overlay)
   , ebuild <- ebuilds
   ]
+
+-- map the cabal license type to the gentoo license string format
+convertLicense :: Cabal.License -> Either String String
+convertLicense l =
+    case l of
+        --  good ones
+        Cabal.GPL mv       -> Right $ "GPL-" ++ (maybe "2" Cabal.display mv)  -- almost certainly version 2
+        Cabal.LGPL mv      -> Right $ "LGPL-" ++ (maybe "2.1" Cabal.display mv) -- probably version 2.1
+        Cabal.BSD3         -> Right "BSD"
+        Cabal.BSD4         -> Right "BSD-4"
+        Cabal.PublicDomain -> Right "public-domain"
+        Cabal.MIT          -> Right "MIT"
+        Cabal.Apache mv    -> Right $ "Apache-" ++ (maybe "1.1" Cabal.display mv) -- probably version 1.1
+        -- bad ones
+        Cabal.AllRightsReserved -> Left "EULA-style licence. Please pick it manually."
+        Cabal.UnknownLicense _  -> Left "license unknown to cabal. Please pick it manually."
+        Cabal.OtherLicense      -> Left "Please look at license file of package and pick it manually."
diff --git a/Portage/Dependency/Print.hs-boot b/Portage/Dependency/Print.hs-boot
deleted file mode 100644
--- a/Portage/Dependency/Print.hs-boot
+++ /dev/null
@@ -1,10 +0,0 @@
-module Portage.Dependency.Print
-  (
-    dep2str
-  , dep2str_denorm -- for debugging
-  ) where
-
-import Portage.Dependency.Types
-
-dep2str :: Int -> Dependency -> String
-dep2str_denorm :: Dependency -> String
diff --git a/Portage/EBuild.hs b/Portage/EBuild.hs
--- a/Portage/EBuild.hs
+++ b/Portage/EBuild.hs
@@ -4,13 +4,11 @@
         , src_uri
         ) where
 
-import Distribution.Text ( Text(..), display )
+import Distribution.Text ( Text(..) )
 import qualified Text.PrettyPrint as Disp
 
 import Portage.Dependency
 
-import Distribution.License as Cabal
-
 import Data.String.Utils
 import qualified Data.Function as F
 import qualified Data.List as L
@@ -25,7 +23,7 @@
     description :: String,
     long_desc :: String,
     homepage :: String,
-    license :: Cabal.License,
+    license :: Either String String,
     slot :: String,
     keywords :: [String],
     iuse :: [String],
@@ -52,7 +50,7 @@
     description = "",
     long_desc = "",
     homepage = "http://hackage.haskell.org/package/${HACKAGE_N}",
-    license = Cabal.UnknownLicense "xxx UNKNOWN xxx",
+    license = Left "unassigned license?",
     slot = "0",
     keywords = ["~amd64","~x86"],
     iuse = [],
@@ -102,9 +100,9 @@
   ss "HOMEPAGE=". quote (expandVars (homepage ebuild)). nl.
   ss "SRC_URI=". quote (toMirror $ src_uri ebuild). nl.
   nl.
-  ss "LICENSE=". quote (convertLicense . license $ ebuild).
-     (if null (licenseComment . license $ ebuild) then id
-         else ss "\t#". ss (licenseComment . license $ ebuild)). nl.
+  ss "LICENSE=". (either (\err -> quote "" . ss ("\t# FIXME: " ++ err))
+                         quote
+                         (license ebuild)). nl.
   ss "SLOT=". quote (slot ebuild). nl.
   ss "KEYWORDS=". quote' (sepBy " " $ keywords ebuild).nl.
   ss "IUSE=". quote' (sepBy " " . sort_iuse $ iuse ebuild). nl.
@@ -214,22 +212,3 @@
 replaceMultiVars whole@((pname,cont):rest) str = case subStr cont str of
     Nothing -> replaceMultiVars rest str
     Just (pre,post) -> (replaceMultiVars rest pre)++pname++(replaceMultiVars whole post)
-
--- map the cabal license type to the gentoo license string format
-convertLicense :: Cabal.License -> String
-convertLicense (Cabal.GPL mv)     = "GPL-" ++ (maybe "2" display mv)  -- almost certainly version 2
-convertLicense (Cabal.LGPL mv)    = "LGPL-" ++ (maybe "2.1" display mv) -- probably version 2.1
-convertLicense Cabal.BSD3         = "BSD"
-convertLicense Cabal.BSD4         = "BSD-4"
-convertLicense Cabal.PublicDomain = "public-domain"
-convertLicense Cabal.AllRightsReserved = ""
-convertLicense Cabal.MIT          = "MIT"
-convertLicense _                  = ""
-
-licenseComment :: Cabal.License -> String
-licenseComment Cabal.AllRightsReserved =
-  "Note: packages without a license cannot be included in portage"
-licenseComment Cabal.OtherLicense =
-  "Fixme: \"OtherLicense\", please fill in manually"
-licenseComment (Cabal.UnknownLicense _) = "Fixme: license unknown to cabal"
-licenseComment _ = ""
diff --git a/Portage/GHCCore.hs b/Portage/GHCCore.hs
--- a/Portage/GHCCore.hs
+++ b/Portage/GHCCore.hs
@@ -69,9 +69,9 @@
 -- Packages that are not core will always be accepted, packages that are
 -- core in any ghc must be satisfied by the 'PackageIndex'.
 dependencySatisfiable :: PackageIndex -> Dependency -> Bool
-dependencySatisfiable pi dep@(Dependency pn _rang)
+dependencySatisfiable pindex dep@(Dependency pn _rang)
   | pn == PackageName "Win32" = False -- only exists on windows, not in linux
-  | not . null $ lookupDependency pi dep = True -- the package index satisfies the dep
+  | not . null $ lookupDependency pindex dep = True -- the package index satisfies the dep
   | packageIsCoreInAnyGHC pn = False -- some other ghcs support the dependency
   | otherwise = True -- the dep is not related with core packages, accept the dep
 
@@ -106,10 +106,10 @@
 mkIndex pids = fromList
   [ emptyInstalledPackageInfo
       { installedPackageId = InstalledPackageId $ display name ++ "-" ++  display version
-      , sourcePackageId = pi
+      , sourcePackageId = pindex
       , exposed = True
       }
-  | pi@(PackageIdentifier name version) <- pids ]
+  | pindex@(PackageIdentifier name version) <- pids ]
 
 packageNamesFromPackageIndex :: PackageIndex -> [PackageName]
 packageNamesFromPackageIndex pix = nub $ map fst $ allPackagesByName pix
@@ -155,7 +155,7 @@
   , p "bytestring" [0,10,0,2]
 --  , p "Cabal" [1,16,0]  package is upgradeable
   , p "containers" [0,5,0,0]
---  , p "deepseq" [1,3,0,1] -- package is upgradeable
+  , p "deepseq" [1,3,0,1] -- used by time, haskell98
   , p "directory" [1,2,0,1]
   , p "filepath" [1,3,0,1]
   , p "ghc-prim" [0,3,0,0]
@@ -181,7 +181,7 @@
   , p "bytestring" [0,10,0,0]
 --  , p "Cabal" [1,16,0]  package is upgradeable
   , p "containers" [0,5,0,0]
---  , p "deepseq" [1,3,0,1] -- package is upgradeable
+  , p "deepseq" [1,3,0,1] -- used by time, haskell98
   , p "directory" [1,2,0,0]
   , p "filepath" [1,3,0,1]
   , p "ghc-prim" [0,3,0,0]
@@ -207,7 +207,7 @@
   , p "bytestring" [0,9,2,1]
 --  , p "Cabal" [1,14,0]  package is upgradeable
   , p "containers" [0,4,2,1]
---  , p "deepseq" [1,3,0,0]  package is upgradeable
+  , p "deepseq" [1,3,0,0] -- used by time, haskell98
   , p "directory" [1,1,0,2]
 -- , p "extensible-exceptions" [0,1,1,4] -- package is upgradeable, stopped shipping in 7.6
   , p "filepath" [1,3,0,0]
@@ -234,7 +234,7 @@
   , p "bytestring" [0,9,2,1]
 --  , p "Cabal" [1,14,0]  package is upgradeable
   , p "containers" [0,4,2,1]
---  , p "deepseq" [1,3,0,0]  package is upgradeable
+  , p "deepseq" [1,3,0,0] -- used by time, haskell98
   , p "directory" [1,1,0,2]
 -- , p "extensible-exceptions" [0,1,1,4] -- package is upgradeable, stopped shipping in 7.6
   , p "filepath" [1,3,0,0]
@@ -419,7 +419,7 @@
   -- ,"syb"       -- was splitted off from ghc again
   ,"template-haskell"
   ,"time" -- ghc-6.12+. startig from ghc-7.6.1 it is very
-          -- unsafe to unpgrade as most others (like directory)
+          -- unsafe to upgrade as most others (like directory)
           -- depend on it
   ,"unix"         -- unsafe to upgrade
   ]
diff --git a/Portage/Host.hs b/Portage/Host.hs
--- a/Portage/Host.hs
+++ b/Portage/Host.hs
@@ -7,11 +7,16 @@
 import Data.Maybe (fromJust, isJust, catMaybes)
 import Control.Applicative ( (<$>) )
 
+import qualified System.Directory as D
+import           System.FilePath ((</>))
+
+import System.IO
+
 data LocalInfo =
     LocalInfo { distfiles_dir :: String
               , overlay_list  :: [FilePath]
               , portage_dir   :: FilePath
-              } deriving Show
+              } deriving (Read, Show)
 
 defaultInfo :: LocalInfo
 defaultInfo = LocalInfo { distfiles_dir = "/usr/portage/distfiles"
@@ -22,9 +27,11 @@
 -- query paludis and then emerge
 getInfo :: IO LocalInfo
 getInfo = fromJust `fmap`
-    performMaybes [ getPaludisInfo
-                  , fmap parse_emerge_output <$> (run_cmd "emerge --info")
-                  , return (Just defaultInfo)
+    performMaybes [ readConfig
+                  , performMaybes [ getPaludisInfo
+                                  , fmap parse_emerge_output <$> (run_cmd "emerge --info")
+                                  , return (Just defaultInfo)
+                                  ] >>= showAnnoyingWarning
                   ]
     where performMaybes [] = return Nothing
           performMaybes (act:acts) =
@@ -33,6 +40,30 @@
                      then return r
                      else performMaybes acts
 
+showAnnoyingWarning :: Maybe LocalInfo -> IO (Maybe LocalInfo)
+showAnnoyingWarning info = do
+    hPutStr stderr $ unlines [ "-- Consider creating ~/" ++ hackport_config ++ " file with contents:"
+                             , show info
+                             , "-- It will speed hackport startup time a bit."
+                             ]
+    return info
+
+-- relative to home dir
+hackport_config :: FilePath
+hackport_config = ".hackport" </> "repositories"
+
+--------------------------
+-- fastest: config reading
+--------------------------
+readConfig :: IO (Maybe LocalInfo)
+readConfig =
+    do home_dir <- D.getHomeDirectory
+       let config_path  = home_dir </> hackport_config
+       exists <- D.doesFileExist config_path
+       case exists of
+           True  -> read <$> readFile config_path
+           False -> return Nothing
+
 ----------
 -- Paludis
 ----------
@@ -47,6 +78,7 @@
   in  fromJust (mkLocalInfo repositories)
   where
   parseRepository :: [String] -> Maybe (String, (String, String))
+  parseRepository [] = Nothing
   parseRepository (firstLine:lns) = do
     name <- case words firstLine of
                 ["Repository", nm] -> return (init nm)
@@ -59,7 +91,7 @@
   mkLocalInfo :: [(String, (String, String))] -> Maybe LocalInfo
   mkLocalInfo repos = do
     (gentooLocation, gentooDistfiles) <- lookup "gentoo" repos
-    let overlays = [ loc | (name, (loc, _dist)) <- repos ]
+    let overlays = [ loc | (_, (loc, _dist)) <- repos ]
     return (LocalInfo
               { distfiles_dir = gentooDistfiles
               , portage_dir = gentooLocation
@@ -67,7 +99,7 @@
               })
 
 splitBy :: (a -> Bool) -> [a] -> [[a]]
-splitBy c [] = []
+splitBy _ [] = []
 splitBy c lst =
   let (x,xs) = break c lst
       (_,xs') = span c xs
diff --git a/Portage/Overlay.hs b/Portage/Overlay.hs
--- a/Portage/Overlay.hs
+++ b/Portage/Overlay.hs
@@ -176,6 +176,11 @@
         , not (ignore name)
         , let path = dir </> name ]
 
-    ignore ['.']      = True
-    ignore ['.', '.'] = True
-    ignore _          = False
+    ignore path = path `elem` [ "."
+                              , ".."
+                              -- those speed things up a bit
+                              -- and reduse memory consumption
+                              -- (as we store it in RAM for the whole run)
+                              , ".git"
+                              , "CVS"
+                              ]
diff --git a/cabal/.git b/cabal/.git
new file mode 100644
--- /dev/null
+++ b/cabal/.git
@@ -0,0 +1,1 @@
+gitdir: /home/slyfox/portage/hackport/.git/modules/cabal
diff --git a/cabal/Cabal/tests/PackageTests.hs b/cabal/Cabal/tests/PackageTests.hs
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests.hs
+++ /dev/null
@@ -1,82 +0,0 @@
--- The intention is that this will be the new unit test framework.
--- Please add any working tests here.  This file should do nothing
--- but import tests from other modules.
---
--- Stephen Blackheath, 2009
-
-module Main where
-
-import Test.Framework
-import Test.Framework.Providers.HUnit
-import Test.Framework.Providers.QuickCheck2
-import qualified Test.HUnit as HUnit
-import PackageTests.BenchmarkExeV10.Check
-import PackageTests.BenchmarkOptions.Check
-import PackageTests.BenchmarkStanza.Check
-import PackageTests.BuildDeps.SameDepsAllRound.Check
-import PackageTests.BuildDeps.TargetSpecificDeps1.Check
-import PackageTests.BuildDeps.TargetSpecificDeps1.Check
-import PackageTests.BuildDeps.TargetSpecificDeps2.Check
-import PackageTests.BuildDeps.TargetSpecificDeps3.Check
-import PackageTests.BuildDeps.GlobalBuildDepsNotAdditive1.Check
-import PackageTests.BuildDeps.GlobalBuildDepsNotAdditive2.Check
-import PackageTests.BuildDeps.InternalLibrary0.Check
-import PackageTests.BuildDeps.InternalLibrary1.Check
-import PackageTests.BuildDeps.InternalLibrary2.Check
-import PackageTests.BuildDeps.InternalLibrary3.Check
-import PackageTests.BuildDeps.InternalLibrary4.Check
-import PackageTests.TestOptions.Check
-import PackageTests.TestStanza.Check
-import PackageTests.TestSuiteExeV10.Check
-import PackageTests.TemplateHaskell.Check
-import Distribution.Text (display)
-import Distribution.Simple.Utils (cabalVersion)
-import Data.Version
-import System.Directory
-
-hunit :: TestName -> HUnit.Test -> Test
-hunit name test = testGroup name $ hUnitTestToTests test
-
-tests :: Version -> [Test]
-tests cabalVersion = [
-        hunit "PackageTests/BuildDeps/SameDepsAllRound/" PackageTests.BuildDeps.SameDepsAllRound.Check.suite,
-        -- The two following tests were disabled by Johan Tibell as
-        -- they have been failing for a long time:
-        -- hunit "PackageTests/BuildDeps/GlobalBuildDepsNotAdditive1/" PackageTests.BuildDeps.GlobalBuildDepsNotAdditive1.Check.suite,
-        -- hunit "PackageTests/BuildDeps/GlobalBuildDepsNotAdditive2/" PackageTests.BuildDeps.GlobalBuildDepsNotAdditive2.Check.suite,
-        hunit "PackageTests/BuildDeps/InternalLibrary0/" (PackageTests.BuildDeps.InternalLibrary0.Check.suite cabalVersion),
-        hunit "PackageTests/TestStanza/" (PackageTests.TestStanza.Check.suite cabalVersion),
-        -- ^ The Test stanza test will eventually be required
-        -- only for higher versions.
-        hunit "PackageTests/TestSuiteExeV10/Test"
-        (PackageTests.TestSuiteExeV10.Check.checkTest cabalVersion),
-        hunit "PackageTests/TestSuiteExeV10/TestWithHpc"
-        (PackageTests.TestSuiteExeV10.Check.checkTestWithHpc cabalVersion),
-        hunit "PackageTests/TestOptions" PackageTests.TestOptions.Check.suite,
-        hunit "PackageTests/BenchmarkStanza/" (PackageTests.BenchmarkStanza.Check.suite cabalVersion),
-        -- ^ The benchmark stanza test will eventually be required
-        -- only for higher versions.
-        hunit "PackageTests/BenchmarkExeV10/Test"
-        (PackageTests.BenchmarkExeV10.Check.checkBenchmark cabalVersion),
-        hunit "PackageTests/BenchmarkOptions" PackageTests.BenchmarkOptions.Check.suite,
-        hunit "PackageTests/TemplateHaskell/profiling" PackageTests.TemplateHaskell.Check.profiling,
-        hunit "PackageTests/TemplateHaskell/dynamic" PackageTests.TemplateHaskell.Check.dynamic
-    ] ++
-    -- These tests are only required to pass on cabal version >= 1.7
-    (if cabalVersion >= Version [1, 7] []
-        then [
-            hunit "PackageTests/BuildDeps/TargetSpecificDeps1/" PackageTests.BuildDeps.TargetSpecificDeps1.Check.suite,
-            hunit "PackageTests/BuildDeps/TargetSpecificDeps2/" PackageTests.BuildDeps.TargetSpecificDeps2.Check.suite,
-            hunit "PackageTests/BuildDeps/TargetSpecificDeps3/" PackageTests.BuildDeps.TargetSpecificDeps3.Check.suite,
-            hunit "PackageTests/BuildDeps/InternalLibrary1/" PackageTests.BuildDeps.InternalLibrary1.Check.suite,
-            hunit "PackageTests/BuildDeps/InternalLibrary2/" PackageTests.BuildDeps.InternalLibrary2.Check.suite,
-            hunit "PackageTests/BuildDeps/InternalLibrary3/" PackageTests.BuildDeps.InternalLibrary3.Check.suite,
-            hunit "PackageTests/BuildDeps/InternalLibrary4/" PackageTests.BuildDeps.InternalLibrary4.Check.suite
-        ]
-        else [])
-
-main = do
-    putStrLn $ "Cabal test suite - testing cabal version "++display cabalVersion
-    setCurrentDirectory "tests"
-    defaultMain (tests cabalVersion)
-
diff --git a/cabal/Cabal/tests/PackageTests/BenchmarkExeV10/Check.hs b/cabal/Cabal/tests/PackageTests/BenchmarkExeV10/Check.hs
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/BenchmarkExeV10/Check.hs
+++ /dev/null
@@ -1,21 +0,0 @@
-module PackageTests.BenchmarkExeV10.Check
-       ( checkBenchmark
-       ) where
-
-import Distribution.PackageDescription ( Benchmark(..), emptyBenchmark )
-import Distribution.Simple.Hpc
-import Distribution.Version
-import Test.HUnit
-import System.Directory
-import System.FilePath
-import PackageTests.PackageTester
-
-dir :: FilePath
-dir = "PackageTests" </> "BenchmarkExeV10"
-
-checkBenchmark :: Version -> Test
-checkBenchmark cabalVersion = TestCase $ do
-    let spec = PackageSpec dir ["--enable-benchmarks"]
-    buildResult <- cabal_build spec
-    let buildMessage = "\'setup build\' should succeed"
-    assertEqual buildMessage True $ successful buildResult
diff --git a/cabal/Cabal/tests/PackageTests/BenchmarkExeV10/Foo.hs b/cabal/Cabal/tests/PackageTests/BenchmarkExeV10/Foo.hs
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/BenchmarkExeV10/Foo.hs
+++ /dev/null
@@ -1,4 +0,0 @@
-module Foo where
-
-fooTest :: [String] -> Bool
-fooTest _ = True
diff --git a/cabal/Cabal/tests/PackageTests/BenchmarkExeV10/Setup.hs b/cabal/Cabal/tests/PackageTests/BenchmarkExeV10/Setup.hs
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/BenchmarkExeV10/Setup.hs
+++ /dev/null
@@ -1,3 +0,0 @@
-import Distribution.Simple
-main = defaultMain
-
diff --git a/cabal/Cabal/tests/PackageTests/BenchmarkExeV10/benchmarks/bench-Foo.hs b/cabal/Cabal/tests/PackageTests/BenchmarkExeV10/benchmarks/bench-Foo.hs
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/BenchmarkExeV10/benchmarks/bench-Foo.hs
+++ /dev/null
@@ -1,8 +0,0 @@
-module Main where
-
-import Foo
-import System.Exit
-
-main :: IO ()
-main | fooTest [] = exitSuccess
-     | otherwise = exitFailure
diff --git a/cabal/Cabal/tests/PackageTests/BenchmarkExeV10/my.cabal b/cabal/Cabal/tests/PackageTests/BenchmarkExeV10/my.cabal
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/BenchmarkExeV10/my.cabal
+++ /dev/null
@@ -1,15 +0,0 @@
-name:           my
-version:        0.1
-license:        BSD3
-cabal-version:  >= 1.9.2
-build-type:     Simple
-
-library
-    exposed-modules:    Foo
-    build-depends:      base
-
-benchmark bench-Foo
-    type:   exitcode-stdio-1.0
-    hs-source-dirs: benchmarks
-    main-is:    bench-Foo.hs
-    build-depends: base, my
diff --git a/cabal/Cabal/tests/PackageTests/BenchmarkOptions/BenchmarkOptions.cabal b/cabal/Cabal/tests/PackageTests/BenchmarkOptions/BenchmarkOptions.cabal
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/BenchmarkOptions/BenchmarkOptions.cabal
+++ /dev/null
@@ -1,20 +0,0 @@
-name: BenchmarkOptions
-version: 0.1
-license: BSD3
-author: Johan Tibell
-stability: stable
-category: PackageTests
-build-type: Simple
-cabal-version: >= 1.9.2
-
-description:
-    Check that Cabal passes the correct test options to test suites.
-
-executable dummy
-    main-is: test-BenchmarkOptions.hs
-    build-depends: base
-
-benchmark test-BenchmarkOptions
-    main-is: test-BenchmarkOptions.hs
-    type: exitcode-stdio-1.0
-    build-depends: base
diff --git a/cabal/Cabal/tests/PackageTests/BenchmarkOptions/Check.hs b/cabal/Cabal/tests/PackageTests/BenchmarkOptions/Check.hs
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/BenchmarkOptions/Check.hs
+++ /dev/null
@@ -1,23 +0,0 @@
-module PackageTests.BenchmarkOptions.Check where
-
-import Test.HUnit
-import System.FilePath
-import PackageTests.PackageTester
-
-suite :: Test
-suite = TestCase $ do
-    let directory = "PackageTests" </> "BenchmarkOptions"
-        pdFile = directory </> "BenchmarkOptions" <.> "cabal"
-        spec = PackageSpec directory ["--enable-benchmarks"]
-    _ <- cabal_build spec
-    result <- cabal_bench spec ["--benchmark-options=1 2 3"]
-    let message = "\"cabal bench\" did not pass the correct options to the "
-                  ++ "benchmark executable with \"--benchmark-options\""
-    assertEqual message True $ successful result
-    result' <- cabal_bench spec [ "--benchmark-option=1"
-                                , "--benchmark-option=2"
-                                , "--benchmark-option=3"
-                                ]
-    let message = "\"cabal bench\" did not pass the correct options to the "
-                  ++ "benchmark executable with \"--benchmark-option\""
-    assertEqual message True $ successful result'
diff --git a/cabal/Cabal/tests/PackageTests/BenchmarkOptions/Setup.hs b/cabal/Cabal/tests/PackageTests/BenchmarkOptions/Setup.hs
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/BenchmarkOptions/Setup.hs
+++ /dev/null
@@ -1,3 +0,0 @@
-import Distribution.Simple
-main = defaultMain
-
diff --git a/cabal/Cabal/tests/PackageTests/BenchmarkOptions/test-BenchmarkOptions.hs b/cabal/Cabal/tests/PackageTests/BenchmarkOptions/test-BenchmarkOptions.hs
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/BenchmarkOptions/test-BenchmarkOptions.hs
+++ /dev/null
@@ -1,11 +0,0 @@
-module Main where
-
-import System.Environment ( getArgs )
-import System.Exit ( exitFailure, exitSuccess )
-
-main :: IO ()
-main = do
-    args <- getArgs
-    if args == ["1", "2", "3"]
-        then exitSuccess
-        else putStrLn ("Got: " ++ show args) >> exitFailure
diff --git a/cabal/Cabal/tests/PackageTests/BenchmarkStanza/Check.hs b/cabal/Cabal/tests/PackageTests/BenchmarkStanza/Check.hs
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/BenchmarkStanza/Check.hs
+++ /dev/null
@@ -1,57 +0,0 @@
-module PackageTests.BenchmarkStanza.Check where
-
-import Test.HUnit
-import System.FilePath
-import PackageTests.PackageTester
-import Data.List (isInfixOf, intercalate)
-import Distribution.Version
-import Distribution.PackageDescription.Parse
-        ( readPackageDescription )
-import Distribution.PackageDescription.Configuration
-        ( finalizePackageDescription )
-import Distribution.Package
-        ( PackageIdentifier(..), PackageName(..), Dependency(..) )
-import Distribution.PackageDescription
-        ( PackageDescription(..), BuildInfo(..), Benchmark(..), Library(..)
-        , BenchmarkInterface(..)
-        , TestType(..), emptyPackageDescription, emptyBuildInfo, emptyLibrary
-        , emptyBenchmark, BuildType(..) )
-import Distribution.Verbosity (silent)
-import Distribution.License (License(..))
-import Distribution.ModuleName (fromString)
-import Distribution.System (buildPlatform)
-import Distribution.Compiler
-        ( CompilerId(..), CompilerFlavor(..) )
-import Distribution.Text
-
-suite :: Version -> Test
-suite cabalVersion = TestCase $ do
-    let directory = "PackageTests" </> "BenchmarkStanza"
-        pdFile = directory </> "my" <.> "cabal"
-        spec = PackageSpec directory []
-    result <- cabal_configure spec
-    let message = "cabal configure should recognize benchmark section"
-        test = "unknown section type"
-               `isInfixOf`
-               (intercalate " " $ lines $ outputText result)
-    assertEqual message False test
-    genPD <- readPackageDescription silent pdFile
-    let compiler = CompilerId GHC $ Version [6, 12, 2] []
-        anyV = intersectVersionRanges anyVersion anyVersion
-        anticipatedBenchmark = emptyBenchmark
-            { benchmarkName = "dummy"
-            , benchmarkInterface = BenchmarkExeV10 (Version [1,0] []) "dummy.hs"
-            , benchmarkBuildInfo = emptyBuildInfo
-                    { targetBuildDepends =
-                            [ Dependency (PackageName "base") anyVersion ]
-                    , hsSourceDirs = ["."]
-                    }
-            , benchmarkEnabled = False
-            }
-    case finalizePackageDescription [] (const True) buildPlatform compiler [] genPD of
-        Left xs -> let depMessage = "should not have missing dependencies:\n" ++
-                                    (unlines $ map (show . disp) xs)
-                   in assertEqual depMessage True False
-        Right (f, _) -> let gotBenchmark = head $ benchmarks f
-                        in assertEqual "parsed benchmark stanza does not match anticipated"
-                                gotBenchmark anticipatedBenchmark
diff --git a/cabal/Cabal/tests/PackageTests/BenchmarkStanza/Setup.hs b/cabal/Cabal/tests/PackageTests/BenchmarkStanza/Setup.hs
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/BenchmarkStanza/Setup.hs
+++ /dev/null
@@ -1,3 +0,0 @@
-import Distribution.Simple
-main = defaultMain
-
diff --git a/cabal/Cabal/tests/PackageTests/BenchmarkStanza/my.cabal b/cabal/Cabal/tests/PackageTests/BenchmarkStanza/my.cabal
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/BenchmarkStanza/my.cabal
+++ /dev/null
@@ -1,19 +0,0 @@
-name: BenchmarkStanza
-version: 0.1
-license: BSD3
-author: Johan Tibell
-stability: stable
-category: PackageTests
-build-type: Simple
-
-description:
-    Check that Cabal recognizes the benchmark stanza defined below.
-
-Library
-    exposed-modules: MyLibrary
-    build-depends: base
-
-benchmark dummy
-    main-is: dummy.hs
-    type: exitcode-stdio-1.0
-    build-depends: base
diff --git a/cabal/Cabal/tests/PackageTests/BuildDeps/GlobalBuildDepsNotAdditive1/Check.hs b/cabal/Cabal/tests/PackageTests/BuildDeps/GlobalBuildDepsNotAdditive1/Check.hs
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/BuildDeps/GlobalBuildDepsNotAdditive1/Check.hs
+++ /dev/null
@@ -1,22 +0,0 @@
-module PackageTests.BuildDeps.GlobalBuildDepsNotAdditive1.Check where
-
-import Test.HUnit
-import PackageTests.PackageTester
-import System.FilePath
-import Data.List
-import Control.Exception
-import Prelude hiding (catch)
-
-
-suite :: Test
-suite = TestCase $ do
-    let spec = PackageSpec ("PackageTests" </> "BuildDeps" </> "GlobalBuildDepsNotAdditive1") []
-    result <- cabal_build spec
-    do
-        assertEqual "cabal build should fail - see test-log.txt" False (successful result)
-        let sb = "Could not find module `Prelude'"
-        assertBool ("cabal output should be "++show sb) $
-            sb `isInfixOf` outputText result
-      `catch` \exc -> do
-        putStrLn $ "Cabal result was "++show result
-        throwIO (exc :: SomeException)
diff --git a/cabal/Cabal/tests/PackageTests/BuildDeps/GlobalBuildDepsNotAdditive1/GlobalBuildDepsN b/cabal/Cabal/tests/PackageTests/BuildDeps/GlobalBuildDepsNotAdditive1/GlobalBuildDepsN
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/BuildDeps/GlobalBuildDepsNotAdditive1/GlobalBuildDepsN
+++ /dev/null
@@ -1,20 +0,0 @@
-name: GlobalBuildDepsNotAdditive1
-version: 0.1
-license: BSD3
-cabal-version: >= 1.6
-author: Stephen Blackheath
-stability: stable
-category: PackageTests
-build-type: Simple
-
-description:
-    If you specify 'base' in the global build dependencies, then define
-    a library without base, it fails to find 'base' for the library.
-
----------------------------------------
-
-build-depends: base
-
-Library
-    exposed-modules: MyLibrary
-    build-depends: bytestring, old-time
diff --git a/cabal/Cabal/tests/PackageTests/BuildDeps/GlobalBuildDepsNotAdditive1/MyLibrary.hs b/cabal/Cabal/tests/PackageTests/BuildDeps/GlobalBuildDepsNotAdditive1/MyLibrary.hs
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/BuildDeps/GlobalBuildDepsNotAdditive1/MyLibrary.hs
+++ /dev/null
@@ -1,10 +0,0 @@
-module MyLibrary where
-
-import qualified Data.ByteString.Char8 as C
-import System.Time
-
-myLibFunc :: IO ()
-myLibFunc = do
-    getClockTime
-    let text = "myLibFunc"
-    C.putStrLn $ C.pack text
diff --git a/cabal/Cabal/tests/PackageTests/BuildDeps/GlobalBuildDepsNotAdditive1/Setup.hs b/cabal/Cabal/tests/PackageTests/BuildDeps/GlobalBuildDepsNotAdditive1/Setup.hs
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/BuildDeps/GlobalBuildDepsNotAdditive1/Setup.hs
+++ /dev/null
@@ -1,3 +0,0 @@
-import Distribution.Simple
-main = defaultMain
-
diff --git a/cabal/Cabal/tests/PackageTests/BuildDeps/GlobalBuildDepsNotAdditive2/Check.hs b/cabal/Cabal/tests/PackageTests/BuildDeps/GlobalBuildDepsNotAdditive2/Check.hs
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/BuildDeps/GlobalBuildDepsNotAdditive2/Check.hs
+++ /dev/null
@@ -1,22 +0,0 @@
-module PackageTests.BuildDeps.GlobalBuildDepsNotAdditive2.Check where
-
-import Test.HUnit
-import PackageTests.PackageTester
-import System.FilePath
-import Data.List
-import Control.Exception
-import Prelude hiding (catch)
-
-
-suite :: Test
-suite = TestCase $ do
-    let spec = PackageSpec ("PackageTests" </> "BuildDeps" </> "GlobalBuildDepsNotAdditive2") []
-    result <- cabal_build spec
-    do
-        assertEqual "cabal build should fail - see test-log.txt" False (successful result)
-        let sb = "Could not find module `Prelude'"
-        assertBool ("cabal output should be "++show sb) $
-            sb `isInfixOf` outputText result
-      `catch` \exc -> do
-        putStrLn $ "Cabal result was "++show result
-        throwIO (exc :: SomeException)
diff --git a/cabal/Cabal/tests/PackageTests/BuildDeps/GlobalBuildDepsNotAdditive2/GlobalBuildDepsN b/cabal/Cabal/tests/PackageTests/BuildDeps/GlobalBuildDepsNotAdditive2/GlobalBuildDepsN
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/BuildDeps/GlobalBuildDepsNotAdditive2/GlobalBuildDepsN
+++ /dev/null
@@ -1,20 +0,0 @@
-name: GlobalBuildDepsNotAdditive1
-version: 0.1
-license: BSD3
-cabal-version: >= 1.6
-author: Stephen Blackheath
-stability: stable
-category: PackageTests
-build-type: Simple
-
-description:
-    If you specify 'base' in the global build dependencies, then define
-    an executable without base, it fails to find 'base' for the executable
-
----------------------------------------
-
-build-depends: base
-
-Executable lemon
-    main-is: lemon.hs
-    build-depends: bytestring, old-time
diff --git a/cabal/Cabal/tests/PackageTests/BuildDeps/GlobalBuildDepsNotAdditive2/Setup.hs b/cabal/Cabal/tests/PackageTests/BuildDeps/GlobalBuildDepsNotAdditive2/Setup.hs
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/BuildDeps/GlobalBuildDepsNotAdditive2/Setup.hs
+++ /dev/null
@@ -1,3 +0,0 @@
-import Distribution.Simple
-main = defaultMain
-
diff --git a/cabal/Cabal/tests/PackageTests/BuildDeps/GlobalBuildDepsNotAdditive2/lemon.hs b/cabal/Cabal/tests/PackageTests/BuildDeps/GlobalBuildDepsNotAdditive2/lemon.hs
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/BuildDeps/GlobalBuildDepsNotAdditive2/lemon.hs
+++ /dev/null
@@ -1,7 +0,0 @@
-import qualified Data.ByteString.Char8 as C
-import System.Time
-
-main = do
-    getClockTime
-    let text = "lemon"
-    C.putStrLn $ C.pack text
diff --git a/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary0/Check.hs b/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary0/Check.hs
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary0/Check.hs
+++ /dev/null
@@ -1,26 +0,0 @@
-module PackageTests.BuildDeps.InternalLibrary0.Check where
-
-import Test.HUnit
-import PackageTests.PackageTester
-import Control.Monad
-import System.FilePath
-import Data.Version
-import Data.List (isInfixOf, intercalate)
-import Control.Exception
-import Prelude hiding (catch)
-
-
-suite :: Version -> Test
-suite cabalVersion = TestCase $ do
-    let spec = PackageSpec ("PackageTests" </> "BuildDeps" </> "InternalLibrary0") []
-    result <- cabal_build spec
-    do
-        assertEqual "cabal build should fail" False (successful result)
-        when (cabalVersion >= Version [1, 7] []) $ do
-            let sb = "library which is defined within the same package."
-            -- In 1.7 it should tell you how to enable the desired behaviour.
-            assertEqual ("cabal output should say "++show sb) True $
-                sb `isInfixOf` (intercalate " " $ lines $ outputText result)
-      `catch` \exc -> do
-        putStrLn $ "Cabal result was "++show result
-        throwIO (exc :: SomeException)
diff --git a/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary0/MyLibrary.hs b/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary0/MyLibrary.hs
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary0/MyLibrary.hs
+++ /dev/null
@@ -1,10 +0,0 @@
-module MyLibrary where
-
-import qualified Data.ByteString.Char8 as C
-import System.Time
-
-myLibFunc :: IO ()
-myLibFunc = do
-    getClockTime
-    let text = "myLibFunc"
-    C.putStrLn $ C.pack text
diff --git a/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary0/Setup.hs b/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary0/Setup.hs
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary0/Setup.hs
+++ /dev/null
@@ -1,3 +0,0 @@
-import Distribution.Simple
-main = defaultMain
-
diff --git a/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary0/my.cabal b/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary0/my.cabal
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary0/my.cabal
+++ /dev/null
@@ -1,24 +0,0 @@
-name: InternalLibrary0
-version: 0.1
-license: BSD3
-cabal-version: >= 1.6
-author: Stephen Blackheath
-stability: stable
-category: PackageTests
-build-type: Simple
-
-description:
-    Check that with 'cabal-version:' containing versions less than 1.7, we do *not*
-    have the new behaviour to allow executables to refer to the library defined
-    in the same module.
-
----------------------------------------
-
-Library
-    exposed-modules: MyLibrary
-    build-depends: base, bytestring, old-time
-
-Executable lemon
-    main-is: lemon.hs
-    hs-source-dirs: programs
-    build-depends: base, bytestring, old-time, InternalLibrary0
diff --git a/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary0/programs/lemon.hs b/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary0/programs/lemon.hs
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary0/programs/lemon.hs
+++ /dev/null
@@ -1,6 +0,0 @@
-import System.Time
-import MyLibrary
-
-main = do
-    getClockTime
-    myLibFunc
diff --git a/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary1/Check.hs b/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary1/Check.hs
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary1/Check.hs
+++ /dev/null
@@ -1,18 +0,0 @@
-module PackageTests.BuildDeps.InternalLibrary1.Check where
-
-import Test.HUnit
-import PackageTests.PackageTester
-import System.FilePath
-import Control.Exception
-import Prelude hiding (catch)
-
-
-suite :: Test
-suite = TestCase $ do
-    let spec = PackageSpec ("PackageTests" </> "BuildDeps" </> "InternalLibrary1") []
-    result <- cabal_build spec
-    do
-        assertEqual "cabal build should succeed - see test-log.txt" True (successful result)
-      `catch` \exc -> do
-        putStrLn $ "Cabal result was "++show result
-        throwIO (exc :: SomeException)
diff --git a/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary1/MyLibrary.hs b/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary1/MyLibrary.hs
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary1/MyLibrary.hs
+++ /dev/null
@@ -1,10 +0,0 @@
-module MyLibrary where
-
-import qualified Data.ByteString.Char8 as C
-import System.Time
-
-myLibFunc :: IO ()
-myLibFunc = do
-    getClockTime
-    let text = "myLibFunc"
-    C.putStrLn $ C.pack text
diff --git a/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary1/Setup.hs b/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary1/Setup.hs
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary1/Setup.hs
+++ /dev/null
@@ -1,3 +0,0 @@
-import Distribution.Simple
-main = defaultMain
-
diff --git a/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary1/my.cabal b/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary1/my.cabal
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary1/my.cabal
+++ /dev/null
@@ -1,23 +0,0 @@
-name: InternalLibrary1
-version: 0.1
-license: BSD3
-cabal-version: >= 1.7.1
-author: Stephen Blackheath
-stability: stable
-category: PackageTests
-build-type: Simple
-
-description:
-    Check for the new (in >= 1.7.1) ability to allow executables to refer to
-    the library defined in the same module.
-
----------------------------------------
-
-Library
-    exposed-modules: MyLibrary
-    build-depends: base, bytestring, old-time
-
-Executable lemon
-    main-is: lemon.hs
-    hs-source-dirs: programs
-    build-depends: base, bytestring, old-time, InternalLibrary1
diff --git a/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary1/programs/lemon.hs b/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary1/programs/lemon.hs
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary1/programs/lemon.hs
+++ /dev/null
@@ -1,6 +0,0 @@
-import System.Time
-import MyLibrary
-
-main = do
-    getClockTime
-    myLibFunc
diff --git a/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary2/Check.hs b/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary2/Check.hs
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary2/Check.hs
+++ /dev/null
@@ -1,34 +0,0 @@
-module PackageTests.BuildDeps.InternalLibrary2.Check where
-
-import Test.HUnit
-import PackageTests.PackageTester
-import System.FilePath
-import qualified Data.ByteString.Char8 as C
-import Control.Exception
-import Prelude hiding (catch)
-
-
-suite :: Test
-suite = TestCase $ do
-    let spec = PackageSpec ("PackageTests" </> "BuildDeps" </> "InternalLibrary2") []
-    let specTI = PackageSpec (directory spec </> "to-install") []
-
-    unregister "InternalLibrary2"
-    iResult <- cabal_install specTI                     
-    do
-        assertEqual "cabal install should succeed" True (successful iResult)
-      `catch` \exc -> do
-        putStrLn $ "Cabal result was "++show iResult
-        throwIO (exc :: SomeException)
-    bResult <- cabal_build spec
-    do
-        assertEqual "cabal build should succeed" True (successful bResult)
-      `catch` \exc -> do
-        putStrLn $ "Cabal result was "++show bResult
-        throwIO (exc :: SomeException)
-    unregister "InternalLibrary2"
-
-    (_, _, output) <- run (Just $ directory spec) "dist/build/lemon/lemon" []
-    C.appendFile (directory spec </> "test-log.txt") (C.pack $ "\ndist/build/lemon/lemon\n"++output)
-    assertEqual "executable should have linked with the internal library" "myLibFunc internal" (concat $ lines output)
-
diff --git a/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary2/MyLibrary.hs b/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary2/MyLibrary.hs
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary2/MyLibrary.hs
+++ /dev/null
@@ -1,10 +0,0 @@
-module MyLibrary where
-
-import qualified Data.ByteString.Char8 as C
-import System.Time
-
-myLibFunc :: IO ()
-myLibFunc = do
-    getClockTime
-    let text = "myLibFunc internal"
-    C.putStrLn $ C.pack text
diff --git a/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary2/Setup.hs b/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary2/Setup.hs
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary2/Setup.hs
+++ /dev/null
@@ -1,3 +0,0 @@
-import Distribution.Simple
-main = defaultMain
-
diff --git a/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary2/my.cabal b/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary2/my.cabal
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary2/my.cabal
+++ /dev/null
@@ -1,23 +0,0 @@
-name: InternalLibrary2
-version: 0.1
-license: BSD3
-cabal-version: >= 1.7.1
-author: Stephen Blackheath
-stability: stable
-category: PackageTests
-build-type: Simple
-
-description:
-    This test is to make sure that the internal library is preferred by ghc to
-    an installed one of the same name and version.
-
----------------------------------------
-
-Library
-    exposed-modules: MyLibrary
-    build-depends: base, bytestring, old-time
-
-Executable lemon
-    main-is: lemon.hs
-    hs-source-dirs: programs
-    build-depends: base, bytestring, old-time, InternalLibrary2
diff --git a/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary2/programs/lemon.hs b/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary2/programs/lemon.hs
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary2/programs/lemon.hs
+++ /dev/null
@@ -1,6 +0,0 @@
-import System.Time
-import MyLibrary
-
-main = do
-    getClockTime
-    myLibFunc
diff --git a/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary2/to-install/MyLibrary.hs b/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary2/to-install/MyLibrary.hs
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary2/to-install/MyLibrary.hs
+++ /dev/null
@@ -1,10 +0,0 @@
-module MyLibrary where
-
-import qualified Data.ByteString.Char8 as C
-import System.Time
-
-myLibFunc :: IO ()
-myLibFunc = do
-    getClockTime
-    let text = "myLibFunc installed"
-    C.putStrLn $ C.pack text
diff --git a/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary2/to-install/Setup.hs b/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary2/to-install/Setup.hs
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary2/to-install/Setup.hs
+++ /dev/null
@@ -1,3 +0,0 @@
-import Distribution.Simple
-main = defaultMain
-
diff --git a/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary2/to-install/my.cabal b/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary2/to-install/my.cabal
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary2/to-install/my.cabal
+++ /dev/null
@@ -1,18 +0,0 @@
-name: InternalLibrary2
-version: 0.1
-license: BSD3
-cabal-version: >= 1.6
-author: Stephen Blackheath
-stability: stable
-category: PackageTests
-build-type: Simple
-
-description:
-    This test is to make sure that the internal library is preferred by ghc to
-    an installed one of the same name and version.
-
----------------------------------------
-
-Library
-    exposed-modules: MyLibrary
-    build-depends: base, bytestring, old-time
diff --git a/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary3/Check.hs b/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary3/Check.hs
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary3/Check.hs
+++ /dev/null
@@ -1,34 +0,0 @@
-module PackageTests.BuildDeps.InternalLibrary3.Check where
-
-import Test.HUnit
-import PackageTests.PackageTester
-import System.FilePath
-import qualified Data.ByteString.Char8 as C
-import Control.Exception
-import Prelude hiding (catch)
-
-
-suite :: Test
-suite = TestCase $ do
-    let spec = PackageSpec ("PackageTests" </> "BuildDeps" </> "InternalLibrary3") []
-    let specTI = PackageSpec (directory spec </> "to-install") []
-
-    unregister "InternalLibrary3"
-    iResult <- cabal_install specTI                     
-    do
-        assertEqual "cabal install should succeed - see to-install/test-log.txt" True (successful iResult)
-      `catch` \exc -> do
-        putStrLn $ "Cabal result was "++show iResult
-        throwIO (exc :: SomeException)
-    bResult <- cabal_build spec
-    do
-        assertEqual "cabal build should succeed - see test-log.txt" True (successful bResult)
-      `catch` \exc -> do
-        putStrLn $ "Cabal result was "++show bResult
-        throwIO (exc :: SomeException)
-    unregister "InternalLibrary3"
-
-    (_, _, output) <- run (Just $ directory spec) "dist/build/lemon/lemon" []
-    C.appendFile (directory spec </> "test-log.txt") (C.pack $ "\ndist/build/lemon/lemon\n"++output)
-    assertEqual "executable should have linked with the internal library" "myLibFunc internal" (concat $ lines output)
-
diff --git a/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary3/MyLibrary.hs b/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary3/MyLibrary.hs
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary3/MyLibrary.hs
+++ /dev/null
@@ -1,10 +0,0 @@
-module MyLibrary where
-
-import qualified Data.ByteString.Char8 as C
-import System.Time
-
-myLibFunc :: IO ()
-myLibFunc = do
-    getClockTime
-    let text = "myLibFunc internal"
-    C.putStrLn $ C.pack text
diff --git a/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary3/Setup.hs b/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary3/Setup.hs
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary3/Setup.hs
+++ /dev/null
@@ -1,3 +0,0 @@
-import Distribution.Simple
-main = defaultMain
-
diff --git a/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary3/my.cabal b/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary3/my.cabal
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary3/my.cabal
+++ /dev/null
@@ -1,23 +0,0 @@
-name: InternalLibrary3
-version: 0.1
-license: BSD3
-cabal-version: >= 1.7.1
-author: Stephen Blackheath
-stability: stable
-category: PackageTests
-build-type: Simple
-
-description:
-    This test is to make sure that the internal library is preferred by ghc to
-    an installed one of the same name, but a *newer* version.
-
----------------------------------------
-
-Library
-    exposed-modules: MyLibrary
-    build-depends: base, bytestring, old-time
-
-Executable lemon
-    main-is: lemon.hs
-    hs-source-dirs: programs
-    build-depends: base, bytestring, old-time, InternalLibrary3
diff --git a/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary3/programs/lemon.hs b/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary3/programs/lemon.hs
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary3/programs/lemon.hs
+++ /dev/null
@@ -1,6 +0,0 @@
-import System.Time
-import MyLibrary
-
-main = do
-    getClockTime
-    myLibFunc
diff --git a/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary3/to-install/MyLibrary.hs b/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary3/to-install/MyLibrary.hs
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary3/to-install/MyLibrary.hs
+++ /dev/null
@@ -1,10 +0,0 @@
-module MyLibrary where
-
-import qualified Data.ByteString.Char8 as C
-import System.Time
-
-myLibFunc :: IO ()
-myLibFunc = do
-    getClockTime
-    let text = "myLibFunc installed"
-    C.putStrLn $ C.pack text
diff --git a/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary3/to-install/Setup.hs b/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary3/to-install/Setup.hs
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary3/to-install/Setup.hs
+++ /dev/null
@@ -1,3 +0,0 @@
-import Distribution.Simple
-main = defaultMain
-
diff --git a/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary3/to-install/my.cabal b/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary3/to-install/my.cabal
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary3/to-install/my.cabal
+++ /dev/null
@@ -1,18 +0,0 @@
-name: InternalLibrary3
-version: 0.2
-license: BSD3
-cabal-version: >= 1.6
-author: Stephen Blackheath
-stability: stable
-category: PackageTests
-build-type: Simple
-
-description:
-    This test is to make sure that the internal library is preferred by ghc to
-    an installed one of the same name but a *newer* version.
-
----------------------------------------
-
-Library
-    exposed-modules: MyLibrary
-    build-depends: base, bytestring, old-time
diff --git a/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary4/Check.hs b/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary4/Check.hs
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary4/Check.hs
+++ /dev/null
@@ -1,34 +0,0 @@
-module PackageTests.BuildDeps.InternalLibrary4.Check where
-
-import Test.HUnit
-import PackageTests.PackageTester
-import System.FilePath
-import qualified Data.ByteString.Char8 as C
-import Control.Exception
-import Prelude hiding (catch)
-
-
-suite :: Test
-suite = TestCase $ do
-    let spec = PackageSpec ("PackageTests" </> "BuildDeps" </> "InternalLibrary4") []
-    let specTI = PackageSpec (directory spec </> "to-install") []
-
-    unregister "InternalLibrary4"
-    iResult <- cabal_install specTI                     
-    do
-        assertEqual "cabal install should succeed - see to-install/test-log.txt" True (successful iResult)
-      `catch` \exc -> do
-        putStrLn $ "Cabal result was "++show iResult
-        throwIO (exc :: SomeException)
-    bResult <- cabal_build spec
-    do
-        assertEqual "cabal build should succeed - see test-log.txt" True (successful bResult)
-      `catch` \exc -> do
-        putStrLn $ "Cabal result was "++show bResult
-        throwIO (exc :: SomeException)
-    unregister "InternalLibrary4"
-
-    (_, _, output) <- run (Just $ directory spec) "dist/build/lemon/lemon" []
-    C.appendFile (directory spec </> "test-log.txt") (C.pack $ "\ndist/build/lemon/lemon\n"++output)
-    assertEqual "executable should have linked with the installed library" "myLibFunc installed" (concat $ lines output)
-
diff --git a/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary4/MyLibrary.hs b/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary4/MyLibrary.hs
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary4/MyLibrary.hs
+++ /dev/null
@@ -1,10 +0,0 @@
-module MyLibrary where
-
-import qualified Data.ByteString.Char8 as C
-import System.Time
-
-myLibFunc :: IO ()
-myLibFunc = do
-    getClockTime
-    let text = "myLibFunc internal"
-    C.putStrLn $ C.pack text
diff --git a/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary4/Setup.hs b/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary4/Setup.hs
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary4/Setup.hs
+++ /dev/null
@@ -1,3 +0,0 @@
-import Distribution.Simple
-main = defaultMain
-
diff --git a/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary4/my.cabal b/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary4/my.cabal
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary4/my.cabal
+++ /dev/null
@@ -1,23 +0,0 @@
-name: InternalLibrary4
-version: 0.1
-license: BSD3
-cabal-version: >= 1.7.1
-author: Stephen Blackheath
-stability: stable
-category: PackageTests
-build-type: Simple
-
-description:
-    This test is to make sure that we can explicitly say we want InternalLibrary4-0.2
-    and it will give us the *installed* version 0.2 instead of the internal 0.1.
-
----------------------------------------
-
-Library
-    exposed-modules: MyLibrary
-    build-depends: base, bytestring, old-time
-
-Executable lemon
-    main-is: lemon.hs
-    hs-source-dirs: programs
-    build-depends: base, bytestring, old-time, InternalLibrary4 >= 0.2
diff --git a/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary4/programs/lemon.hs b/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary4/programs/lemon.hs
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary4/programs/lemon.hs
+++ /dev/null
@@ -1,6 +0,0 @@
-import System.Time
-import MyLibrary
-
-main = do
-    getClockTime
-    myLibFunc
diff --git a/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary4/to-install/MyLibrary.hs b/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary4/to-install/MyLibrary.hs
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary4/to-install/MyLibrary.hs
+++ /dev/null
@@ -1,10 +0,0 @@
-module MyLibrary where
-
-import qualified Data.ByteString.Char8 as C
-import System.Time
-
-myLibFunc :: IO ()
-myLibFunc = do
-    getClockTime
-    let text = "myLibFunc installed"
-    C.putStrLn $ C.pack text
diff --git a/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary4/to-install/Setup.hs b/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary4/to-install/Setup.hs
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary4/to-install/Setup.hs
+++ /dev/null
@@ -1,3 +0,0 @@
-import Distribution.Simple
-main = defaultMain
-
diff --git a/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary4/to-install/my.cabal b/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary4/to-install/my.cabal
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/BuildDeps/InternalLibrary4/to-install/my.cabal
+++ /dev/null
@@ -1,18 +0,0 @@
-name: InternalLibrary4
-version: 0.2
-license: BSD3
-cabal-version: >= 1.6
-author: Stephen Blackheath
-stability: stable
-category: PackageTests
-build-type: Simple
-
-description:
-    This test is to make sure that the internal library is preferred by ghc to
-    an installed one of the same name but a *newer* version.
-
----------------------------------------
-
-Library
-    exposed-modules: MyLibrary
-    build-depends: base, bytestring, old-time
diff --git a/cabal/Cabal/tests/PackageTests/BuildDeps/SameDepsAllRound/Check.hs b/cabal/Cabal/tests/PackageTests/BuildDeps/SameDepsAllRound/Check.hs
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/BuildDeps/SameDepsAllRound/Check.hs
+++ /dev/null
@@ -1,18 +0,0 @@
-module PackageTests.BuildDeps.SameDepsAllRound.Check where
-
-import Test.HUnit
-import PackageTests.PackageTester
-import System.FilePath
-import Control.Exception
-import Prelude hiding (catch)
-
-
-suite :: Test
-suite = TestCase $ do
-    let spec = PackageSpec ("PackageTests" </> "BuildDeps" </> "SameDepsAllRound") []
-    result <- cabal_build spec
-    do
-        assertEqual "cabal build should succeed - see test-log.txt" True (successful result)
-      `catch` \exc -> do
-        putStrLn $ "Cabal result was "++show result
-        throwIO (exc :: SomeException)
diff --git a/cabal/Cabal/tests/PackageTests/BuildDeps/SameDepsAllRound/MyLibrary.hs b/cabal/Cabal/tests/PackageTests/BuildDeps/SameDepsAllRound/MyLibrary.hs
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/BuildDeps/SameDepsAllRound/MyLibrary.hs
+++ /dev/null
@@ -1,10 +0,0 @@
-module MyLibrary where
-
-import qualified Data.ByteString.Char8 as C
-import System.Time
-
-myLibFunc :: IO ()
-myLibFunc = do
-    getClockTime
-    let text = "myLibFunc"
-    C.putStrLn $ C.pack text
diff --git a/cabal/Cabal/tests/PackageTests/BuildDeps/SameDepsAllRound/SameDepsAllRound.cabal b/cabal/Cabal/tests/PackageTests/BuildDeps/SameDepsAllRound/SameDepsAllRound.cabal
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/BuildDeps/SameDepsAllRound/SameDepsAllRound.cabal
+++ /dev/null
@@ -1,31 +0,0 @@
-name: SameDepsAllRound
-version: 0.1
-license: BSD3
-cabal-version: >= 1.6
-author: Stephen Blackheath
-stability: stable
-synopsis: Same dependencies all round
-category: PackageTests
-build-type: Simple
-
-description:
-    Check for the "old build-dep behaviour" namely that we get the same
-    package dependencies on all build targets, even if different ones
-    were specified for different targets
-    .
-    Here all .hs files use the three packages mentioned, so this shows
-    that build-depends is not target-specific.  This is the behaviour
-    we want when cabal-version contains versions less than 1.7.
-
----------------------------------------
-
-Library
-    exposed-modules: MyLibrary
-    build-depends: base, bytestring
-
-Executable lemon
-    main-is: lemon.hs
-    build-depends: old-time
-
-Executable pineapple
-    main-is: pineapple.hs
diff --git a/cabal/Cabal/tests/PackageTests/BuildDeps/SameDepsAllRound/Setup.hs b/cabal/Cabal/tests/PackageTests/BuildDeps/SameDepsAllRound/Setup.hs
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/BuildDeps/SameDepsAllRound/Setup.hs
+++ /dev/null
@@ -1,3 +0,0 @@
-import Distribution.Simple
-main = defaultMain
-
diff --git a/cabal/Cabal/tests/PackageTests/BuildDeps/SameDepsAllRound/lemon.hs b/cabal/Cabal/tests/PackageTests/BuildDeps/SameDepsAllRound/lemon.hs
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/BuildDeps/SameDepsAllRound/lemon.hs
+++ /dev/null
@@ -1,7 +0,0 @@
-import qualified Data.ByteString.Char8 as C
-import System.Time
-
-main = do
-    getClockTime
-    let text = "lemon"
-    C.putStrLn $ C.pack text
diff --git a/cabal/Cabal/tests/PackageTests/BuildDeps/SameDepsAllRound/pineapple.hs b/cabal/Cabal/tests/PackageTests/BuildDeps/SameDepsAllRound/pineapple.hs
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/BuildDeps/SameDepsAllRound/pineapple.hs
+++ /dev/null
@@ -1,7 +0,0 @@
-import qualified Data.ByteString.Char8 as C
-import System.Time
-
-main = do
-    getClockTime
-    let text = "pineapple"
-    C.putStrLn $ C.pack text
diff --git a/cabal/Cabal/tests/PackageTests/BuildDeps/TargetSpecificDeps1/Check.hs b/cabal/Cabal/tests/PackageTests/BuildDeps/TargetSpecificDeps1/Check.hs
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/BuildDeps/TargetSpecificDeps1/Check.hs
+++ /dev/null
@@ -1,24 +0,0 @@
-module PackageTests.BuildDeps.TargetSpecificDeps1.Check where
-
-import Test.HUnit
-import PackageTests.PackageTester
-import System.FilePath
-import Data.List
-import Control.Exception
-import Prelude hiding (catch)
-
-
-suite :: Test
-suite = TestCase $ do
-    let spec = PackageSpec ("PackageTests" </> "BuildDeps" </> "TargetSpecificDeps1") []
-    result <- cabal_build spec
-    do
-        assertEqual "cabal build should fail - see test-log.txt" False (successful result)
-        assertBool "error should be in MyLibrary.hs" $
-            "MyLibrary.hs:" `isInfixOf` outputText result
-        assertBool "error should be \"Could not find module `System.Time\"" $
-            "Could not find module `System.Time'" `isInfixOf`
-                            (intercalate " " $ lines $ outputText result)
-      `catch` \exc -> do
-        putStrLn $ "Cabal result was "++show result
-        throwIO (exc :: SomeException)
diff --git a/cabal/Cabal/tests/PackageTests/BuildDeps/TargetSpecificDeps1/MyLibrary.hs b/cabal/Cabal/tests/PackageTests/BuildDeps/TargetSpecificDeps1/MyLibrary.hs
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/BuildDeps/TargetSpecificDeps1/MyLibrary.hs
+++ /dev/null
@@ -1,10 +0,0 @@
-module MyLibrary where
-
-import qualified Data.ByteString.Char8 as C
-import System.Time
-
-myLibFunc :: IO ()
-myLibFunc = do
-    getClockTime
-    let text = "myLibFunc"
-    C.putStrLn $ C.pack text
diff --git a/cabal/Cabal/tests/PackageTests/BuildDeps/TargetSpecificDeps1/Setup.hs b/cabal/Cabal/tests/PackageTests/BuildDeps/TargetSpecificDeps1/Setup.hs
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/BuildDeps/TargetSpecificDeps1/Setup.hs
+++ /dev/null
@@ -1,3 +0,0 @@
-import Distribution.Simple
-main = defaultMain
-
diff --git a/cabal/Cabal/tests/PackageTests/BuildDeps/TargetSpecificDeps1/lemon.hs b/cabal/Cabal/tests/PackageTests/BuildDeps/TargetSpecificDeps1/lemon.hs
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/BuildDeps/TargetSpecificDeps1/lemon.hs
+++ /dev/null
@@ -1,7 +0,0 @@
-import qualified Data.ByteString.Char8 as C
-import System.Time
-
-main = do
-    getClockTime
-    let text = "lemon"
-    C.putStrLn $ C.pack text
diff --git a/cabal/Cabal/tests/PackageTests/BuildDeps/TargetSpecificDeps1/my.cabal b/cabal/Cabal/tests/PackageTests/BuildDeps/TargetSpecificDeps1/my.cabal
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/BuildDeps/TargetSpecificDeps1/my.cabal
+++ /dev/null
@@ -1,22 +0,0 @@
-name: TargetSpecificDeps1
-version: 0.1
-license: BSD3
-cabal-version: >= 1.7.1
-author: Stephen Blackheath
-stability: stable
-category: PackageTests
-build-type: Simple
-
-description:
-    Check for the new build-dep behaviour, where build-depends are
-    handled specifically for each target
-
----------------------------------------
-
-Library
-    exposed-modules: MyLibrary
-    build-depends: base, bytestring
-
-Executable lemon
-    main-is: lemon.hs
-    build-depends: base, bytestring, old-time
diff --git a/cabal/Cabal/tests/PackageTests/BuildDeps/TargetSpecificDeps2/Check.hs b/cabal/Cabal/tests/PackageTests/BuildDeps/TargetSpecificDeps2/Check.hs
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/BuildDeps/TargetSpecificDeps2/Check.hs
+++ /dev/null
@@ -1,19 +0,0 @@
-module PackageTests.BuildDeps.TargetSpecificDeps2.Check where
-
-import Test.HUnit
-import PackageTests.PackageTester
-import System.FilePath
-import Data.List
-import Control.Exception
-import Prelude hiding (catch)
-
-
-suite :: Test
-suite = TestCase $ do
-    let spec = PackageSpec ("PackageTests" </> "BuildDeps" </> "TargetSpecificDeps2") []
-    result <- cabal_build spec
-    do
-        assertEqual "cabal build should succeed - see test-log.txt" True (successful result)
-      `catch` \exc -> do
-        putStrLn $ "Cabal result was "++show result
-        throwIO (exc :: SomeException)
diff --git a/cabal/Cabal/tests/PackageTests/BuildDeps/TargetSpecificDeps2/MyLibrary.hs b/cabal/Cabal/tests/PackageTests/BuildDeps/TargetSpecificDeps2/MyLibrary.hs
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/BuildDeps/TargetSpecificDeps2/MyLibrary.hs
+++ /dev/null
@@ -1,10 +0,0 @@
-module MyLibrary where
-
-import qualified Data.ByteString.Char8 as C
-import System.Time
-
-myLibFunc :: IO ()
-myLibFunc = do
-    getClockTime
-    let text = "myLibFunc"
-    C.putStrLn $ C.pack text
diff --git a/cabal/Cabal/tests/PackageTests/BuildDeps/TargetSpecificDeps2/Setup.hs b/cabal/Cabal/tests/PackageTests/BuildDeps/TargetSpecificDeps2/Setup.hs
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/BuildDeps/TargetSpecificDeps2/Setup.hs
+++ /dev/null
@@ -1,3 +0,0 @@
-import Distribution.Simple
-main = defaultMain
-
diff --git a/cabal/Cabal/tests/PackageTests/BuildDeps/TargetSpecificDeps2/lemon.hs b/cabal/Cabal/tests/PackageTests/BuildDeps/TargetSpecificDeps2/lemon.hs
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/BuildDeps/TargetSpecificDeps2/lemon.hs
+++ /dev/null
@@ -1,5 +0,0 @@
-import qualified Data.ByteString.Char8 as C
-
-main = do
-    let text = "lemon"
-    C.putStrLn $ C.pack text
diff --git a/cabal/Cabal/tests/PackageTests/BuildDeps/TargetSpecificDeps2/my.cabal b/cabal/Cabal/tests/PackageTests/BuildDeps/TargetSpecificDeps2/my.cabal
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/BuildDeps/TargetSpecificDeps2/my.cabal
+++ /dev/null
@@ -1,24 +0,0 @@
-name: TargetSpecificDeps1
-version: 0.1
-license: BSD3
-cabal-version: >= 1.7.1
-author: Stephen Blackheath
-stability: stable
-category: PackageTests
-build-type: Simple
-
-description:
-    Check for the new build-dep behaviour, where build-depends are
-    handled specifically for each target
-    This one is a control against TargetSpecificDeps1 - it is correct and should
-    succeed.
-
----------------------------------------
-
-Library
-    exposed-modules: MyLibrary
-    build-depends: base, bytestring, old-time
-
-Executable lemon
-    main-is: lemon.hs
-    build-depends: base, bytestring
diff --git a/cabal/Cabal/tests/PackageTests/BuildDeps/TargetSpecificDeps3/Check.hs b/cabal/Cabal/tests/PackageTests/BuildDeps/TargetSpecificDeps3/Check.hs
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/BuildDeps/TargetSpecificDeps3/Check.hs
+++ /dev/null
@@ -1,23 +0,0 @@
-module PackageTests.BuildDeps.TargetSpecificDeps3.Check where
-
-import Test.HUnit
-import PackageTests.PackageTester
-import System.FilePath
-import Data.List
-import Control.Exception
-import Prelude hiding (catch)
-
-
-suite :: Test
-suite = TestCase $ do
-    let spec = PackageSpec ("PackageTests" </> "BuildDeps" </> "TargetSpecificDeps3") []
-    result <- cabal_build spec
-    do
-        assertEqual "cabal build should fail - see test-log.txt" False (successful result)
-        assertBool "error should be in lemon.hs" $
-            "lemon.hs:" `isInfixOf` outputText result
-        assertBool "error should be \"Could not find module `System.Time\"" $
-            "Could not find module `System.Time'" `isInfixOf` (intercalate " " $ lines $ outputText result)
-      `catch` \exc -> do
-        putStrLn $ "Cabal result was "++show result
-        throwIO (exc :: SomeException)
diff --git a/cabal/Cabal/tests/PackageTests/BuildDeps/TargetSpecificDeps3/MyLibrary.hs b/cabal/Cabal/tests/PackageTests/BuildDeps/TargetSpecificDeps3/MyLibrary.hs
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/BuildDeps/TargetSpecificDeps3/MyLibrary.hs
+++ /dev/null
@@ -1,10 +0,0 @@
-module MyLibrary where
-
-import qualified Data.ByteString.Char8 as C
-import System.Time
-
-myLibFunc :: IO ()
-myLibFunc = do
-    getClockTime
-    let text = "myLibFunc"
-    C.putStrLn $ C.pack text
diff --git a/cabal/Cabal/tests/PackageTests/BuildDeps/TargetSpecificDeps3/Setup.hs b/cabal/Cabal/tests/PackageTests/BuildDeps/TargetSpecificDeps3/Setup.hs
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/BuildDeps/TargetSpecificDeps3/Setup.hs
+++ /dev/null
@@ -1,3 +0,0 @@
-import Distribution.Simple
-main = defaultMain
-
diff --git a/cabal/Cabal/tests/PackageTests/BuildDeps/TargetSpecificDeps3/lemon.hs b/cabal/Cabal/tests/PackageTests/BuildDeps/TargetSpecificDeps3/lemon.hs
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/BuildDeps/TargetSpecificDeps3/lemon.hs
+++ /dev/null
@@ -1,7 +0,0 @@
-import qualified Data.ByteString.Char8 as C
-import System.Time
-
-main = do
-    getClockTime
-    let text = "lemon"
-    C.putStrLn $ C.pack text
diff --git a/cabal/Cabal/tests/PackageTests/BuildDeps/TargetSpecificDeps3/my.cabal b/cabal/Cabal/tests/PackageTests/BuildDeps/TargetSpecificDeps3/my.cabal
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/BuildDeps/TargetSpecificDeps3/my.cabal
+++ /dev/null
@@ -1,22 +0,0 @@
-name: test
-version: 0.1
-license: BSD3
-cabal-version: >= 1.7.1
-author: Stephen Blackheath
-stability: stable
-category: PackageTests
-build-type: Simple
-
-description:
-    Check for the new build-dep behaviour, where build-depends are
-    handled specifically for each target
-
----------------------------------------
-
-Library
-    exposed-modules: MyLibrary
-    build-depends: base, bytestring, old-time
-
-Executable lemon
-    main-is: lemon.hs
-    build-depends: base, bytestring
diff --git a/cabal/Cabal/tests/PackageTests/PackageTester.hs b/cabal/Cabal/tests/PackageTests/PackageTester.hs
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/PackageTester.hs
+++ /dev/null
@@ -1,179 +0,0 @@
-module PackageTests.PackageTester (
-        PackageSpec(..),
-        Success(..),
-        Result(..),
-        cabal_configure,
-        cabal_build,
-        cabal_test,
-        cabal_bench,
-        cabal_install,
-        unregister,
-        run
-    ) where
-
-import qualified Control.Exception.Extensible as E
-import System.Directory
-import System.FilePath
-import System.IO
-import System.Posix.IO
-import System.Process
-import System.Exit
-import Control.Concurrent.Chan
-import Control.Concurrent.MVar
-import Control.Concurrent
-import Control.Monad
-import Data.List
-import Data.Maybe
-import qualified Data.ByteString.Char8 as C
-
-
-data PackageSpec =
-    PackageSpec {
-        directory  :: FilePath,
-        configOpts :: [String]
-    }
-
-data Success = Failure
-             | ConfigureSuccess
-             | BuildSuccess
-             | InstallSuccess
-             | TestSuccess
-             | BenchSuccess
-             deriving (Eq, Show)
-
-data Result = Result {
-        successful :: Bool,
-        success    :: Success,
-        outputText :: String
-    }
-    deriving Show
-
-nullResult :: Result
-nullResult = Result True Failure ""
-
-recordRun :: (String, ExitCode, String) -> Success -> Result -> Result
-recordRun (cmd, exitCode, exeOutput) thisSucc res =
-    res {
-        successful = successful res && exitCode == ExitSuccess,
-        success = if exitCode == ExitSuccess then thisSucc
-                                             else success res,
-        outputText =
-            (if null $ outputText res then "" else outputText res ++ "\n") ++
-                cmd ++ "\n" ++ exeOutput
-    }
-
-cabal_configure :: PackageSpec -> IO Result
-cabal_configure spec = do
-    res <- doCabalConfigure spec
-    record spec res
-    return res
-
-doCabalConfigure :: PackageSpec -> IO Result
-doCabalConfigure spec = do
-    cleanResult@(_, _, cleanOutput) <- cabal spec ["clean"]
-    requireSuccess cleanResult
-    res <- cabal spec $ ["configure", "--user"] ++ configOpts spec
-    return $ recordRun res ConfigureSuccess nullResult
-
-doCabalBuild :: PackageSpec -> IO Result
-doCabalBuild spec = do
-    configResult <- doCabalConfigure spec
-    if successful configResult
-        then do
-            res <- cabal spec ["build"]
-            return $ recordRun res BuildSuccess configResult
-        else
-            return configResult
-
-cabal_build :: PackageSpec -> IO Result
-cabal_build spec = do
-    res <- doCabalBuild spec
-    record spec res
-    return res
-
-unregister :: String -> IO ()
-unregister libraryName = do
-    res@(_, _, output) <- run Nothing "ghc-pkg" ["unregister", "--user", libraryName]
-    if "cannot find package" `isInfixOf` output
-        then return ()
-        else requireSuccess res
-
--- | Install this library in the user area
-cabal_install :: PackageSpec -> IO Result
-cabal_install spec = do
-    buildResult <- doCabalBuild spec
-    res <- if successful buildResult
-        then do
-            res <- cabal spec ["install"]
-            return $ recordRun res InstallSuccess buildResult
-        else
-            return buildResult
-    record spec res
-    return res
-
-cabal_test :: PackageSpec -> [String] -> IO Result
-cabal_test spec extraArgs = do
-    res <- cabal spec $ "test" : extraArgs
-    let r = recordRun res TestSuccess nullResult
-    record spec r
-    return r
-
-cabal_bench :: PackageSpec -> [String] -> IO Result
-cabal_bench spec extraArgs = do
-    res <- cabal spec $ "bench" : extraArgs
-    let r = recordRun res BenchSuccess nullResult
-    record spec r
-    return r
-
--- | Returns the command that was issued, the return code, and hte output text
-cabal :: PackageSpec -> [String] -> IO (String, ExitCode, String)
-cabal spec cabalArgs = do
-    wd <- getCurrentDirectory
-    r <- run (Just $ directory spec) "ghc"
-             [ "--make"
--- HPC causes trouble -- see #1012
---             , "-fhpc"
-             , "-package-conf " ++ wd </> "../dist/package.conf.inplace"
-             , "Setup.hs"
-             ]
-    requireSuccess r
-    run (Just $ directory spec) (wd </> directory spec </> "Setup") cabalArgs
-
--- | Returns the command that was issued, the return code, and hte output text
-run :: Maybe FilePath -> String -> [String] -> IO (String, ExitCode, String)
-run cwd cmd args = do
-    -- Posix-specific
-    (outf, outf0) <- createPipe
-    outh <- fdToHandle outf
-    outh0 <- fdToHandle outf0
-    pid <- runProcess cmd args cwd Nothing Nothing (Just outh0) (Just outh0)
-
-    -- fork off a thread to start consuming the output
-    output <- suckH [] outh
-    hClose outh
-
-    -- wait on the process
-    ex <- waitForProcess pid
-    let fullCmd = intercalate " " $ cmd:args
-    return ("\"" ++ fullCmd ++ "\" in " ++ fromMaybe "" cwd,
-        ex, output)
-  where
-    suckH output h = do
-        eof <- hIsEOF h
-        if eof
-            then return (reverse output)
-            else do
-                c <- hGetChar h
-                suckH (c:output) h
-
-requireSuccess :: (String, ExitCode, String) -> IO ()
-requireSuccess (cmd, exitCode, output) = do
-    case exitCode of
-        ExitSuccess -> return ()
-        ExitFailure r -> do
-            ioError $ userError $ "Command " ++ cmd ++ " failed."
-
-record :: PackageSpec -> Result -> IO ()
-record spec res = do
-    C.writeFile (directory spec </> "test-log.txt") (C.pack $ outputText res)
-
diff --git a/cabal/Cabal/tests/PackageTests/TemplateHaskell/Check.hs b/cabal/Cabal/tests/PackageTests/TemplateHaskell/Check.hs
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/TemplateHaskell/Check.hs
+++ /dev/null
@@ -1,44 +0,0 @@
-module PackageTests.TemplateHaskell.Check where
-
-import Test.HUnit
-import System.FilePath
-import PackageTests.PackageTester
-import Data.List (isInfixOf, intercalate)
-import Distribution.Version
-import Distribution.PackageDescription.Parse
-        ( readPackageDescription )
-import Distribution.PackageDescription.Configuration
-        ( finalizePackageDescription )
-import Distribution.Package
-        ( PackageIdentifier(..), PackageName(..), Dependency(..) )
-import Distribution.PackageDescription
-        ( PackageDescription(..), BuildInfo(..), TestSuite(..), Library(..)
-        , TestSuiteInterface(..)
-        , TestType(..), emptyPackageDescription, emptyBuildInfo, emptyLibrary
-        , emptyTestSuite, BuildType(..) )
-import Distribution.Verbosity (silent)
-import Distribution.License (License(..))
-import Distribution.ModuleName (fromString)
-import Distribution.System (buildPlatform)
-import Distribution.Compiler
-        ( CompilerId(..), CompilerFlavor(..) )
-import Distribution.Text
-
-profiling :: Test
-profiling = TestCase $ do
-   let flags = ["--enable-library-profiling"
---                ,"--disable-library-vanilla"
-               ,"--enable-executable-profiling"]
-       spec = PackageSpec ("PackageTests" </> "TemplateHaskell" </> "profiling") flags
-   result <- cabal_build spec
-   assertEqual "cabal build should succeed - see test-log.txt" True (successful result)
-
-dynamic :: Test
-dynamic = TestCase $ do
-    let flags = ["--enable-shared"
---                ,"--disable-library-vanilla"
-                ,"--enable-executable-dynamic"]
-        spec = PackageSpec ("PackageTests" </> "TemplateHaskell" </> "dynamic") flags
-    result <- cabal_build spec
-    assertEqual "cabal build should succeed - see test-log.txt" True (successful result)
-
diff --git a/cabal/Cabal/tests/PackageTests/TemplateHaskell/dynamic/Exe.hs b/cabal/Cabal/tests/PackageTests/TemplateHaskell/dynamic/Exe.hs
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/TemplateHaskell/dynamic/Exe.hs
+++ /dev/null
@@ -1,6 +0,0 @@
-{-# LANGUAGE TemplateHaskell #-}
-module Main where
-
-import TH
-
-main = print $(splice)
diff --git a/cabal/Cabal/tests/PackageTests/TemplateHaskell/dynamic/Lib.hs b/cabal/Cabal/tests/PackageTests/TemplateHaskell/dynamic/Lib.hs
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/TemplateHaskell/dynamic/Lib.hs
+++ /dev/null
@@ -1,6 +0,0 @@
-{-# LANGUAGE TemplateHaskell #-}
-module Lib where
-
-import TH
-
-val = $(splice)
diff --git a/cabal/Cabal/tests/PackageTests/TemplateHaskell/dynamic/Setup.hs b/cabal/Cabal/tests/PackageTests/TemplateHaskell/dynamic/Setup.hs
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/TemplateHaskell/dynamic/Setup.hs
+++ /dev/null
@@ -1,3 +0,0 @@
-import Distribution.Simple
-main = defaultMain
-
diff --git a/cabal/Cabal/tests/PackageTests/TemplateHaskell/dynamic/TH.hs b/cabal/Cabal/tests/PackageTests/TemplateHaskell/dynamic/TH.hs
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/TemplateHaskell/dynamic/TH.hs
+++ /dev/null
@@ -1,4 +0,0 @@
-{-# LANGUAGE TemplateHaskell #-}
-module TH where
-
-splice = [| () |]
diff --git a/cabal/Cabal/tests/PackageTests/TemplateHaskell/dynamic/my.cabal b/cabal/Cabal/tests/PackageTests/TemplateHaskell/dynamic/my.cabal
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/TemplateHaskell/dynamic/my.cabal
+++ /dev/null
@@ -1,15 +0,0 @@
-Name: templateHaskell
-Version: 0.1
-Build-Type: Simple
-Cabal-Version: >= 1.2
-
-Library
-    Exposed-Modules: Lib
-    Other-Modules: TH
-    Build-Depends: base, template-haskell
-    Extensions: TemplateHaskell
-
-Executable main
-    Main-is: Exe.hs
-    Build-Depends: base, template-haskell
-    Extensions: TemplateHaskell
diff --git a/cabal/Cabal/tests/PackageTests/TemplateHaskell/profiling/Exe.hs b/cabal/Cabal/tests/PackageTests/TemplateHaskell/profiling/Exe.hs
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/TemplateHaskell/profiling/Exe.hs
+++ /dev/null
@@ -1,6 +0,0 @@
-{-# LANGUAGE TemplateHaskell #-}
-module Main where
-
-import TH
-
-main = print $(splice)
diff --git a/cabal/Cabal/tests/PackageTests/TemplateHaskell/profiling/Lib.hs b/cabal/Cabal/tests/PackageTests/TemplateHaskell/profiling/Lib.hs
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/TemplateHaskell/profiling/Lib.hs
+++ /dev/null
@@ -1,6 +0,0 @@
-{-# LANGUAGE TemplateHaskell #-}
-module Lib where
-
-import TH
-
-val = $(splice)
diff --git a/cabal/Cabal/tests/PackageTests/TemplateHaskell/profiling/Setup.hs b/cabal/Cabal/tests/PackageTests/TemplateHaskell/profiling/Setup.hs
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/TemplateHaskell/profiling/Setup.hs
+++ /dev/null
@@ -1,3 +0,0 @@
-import Distribution.Simple
-main = defaultMain
-
diff --git a/cabal/Cabal/tests/PackageTests/TemplateHaskell/profiling/TH.hs b/cabal/Cabal/tests/PackageTests/TemplateHaskell/profiling/TH.hs
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/TemplateHaskell/profiling/TH.hs
+++ /dev/null
@@ -1,4 +0,0 @@
-{-# LANGUAGE TemplateHaskell #-}
-module TH where
-
-splice = [| () |]
diff --git a/cabal/Cabal/tests/PackageTests/TemplateHaskell/profiling/my.cabal b/cabal/Cabal/tests/PackageTests/TemplateHaskell/profiling/my.cabal
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/TemplateHaskell/profiling/my.cabal
+++ /dev/null
@@ -1,15 +0,0 @@
-Name: templateHaskell
-Version: 0.1
-Build-Type: Simple
-Cabal-Version: >= 1.2
-
-Library
-    Exposed-Modules: Lib
-    Other-Modules: TH
-    Build-Depends: base, template-haskell
-    Extensions: TemplateHaskell
-
-Executable main
-    Main-is: Exe.hs
-    Build-Depends: base, template-haskell
-    Extensions: TemplateHaskell
diff --git a/cabal/Cabal/tests/PackageTests/TestOptions/Check.hs b/cabal/Cabal/tests/PackageTests/TestOptions/Check.hs
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/TestOptions/Check.hs
+++ /dev/null
@@ -1,23 +0,0 @@
-module PackageTests.TestOptions.Check where
-
-import Test.HUnit
-import System.FilePath
-import PackageTests.PackageTester
-
-suite :: Test
-suite = TestCase $ do
-    let directory = "PackageTests" </> "TestOptions"
-        pdFile = directory </> "TestOptions" <.> "cabal"
-        spec = PackageSpec directory ["--enable-tests"]
-    _ <- cabal_build spec
-    result <- cabal_test spec ["--test-options=1 2 3"]
-    let message = "\"cabal test\" did not pass the correct options to the "
-                  ++ "test executable with \"--test-options\""
-    assertEqual message True $ successful result
-    result' <- cabal_test spec [ "--test-option=1"
-                               , "--test-option=2"
-                               , "--test-option=3"
-                               ]
-    let message = "\"cabal test\" did not pass the correct options to the "
-                  ++ "test executable with \"--test-option\""
-    assertEqual message True $ successful result'
diff --git a/cabal/Cabal/tests/PackageTests/TestOptions/Setup.hs b/cabal/Cabal/tests/PackageTests/TestOptions/Setup.hs
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/TestOptions/Setup.hs
+++ /dev/null
@@ -1,3 +0,0 @@
-import Distribution.Simple
-main = defaultMain
-
diff --git a/cabal/Cabal/tests/PackageTests/TestOptions/TestOptions.cabal b/cabal/Cabal/tests/PackageTests/TestOptions/TestOptions.cabal
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/TestOptions/TestOptions.cabal
+++ /dev/null
@@ -1,20 +0,0 @@
-name: TestOptions
-version: 0.1
-license: BSD3
-author: Thomas Tuegel
-stability: stable
-category: PackageTests
-build-type: Simple
-cabal-version: >= 1.9.2
-
-description:
-    Check that Cabal passes the correct test options to test suites.
-
-executable dummy
-    main-is: test-TestOptions.hs
-    build-depends: base
-
-test-suite test-TestOptions
-    main-is: test-TestOptions.hs
-    type: exitcode-stdio-1.0
-    build-depends: base
diff --git a/cabal/Cabal/tests/PackageTests/TestOptions/test-TestOptions.hs b/cabal/Cabal/tests/PackageTests/TestOptions/test-TestOptions.hs
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/TestOptions/test-TestOptions.hs
+++ /dev/null
@@ -1,11 +0,0 @@
-module Main where
-
-import System.Environment ( getArgs )
-import System.Exit ( exitFailure, exitSuccess )
-
-main :: IO ()
-main = do
-    args <- getArgs
-    if args == ["1", "2", "3"]
-        then exitSuccess
-        else putStrLn ("Got: " ++ show args) >> exitFailure
diff --git a/cabal/Cabal/tests/PackageTests/TestStanza/Check.hs b/cabal/Cabal/tests/PackageTests/TestStanza/Check.hs
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/TestStanza/Check.hs
+++ /dev/null
@@ -1,57 +0,0 @@
-module PackageTests.TestStanza.Check where
-
-import Test.HUnit
-import System.FilePath
-import PackageTests.PackageTester
-import Data.List (isInfixOf, intercalate)
-import Distribution.Version
-import Distribution.PackageDescription.Parse
-        ( readPackageDescription )
-import Distribution.PackageDescription.Configuration
-        ( finalizePackageDescription )
-import Distribution.Package
-        ( PackageIdentifier(..), PackageName(..), Dependency(..) )
-import Distribution.PackageDescription
-        ( PackageDescription(..), BuildInfo(..), TestSuite(..), Library(..)
-        , TestSuiteInterface(..)
-        , TestType(..), emptyPackageDescription, emptyBuildInfo, emptyLibrary
-        , emptyTestSuite, BuildType(..) )
-import Distribution.Verbosity (silent)
-import Distribution.License (License(..))
-import Distribution.ModuleName (fromString)
-import Distribution.System (buildPlatform)
-import Distribution.Compiler
-        ( CompilerId(..), CompilerFlavor(..) )
-import Distribution.Text
-
-suite :: Version -> Test
-suite cabalVersion = TestCase $ do
-    let directory = "PackageTests" </> "TestStanza"
-        pdFile = directory </> "my" <.> "cabal"
-        spec = PackageSpec directory []
-    result <- cabal_configure spec
-    let message = "cabal configure should recognize test section"
-        test = "unknown section type"
-               `isInfixOf`
-               (intercalate " " $ lines $ outputText result)
-    assertEqual message False test
-    genPD <- readPackageDescription silent pdFile
-    let compiler = CompilerId GHC $ Version [6, 12, 2] []
-        anyV = intersectVersionRanges anyVersion anyVersion
-        anticipatedTestSuite = emptyTestSuite
-            { testName = "dummy"
-            , testInterface = TestSuiteExeV10 (Version [1,0] []) "dummy.hs"
-            , testBuildInfo = emptyBuildInfo
-                    { targetBuildDepends =
-                            [ Dependency (PackageName "base") anyVersion ]
-                    , hsSourceDirs = ["."]
-                    }
-            , testEnabled = False
-            }
-    case finalizePackageDescription [] (const True) buildPlatform compiler [] genPD of
-        Left xs -> let depMessage = "should not have missing dependencies:\n" ++
-                                    (unlines $ map (show . disp) xs)
-                   in assertEqual depMessage True False
-        Right (f, _) -> let gotTest = head $ testSuites f
-                        in assertEqual "parsed test-suite stanza does not match anticipated"
-                                gotTest anticipatedTestSuite
diff --git a/cabal/Cabal/tests/PackageTests/TestStanza/Setup.hs b/cabal/Cabal/tests/PackageTests/TestStanza/Setup.hs
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/TestStanza/Setup.hs
+++ /dev/null
@@ -1,3 +0,0 @@
-import Distribution.Simple
-main = defaultMain
-
diff --git a/cabal/Cabal/tests/PackageTests/TestStanza/my.cabal b/cabal/Cabal/tests/PackageTests/TestStanza/my.cabal
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/TestStanza/my.cabal
+++ /dev/null
@@ -1,19 +0,0 @@
-name: TestStanza
-version: 0.1
-license: BSD3
-author: Thomas Tuegel
-stability: stable
-category: PackageTests
-build-type: Simple
-
-description:
-    Check that Cabal recognizes the Test stanza defined below.
-
-Library
-    exposed-modules: MyLibrary
-    build-depends: base
-
-test-suite dummy
-    main-is: dummy.hs
-    type: exitcode-stdio-1.0
-    build-depends: base
diff --git a/cabal/Cabal/tests/PackageTests/TestSuiteExeV10/Check.hs b/cabal/Cabal/tests/PackageTests/TestSuiteExeV10/Check.hs
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/TestSuiteExeV10/Check.hs
+++ /dev/null
@@ -1,47 +0,0 @@
-module PackageTests.TestSuiteExeV10.Check
-       ( checkTest
-       , checkTestWithHpc
-       ) where
-
-import Distribution.PackageDescription ( TestSuite(..), emptyTestSuite )
-import Distribution.Simple.Hpc
-import Distribution.Version
-import Test.HUnit
-import System.Directory
-import System.FilePath
-import PackageTests.PackageTester
-
-dir :: FilePath
-dir = "PackageTests" </> "TestSuiteExeV10"
-
-checkTest :: Version -> Test
-checkTest cabalVersion = TestCase $ do
-    let spec = PackageSpec dir ["--enable-tests"]
-    buildResult <- cabal_build spec
-    let buildMessage = "\'setup build\' should succeed"
-    assertEqual buildMessage True $ successful buildResult
-    testResult <- cabal_test spec []
-    let testMessage = "\'setup test\' should succeed"
-    assertEqual testMessage True $ successful testResult
-
-checkTestWithHpc :: Version -> Test
-checkTestWithHpc cabalVersion = TestCase $ do
-    let spec = PackageSpec dir [ "--enable-tests"
-                               , "--enable-library-coverage"
-                               ]
-    buildResult <- cabal_build spec
-    let buildMessage = "\'setup build\' should succeed"
-    assertEqual buildMessage True $ successful buildResult
-    testResult <- cabal_test spec []
-    let testMessage = "\'setup test\' should succeed"
-    assertEqual testMessage True $ successful testResult
-    let dummy = emptyTestSuite { testName = "test-Foo" }
-        tixFile = tixFilePath (dir </> "dist") $ testName dummy
-        tixFileMessage = ".tix file should exist"
-        markupDir = htmlDir (dir </> "dist") $ testName dummy
-        markupFile = markupDir </> "hpc_index" <.> "html"
-        markupFileMessage = "HPC markup file should exist"
-    tixFileExists <- doesFileExist tixFile
-    assertEqual tixFileMessage True tixFileExists
-    markupFileExists <- doesFileExist markupFile
-    assertEqual markupFileMessage True markupFileExists
diff --git a/cabal/Cabal/tests/PackageTests/TestSuiteExeV10/Foo.hs b/cabal/Cabal/tests/PackageTests/TestSuiteExeV10/Foo.hs
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/TestSuiteExeV10/Foo.hs
+++ /dev/null
@@ -1,4 +0,0 @@
-module Foo where
-
-fooTest :: [String] -> Bool
-fooTest _ = True
diff --git a/cabal/Cabal/tests/PackageTests/TestSuiteExeV10/Setup.hs b/cabal/Cabal/tests/PackageTests/TestSuiteExeV10/Setup.hs
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/TestSuiteExeV10/Setup.hs
+++ /dev/null
@@ -1,3 +0,0 @@
-import Distribution.Simple
-main = defaultMain
-
diff --git a/cabal/Cabal/tests/PackageTests/TestSuiteExeV10/my.cabal b/cabal/Cabal/tests/PackageTests/TestSuiteExeV10/my.cabal
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/TestSuiteExeV10/my.cabal
+++ /dev/null
@@ -1,15 +0,0 @@
-name:           my
-version:        0.1
-license:        BSD3
-cabal-version:  >= 1.9.2
-build-type:     Simple
-
-library
-    exposed-modules:    Foo
-    build-depends:      base
-
-test-suite test-Foo
-    type:   exitcode-stdio-1.0
-    hs-source-dirs: tests
-    main-is:    test-Foo.hs
-    build-depends: base, my
diff --git a/cabal/Cabal/tests/PackageTests/TestSuiteExeV10/tests/test-Foo.hs b/cabal/Cabal/tests/PackageTests/TestSuiteExeV10/tests/test-Foo.hs
deleted file mode 100644
--- a/cabal/Cabal/tests/PackageTests/TestSuiteExeV10/tests/test-Foo.hs
+++ /dev/null
@@ -1,8 +0,0 @@
-module Main where
-
-import Foo
-import System.Exit
-
-main :: IO ()
-main | fooTest [] = exitSuccess
-     | otherwise = exitFailure
diff --git a/cabal/Cabal/tests/UnitTests.hs b/cabal/Cabal/tests/UnitTests.hs
deleted file mode 100644
--- a/cabal/Cabal/tests/UnitTests.hs
+++ /dev/null
@@ -1,17 +0,0 @@
-module Main
-    ( main
-    ) where
-
-import Test.Framework
-import Test.Framework.Providers.HUnit
-
-import qualified UnitTests.Distribution.Compat.ReadP
-
-tests :: [Test]
-tests = [
-    testGroup "Distribution.Compat.ReadP"
-        UnitTests.Distribution.Compat.ReadP.tests
-    ]
-
-main :: IO ()
-main = defaultMain tests
diff --git a/cabal/Cabal/tests/UnitTests/Distribution/Compat/ReadP.hs b/cabal/Cabal/tests/UnitTests/Distribution/Compat/ReadP.hs
deleted file mode 100644
--- a/cabal/Cabal/tests/UnitTests/Distribution/Compat/ReadP.hs
+++ /dev/null
@@ -1,140 +0,0 @@
------------------------------------------------------------------------------
--- |
--- Module      :  Distribution.Compat.ReadP
--- Copyright   :  (c) The University of Glasgow 2002
--- License     :  BSD-style (see the file libraries/base/LICENSE)
---
--- Maintainer  :  libraries@haskell.org
--- Portability :  portable
---
--- This code was originally in Distribution.Compat.ReadP. Please see that file
--- for provenace. The tests have been integrated into the test framework.
--- Some properties cannot be tested, as they hold over arbitrary ReadP values,
--- and we don't have a good Arbitrary instance (nor Show instance) for ReadP.
---
-module UnitTests.Distribution.Compat.ReadP
-    ( tests
-    -- * Properties
-    -- $properties
-    ) where
-
-import Data.List
-import Distribution.Compat.ReadP
-
-import Test.Framework
-import Test.Framework.Providers.HUnit
-import Test.Framework.Providers.QuickCheck2
-
-tests =
-    [ testProperty "Get Nil" prop_Get_Nil
-    , testProperty "Get Cons" prop_Get_Cons
-    , testProperty "Look" prop_Look
-    , testProperty "Fail" prop_Fail
-    , testProperty "Return" prop_Return
-    --, testProperty "Bind" prop_Bind
-    --, testProperty "Plus" prop_Plus
-    --, testProperty "LeftPlus" prop_LeftPlus
-    --, testProperty "Gather" prop_Gather
-    , testProperty "String Yes" prop_String_Yes
-    , testProperty "String Maybe" prop_String_Maybe
-    , testProperty "Munch" (prop_Munch evenChar)
-    , testProperty "Munch1" (prop_Munch1 evenChar)
-    --, testProperty "Choice" prop_Choice
-    --, testProperty "ReadS" prop_ReadS
-    ]
-
--- ---------------------------------------------------------------------------
--- QuickCheck properties that hold for the combinators
-
-{- $properties
-The following are QuickCheck specifications of what the combinators do.
-These can be seen as formal specifications of the behavior of the
-combinators.
-
-We use bags to give semantics to the combinators.
--}
-
-type Bag a = [a]
-
--- Equality on bags does not care about the order of elements.
-
-(=~) :: Ord a => Bag a -> Bag a -> Bool
-xs =~ ys = sort xs == sort ys
-
--- A special equality operator to avoid unresolved overloading
--- when testing the properties.
-
-(=~.) :: Bag (Int,String) -> Bag (Int,String) -> Bool
-(=~.) = (=~)
-
--- Here follow the properties:
-
-prop_Get_Nil =
-  readP_to_S get [] =~ []
-
-prop_Get_Cons c s =
-  readP_to_S get (c:s) =~ [(c,s)]
-
-prop_Look s =
-  readP_to_S look s =~ [(s,s)]
-
-prop_Fail s =
-  readP_to_S pfail s =~. []
-
-prop_Return x s =
-  readP_to_S (return x) s =~. [(x,s)]
-
-prop_Bind p k s =
-  readP_to_S (p >>= k) s =~.
-    [ ys''
-    | (x,s') <- readP_to_S p s
-    , ys''   <- readP_to_S (k (x::Int)) s'
-    ]
-
-prop_Plus p q s =
-  readP_to_S (p +++ q) s =~.
-    (readP_to_S p s ++ readP_to_S q s)
-
-prop_LeftPlus p q s =
-  readP_to_S (p <++ q) s =~.
-    (readP_to_S p s +<+ readP_to_S q s)
- where
-  [] +<+ ys = ys
-  xs +<+ _  = xs
-
-{-
-prop_Gather s =
-  forAll readPWithoutReadS $ \p ->
-    readP_to_S (gather p) s =~
-  [ ((pre,x::Int),s')
-  | (x,s') <- readP_to_S p s
-  , let pre = take (length s - length s') s
-  ]
--}
-
-prop_String_Yes this s =
-  readP_to_S (string this) (this ++ s) =~
-    [(this,s)]
-
-prop_String_Maybe this s =
-  readP_to_S (string this) s =~
-    [(this, drop (length this) s) | this `isPrefixOf` s]
-
-prop_Munch p s =
-  readP_to_S (munch p) s =~
-    [(takeWhile p s, dropWhile p s)]
-
-prop_Munch1 p s =
-  readP_to_S (munch1 p) s =~
-    [(res,s') | let (res,s') = (takeWhile p s, dropWhile p s), not (null res)]
-
-prop_Choice ps s =
-  readP_to_S (choice ps) s =~.
-    readP_to_S (foldr (+++) pfail ps) s
-
-prop_ReadS r s =
-  readP_to_S (readS_to_P r) s =~. r s
-
-evenChar :: Char -> Bool
-evenChar = even . fromEnum
-
diff --git a/cabal/Cabal/tests/hackage/check.sh b/cabal/Cabal/tests/hackage/check.sh
deleted file mode 100644
--- a/cabal/Cabal/tests/hackage/check.sh
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/bin/sh
-
-base_version=1.4.0.2
-test_version=1.5.6
-
-for setup in archive/*/*/Setup.hs archive/*/*/Setup.lhs; do
-
-  pkgname=$(basename ${setup})
-  
-  if test $(wc -w < ${setup}) -gt 21; then
-    if ghc -package Cabal-${base_version} -S ${setup} -o /dev/null 2> /dev/null; then
-
-      if ghc -package Cabal-${test_version} -S ${setup} -o /dev/null 2> /dev/null; then
-        echo "OK ${setup}"
-      else
-        echo "FAIL ${setup} does not compile with Cabal-${test_version}"     
-      fi
-    else
-      echo "OK ${setup} (does not compile with Cabal-${base_version})" 
-    fi
-  else
-    echo "trivial ${setup}"
-  fi
-
-done
diff --git a/cabal/Cabal/tests/hackage/download.sh b/cabal/Cabal/tests/hackage/download.sh
deleted file mode 100644
--- a/cabal/Cabal/tests/hackage/download.sh
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/bin/sh
-
-if test ! -f archive/archive.tar; then
-
-  wget http://hackage.haskell.org/cgi-bin/hackage-scripts/archive.tar
-  mkdir -p archive
-  mv archive.tar archive/
-  tar -C archive -xf archive/archive.tar    
-
-fi
-
-if test ! -f archive/00-index.tar.gz; then
-
-  wget http://hackage.haskell.org/packages/archive/00-index.tar.gz
-  mkdir -p archive
-  mv 00-index.tar.gz archive/
-  tar -C archive -xzf archive/00-index.tar.gz
-
-fi
diff --git a/cabal/Cabal/tests/hackage/unpack.sh b/cabal/Cabal/tests/hackage/unpack.sh
deleted file mode 100644
--- a/cabal/Cabal/tests/hackage/unpack.sh
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/bin/sh
-
-for tarball in archive/*/*/*.tar.gz; do
-
-  pkgdir=$(dirname ${tarball})
-  pkgname=$(basename ${tarball} .tar.gz)
-
-  if tar -tzf ${tarball} ${pkgname}/Setup.hs 2> /dev/null; then
-    tar -xzf ${tarball} ${pkgname}/Setup.hs -O > ${pkgdir}/Setup.hs
-  elif tar -tzf ${tarball} ${pkgname}/Setup.lhs 2> /dev/null; then
-    tar -xzf ${tarball} ${pkgname}/Setup.lhs -O > ${pkgdir}/Setup.lhs
-  else
-    echo "${pkgname} has no Setup.hs or .lhs at all!!?!"
-  fi
-
-done
diff --git a/cabal/Cabal/tests/misc/ghc-supported-languages.hs b/cabal/Cabal/tests/misc/ghc-supported-languages.hs
deleted file mode 100644
--- a/cabal/Cabal/tests/misc/ghc-supported-languages.hs
+++ /dev/null
@@ -1,99 +0,0 @@
--- | A test program to check that ghc has got all of its extensions registered
---
-module Main where
-
-import Language.Haskell.Extension
-import Distribution.Text
-import Distribution.Simple.Utils
-import Distribution.Verbosity
-
-import Data.List ((\\))
-import Data.Maybe
-import Control.Applicative
-import Control.Monad
-import System.Environment
-import System.Exit
-
--- | A list of GHC extensions that are deliberately not registered,
--- e.g. due to being experimental and not ready for public consumption
---
-exceptions = map readExtension
-  [ "PArr"   -- still classed as experimental, will be renamed and registered
-  ]
-
-checkProblems :: [Extension] -> [String]
-checkProblems implemented =
-
-  let unregistered  =
-        [ ext | ext <- implemented          -- extensions that ghc knows about 
-              , not (registered ext)        -- but that are not registered
-              , ext `notElem` exceptions ]  -- except for the exceptions
-
-      -- check if someone has forgotten to update the exceptions list...
-
-      -- exceptions that are not implemented
-      badExceptions  = exceptions \\ implemented
-      
-      -- exceptions that are now registered
-      badExceptions' = filter registered exceptions
-      
-   in catMaybes
-      [ check unregistered $ unlines
-          [ "The following extensions are known to GHC but are not in the "
-          , "extension registry in Language.Haskell.Extension."
-          , "  " ++ intercalate "\n  " (map display unregistered)
-          , "If these extensions are ready for public consumption then they "
-          , "should be registered. If they are still experimental and you "
-          , "think they are not ready to be registered then please add them "
-          , "to the exceptions list in this test program along with an "
-          , "explanation."
-          ]
-      , check badExceptions $ unlines
-          [ "Error in the extension exception list. The following extensions"
-          , "are listed as exceptions but are not even implemented by GHC:"
-          , "  " ++ intercalate "\n  " (map display badExceptions)
-          , "Please fix this test program by correcting the list of"
-          , "exceptions."
-          ]
-      , check badExceptions' $ unlines
-          [ "Error in the extension exception list. The following extensions"
-          , "are listed as exceptions to registration but they are in fact"
-          , "now registered in Language.Haskell.Extension:"
-          , "  " ++ intercalate "\n  " (map display badExceptions')
-          , "Please fix this test program by correcting the list of"
-          , "exceptions."
-          ]
-      ]
-  where
-   registered (UnknownExtension _) = False
-   registered _                    = True
-
-   check [] _ = Nothing  
-   check _  i = Just i
-
-
-main = topHandler $ do
-  [ghcPath] <- getArgs
-  exts      <- getExtensions ghcPath
-  let problems = checkProblems exts
-  putStrLn (intercalate "\n" problems)
-  if null problems
-    then exitSuccess
-    else exitFailure
-
-getExtensions :: FilePath -> IO [Extension]
-getExtensions ghcPath =
-        map readExtension . lines
-    <$> rawSystemStdout normal ghcPath ["--supported-languages"]
-
-readExtension :: String -> Extension
-readExtension str = handleNoParse $ do
-    -- GHC defines extensions in a positive way, Cabal defines them
-    -- relative to H98 so we try parsing ("No" ++ extName) first
-    ext <- simpleParse ("No" ++ str)
-    case ext of
-      UnknownExtension _ -> simpleParse str
-      _                  -> return ext
-  where
-    handleNoParse :: Maybe Extension -> Extension
-    handleNoParse = fromMaybe (error $ "unparsable extension " ++ show str)
diff --git a/cabal/cabal-install/tests/test-cabal-install b/cabal/cabal-install/tests/test-cabal-install
deleted file mode 100644
--- a/cabal/cabal-install/tests/test-cabal-install
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/sh
-
-darcs get --partial http://darcs.haskell.org/packages/Cabal/ && \
-cd Cabal/cabal-install && \
-make && \
-sudo make install && \
-sudo cabal-install update && \
-cabal-install install --prefix=/tmp --user hnop && \
-ls -l /tmp/bin/hnop
diff --git a/cabal/cabal-install/tests/test-cabal-install-user b/cabal/cabal-install/tests/test-cabal-install-user
deleted file mode 100644
--- a/cabal/cabal-install/tests/test-cabal-install-user
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/bin/sh
-
-darcs get --partial http://darcs.haskell.org/packages/Cabal/ && \
-cd Cabal/cabal-install && \
-make install-user && \
-cabal-install update && \
-cabal-install install --prefix=/tmp --user hnop && \
-ls -l /tmp/bin/hnop
diff --git a/hackport.cabal b/hackport.cabal
--- a/hackport.cabal
+++ b/hackport.cabal
@@ -1,5 +1,5 @@
 Name:           hackport
-Version:        0.3.4
+Version:        0.3.5
 License:        GPL
 License-file:   LICENSE
 Author:         Henning Günther, Duncan Coutts, Lennart Kolmodin
