diff --git a/.ghci b/.ghci
deleted file mode 100644
--- a/.ghci
+++ /dev/null
@@ -1,1 +0,0 @@
-:set -XCPP -optP -DCABAL19
diff --git a/Debian/Apt/Dependencies.hs b/Debian/Apt/Dependencies.hs
--- a/Debian/Apt/Dependencies.hs
+++ b/Debian/Apt/Dependencies.hs
@@ -20,6 +20,7 @@
 import Data.Tree(Tree(rootLabel, Node))
 import Debian.Apt.Package(PackageNameMap, packageNameMap, lookupPackageByRel)
 import Debian.Control.ByteString(ControlFunctions(stripWS, lookupP, parseControlFromFile), Field'(Field), Control'(Control), Paragraph, Control)
+import Debian.Relation (BinPkgName(..), PkgName(..))
 import Debian.Relation.ByteString(ParseRelations(..), Relation(..), OrRelation, AndRelation, Relations, checkVersionReq)
 import Debian.Version(DebianVersion, parseDebianVersion, prettyDebianVersion)
 
@@ -42,7 +43,7 @@
           , relations :: Relations
           , depFunction :: (a -> Relations)
           , conflicts :: a -> Relations
-          , packageVersion :: a -> (String, DebianVersion)
+          , packageVersion :: a -> (BinPkgName, DebianVersion)
           }
 
 -- * Test CSP
@@ -57,10 +58,10 @@
         , packageVersion = packageVersionParagraph
         }
     where
-      getName :: Paragraph -> String
-      getName p = case lookupP "Package" p of Nothing -> error "Missing Package field" ; (Just (Field (_,n))) -> C.unpack (stripWS n)
+      getName :: Paragraph -> BinPkgName
+      getName p = case lookupP "Package" p of Nothing -> error "Missing Package field" ; (Just (Field (_,n))) -> BinPkgName (PkgName (C.unpack (stripWS n)))
       conflicts' :: Paragraph -> Relations
-      conflicts' p = 
+      conflicts' p =
           case lookupP "Conflicts" p of
             Nothing -> []
             Just (Field (_, c)) -> either (error . show) id (parseRelations c)
@@ -98,14 +99,14 @@
     testCSP controlFP depF rel (mapM_ (\ (_,p) -> mapM_ (print . second prettyDebianVersion . packageVersionParagraph) p ) . take 1 . search labeler)
 
 -- TODO: add better errors
-packageVersionParagraph :: Paragraph -> (String, DebianVersion)
+packageVersionParagraph :: Paragraph -> (BinPkgName, DebianVersion)
 packageVersionParagraph p =
     case lookupP "Package" p of
       Nothing -> error $ "Paragraph missing Package field"
       (Just (Field (_, name))) ->
           case lookupP "Version" p of
             Nothing -> error $ "Paragraph missing Version field"
-            (Just (Field (_, version))) -> (C.unpack (stripWS name), parseDebianVersion (C.unpack version))
+            (Just (Field (_, version))) -> (BinPkgName (PkgName (C.unpack (stripWS name))), parseDebianVersion (C.unpack version))
 
 
 
@@ -117,11 +118,11 @@
       if name1 == name2
       then version1 /= version2
       else
-        any (conflict' (name1, version1)) (concat $ (conflicts csp) p2) || 
+        any (conflict' (name1, version1)) (concat $ (conflicts csp) p2) ||
         any (conflict' (name2, version2)) (concat $ (conflicts csp) p1)
-        
+
 -- |JAS: deal with 'Provides' (can a package provide more than one package?)
-conflict' :: (String, DebianVersion) -> Relation -> Bool
+conflict' :: (BinPkgName, DebianVersion) -> Relation -> Bool
 conflict' (pName, pVersion) (Rel pkgName mVersionReq _) =
     (pName == pkgName) && (checkVersionReq mVersionReq (Just pVersion))
 
@@ -198,7 +199,7 @@
 -- the 'reverse as' is because the vars are order high to low, but we
 -- want to find the lowest numbered (aka, eariest) inconsistency ??
 -- 
-earliestInconsistency :: CSP a -> State a -> Maybe ((String, DebianVersion), (String, DebianVersion))
+earliestInconsistency :: CSP a -> State a -> Maybe ((BinPkgName, DebianVersion), (BinPkgName, DebianVersion))
 earliestInconsistency _ (_,[]) = Nothing
 earliestInconsistency _ (_,[_p]) = Nothing
 earliestInconsistency csp (_,(p:ps)) =
@@ -209,7 +210,7 @@
 -- * Conflict Set
 
 -- | conflicting packages and relations that require non-existant packages
-type ConflictSet = ([(String, DebianVersion)],[Relation])
+type ConflictSet = ([(BinPkgName, DebianVersion)],[Relation])
 
 isConflict :: ConflictSet -> Bool
 isConflict ([],[]) = False
@@ -231,7 +232,7 @@
       f s@(status,_) =
               case status of
                 (MissingDep rel) -> (s, ([], [rel]))
-                _ ->                      
+                _ ->
                     (s,
                       case (earliestInconsistency csp) s of
                         Nothing -> ([],[])
diff --git a/Debian/Apt/Index.hs b/Debian/Apt/Index.hs
--- a/Debian/Apt/Index.hs
+++ b/Debian/Apt/Index.hs
@@ -20,6 +20,7 @@
 import qualified Codec.Compression.BZip as BZip
 import qualified Data.ByteString.Char8 as B
 import qualified Data.ByteString.Lazy.Char8 as L
+import qualified Data.Digest.Pure.MD5 as MD5
 import Data.Function
 import Data.List
 import qualified Data.Map as M
@@ -35,8 +36,8 @@
 import System.Directory
 import System.FilePath ((</>))
 import System.Posix.Files
-import System.Unix.FilePath
-import qualified System.Unix.Misc as Misc
+import System.FilePath (takeBaseName)
+--import qualified System.Unix.Misc as Misc
 import Text.ParserCombinators.Parsec.Error
 
 
@@ -286,11 +287,11 @@
              if not e
               then return Nothing
               else do size <- getFileStatus (basePath </> fp) >>= return . fromIntegral . fileSize
-                      md5 <- Misc.md5sum (basePath </> fp)
+                      md5 <- L.readFile (basePath </> fp) >>= return . show . MD5.md5
                       return $ Just (CheckSums { md5sum = Just md5, sha1 = Nothing, sha256 = Nothing }, size, fp)
 
 -- |find the Contents-* files. These are not listed in the Release file
 findContentsFiles :: (FilePath -> Bool) -> FilePath -> IO [FilePath]
 findContentsFiles filterP distDir =
           do files <- getDirectoryContents distDir
-             return $ filter filterP $ filter (isPrefixOf "Contents-" . baseName) files
+             return $ filter filterP $ filter (isPrefixOf "Contents-" . takeBaseName) files
diff --git a/Debian/Apt/Package.hs b/Debian/Apt/Package.hs
--- a/Debian/Apt/Package.hs
+++ b/Debian/Apt/Package.hs
@@ -11,13 +11,13 @@
 import Debian.Version
 import Debian.Relation
 
-type PackageNameMap a = Map.Map String [a]
+type PackageNameMap a = Map.Map BinPkgName [a]
 
 -- |'packageNameMap' creates a map from a package name to all the versions of that package
 -- NOTE: Provides are not included in the map
 -- NOTE: the sort order is random -- this is perhaps a bug
 -- see also: 'addProvides'
-packageNameMap :: (a -> String) -> [a] -> PackageNameMap a
+packageNameMap :: (a -> BinPkgName) -> [a] -> PackageNameMap a
 packageNameMap getName packages = foldl (\m p -> Map.insertWith (++) (getName p) [p] m) Map.empty packages
 
 -- |'addProvides' finds packages that Provide other packages and adds
@@ -25,21 +25,21 @@
 -- list, so that real packages have 'higher priority' than virtual
 -- packages.
 -- NOTE: Does not check for duplication or multiple use
-addProvides :: (p -> [PkgName]) -> [p] -> PackageNameMap p -> PackageNameMap p
+addProvides :: (p -> [BinPkgName]) -> [p] -> PackageNameMap p -> PackageNameMap p
 addProvides providesf ps pnm =
     let provides = findProvides providesf ps in
     foldl (\m (packageName, package) -> Map.insertWith (flip (++)) packageName [package] m) pnm provides
 
 -- |'findProvides'
-findProvides :: forall p. (p -> [PkgName]) -> [p] -> [(PkgName, p)]
+findProvides :: forall p. (p -> [BinPkgName]) -> [p] -> [(BinPkgName, p)]
 findProvides providesf packages = foldl addProvides [] packages
-    where addProvides :: [(PkgName, p)] -> p -> [(PkgName, p)]
+    where addProvides :: [(BinPkgName, p)] -> p -> [(BinPkgName, p)]
           addProvides providesList package =
               foldl (\pl pkgName -> (pkgName, package): pl) providesList (providesf package)
 
 -- |'lookupPackageByRel' returns all the packages that satisfy the specified relation
 -- TODO: Add architecture check
-lookupPackageByRel :: PackageNameMap a -> (a -> (String, DebianVersion)) -> Relation -> [a]
+lookupPackageByRel :: PackageNameMap a -> (a -> (BinPkgName, DebianVersion)) -> Relation -> [a]
 lookupPackageByRel pm packageVersionF (Rel pkgName mVerReq _mArch) =
     case Map.lookup pkgName pm of
       Nothing -> []
diff --git a/Debian/Control/ByteString.hs b/Debian/Control/ByteString.hs
--- a/Debian/Control/ByteString.hs
+++ b/Debian/Control/ByteString.hs
@@ -1,4 +1,4 @@
-{-# LANGUAGE ScopedTypeVariables #-}
+{-# LANGUAGE PackageImports, ScopedTypeVariables #-}
 {-# OPTIONS_GHC -fno-warn-name-shadowing -fno-warn-orphans #-}
 module Debian.Control.ByteString
     ( Control'(..)
@@ -22,7 +22,7 @@
 -- Standard GHC modules
 
 import qualified Control.Exception as E
-import Control.Monad.State
+import "mtl" Control.Monad.State
 
 import Data.Char(chr,ord,toLower)
 import Data.List
diff --git a/Debian/Deb.hs b/Debian/Deb.hs
--- a/Debian/Deb.hs
+++ b/Debian/Deb.hs
@@ -5,19 +5,20 @@
 
 import Data.ByteString.Lazy (empty)
 import Debian.Control.Common
-import System.Unix.Directory
-import System.Unix.FilePath
-import System.Unix.Process
+import System.Exit (ExitCode(..))
+import System.Unix.Directory (withTemporaryDirectory, withWorkingDirectory)
+import System.Unix.FilePath (realpath)
+import System.Unix.Process (readProcessWithExitCode)
 
 fields :: (ControlFunctions a) => FilePath -> IO (Control' a)
 fields debFP =
     withTemporaryDirectory ("fields.XXXXXX") $ \tmpdir ->
       do debFP <- realpath debFP
-         withWorkingDirectory tmpdir $ 
-           do (out, err, res) <- lazyProcess "ar" ["x",debFP,"control.tar.gz"] Nothing Nothing empty >>= return . collectOutputUnpacked 
-              when (res /= ExitSuccess) (error $ "Dpkg.fields: " ++ out ++ "\n" ++ err ++ "\n" ++ show res)
-              (out, err, res) <- lazyProcess "tar" ["xzf", "control.tar.gz", "./control"] Nothing Nothing empty >>= return . collectOutputUnpacked
-              when (res /= ExitSuccess) (error $ "Dpkg.fields: " ++ out ++ "\n" ++ err ++ "\n" ++ show res)
+         withWorkingDirectory tmpdir $
+           do (res, out, err) <- readProcessWithExitCode "ar" ["x",debFP,"control.tar.gz"] id empty
+              when (res /= ExitSuccess) (error $ "Dpkg.fields: " ++ show out ++ "\n" ++ show err ++ "\n" ++ show res)
+              (res, out, err) <- readProcessWithExitCode "tar" ["xzf", "control.tar.gz", "./control"] id empty
+              when (res /= ExitSuccess) (error $ "Dpkg.fields: " ++ show out ++ "\n" ++ show err ++ "\n" ++ show res)
               c <- parseControlFromFile "control" 
               case c of
                 Left e -> error (show e)
diff --git a/Debian/GenBuildDeps.hs b/Debian/GenBuildDeps.hs
--- a/Debian/GenBuildDeps.hs
+++ b/Debian/GenBuildDeps.hs
@@ -1,14 +1,15 @@
+{-# LANGUAGE RecordWildCards, ScopedTypeVariables #-}
 -- |Figure out the dependency relation between debianized source
 -- directories.  The code to actually solve these dependency relations
 -- for a particular set of binary packages is in Debian.Repo.Dependency.
 module Debian.GenBuildDeps 
-    ( DepInfo
-    , SrcPkgName(..)
-    , BinPkgName(..)
+    ( DepInfo(..)
     -- * Preparing dependency info
     , buildDependencies
-    , RelaxInfo(..)
+    , RelaxInfo
     , relaxDeps
+    , OldRelaxInfo(..)
+    , oldRelaxDeps
     -- * Using dependency info
     , BuildableInfo(..)
     , buildable
@@ -30,15 +31,13 @@
 import qualified Data.Set as Set
 import		 Debian.Relation
 import		 System.Directory (getDirectoryContents, doesFileExist)
-import		 System.IO
 
-newtype SrcPkgName = SrcPkgName PkgName deriving (Show, Eq)
-newtype BinPkgName = BinPkgName PkgName deriving (Show, Eq)
-
--- |This type describes the build dependencies of a source package.
-type DepInfo = (SrcPkgName,	-- source package name
-                Relations,	-- dependency relations
-                [BinPkgName])	-- binary package names
+-- | This type describes the build dependencies of a source package.
+data DepInfo = DepInfo {
+      sourceName :: SrcPkgName		-- ^ source package name
+    , relations :: Relations		-- ^ dependency relations
+    , binaryNames :: [BinPkgName]	-- ^ binary dependency names (is this a function of relations?)
+    }
 
 -- |Turn a list of eithers into an either of lists
 -- copied from Extra.Either
@@ -54,9 +53,9 @@
 buildDependencies :: Control -> Either String DepInfo
 buildDependencies (Control []) = error "Control file seems to be empty"
 buildDependencies (Control (source:binaries)) =
-    either (Left . concat) (\ deps -> Right (sourcePackage, deps, bins)) deps
+    either (Left . concat) (\ deps -> Right (DepInfo {sourceName = sourcePackage, relations = deps, binaryNames = bins})) deps
     where
-      sourcePackage = maybe (error "First Paragraph in control file lacks a Source field") SrcPkgName $ assoc "Source" source
+      sourcePackage = maybe (error "First Paragraph in control file lacks a Source field") (SrcPkgName . PkgName) $ assoc "Source" source
       -- The raw list of build dependencies for this package
       deps = either Left (Right . concat) (concatEithers [buildDeps, buildDepsIndep])
       buildDeps =
@@ -69,36 +68,69 @@
             _ -> Right []
       bins = mapMaybe lookupPkgName binaries
       lookupPkgName :: Paragraph -> Maybe BinPkgName
-      lookupPkgName p = maybe Nothing (Just . BinPkgName) (assoc "Package" p)
+      lookupPkgName p = maybe Nothing (Just . BinPkgName . PkgName) (assoc "Package" p)
 
 -- |Specifies build dependencies that should be ignored during the build
 -- decision.  If the pair is (BINARY, Nothing) it means the binary package
 -- BINARY should always be ignored when deciding whether to build.  If the
 -- pair is (BINARY, Just SOURCE) it means that binary package BINARY should
 -- be ignored when deiciding whether to build package SOURCE.
-newtype RelaxInfo = RelaxInfo [(BinPkgName, Maybe SrcPkgName)] deriving Show
+newtype OldRelaxInfo = RelaxInfo [(BinPkgName, Maybe SrcPkgName)] deriving Show
 
+-- | Given a source package name and a binary package name, return
+-- False if the binary package should be ignored hwen deciding whether
+-- to build the source package.  This is used to prevent build
+-- dependency cycles from triggering unnecessary rebuilds.  (This is a
+-- replacement for the RelaxInfo type, which we temporarily rename
+-- OldRelaxInfo.)
+type RelaxInfo = SrcPkgName -> BinPkgName -> Bool
+
+makeRelaxInfo :: OldRelaxInfo -> RelaxInfo
+makeRelaxInfo (RelaxInfo xs) srcPkgName binPkgName =
+    Set.member binPkgName global || maybe False (Set.member binPkgName) (Map.lookup srcPkgName mp)
+    where
+      (global :: Set.Set BinPkgName, mp :: Map.Map SrcPkgName (Set.Set BinPkgName)) =
+          foldr (\ entry (global', mp') ->
+                     case entry of
+                       (b, Just s) -> (global', Map.insertWith Set.union s (Set.singleton b) mp')
+                       (b, Nothing) -> (Set.insert b global', mp')) (Set.empty, Map.empty) xs
+
 -- |Remove any dependencies that are designated \"relaxed\" by relaxInfo.
 relaxDeps :: RelaxInfo -> [DepInfo] -> [DepInfo]
 relaxDeps relaxInfo deps =
-    map (relaxDep relaxInfo) deps
+    map relaxDep deps
     where
-      relaxDep :: RelaxInfo -> DepInfo -> DepInfo
-      relaxDep relaxInfo (sourceName, relations, binaryNames) =
-          (sourceName, filteredDependencies, binaryNames)
+      relaxDep :: DepInfo -> DepInfo
+      relaxDep info = info {relations = filteredDependencies}
           where
             -- Discard any dependencies not on the filtered package name list.  If
             -- this results in an empty list in an or-dep the entire dependency can
             -- be discarded.
             filteredDependencies :: Relations
-            filteredDependencies = filter (/= []) (map (filter keepDep) relations)
+            filteredDependencies = filter (/= []) (map (filter keepDep) (relations info))
             keepDep :: Relation -> Bool
-            keepDep (Rel name _ _) = not (elem (BinPkgName name) ignored)
+            keepDep (Rel name _ _) = not (relaxInfo (sourceName info) name)
+
+-- |Remove any dependencies that are designated \"relaxed\" by relaxInfo.
+oldRelaxDeps :: OldRelaxInfo -> [DepInfo] -> [DepInfo]
+oldRelaxDeps relaxInfo deps =
+    map relaxDep deps
+    where
+      relaxDep :: DepInfo -> DepInfo
+      relaxDep info = info {relations = filteredDependencies}
+          where
+            -- Discard any dependencies not on the filtered package name list.  If
+            -- this results in an empty list in an or-dep the entire dependency can
+            -- be discarded.
+            filteredDependencies :: Relations
+            filteredDependencies = filter (/= []) (map (filter keepDep) (relations info))
+            keepDep :: Relation -> Bool
+            keepDep (Rel name _ _) = not (elem name ignored)
             -- Binary packages to be ignored wrt this source package's build decision
-            ignored = ignoredForSourcePackage sourceName relaxInfo
+            ignored = ignoredForSourcePackage (sourceName info) relaxInfo
             -- Return a list of binary packages which should be ignored for this
             -- source package.
-            ignoredForSourcePackage :: SrcPkgName -> RelaxInfo -> [BinPkgName]
+            ignoredForSourcePackage :: SrcPkgName -> OldRelaxInfo -> [BinPkgName]
             ignoredForSourcePackage source (RelaxInfo pairs) =
                 map fst . filter (maybe True (== source) . snd) $ pairs
                 -- concat . map binaries . catMaybes . map snd . filter (\ (_, x) -> maybe True (== source) x) $ pairs
@@ -207,13 +239,13 @@
 -- a pretty simplistic approach to 'or' build depends. However, I
 -- think this should work pretty nicely in practice.
 compareSource :: DepInfo -> DepInfo -> Ordering
-compareSource (_, depends1, bins1) (_, depends2, bins2)
+compareSource (DepInfo {relations = depends1, binaryNames = bins1}) (DepInfo {relations = depends2, binaryNames = bins2})
     | any (\rel -> isJust (find (checkPackageNameReq rel) bins2)) (concat depends1) = GT
     | any (\rel -> isJust (find (checkPackageNameReq rel) bins1)) (concat depends2) = LT
     | otherwise = EQ
     where
       checkPackageNameReq :: Relation -> BinPkgName -> Bool
-      checkPackageNameReq (Rel rPkgName _ _) (BinPkgName bPkgName) = rPkgName == bPkgName 
+      checkPackageNameReq (Rel rPkgName _ _) bPkgName = rPkgName == bPkgName
 
 -- |Return the dependency info for a list of control files.
 genDeps :: [FilePath] -> IO (Either String [DepInfo])
@@ -234,7 +266,7 @@
 getSourceOrder fp =
     findControlFiles fp >>=
     genDeps >>=
-    return . either Left (Right . map ( \(pkgName,_,_) -> pkgName) . orderSource compareSource)
+    return . either Left (Right . map sourceName . orderSource compareSource)
     where
       -- Return a list of the files that look like debian\/control.
       findControlFiles :: FilePath -> IO [FilePath]
diff --git a/Debian/Relation.hs b/Debian/Relation.hs
--- a/Debian/Relation.hs
+++ b/Debian/Relation.hs
@@ -1,7 +1,12 @@
 -- |A module for working with debian relationships <http://www.debian.org/doc/debian-policy/ch-relationships.html>
 module Debian.Relation
     ( -- * Types
-      PkgName
+      PkgName(..)
+    , SrcPkgName(..)
+    , BinPkgName(..)
+    , prettyPkgName
+    , prettySrcPkgName
+    , prettyBinPkgName
     , AndRelation
     , OrRelation
     , Relations
@@ -16,5 +21,5 @@
     , ParseRelations(..)
     ) where 
 
-import Debian.Relation.Common (prettyRelation)
+import Debian.Relation.Common (prettyRelation, SrcPkgName(..), BinPkgName(..), PkgName(..), prettyPkgName, prettySrcPkgName, prettyBinPkgName)
 import Debian.Relation.String
diff --git a/Debian/Relation/ByteString.hs b/Debian/Relation/ByteString.hs
--- a/Debian/Relation/ByteString.hs
+++ b/Debian/Relation/ByteString.hs
@@ -15,13 +15,6 @@
     , ParseRelations(..)
     ) where 
 
--- Standard GHC Modules
-
-import Data.List
-import Text.ParserCombinators.Parsec
-
--- 3rd Party Modules
-
 import qualified Data.ByteString.Char8 as C
 
 -- Local Modules
@@ -34,8 +27,4 @@
 
 -- For now we just wrap the string version
 instance ParseRelations C.ByteString where
-    parseRelations byteStr = 
-        let str = C.unpack byteStr in
-        case parse pRelations str str of
-          Right relations -> Right (filter (/= []) relations)
-          x -> x
+    parseRelations byteStr = parseRelations (C.unpack byteStr)
diff --git a/Debian/Relation/Common.hs b/Debian/Relation/Common.hs
--- a/Debian/Relation/Common.hs
+++ b/Debian/Relation/Common.hs
@@ -13,16 +13,26 @@
 
 -- Datatype for relations
 
-type PkgName = String
-
 type Relations = AndRelation
 type AndRelation = [OrRelation]
 type OrRelation = [Relation]
 
-data Relation = Rel PkgName (Maybe VersionReq) (Maybe ArchitectureReq)
-		deriving Eq
+data Relation = Rel BinPkgName (Maybe VersionReq) (Maybe ArchitectureReq) deriving Eq
 
+newtype PkgName = PkgName {unPkgName :: String} deriving (Show, Eq, Ord)
 
+newtype SrcPkgName = SrcPkgName {unSrcPkgName :: PkgName} deriving (Show, Eq, Ord)
+newtype BinPkgName = BinPkgName {unBinPkgName :: PkgName} deriving (Show, Eq, Ord)
+
+prettySrcPkgName :: SrcPkgName -> Doc
+prettySrcPkgName = prettyPkgName . unSrcPkgName
+
+prettyBinPkgName :: BinPkgName -> Doc
+prettyBinPkgName = prettyPkgName . unBinPkgName
+
+prettyPkgName :: PkgName -> Doc
+prettyPkgName = text . unPkgName
+
 class ParseRelations a where
     -- |'parseRelations' parse a debian relation (i.e. the value of a
     -- Depends field). Return a parsec error or a value of type
@@ -32,7 +42,7 @@
 
 prettyRelation :: Relation -> Doc
 prettyRelation (Rel name ver arch) =
-    text (name ++ maybe "" (show . prettyVersionReq) ver ++ maybe "" (show . prettyArchitectureReq) arch)
+    text (unPkgName (unBinPkgName name) ++ maybe "" (show . prettyVersionReq) ver ++ maybe "" (show . prettyArchitectureReq) arch)
 
 instance Ord Relation where
     compare (Rel pkgName1 mVerReq1 _mArch1) (Rel pkgName2 mVerReq2 _mArch2) =
diff --git a/Debian/Relation/String.hs b/Debian/Relation/String.hs
--- a/Debian/Relation/String.hs
+++ b/Debian/Relation/String.hs
@@ -19,7 +19,6 @@
 
 -- Standard GHC Modules
 
-import Data.List
 import Text.ParserCombinators.Parsec
 
 -- Local Modules
@@ -30,10 +29,16 @@
 -- * ParseRelations
 
 instance ParseRelations String where
-    parseRelations str = 
-        case parse pRelations str str of
+    parseRelations str =
+        let str' = scrub str in
+        case parse pRelations str' str' of
           Right relations -> Right (filter (/= []) relations)
           x -> x
+        where
+          scrub = unlines . filter (not . comment) . lines
+          comment s = case dropWhile (`elem` " \t") s of
+                           ('#' : _) -> True
+                           _ -> False
 
 -- * Relation Parser
 
@@ -63,7 +68,7 @@
        mVerReq <- pMaybeVerReq
        skipMany whiteChar
        mArch <- pMaybeArch
-       return $ Rel pkgName mVerReq mArch
+       return $ Rel (BinPkgName (PkgName pkgName)) mVerReq mArch
 
 pMaybeVerReq :: RelParser (Maybe VersionReq)
 pMaybeVerReq =
diff --git a/Debian/Release.hs b/Debian/Release.hs
--- a/Debian/Release.hs
+++ b/Debian/Release.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE DeriveDataTypeable #-}
 module Debian.Release
     ( ReleaseName(..)
     , parseReleaseName
@@ -13,12 +14,14 @@
     , parseSection'
     ) where
 
+import Data.Data (Data)
+import Data.Typeable (Typeable)
 import Debian.URI
 
 -- |A distribution (aka release) name.  This type is expected to refer
 -- to a subdirectory of the dists directory which is at the top level
 -- of a repository.
-data ReleaseName = ReleaseName { relName :: String } deriving (Eq, Ord, Read, Show)
+data ReleaseName = ReleaseName { relName :: String } deriving (Eq, Ord, Read, Show, Data, Typeable)
 
 parseReleaseName :: String -> ReleaseName
 parseReleaseName name = ReleaseName {relName = unEscapeString name}
@@ -28,7 +31,7 @@
 
 -- |The types of architecture that a package can have, either Source
 -- or some type of binary architecture.
-data Arch = Source | Binary String deriving (Read, Show, Eq, Ord)
+data Arch = Source | Binary String deriving (Read, Show, Eq, Ord, Data, Typeable)
 
 archName :: Arch -> String
 archName Source = "source"
diff --git a/Debian/URI.hs b/Debian/URI.hs
--- a/Debian/URI.hs
+++ b/Debian/URI.hs
@@ -14,8 +14,11 @@
 import Data.Maybe (catMaybes)
 import Network.URI
 import System.Directory (getDirectoryContents)
-import System.Unix.Process (collectStdout)
-import System.Unix.Progress (lazyCommandF)
+import System.Exit (ExitCode(..))
+import System.Process (showCommandForUser)
+import System.Unix.Process (readProcessWithExitCode)
+-- import System.Unix.LazyProcess (collectStdout)
+-- import System.Unix.Progress (lazyCommandF)
 import Text.Regex (mkRegex, matchRegex)
 
 uriToString' :: URI -> String
@@ -28,25 +31,38 @@
 type URIString = String
 
 fileFromURI :: URI -> IO (Either SomeException L.ByteString)
-fileFromURI uri =
+fileFromURI uri = try $
     case (uriScheme uri, uriAuthority uri) of
-      ("file:", Nothing) -> try (L.readFile (uriPath uri))
+      ("file:", Nothing) -> L.readFile (uriPath uri)
       -- ("ssh:", Just auth) -> cmdOutput ("ssh " ++ uriUserInfo auth ++ uriRegName auth ++ uriPort auth ++ " cat " ++ show (uriPath uri))
-      ("ssh:", Just auth) -> try (lazyCommandF ("ssh " ++ uriUserInfo auth ++ uriRegName auth ++ uriPort auth ++ " cat " ++ show (uriPath uri)) L.empty >>=
-                                  return . fst . collectStdout)
-      _ -> try (lazyCommandF ("curl -s -g '" ++ uriToString' uri ++ "'") L.empty >>=
-                return . fst . collectStdout)
+      ("ssh:", Just auth) ->
+          do let cmd  = "ssh"
+                 args = [uriUserInfo auth ++ uriRegName auth ++ uriPort auth, "cat", uriPath uri]
+             (code, out, _err) <- readProcessWithExitCode cmd args id L.empty
+             case code of
+               ExitFailure _ -> error (showCommandForUser cmd args ++ " -> " ++ show code)
+               _ -> return out
+      _ ->
+          do let cmd = "curl"
+                 args = ["-s", "-g", uriToString' uri]
+             (_code, out, _err) <- readProcessWithExitCode cmd args id L.empty
+             return out
 
 fileFromURIStrict :: URI -> IO (Either SomeException B.ByteString)
-fileFromURIStrict uri =
+fileFromURIStrict uri = try $
     case (uriScheme uri, uriAuthority uri) of
-      ("file:", Nothing) -> try (B.readFile (uriPath uri))
+      ("file:", Nothing) -> B.readFile (uriPath uri)
       -- ("ssh:", Just auth) -> cmdOutputStrict ("ssh " ++ uriUserInfo auth ++ uriRegName auth ++ uriPort auth ++ " cat " ++ show (uriPath uri))
-      ("ssh:", Just auth) -> try (lazyCommandF ("ssh " ++ uriUserInfo auth ++ uriRegName auth ++ uriPort auth ++ " cat " ++ show (uriPath uri)) L.empty >>=
-                                  return . B.concat . L.toChunks . fst . collectStdout)
-      _ -> try (lazyCommandF ("curl -s -g '" ++ uriToString' uri ++ "'") L.empty >>=
-                return . B.concat . L.toChunks . fst . collectStdout)
-      -- _ -> cmdOutputStrict ("curl -s -g '" ++ uriToString' uri ++ "'")
+      ("ssh:", Just auth) -> do
+          let cmd = "ssh"
+              args = [uriUserInfo auth ++ uriRegName auth ++ uriPort auth, "cat", uriPath uri]
+          (_code, out, _err) <- readProcessWithExitCode cmd args id L.empty
+          return . B.concat . L.toChunks $ out
+      _ -> do
+          let cmd = "curl"
+              args = ["-s", "-g", uriToString' uri]
+          (_code, out, _err) <- readProcessWithExitCode cmd args id L.empty
+          return . B.concat . L.toChunks $ out
 
 -- | Parse the text returned when a directory is listed by a web
 -- server.  This is currently only known to work with Apache.
@@ -62,11 +78,16 @@
 
 
 dirFromURI :: URI -> IO (Either SomeException [String])
-dirFromURI uri =
+dirFromURI uri = try $
     case (uriScheme uri, uriAuthority uri) of
-      ("file:", Nothing) -> try (getDirectoryContents (uriPath uri))
-      -- ("ssh:", Just auth) -> cmdOutput ("ssh " ++ uriUserInfo auth ++ uriRegName auth ++ uriPort auth ++ " ls -1 " ++ uriPath uri) >>=
-      ("ssh:", Just auth) -> try (lazyCommandF ("ssh " ++ uriUserInfo auth ++ uriRegName auth ++ uriPort auth ++ " ls -1 " ++ uriPath uri) L.empty >>=
-                                  return . lines . L.unpack . fst . collectStdout)
-      -- _ -> cmdOutput ("curl -s -g '" ++ uriToString' uri ++ "/'") >>= return . either Left (Right . webServerDirectoryContents)
-      _ -> try (lazyCommandF ("curl -s -g '" ++ uriToString' uri ++ "/'") L.empty >>= return . webServerDirectoryContents . fst . collectStdout)
+      ("file:", Nothing) -> getDirectoryContents (uriPath uri)
+      ("ssh:", Just auth) ->
+          do let cmd = "ssh"
+                 args = [uriUserInfo auth ++ uriRegName auth ++ uriPort auth, "ls", "-1", uriPath uri]
+             (_code, out, _err) <- readProcessWithExitCode cmd args id L.empty
+             return . lines . L.unpack $ out
+      _ ->
+          do let cmd = "curl"
+                 args = ["-s", "-g", uriToString' uri]
+             (_code, out, _err) <- readProcessWithExitCode cmd args id L.empty
+             return . webServerDirectoryContents $ out
diff --git a/Debian/Util/FakeChanges.hs b/Debian/Util/FakeChanges.hs
--- a/Debian/Util/FakeChanges.hs
+++ b/Debian/Util/FakeChanges.hs
@@ -4,6 +4,8 @@
 --import Control.Arrow
 import Control.Exception
 import Control.Monad hiding (mapM)
+import qualified Data.ByteString.Lazy.Char8 as L
+import qualified Data.Digest.Pure.MD5 as MD5
 import Data.Foldable
 import Data.List hiding (concat, foldr, all)
 import Data.Maybe 
@@ -12,6 +14,7 @@
 import Data.Traversable
 import Debian.Time
 import System.Environment
+import System.FilePath
 import System.Posix.Files
 import Text.Regex.TDFA
 import Prelude hiding (catch, concat, foldr, all, mapM)
@@ -19,8 +22,8 @@
 
 import Debian.Control
 import qualified Debian.Deb as Deb
-import System.Unix.FilePath
-import System.Unix.Misc
+-- import System.Unix.FilePath
+-- import System.Unix.Misc
 
 
 data Error
@@ -166,17 +169,17 @@
 mkFileLine :: FilePath -> IO String
 mkFileLine fp
     | ".deb" `isSuffixOf` fp =
-        do sum <- md5sum fp
+        do sum <- L.readFile fp >>= return . show . MD5.md5
            size <- liftM fileSize $ getFileStatus fp 
            (Control (p:_)) <- Deb.fields fp
            return $ concat [ " ", sum, " ", show size, " ", fromMaybe "unknown" (fieldValue "Section" p), " "
-                           , fromMaybe "optional" (fieldValue "Priority" p), " ", (baseName fp)
+                           , fromMaybe "optional" (fieldValue "Priority" p), " ", (takeBaseName fp)
                            ]
     | otherwise =
-        do sum <- md5sum fp 
+        do sum <- L.readFile fp >>= return . show . MD5.md5
            size <- liftM fileSize $ getFileStatus fp
            return $ concat [ " ", sum, " ", show size, " ", "unknown", " "
-                           , "optional"," ", (baseName fp)
+                           , "optional"," ", (takeBaseName fp)
                            ]
        
 -- more implementations can be found at:
@@ -190,7 +193,7 @@
 -- move to different library
 debNameSplit :: String -> Either FilePath (String, String, String)
 debNameSplit fp =
-    case (baseName fp) =~ "^(.*)_(.*)_(.*).deb$" of
+    case (takeBaseName fp) =~ "^(.*)_(.*)_(.*).deb$" of
       [[_, name, version, arch]] -> Right (name, version, arch)
       _ -> Left fp
     
diff --git a/Debian/Version/Internal.hs b/Debian/Version/Internal.hs
--- a/Debian/Version/Internal.hs
+++ b/Debian/Version/Internal.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE DeriveDataTypeable #-}
 module Debian.Version.Internal
     ( DebianVersion(..)
     , Numeric(..)
@@ -5,26 +6,30 @@
     , Found(..)
     )
     where
+
+import Data.Data (Data)
+import Data.Typeable (Typeable)
+
 -- Currently we store the original version string in the data-type so
 -- that we can faithfully reproduce it quickly. Currently we do not
 -- have any way to modify a version number -- so this works fine. May
 -- have to change later.
 data DebianVersion
-    = DebianVersion String (Found Int, NonNumeric, Found NonNumeric)
+    = DebianVersion String (Found Int, NonNumeric, Found NonNumeric) deriving (Data, Typeable)
 
 data NonNumeric
     = NonNumeric String (Found Numeric)
-      deriving Show
+      deriving (Show, Data, Typeable)
 
 data Numeric
     = Numeric Int (Maybe NonNumeric)
-      deriving Show
+      deriving (Show, Data, Typeable)
 
 
 data Found a
     = Found { unFound :: a }
     | Simulated { unFound :: a }
-      deriving Show
+      deriving (Show, Data, Typeable)
 
 instance (Eq a) => Eq (Found a) where
     f1 == f2 = (unFound f1) == (unFound f2)
diff --git a/Test/Dependencies.hs b/Test/Dependencies.hs
--- a/Test/Dependencies.hs
+++ b/Test/Dependencies.hs
@@ -101,26 +101,26 @@
         , packageVersion = packageVersionParagraph
         }
     where
-      getName :: [(String, String)] -> String
-      getName p = case lookup "Package" p of Nothing -> error "Missing Package field" ; (Just n) -> stripWS n
+      getName :: [(String, String)] -> BinPkgName
+      getName p = case lookup "Package" p of Nothing -> error "Missing Package field" ; (Just n) -> BinPkgName (PkgName (stripWS n))
       conflicts' :: [(String, String)] -> Relations
       conflicts' p = 
           case lookup "Conflicts" p of
             Nothing -> []
             (Just c) -> either (error . show) id (parseRelations c)
 
-      providesF :: [(String, String)] -> [String]
+      providesF :: [(String, String)] -> [BinPkgName]
       providesF p =
           case lookup "Provides" p of
             Nothing -> []
             (Just v) ->
-                 parseCommaList v
+                 map (BinPkgName . PkgName) $ parseCommaList v
 
 parseCommaList :: String -> [String]
 parseCommaList str =
     words $ map (\c -> if c == ',' then ' ' else c) str
 
-packageVersionParagraph :: [(String, String)] -> (String, DebianVersion) 
+packageVersionParagraph :: [(String, String)] -> (BinPkgName, DebianVersion) 
 packageVersionParagraph p =
     case lookup "Package" p of
       Nothing -> error $ "Could not find Package in " ++ show p
@@ -128,7 +128,7 @@
           case lookup "Version" p of
             Nothing -> error $ "Could not find Package in " ++ show p
             (Just v) -> 
-                (stripWS n, parseDebianVersion v)
+                (BinPkgName (PkgName (stripWS n)), parseDebianVersion v)
 
 mapSnd :: (b -> c) -> [(a,b)] -> [(a,c)]
 mapSnd f = map (second f)
diff --git a/cbits/gwinsz.h b/cbits/gwinsz.h
deleted file mode 100644
--- a/cbits/gwinsz.h
+++ /dev/null
@@ -1,1 +0,0 @@
-unsigned long c_get_window_size(void);
diff --git a/debian.cabal b/debian.cabal
--- a/debian.cabal
+++ b/debian.cabal
@@ -1,5 +1,5 @@
 Name:           debian
-Version:        3.61
+Version:        3.64
 License:        BSD3
 License-File:   debian/copyright
 Author:         David Fox <dsf@seereason.com>, Jeremy Shaw <jeremy@seereason.com>, Clifford Beshers <beshers@seereason.com>
@@ -20,10 +20,29 @@
  Description: True if Cabal >= 1.9 is available
 
 Library
- Build-Depends:  base >= 4 && < 5, bytestring, containers, directory,
-                 filepath, mtl, network, old-locale, parsec >= 2 && <4, pretty, process,
-                 regex-tdfa, regex-compat, time, unix, bzlib, HaXml >= 1.20, Unixutils >= 1.41, zlib, HUnit,
-                 utf8-string
+ Build-Depends:
+   base >= 4 && < 5,
+   bytestring,
+   bzlib,
+   containers,
+   directory,
+   filepath,
+   HaXml >= 1.20,
+   HUnit,
+   mtl,
+   network,
+   old-locale,
+   parsec >= 2 && <4,
+   pretty,
+   process,
+   pureMD5,
+   regex-compat,
+   regex-tdfa,
+   time,
+   unix,
+   Unixutils >= 1.50,
+   utf8-string,
+   zlib
  ghc-options: -W -Wall -O2
  if flag(cabal19)
    build-depends: Cabal >= 1.9
diff --git a/debian/apt-get-build-depends.1 b/debian/apt-get-build-depends.1
deleted file mode 100644
--- a/debian/apt-get-build-depends.1
+++ /dev/null
@@ -1,17 +0,0 @@
-.TH APT-GET-BUILD-DEPENDS 1  "May 10, 2010"
-
-.SH NAME
-apt-get-build-depends \- apt-get install build depends
-
-.SH SYNOPSIS
-.B apt-get-build-depends
-.RI 
-
-.SH DESCRIPTION
-apt-get-build-depends parse the Build-Depends{-Indep} lines from a
-debian/control file and apt-get installs the required packages.
-
-.SH AUTHOR
-This manual page was originally written by Erik de Castro Lopo 
-<erikd@mega-nerd.com> for the Debian GNU/Linux system (but may be used by 
-others).
diff --git a/debian/changelog b/debian/changelog
deleted file mode 100644
--- a/debian/changelog
+++ /dev/null
@@ -1,121 +0,0 @@
-haskell-debian (3.61) unstable; urgency=low
-
-  * Uploading to hackage.
-  * Remove crypto++ dependency (it was a mistake.)
-  * Add optimization flag to ghc-options
-  * Reference seereason darcs repo
-
- -- David Fox <dsf@seereason.com>  Thu, 06 Oct 2011 09:04:38 -0700
-
-haskell-debian (3.60) unstable; urgency=low
-
-  * Replace bogus Show instances in Debian.Relation.Common with pretty
-    printing functions.
-  * Change cabal category from System to Debian (to join the dpkg package)
-  * Fix some of the compiler warnings.
-  * Change the Show instances in Debian.Version into pretty printing
-    functions too.
-
- -- David Fox <dsf@seereason.com>  Sun, 25 Sep 2011 07:33:25 -0700
-
-haskell-debian (3.59) unstable; urgency=low
-
-  * Move the cabal-debian program into a separate pacakge.
-
- -- David Fox <dsf@seereason.com>  Sun, 18 Sep 2011 06:43:36 -0700
-
-haskell-debian (3.58-0.2) unstable; urgency=low
-
-  * Remove the --deb-name option, all the package name special cases need
-    to be encoded in the Distribution.Package.Debian.Bundled.debianName function
-    so that we can fix both the names for the package we are building and
-    the names of its dependencies.
-
- -- David Fox <dsf@seereason.com>  Thu, 25 Aug 2011 10:58:11 -0700
-
-haskell-debian (3.58-0.1) unstable; urgency=low
-
-  * Add --deb-name option, which sets the part of the package name between
-    the prefix libghc- and the suffix -dev.
-  * Add --epoch
-  * Add --deb-version
-
- -- David Fox <dsf@seereason.com>  Wed, 24 Aug 2011 20:45:33 -0700
-
-haskell-debian (3.58) unstable; urgency=low
-
-  * Add a --ghc-version option to specify what the ghc version is in the
-    build environment, in case it is different from the one where the
-    autobuilder is being run.  This affects what packages cabal-debian
-    thinks are built into the compiler.  I have non-working code to actually
-    look in the environment for this information, but it depends on having
-    the compiler already installed there.
-  * Greatly sped-up cabal-debian.
-  * Add --build-dep to specify extra build dependencies.
-  * Generate a haskell-packagename-utils deb with all the executables, rather
-    than one deb per executable.
-
- -- David Fox <dsf@seereason.com>  Fri, 19 Aug 2011 08:34:36 -0700
-
-haskell-debian (3.57) unstable; urgency=low
-
-  * Re-order generated dependencies so we are more likely to build
-    with newer packages installed.
-
- -- David Fox <dsf@seereason.com>  Tue, 16 Aug 2011 19:04:29 -0700
-
-haskell-debian (3.56-1) unstable; urgency=low
-
-  * I created a new repository by importing the sid version of
-    haskell-debian-3.55 and then applying my patches.  This is because
-    I don't understand why Marco's repository is so different from the
-    code in sid.  At some point we will get this all sorted out.
-
- -- David Fox <dsf@seereason.com>  Tue, 16 Aug 2011 13:00:15 -0700
-
-haskell-debian (3.55-2) unstable; urgency=low
-
-  * Build against parsec 3
-
- -- Joachim Breitner <nomeata@debian.org>  Mon, 13 Jun 2011 18:13:10 +0200
-
-haskell-debian (3.55-1) unstable; urgency=low
-
-  * Use ghc instead of ghc6
-  * control: Standards-Version: Bump, no changes needed.
-  * control: haskell-debian-utils: Adds Recommends: apt-file.
-  * New upstream version.
-  * patches/dont-build-teste.patch: Update patch to new upstream
-    version.
-  * control: Update dependency on haxml to 1.20.*.
-  * control: Depends on utf8-string.
-
- -- Marco Túlio Gontijo e Silva <marcot@debian.org>  Fri, 03 Jun 2011 22:49:23 -0300
-
-haskell-debian (3.47-3) unstable; urgency=low
-
-  * Re-add dont-build-tests.patch, lost in the previous upload 
-
- -- Joachim Breitner <nomeata@debian.org>  Thu, 24 Jun 2010 19:33:30 +0200
-
-haskell-debian (3.47-2) unstable; urgency=low
-
-  [ Erik de Castro Lopo ]
-  * debian/control: Fix lintian warnings.
-  * Add man pages for apt-get-build-depends, cabal-debian, debian-report and
-    fakechanges.
-  * Add libghc6-debian-doc.doc-base.
-  * Move installation of binaries and man pages from rules file to new file
-    haskell-debian-utils.install.
-
-  [ Joachim Breitner ]
-  * Adjust copyright file per FTP master request. 
-  * Bump haskell-regex-tdfa dependency
-
- -- Joachim Breitner <nomeata@debian.org>  Thu, 24 Jun 2010 09:47:55 +0200
-
-haskell-debian (3.47-1) unstable; urgency=low
-
-  * Initial release.
-
- -- Joachim Breitner <nomeata@debian.org>  Sun, 09 May 2010 19:08:20 +0200
diff --git a/debian/changelog.pre-debian b/debian/changelog.pre-debian
deleted file mode 100644
--- a/debian/changelog.pre-debian
+++ /dev/null
@@ -1,625 +0,0 @@
-haskell-debian (3.53) unstable; urgency=low
-
-  * Changes for unixutils-1.30
-  * Changes for unixutils-1.31
-
- -- David Fox <dsf@seereason.com>  Sun, 26 Dec 2010 09:12:20 -0800
-
-haskell-debian (3.52) unstable; urgency=low
-
-  * Update to work with Cabal 1.10, shipped with ghc7.
-
- -- David Fox <dsf@seereason.com>  Sat, 20 Nov 2010 07:54:52 -0800
-
-haskell-debian (3.51) unstable; urgency=low
-
-  * Remove dependency on haskell-utils, it is no longer in the repository.
-  * Change the doc package prefix generated by cabal-debian from haskell-
-    to libghc6-, this is the prefix chosen by the Debian packaging team.
-    and I believe that if haskell- is used the documentation ends up in
-    a directory in /usr/share/doc with the libghc6- prefix anyway.
-
- -- David Fox <dsf@seereason.com>  Mon, 19 Jul 2010 10:37:39 -0700
-
-haskell-debian (3.50) unstable; urgency=low
-
-  * Switch back to regex-tdfa, regex-posix can't match extended ASCII
-    like "\250" =~ "[\249\250]"
-
- -- David Fox <dsf@seereason.com>  Sun, 18 Jul 2010 22:34:13 +0100
-
-haskell-debian (3.49) unstable; urgency=low
-
-  * Add Show instances.
-
- -- David Fox <dsf@seereason.com>  Fri, 16 Jul 2010 14:35:15 -0700
-
-haskell-debian (3.48) unstable; urgency=low
-
-  * Switch from regex-tdfa to regex-posix to avoid this failure, which
-    seems to have appeared going from 1.1.2 to 1.1.3:
-    "Explict error in module Text.Regex.TDFA.NewDFA : compressOrbit,1"
-
- -- David Fox <dsf@seereason.com>  Fri, 16 Jul 2010 10:43:13 -0700
-
-haskell-debian (3.47) unstable; urgency=low
-
-  * require HaXml < 1.14
-
- -- Jeremy Shaw <jeremy@seereason.com>  Wed, 05 May 2010 14:23:26 -0500
-
-haskell-debian (3.46) unstable; urgency=low
-
-  * Relax the Cabal >= 1.9 requirement by conditionalizing the code
-    that is affected by the change.
-  * Remove the applicative-extras dependency, instead of Failing a
-    use Either [String] a.
-  * Include Joachim Breitner's fixes for the Relation Ord instance.
-  * Do case insensitive field name comparisons in Debian.Control.
-
- -- David Fox <dsf@seereason.com>  Tue, 04 May 2010 11:55:24 -0700
-
-haskell-debian (3.45) unstable; urgency=low
-
-  * Don't require targets to be Show instance in GenBuildDeps.buildable.
-  * Eliminate use of OldException.
-
- -- David Fox <dsf@seereason.com>  Fri, 19 Feb 2010 06:47:04 -0800
-
-haskell-debian (3.44) unstable; urgency=low
-
-  * Add a rule to debian/rules to install the executables.
-
- -- David Fox <dsf@seereason.com>  Thu, 18 Feb 2010 12:16:18 -0800
-
-haskell-debian (3.43) unstable; urgency=low
-
-  * Add a strict version of fileFromURI.
-  * Catch errors thrown by hGetContents when reading control files
-
- -- David Fox <dsf@seereason.com>  Sat, 02 Jan 2010 12:29:45 -0800
-
-haskell-debian (3.42) unstable; urgency=low
-
-  * Fix signature regex so we always split at the first pair of spaces.
-
- -- David Fox <dsf@seereason.com>  Tue, 29 Dec 2009 19:25:27 -0800
-
-haskell-debian (3.41) unstable; urgency=low
-
-  * Use Text.Regex.TDFA for parsing changelog instead of Text.Regex.Compat, it
-    can handle Unicode.
-  * Run unit tests during build, add some changelog unit tests.
-
- -- David Fox <dsf@seereason.com>  Tue, 29 Dec 2009 12:22:40 -0800
-
-haskell-debian (3.40) unstable; urgency=low
-
-  * Remove the now unused Extra.CIO and Debian.Extra.CIO modules
-
- -- David Fox <dsf@seereason.com>  Mon, 14 Sep 2009 09:41:52 -0700
-
-haskell-debian (3.39) unstable; urgency=low
-
-  * Remove dependency on Extra
-  * Remove debian directory from .cabal
-
- -- Jeremy Shaw <jeremy@seereason.com>  Wed, 09 Sep 2009 11:57:03 -0500
-
-haskell-debian (3.38) unstable; urgency=low
-
-  * Use parsec 3
-
- -- Jeremy Shaw <jeremy@seereason.com>  Tue, 28 Jul 2009 19:12:03 -0500
-
-haskell-debian (3.37) unstable; urgency=low
-
-  * Escape the vendor tag before embedding it in a regular expression.
-    (I wrote an escapeForRegex that only escapes +, the character I want
-    to use right now.  This function should be available somewhere in the
-    haskell standard libraries, right?)
-  * Moved the VersionPolicy module to haskell-debian-repo.
-
- -- David Fox <dsf@seereason.com>  Thu, 23 Jul 2009 07:38:00 -0700
-
-haskell-debian (3.36) unstable; urgency=low
-
-  * Make the changelog parser more liberal, allow a tab character at
-    the beginning of a text line instead of two spaces.  This parses
-    the new changelog entry for hscolour.
-
- -- David Fox <dsf@seereason.com>  Tue, 21 Jul 2009 06:45:24 -0700
-
-haskell-debian (3.35) unstable; urgency=low
-
-  * removed dependencies on Extra.HaXml
-  * Updated to base >= 4 && < 5
-  * Fixed test suite
-
- -- Jeremy Shaw <jeremy@seereason.com>  Wed, 01 Jul 2009 09:48:00 -0500
-
-haskell-debian (3.34) unstable; urgency=low
-
-  * cabal-debian: move -doc packages to Build-Depends-Indep
-  * cabal-debian: properly nub Build-Depends and Build-Depends-Indep
-
- -- Jeremy Shaw <jeremy@seereason.com>  Sun, 03 May 2009 12:15:52 -0500
-
-haskell-debian (3.33) unstable; urgency=low
-
-  * cabal-debian: Setion: libdevel -> haskell
-
- -- Jeremy Shaw <jeremy@seereason.com>  Thu, 16 Apr 2009 16:22:35 -0500
-
-haskell-debian (3.32) unstable; urgency=low
-
-  * Add fields to Debian.Changes.ChangedFileSpec for SHA1 and SHA256
-    checksums.
-
- -- David Fox <dsf@seereason.com>  Fri, 03 Apr 2009 07:14:59 -0700
-
-haskell-debian (3.31) unstable; urgency=low
-
-  * update to use newer haskell-devscripts which includes hlibrary.mk
-  * change libghc6-*-doc to haskell-*-doc
-  * move haskell-*-doc to Section: doc
-  * build haskell-*-doc for Architecture 'all' instead of 'any'
-  * make ghc6-doc and haddock Build-Depends-Indep
-  * update Standards-Version to 3.8.1
-  * depend on cdbs and haskell-devscripts instead of haskell-cdbs
-  * only use one space at the beginning of lines in the long description
-  * add ${misc:Depends} to Depends lines
-
- -- Jeremy Shaw <jeremy@seereason.com>  Mon, 23 Mar 2009 20:18:41 -0500
-
-haskell-debian (3.30) unstable; urgency=low
-
-  * Move the modules for dealing with the repository into a new package
-    named haskell-debian-repo.  The cabal-debian tool remains in this
-    package, so this split means that the repo package can change without
-    triggering massive rebuilding due to build dependencies on
-    cabal-debian.
-
- -- David Fox <dsf@seereason.com>  Wed, 18 Feb 2009 06:36:25 -0800
-
-haskell-debian (3.29) unstable; urgency=low
-
-  * Add System.Chroot to list of exported modules
-  * Reduce number of modules loaded by CabalDebian.
-
- -- David Fox <dsf@seereason.com>  Tue, 10 Feb 2009 17:06:47 -0800
-
-haskell-debian (3.28) unstable; urgency=low
-
-  * Add System.Chroot.useEnv, and use it to allow contact with the ssh
-    agent from inside of changeroots.
-
- -- David Fox <dsf@seereason.com>  Mon, 09 Feb 2009 11:18:59 -0800
-
-haskell-debian (3.27) unstable; urgency=low
-
-  * Added apt-get-build-deps. not librarized yet :(
-
- -- Jeremy Shaw <jeremy@seereason.com>  Fri, 06 Feb 2009 18:52:36 -0600
-
-haskell-debian (3.26) unstable; urgency=low
-
-  * Improve the code that decides whether the sources.list has changed,
-    to avoid recreating the build environment as often.
-
- -- David Fox <dsf@seereason.com>  Thu, 05 Feb 2009 08:56:32 -0800
-
-haskell-debian (3.25) unstable; urgency=low
-
-  * Use State monad instead of RWS monad for AptIO
-  * Rename IOState to AptState
-
- -- David Fox <dsf@seereason.com>  Wed, 04 Feb 2009 09:34:24 -0800
-
-haskell-debian (3.24) unstable; urgency=low
-
-  * Use Data.Time instead of System.Time
-  * Fix code to compute the elapsed time for the dpkg-buildpackage.
-  * Restore some generated dependencies that got dropped out of
-    cabal-debian.
-
- -- David Fox <dsf@seereason.com>  Sat, 31 Jan 2009 08:45:51 -0800
-
-haskell-debian (3.23) unstable; urgency=low
-
-  * Eliminate the use of EnvPath in most places, just use a regular
-    path instead.  There were very few places where we actually were
-    inside a changeroot.
-
- -- David Fox <dsf@seereason.com>  Thu, 29 Jan 2009 16:48:23 -0800
-
-haskell-debian (3.22) unstable; urgency=low
-
-  * cabal-debian now has autodetection of ghc6 bundled packages
-
- -- Jeremy Shaw <jeremy@seereason.com>  Thu, 29 Jan 2009 15:26:25 -0600
-
-haskell-debian (3.21) unstable; urgency=low
-
-  * Don't write out postinst and postrm for the doc package, they are
-    now automatically added by haskell-cdbs.
-
- -- David Fox <dsf@seereason.com>  Tue, 27 Jan 2009 10:14:20 -0800
-
-haskell-debian (3.20) unstable; urgency=low
-
-  * Modify the buildable function in GenBuildDeps so it returns more
-    info about the ready packages and what packages each one blocks.
-
- -- David Fox <dsf@seereason.com>  Tue, 27 Jan 2009 06:55:39 -0800
-
-haskell-debian (3.19) unstable; urgency=low
-
-  * Make cabal-debian depend on haskell-cdbs, it used to be the opposite.
-
- -- David Fox <dsf@seereason.com>  Sun, 25 Jan 2009 15:22:41 -0800
-
-haskell-debian (3.18) unstable; urgency=low
-
-  * Modify cabal-debian to it creates debianizations that use the new
-    haskell-cdbs package instead of our modified haskell-devscripts with
-    the cdbs file hlibrary.mk added in.
-  * Have cabal-debian explain what changes it is making to the dependency
-    list.
-
- -- David Fox <dsf@seereason.com>  Sat, 24 Jan 2009 07:27:47 -0800
-
-haskell-debian (3.17) unstable; urgency=low
-
-  * Have cabal-debian --substvar print its result to stderr.
-
- -- David Fox <dsf@seereason.com>  Fri, 23 Jan 2009 10:33:48 -0800
-
-haskell-debian (3.16) unstable; urgency=low
-
-  * Back out register/unregister stuff, just have cabal-debian die if the
-    package doesn't have a library section.
-
- -- David Fox <dsf@seereason.com>  Thu, 22 Jan 2009 15:33:43 -0800
-
-haskell-debian (3.15) unstable; urgency=low
-
-  * Don't leave package registered after computing lbi.
-
- -- David Fox <dsf@seereason.com>  Thu, 22 Jan 2009 14:19:23 -0800
-
-haskell-debian (3.14) unstable; urgency=low
-
-  * Fix a bug that resulted in a fromJust Nothing error.
-
- -- David Fox <dsf@seereason.com>  Thu, 22 Jan 2009 09:59:16 -0800
-
-haskell-debian (3.13) unstable; urgency=low
-
-  * Add the cabal-debian executable to this package to ease bootstrapping.
-
- -- David Fox <dsf@seereason.com>  Fri, 16 Jan 2009 06:41:40 -0800
-
-haskell-debian (3.12) unstable; urgency=low
-
-  * Export some functions and types from Debian.Apt.Index that were
-    already being used by other applications
-  * Allow relation parser to skip empty relations like such as: a, ,c
-
- -- Jeremy Shaw <jeremy@n-heptane.com>  Fri, 09 Jan 2009 18:22:09 -0600
-
-haskell-debian (3.11) unstable; urgency=low
-
-  * Gather code to retrieve the text an URI points to into the Debian.URI
-    module.
-
- -- David Fox <dsf@seereason.com>  Tue, 04 Nov 2008 13:53:33 -0800
-
-haskell-debian (3.10) unstable; urgency=low
-
-  * Change name and arch of doc package.
-
- -- David Fox <dsf@seereason.com>  Sat, 20 Sep 2008 12:07:38 -0700
-
-haskell-debian (3.9) unstable; urgency=low
-
-  * Compute exactly which packages participate in dependency cycles.
-
- -- David Fox <dsf@seereason.com>  Mon, 18 Aug 2008 12:42:56 -0700
-
-haskell-debian (3.8) unstable; urgency=low
-
-  * Don't add an extra newline at the end of the Files section when
-    editing the .changes file.
-
- -- David Fox <dsf@seereason.com>  Mon, 21 Jul 2008 10:57:49 -0700
-
-haskell-debian (3.7) unstable; urgency=low
-
-  * Eliminate all direct uses of TIO, we always use CIO m => so
-    that all functions can be called from the regular IO monad.
-
- -- David Fox <dsf@seereason.com>  Sat, 19 Jul 2008 10:27:49 -0700
-
-haskell-debian (3.6) unstable; urgency=low
-
-  * Remove useless arguments from insertRelease.
-  * Replace debianization
-
- -- David Fox <dsf@seereason.com>  Tue, 01 Jul 2008 10:41:22 -0700
-
-haskell-debian (3.5) unstable; urgency=low
-
-  * Debianization generated by cabal-debian
-
- -- David Fox <dsf@seereason.com>  Sat, 28 Jun 2008 15:49:07 -0700
-
-haskell-debian (3.4) unstable; urgency=low
-
-  * Even correcter code for doing Relax-Depends.  The relaxDeps function
-    is now seperate from the other build depenency functions, which makes
-    things a bit simpler and easier to document.
-
- -- David Fox <dsf@seereason.com>  Wed, 18 Jun 2008 21:00:36 +0000
-
-haskell-debian (3.3) unstable; urgency=low
-
-  * Add code to correctly implement Relax-Depends for non-global
-    dependencies.
-
- -- David Fox <dsf@seereason.com>  Sat, 31 May 2008 07:31:15 +0000
-
-haskell-debian (3.2) unstable; urgency=low
-
-  * Redo the buildable function in GenBuildDeps.
-  * Improve message from OSImage.updateLists.
-
- -- David Fox <dsf@seereason.com>  Sat, 24 May 2008 13:06:09 +0000
-
-haskell-debian (3.1-1) unstable; urgency=low
-
-  * Version number follies.
-
- -- David Fox <dsf@seereason.com>  Thu, 22 May 2008 16:18:47 -0700
-
-haskell-debian (3.1) unstable; urgency=low
-
-  * Re-worked the build dependency computation
-
- -- David Fox <dsf@seereason.com>  Thu, 22 May 2008 10:59:22 -0700
-
-haskell-debian (3.0) unstable; urgency=low
-
-  * Re-organization of module heirarchy.
-
- -- David Fox <dsf@seereason.com>  Mon, 19 May 2008 12:47:25 -0700
-
-haskell-debian (2.28) unstable; urgency=low
-
-  * Eliminate use of haskell-ugly library.
-
- -- David Fox <dsf@seereason.com>  Wed, 14 May 2008 12:30:40 -0700
-
-haskell-debian (2.27) unstable; urgency=low
-
-  * Changes for switch to lazy bytestrings in haskell-unixutils.
-
- -- David Fox <dsf@seereason.com>  Tue, 06 May 2008 05:52:51 -0700
-
-haskell-debian (2.26) unstable; urgency=low
-
-  * Improve error report from "Missing control file or changelog"
-
- -- David Fox <dsf@seereason.com>  Mon, 05 May 2008 05:59:27 -0700
-
-haskell-debian (2.25) unstable; urgency=low
-
-  * Packaging changes for haskell-devscripts 0.6.10.
-
- -- David Fox <dsf@seereason.com>  Sat, 29 Mar 2008 10:25:54 -0700
-
-haskell-debian (2.24) unstable; urgency=low
-
-  * New version of dupload reads both /etc/dupload.conf and ~/.dupload.conf, so
-    we have to explicitly unset $preupload in ~/.dupload.conf.
-
- -- David Fox <dsf@seereason.com>  Tue, 25 Mar 2008 05:49:08 -0700
-
-haskell-debian (2.23) unstable; urgency=low
-
-  * Fix a divide by zero error in Debian.Shell.  This should also improve
-    the behavior of the code that outputs one dot per 128 characters of
-    shell command output.
-
- -- David Fox <dsf@seereason.com>  Wed, 12 Mar 2008 16:55:59 +0000
-
-haskell-debian (2.22) unstable; urgency=low
-
-  * Add a chars/dot argument to Shell.dotOutput
-  * Moved some functions from Shell to haskell-unixutils
-  * Moved TIO module to haskell-extra
-
- -- David Fox <dsf@seereason.com>  Sun, 02 Mar 2008 10:14:13 -0800
-
-haskell-debian (2.21) unstable; urgency=low
-
-  * Change some writeFile calls to avoid lazyness in evaluating the
-    second argument, which appears to lead to locked file errors.
-
- -- David Fox <dsf@seereason.com>  Sun, 24 Feb 2008 11:06:53 -0800
-
-haskell-debian (2.20) unstable; urgency=low
-
-  * Message Improvements
-  * Discard duplicate dependency relations
-  * Fix rfc822DateFormat
-
- -- Jeremy Shaw <jeremy@n-heptane.com>  Wed, 20 Feb 2008 13:34:34 -0800
-
-haskell-debian (2.19) unstable; urgency=low
-
-  * Added more functions for working with index files
-
- -- Jeremy Shaw <jeremy@n-heptane.com>  Tue, 19 Feb 2008 16:07:46 -0800
-
-haskell-debian (2.18) unstable; urgency=low
-
-  * Hack: Debian.Local.Insert.addPackagesToIndexes work-around for optimizer bug
-  * Debian.Package: use controlFromIndex instead of calling zcat
-
- -- Jeremy Shaw <jeremy@n-heptane.com>  Mon, 11 Feb 2008 23:08:30 -0800
-
-haskell-debian (2.17) unstable; urgency=low
-
-  * TIO module fixes and cleanups.
-
- -- David Fox <dsf@seereason.com>  Thu, 07 Feb 2008 05:45:00 -0800
-
-haskell-debian (2.16) unstable; urgency=low
-
-  * Add setRepoMap to install cached repository info
-  * Print more info about what happened when a repository appears not to exist.
-
- -- David Fox <ddssff@gmail.com>  Wed, 06 Feb 2008 16:00:45 -0800
-
-haskell-debian (2.15) unstable; urgency=low
-
-  * Fix bug in Debian.VersionPolicy
-  * Split a simple TIO monad out of the AptIO monad.
-  * Simplify Repository type, eliminate parameterized Release etc.
-  * Improve type safety of the SourcesList related types
-
- -- David Fox <ddssff@gmail.com>  Wed, 06 Feb 2008 05:38:12 -0800
-
-haskell-debian (2.14) unstable; urgency=low
-
-  * Rewrite of Debian.VersionPolicy.
-  * Run unit tests during build
-
- -- David Fox <ddssff@gmail.com>  Mon, 28 Jan 2008 13:07:00 -0800
-
-haskell-debian (2.13) unstable; urgency=low
-
-  * Improvements in code currently used to compute the build dependencies.
-    This allows builds of packages which previously caused an combinatoric
-    explosion in memory and time use.  The specific modifications are to
-    avoid making a huge list of all the solution candidates that failed,
-    and to put the relations into a normal form which only involves equals
-    dependencies on packages that are actually available for installation.
-    Finally, a bug in handling of architecture specific dependencies was
-    fixed which might have been causing the extremely long and fruitless
-    searches for some packages' build dependencies.
-
- -- David Fox <ddssff@gmail.com>  Sat, 19 Jan 2008 19:28:32 +0000
-
-haskell-debian (2.12) unstable; urgency=low
-
-  * Add Debian.Apt.Dependecies and Debian.Apt.Package to debian.cabal
-
- -- Jeremy Shaw <jeremy.shaw@linspireinc.com>  Fri, 18 Jan 2008 17:13:24 -0800
-
-haskell-debian (2.11) unstable; urgency=low
-
-  * Added trump detector
-  * Added code to find parents and siblings of a binary package from the
-    Packages/Sources files
-  * Packaging updates
-
- -- Jeremy Shaw <jeremy.shaw@linspireinc.com>  Fri, 14 Dec 2007 13:55:20 -0800
-
-haskell-debian (2.10) unstable; urgency=low
-
-  * Added new interface, Apt.Debian.Methods.fetch which allows the UI
-    portion of fetching (status, authentication), to be controlled by
-    providing a set of callback functions.
-
- -- Jeremy Shaw <jeremy.shaw@linspireinc.com>  Tue, 20 Nov 2007 14:07:43 -0800
-
-haskell-debian (2.9) unstable; urgency=low
-
-  * Add caching of loaded package indexes based on the path and the
-    file status of the cached index file.  Also splits Debian.Types
-    into several modules.
-
- -- David Fox <dsf@seereason.org>  Fri,  9 Nov 2007 11:05:11 -0800
-
-haskell-debian (2.8) unstable; urgency=low
-
-  * Last version had bogus dependencies due to an unknown build error.
-    Make loading of package indexes less lazy in an attempt to reduce
-    memory usage.
-
- -- David Fox <dsf@seereason.org>  Wed,  7 Nov 2007 10:54:27 -0800
-
-haskell-debian (2.7) unstable; urgency=low
-
-  * Make loading of package indexes lazy.
-
- -- David Fox <dsf@seereason.org>  Mon, 22 Oct 2007 11:11:34 -0700
-
-haskell-debian (2.6) unstable; urgency=low
-
-  * Pass --immediate-configure-false to build-env so we can create
-    environments for gutsy, lenny, and sid.
-
- -- David Fox <dsf@seereason.org>  Sat, 20 Oct 2007 16:17:59 -0700
-
-haskell-debian (2.5) unstable; urgency=low
-
-  * Reduce amount of apt-get updating that occurs.
-
- -- David Fox <ddssff@gmail.com>  Sat, 20 Oct 2007 13:50:25 +0000
-
-haskell-debian (2.4) unstable; urgency=low
-
-  * Fix parsing of version tags in VersionPolicy.  It was always failing
-    and therefore not understanding versions we had generated.
-
- -- David Fox <ddssff@gmail.com>  Sat, 13 Oct 2007 04:44:39 -0700
-
-haskell-debian (2.3) unstable; urgency=low
-
-  * The EnvPath and EnvRoot types had show methods that were not
-    invertable by read.  Now they use deriving Show, and use rootPath
-    and the new outsidePath to convert EnvRoot and EnvPath to the
-    FilePath type.  This is a big looking change, but safe.
-  * Replace code that looked at the "Package" and "Version" fields
-    of a parsed control file with calls to packageName and
-    packageVersion, which just returns values already computed and
-    saved in the Package object.
-  * Use EnvPath instead of FilePath in places where it makes sense, such
-    as the copyDebianBuildTree and other places in Debian.SourceTree.
-    This change propagated down in various places, and the cutoff may be
-    a little out of whack in some places, but it is all typesafe (and
-    therefore wonderful?)
-
- -- David Fox <ddssff@gmail.com>  Thu, 11 Oct 2007 15:43:03 +0000
-
-haskell-debian (2.2) unstable; urgency=low
-
-  * Fix a bug in parsing of dependency relations when there is
-    whitespace after a right square brace.
-
- -- David Fox <ddssff@gmail.com>  Tue,  9 Oct 2007 21:00:24 +0000
-
-haskell-debian (2.1) unstable; urgency=low
-
-  * Fix show method of SliceList, the elements need to be
-    terminated by newlines.
-
- -- David Fox <ddssff@gmail.com>  Fri,  5 Oct 2007 00:11:33 -0700
-
-haskell-debian (2.0) unstable; urgency=low
-
-  * Change Apt. to Debian.
-  * Added Debian.Apt.Methods
-  * Added Debian.Deb
-  * Added Debian.Time
-
- -- Jeremy Shaw <jeremy.shaw@linspire.com>  Wed, 19 Sep 2007 15:14:10 -0700
-
-haskell-apt (1.0) unstable; urgency=low
-
-  * Initial Debian package.
-
- -- David Fox <ddssff@gmail.com>  Tue, 18 Sep 2007 09:33:24 -0700
diff --git a/debian/compat b/debian/compat
deleted file mode 100644
--- a/debian/compat
+++ /dev/null
@@ -1,1 +0,0 @@
-7
diff --git a/debian/control b/debian/control
deleted file mode 100644
--- a/debian/control
+++ /dev/null
@@ -1,135 +0,0 @@
-Source: haskell-debian
-Section: haskell
-Priority: extra
-Maintainer: Debian Haskell Group <pkg-haskell-maintainers@lists.alioth.debian.org>
-Uploaders: Joachim Breitner <nomeata@debian.org>
-Build-Depends: debhelper (>= 7)
-  , cdbs
-  , haskell-devscripts (>= 0.7)
-  , ghc
-  , ghc-prof
-  , libghc-mtl-dev
-  , libghc-mtl-prof
-  , libghc-parsec3-dev
-  , libghc-parsec3-prof
-  , libghc-regex-compat-dev
-  , libghc-regex-compat-prof
-  , libghc-regex-tdfa-dev (>= 1.1.3)
-  , libghc-regex-tdfa-prof
-  , libghc-bzlib-dev (>= 0.5.0.0-4)
-  , libghc-bzlib-prof
-  , libghc-haxml-prof (>= 1:1.20)
-  , libghc-unixutils-dev (>= 1.41)
-  , libghc-unixutils-prof (>= 1.41)
-  , libghc-zlib-dev
-  , libghc-zlib-prof
-  , libghc-network-dev
-  , libghc-network-prof
-  , libghc-utf8-string-dev
-  , libghc-utf8-string-prof,
-  , libcrypto++-dev
-Build-Depends-Indep: ghc-doc
-  , libghc-mtl-doc
-  , libghc-parsec3-doc
-  , libghc-regex-compat-doc
-  , libghc-regex-tdfa-doc
-  , libghc-bzlib-doc
-  , libghc-haxml-doc (>= 1:1.20)
-  , libghc-unixutils-doc (>= 1.41)
-  , libghc-zlib-doc
-  , libghc-network-doc
-  , libghc-utf8-string-doc
-Build-Conflicts:
-  libghc-parsec2-dev
-Standards-Version: 3.9.2
-Homepage: http://hackage.haskell.org/package/debian
-Vcs-Darcs: http://darcs.debian.org/pkg-haskell/haskell-debian
-Vcs-Browser: http://darcs.debian.org/cgi-bin/darcsweb.cgi?r=pkg-haskell/haskell-debian
-
-Package: libghc-debian-dev
-Architecture: any
-Depends: ${haskell:Depends}
-  , ${shlibs:Depends}
-  , ${misc:Depends}
-Recommends: ${haskell:Recommends}
-Suggests: ${haskell:Suggests}
-Provides: ${haskell:Provides}
-Description: Haskell library for working with the Debian package system
- This package provides a library for the Haskell programming language.
- See http://www.haskell.org/ for more information on Haskell.
- .
- This library includes modules covering almost every aspect of the Debian
- packaging system, including low level data types such as version numbers
- and dependency relations, on up to the types necessary for computing and
- installing build dependencies, building source and binary packages,
- and inserting them into a repository.
- .
- This package contains the libraries compiled for GHC 6.
-
-Package: libghc-debian-prof
-Architecture: any
-Depends: ${haskell:Depends}
-  , ${shlibs:Depends}
-  , ${misc:Depends}
-Recommends: ${haskell:Recommends}
-Suggests: ${haskell:Suggests}
-Provides: ${haskell:Provides}
-Description: Profiling library for working with the Debian package system
- This package provides a library for the Haskell programming language,
- compiled for profiling.
- See http://www.haskell.org/ for more information on Haskell.
- .
- This library includes modules covering almost every aspect of the Debian
- packaging system, including low level data types such as version numbers
- and dependency relations, on up to the types necessary for computing and
- installing build dependencies, building source and binary packages,
- and inserting them into a repository.
- .
- This package contains the profiling libraries compiled for GHC 6.
-
-Package: libghc-debian-doc
-Section: doc
-Architecture: all
-Depends: ${misc:Depends}, ${haskell:Depends}
-Recommends: ${haskell:Recommends}
-Suggests: ${haskell:Suggests}
-Description: Documentation for Debian package system library
- This package provides the documentation for a library for the Haskell
- programming language.
- See http://www.haskell.org/ for more information on Haskell.
- .
- This library includes modules covering almost every aspect of the Debian
- packaging system, including low level data types such as version numbers
- and dependency relations, on up to the types necessary for computing and
- installing build dependencies, building source and binary packages,
- and inserting them into a repository.
- .
- This package contains the library documentation.
-
-Package: haskell-debian-utils
-Section: devel
-Architecture: any
-Depends: ghc, ${misc:Depends}, ${shlibs:Depends}
-Recommends: apt-file
-Description: Various helpers to work with Debian packages
- This package contains tools shipped with the Haskell library “debian”:
- .
-   * fakechanges:
-     Sometimes you have the .debs, .dsc, .tar.gz, .diff.gz, etc from a package
-     build, but not the .changes file. This package lets you create a fake
-     .changes file in case you need one.
- .
-   * debian-report:
-     Analyze Debian repositories and generate reports about their contents and
-     relations. For example, a list of all packages in a distribution that are
-     trumped by another distribution.
- .
-   * cabal-debian:
-     Tool for creating debianizations of Haskell packages based on the .cabal
-     file.  If apt-file is installed it will use it to discover what is the
-     debian package name of a C library.
- .
-   * apt-get-build-depends:
-     Tool which will parse the Build-Depends{-Indep} lines from debian/control
-     and apt-get install the required packages
-
diff --git a/debian/debian-report.1 b/debian/debian-report.1
deleted file mode 100644
--- a/debian/debian-report.1
+++ /dev/null
@@ -1,20 +0,0 @@
-.\"Original page generated by txt2man and then hacked extensively.
-.TH DEBIAN-REPORT 1  "May 10, 2010"
-
-.SH NAME
-debian-report \- report differences in packages referenced by two sources.list
-files.
-
-.SH SYNOPSIS
-.B debian-report
-.RI "<old sources.list> <new sources.list>"
-
-.SH DESCRIPTION
-debian-report is given two Debain sources.list files as arguments and will
-find all the packages referenced by the second which trump packages found in
-the first.
-
-.SH AUTHOR
-This manual page was originally written by Erik de Castro Lopo 
-<erikd@mega-nerd.com> for the Debian GNU/Linux system (but may be used by 
-others).
diff --git a/debian/fakechanges.1 b/debian/fakechanges.1
deleted file mode 100644
--- a/debian/fakechanges.1
+++ /dev/null
@@ -1,17 +0,0 @@
-.TH FAKECHANGES 1  "May 10, 2010"
-
-.SH NAME
-fakechanges \- reverse engineer a Debian .changes file.
-
-.SH SYNOPSIS
-.B fakechanges
-.RI "[OPTION]  files..."
-
-.SH DESCRIPTION
-fakechanges can reverse engineer the .changes file from the .debs, .dsc,
- .tar.gz, .diff.gz, etc from a package build.
-
-.SH AUTHOR
-This manual page was originally written by Erik de Castro Lopo 
-<erikd@mega-nerd.com> for the Debian GNU/Linux system (but may be used by 
-others).
diff --git a/debian/haskell-debian-utils.install b/debian/haskell-debian-utils.install
deleted file mode 100644
--- a/debian/haskell-debian-utils.install
+++ /dev/null
@@ -1,3 +0,0 @@
-dist-ghc/build/apt-get-build-depends/apt-get-build-depends		usr/bin/
-dist-ghc/build/debian-report/debian-report						usr/bin/
-dist-ghc/build/fakechanges/fakechanges							usr/bin/
diff --git a/debian/haskell-debian-utils.manpages b/debian/haskell-debian-utils.manpages
deleted file mode 100644
--- a/debian/haskell-debian-utils.manpages
+++ /dev/null
@@ -1,1 +0,0 @@
-debian/*.1
diff --git a/debian/libghc-debian-doc.doc-base b/debian/libghc-debian-doc.doc-base
deleted file mode 100644
--- a/debian/libghc-debian-doc.doc-base
+++ /dev/null
@@ -1,13 +0,0 @@
-Document: libghc-debian-doc
-Title: Manual for the Haskell Debian library
-Abstract:  This library includes modules covering almost every aspect of the
- Debian packaging system, including low level data types such as version
- numbers and dependency relations, on up to the types necessary for computing
- and installing build dependencies, building source and binary packages,
- and inserting them into a repository.
-Section: Programming
-
-Format: HTML
-Index: /usr/share/doc/libghc-debian-doc/html/doc-index.html
-Files: /usr/share/doc/libghc-debian-doc/html/*.html
- /usr/share/doc/libghc-debian-doc/html/src/*.html
diff --git a/debian/patches/dont-build-tests.patch b/debian/patches/dont-build-tests.patch
deleted file mode 100644
--- a/debian/patches/dont-build-tests.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-Index: debian-3.55/debian.cabal
-===================================================================
---- debian-3.55.orig/debian.cabal	2011-06-03 21:02:01.000000000 -0300
-+++ debian-3.55/debian.cabal	2011-06-03 21:03:43.000000000 -0300
-@@ -22,7 +22,7 @@
- Library
-  Build-Depends:  base >= 4 && < 5, bytestring, containers, directory,
-                  filepath, mtl, network, old-locale, parsec >= 2 && <4, pretty, process,
--                 regex-tdfa, regex-compat, time, unix, bzlib, HaXml == 1.20.*, Unixutils >= 1.32, zlib, HUnit,
-+                 regex-tdfa, regex-compat, time, unix, bzlib, HaXml == 1.20.*, Unixutils >= 1.32, zlib,
-                  utf8-string
-  ghc-options: -W -Wall
-  if flag(cabal19)
-@@ -65,11 +65,7 @@
-         Distribution.Package.Debian.Bundled,
-         Distribution.Package.Debian.Setup,
-         Distribution.Package.Debian.Main,
--        Distribution.Package.Debian,
--        Test.Changes,
--        Test.Dependencies,
--        Test.SourcesList,
--        Test.Versions
-+        Distribution.Package.Debian
- 
- Executable fakechanges
-  Main-is: utils/FakeChanges.hs
diff --git a/debian/patches/series b/debian/patches/series
deleted file mode 100644
--- a/debian/patches/series
+++ /dev/null
@@ -1,1 +0,0 @@
-dont-build-tests.patch
diff --git a/debian/rules b/debian/rules
deleted file mode 100644
--- a/debian/rules
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/usr/bin/make -f
-
-DEB_BUILD_DEPENDENCIES = build-arch
-
-include /usr/share/cdbs/1/rules/debhelper.mk
-include /usr/share/cdbs/1/class/hlibrary.mk
-
-
diff --git a/debian/watch b/debian/watch
deleted file mode 100644
--- a/debian/watch
+++ /dev/null
@@ -1,5 +0,0 @@
-version=3
-opts="downloadurlmangle=s|archive/([\w\d_-]+)/([\d\.]+)/|archive/$1/$2/$1-$2.tar.gz|,\
-filenamemangle=s|(.*)/$|debian-$1.tar.gz|" \
-    http://hackage.haskell.org/packages/archive/debian \
-    ([\d\.]*\d)/
diff --git a/utils/AptGetBuildDeps.hs b/utils/AptGetBuildDeps.hs
--- a/utils/AptGetBuildDeps.hs
+++ b/utils/AptGetBuildDeps.hs
@@ -1,42 +1,41 @@
 module Main where
 
-import Control.Monad
-import Data.ByteString.Char8 (ByteString)
 import Debian.Control  -- (Control(..),lookupP,parseControlFromFile)
 import Debian.Relation
 import System.Process
 import System.Exit
 import System.Environment
 
-lookupBuildDeps :: FilePath -> IO [PkgName]
+lookupBuildDeps :: FilePath -> IO [BinPkgName]
 lookupBuildDeps fp =
     do control <- parseControlFromFile fp
-       case control of 
+       case control of
          (Left e) -> error (show e)
+         (Right (Control [])) -> error "Empty control file"
          (Right (Control (p:_))) ->
              return $ ((lookupDepends "Build-Depends" p) ++
                        (lookupDepends "Build-Depends-Indep" p))
 
-lookupDepends :: String -> Paragraph' String -> [PkgName]
-lookupDepends key paragraph = 
+lookupDepends :: String -> Paragraph' String -> [BinPkgName]
+lookupDepends key paragraph =
     case fieldValue key paragraph of
                 Nothing -> [] -- (Left $ "could not find key " ++ key)
-                (Just relationString) -> 
+                (Just relationString) ->
                     case parseRelations relationString of
                       (Left e) -> error (show e)
                       (Right andRelations) ->
                           map pkgName (concatMap (take 1) andRelations)
     where
-      pkgName :: Relation -> PkgName
+      pkgName :: Relation -> BinPkgName
       pkgName (Rel name _ _) = name
 
 
-aptGetInstall :: [String] -> [PkgName] -> IO ExitCode
+aptGetInstall :: [String] -> [BinPkgName] -> IO ExitCode
 aptGetInstall options pkgnames =
     do (_,_,_,ph)
-         <- createProcess $ proc "apt-get" $ ["install"] ++ options ++ pkgnames
+         <- createProcess $ proc "apt-get" $ ["install"] ++ options ++ map (unPkgName . unBinPkgName) pkgnames
        waitForProcess ph
-       
+
 main :: IO ()
 main
   = do
