diff --git a/Setup.hs b/Setup.hs
--- a/Setup.hs
+++ b/Setup.hs
@@ -1,14 +1,18 @@
 #!/usr/bin/runhaskell
 
+import Control.Exception (try)
 import Control.Monad (when)
 import Distribution.Simple
 import Distribution.Simple.LocalBuildInfo (LocalBuildInfo(buildDir))
 import Distribution.Simple.Program
+import GHC.IO.Exception (IOException(ioe_type), IOErrorType(InvalidArgument, NoSuchThing))
+import System.Posix.Files (readSymbolicLink, createSymbolicLink)
 import System.Process
 import System.Directory
 import System.Exit
 
 main =
+    ensureSymbolicLink "../debian-haskell" "debian-haskell" >>
     defaultMainWithHooks simpleUserHooks
        { preSDist = \ a b -> copyFile "debian/changelog" "changelog" >> preSDist simpleUserHooks a b }
 
@@ -16,4 +20,24 @@
     system (buildDir lbi ++ "/cabal-debian-tests/cabal-debian-tests") >>= \ code ->
     if code == ExitSuccess then return () else error "unit test failure"
 
-
+-- Do all we can to create or update a symbolic link - remove any
+-- existing file or directory and verify the link contents.
+ensureSymbolicLink destination location = do
+  result <- try (readSymbolicLink location)
+  case result of
+    Right destination' | destination' == destination -> return ()
+    Right _ -> remove location >> ensureSymbolicLink destination location
+    Left e -> case ioe_type e of
+                InvalidArgument -> remove location >> ensureSymbolicLink destination location
+                NoSuchThing -> createSymbolicLink destination location
+                _ -> error $ "ensureSymbolicLink " ++ show destination ++ " " ++ show location ++ " -> " ++ show e
+    where
+      remove path =
+          do fileExists <- doesFileExist path
+             case fileExists of
+               True -> removeFile path
+               False -> do
+                 dirExists <- doesDirectoryExist path
+                 case dirExists of
+                   True -> removeDirectoryRecursive path
+                   False -> return ()
diff --git a/Tests.hs b/Tests.hs
--- a/Tests.hs
+++ b/Tests.hs
@@ -16,27 +16,28 @@
 import Data.Maybe (fromMaybe)
 import Data.Monoid ((<>), mconcat, mempty)
 import Data.Set as Set (fromList, singleton, union)
-import Data.Text as Text (intercalate, lines, split, Text, unlines, unpack)
+import Data.Text as Text (intercalate, lines, split, Text, unlines, pack, unpack)
 import Data.Version (Version(Version, versionBranch))
 import Debian.Changes (ChangeLog(..), ChangeLogEntry(..), parseEntry)
 import Debian.Debianize.DebianName (mapCabal, splitCabal)
 import Debian.Debianize.Files (debianizationFileMap)
 import Debian.Debianize.Finalize (debianization, finalizeDebianization')
 import Debian.Debianize.Goodies (doBackups, doExecutable, doServer, doWebsite, makeRulesHead, tightDependencyFixup)
-import Debian.Debianize.Input (inputChangeLog, inputDebianization)
+import Debian.Debianize.Input (inputChangeLog, inputDebianization, inputCabalization)
 import Debian.Debianize.Monad (DebT, evalDebT, execDebM, execDebT)
-import Debian.Debianize.Prelude ((%=), (+++=), (++=), (+=), (~=), withCurrentDirectory)
+import Debian.Debianize.Prelude ((%=), (++=), (+=), (~=), withCurrentDirectory)
 import Debian.Debianize.Types as T
 import Debian.Debianize.Types.Atoms as T
 import qualified Debian.Debianize.Types.BinaryDebDescription as B
+import Debian.Debianize.Types.CopyrightDescription
 import qualified Debian.Debianize.Types.SourceDebDescription as S
 import Debian.Debianize.VersionSplits (DebBase(DebBase))
 import Debian.Pretty (ppDisplay)
-import Debian.Policy (databaseDirectory, PackageArchitectures(All), PackagePriority(Extra), parseMaintainer, Section(MainSection), SourceFormat(Native3), StandardsVersion(..), getDebhelperCompatLevel, getDebianStandardsVersion)
+import Debian.Policy (databaseDirectory, PackageArchitectures(All), PackagePriority(Extra), parseMaintainer, Section(MainSection), SourceFormat(Native3), StandardsVersion(..), getDebhelperCompatLevel, getDebianStandardsVersion, License(..))
 import Debian.Relation (BinPkgName(..), Relation(..), SrcPkgName(..), VersionReq(..))
 import Debian.Release (ReleaseName(ReleaseName, relName))
 import Debian.Version (parseDebianVersion, buildDebianVersion)
-import Distribution.Compiler (CompilerId(..), CompilerFlavor(GHC))
+import Distribution.Compiler (CompilerFlavor(GHC))
 import Distribution.License (License(..))
 import Distribution.Package (PackageName(PackageName))
 import Prelude hiding (log)
@@ -64,15 +65,6 @@
     where
       ghc763 :: Atoms -> Atoms
       ghc763 atoms = setL T.compilerFlavors (singleton GHC) atoms
-{-
-#if MIN_VERSION_Cabal(1,21,0)
-          let CompilerId flavor version _ = getL ghcVersion_ atoms in
-          atoms {ghcVersion_ = CompilerId flavor (version {versionBranch = [7, 6, 3]}) Nothing}
-#else
-          let CompilerId flavor version = ghcVersion_ atoms in
-          atoms {ghcVersion_ = CompilerId flavor (version {versionBranch = [7, 6, 3]})}
-#endif
--}
 
 -- | Create a Debianization based on a changelog entry and a license
 -- value.  Uses the currently installed versions of debhelper and
@@ -104,8 +96,23 @@
                                                    test7 "test7 - debian/Debianize.hs",
                                                    test8 "test8 - test-data/artvaluereport-data",
                                                    test9 "test9 - test-data/alex",
-                                                   test10 "test10 - test-data/archive"])
+                                                   test10 "test10 - test-data/archive" {- ,
+                                                   issue23 "issue23" -}])
 
+issue23 :: String -> Test
+issue23 label =
+    TestLabel label $
+    TestCase (do atoms <- testAtoms
+                 actual <- withCurrentDirectory "test-data/alex/input" $
+                           evalDebT (do inputCabalization
+                                        T.changelog ~= Just (ChangeLog [testEntry])
+                                        T.compat ~= Just 9
+                                        T.official ~= True
+                                        Map.toList <$> debianizationFileMap) atoms
+                 assertEqual label
+                   []
+                   actual)
+
 test1 :: String -> Test
 test1 label =
     TestLabel label $
@@ -116,7 +123,7 @@
                           (do -- let top = Top "."
                               defaultAtoms
                               newDebianization (ChangeLog [testEntry]) level standards
-                              license ~= Just BSD3
+                              copyright %= (\ c -> c { _summaryLicense = Just BSD_3_Clause })
                               -- inputCabalization top
                               finalizeDebianization')
                           atoms
@@ -134,7 +141,7 @@
                                                 , "include /usr/share/cdbs/1/rules/debhelper.mk"
                                                 , "include /usr/share/cdbs/1/class/hlibrary.mk" ])))
                 compat ~= Just 9 -- This will change as new version of debhelper are released
-                license ~= Just BSD3
+                copyright %= (\ c -> c { _summaryLicense = Just BSD_3_Clause })
                 T.source ~= Just (SrcPkgName {unSrcPkgName = "haskell-cabal-debian"})
                 T.maintainer ~= Just (NameAddr (Just "David Fox") "dsf@seereason.com")
                 T.standardsVersion ~= Just (StandardsVersion 3 9 3 (Just 1)) -- This will change as new versions of debian-policy are released
@@ -163,7 +170,7 @@
                           (do -- let top = Top "."
                               defaultAtoms
                               newDebianization (ChangeLog [testEntry]) level standards
-                              license ~= Just BSD3
+                              copyright %= (\ c -> c { _summaryLicense = Just BSD_3_Clause })
                               -- inputCabalization top
                               finalizeDebianization')
                           atoms
@@ -180,7 +187,7 @@
                                                  "include /usr/share/cdbs/1/rules/debhelper.mk",
                                                  "include /usr/share/cdbs/1/class/hlibrary.mk"])))
                 compat ~= Just 9
-                license ~= Just BSD3
+                copyright %= (\ c -> c { _summaryLicense = Just BSD_3_Clause })
                 T.source ~= Just (SrcPkgName {unSrcPkgName = "haskell-cabal-debian"})
                 T.maintainer ~= Just (NameAddr {nameAddr_name = Just "David Fox", nameAddr_addr = "dsf@seereason.com"})
                 T.standardsVersion ~= Just (StandardsVersion 3 9 3 (Just 1))
@@ -272,7 +279,7 @@
                                                     "",
                                                     ""])
                 T.compat ~= Just 7
-                T.copyright ~= Just "This package was debianized by John Goerzen <jgoerzen@complete.org> on\nWed,  6 Oct 2004 09:46:14 -0500.\n\nCopyright information removed from this test data.\n\n"
+                T.copyright %= \ c -> c { _summaryComment = Just "This package was debianized by John Goerzen <jgoerzen@complete.org> on\nWed,  6 Oct 2004 09:46:14 -0500.\n\nCopyright information removed from this test data.\n" }
                 T.source ~= Just (SrcPkgName {unSrcPkgName = "haskell-devscripts"})
                 T.maintainer ~= Just (NameAddr {nameAddr_name = Just "Debian Haskell Group", nameAddr_addr = "pkg-haskell-maintainers@lists.alioth.debian.org"})
                 T.uploaders ~= [NameAddr {nameAddr_name = Just "Marco Silva", nameAddr_addr = "marcot@debian.org"},NameAddr {nameAddr_name = Just "Joachim Breitner", nameAddr_addr = "nomeata@debian.org"}]
@@ -573,14 +580,14 @@
 test6 :: String -> Test
 test6 label =
     TestLabel label $
-    TestCase (do result <- readProcessWithExitCode "runhaskell" ["-isrc", "-DMIN_VERSION_Cabal(1,18,0)", "test-data/artvaluereport2/input/debian/Debianize.hs"] ""
+    TestCase (do result <- readProcessWithExitCode "runhaskell" ["-isrc", "-DMIN_VERSION_Cabal(a,b,c)=1", "test-data/artvaluereport2/input/debian/Debianize.hs"] ""
                  assertEqual label (ExitSuccess, "", "") result)
 
 test7 :: String -> Test
 test7 label =
     TestLabel label $
-    TestCase (do new <- readProcessWithExitCode "runhaskell" ["-isrc", "debian/Debianize.hs"] ""
-                 assertEqual label (ExitSuccess, "", "Ignored: ./debian/cabal-debian.1\nIgnored: ./debian/cabal-debian.manpages\n") new)
+    TestCase (do new <- readProcessWithExitCode "runhaskell" ["-isrc", "-DMIN_VERSION_Cabal(a,b,c)=1", "debian/Debianize.hs"] ""
+                 assertEqual label (ExitSuccess, "", "Ignored: debian/cabal-debian.1\nIgnored: debian/cabal-debian.manpages\n") new)
 
 test8 :: String -> Test
 test8 label =
diff --git a/cabal-debian.cabal b/cabal-debian.cabal
--- a/cabal-debian.cabal
+++ b/cabal-debian.cabal
@@ -1,5 +1,5 @@
 Name:           cabal-debian
-Version:        4.17.5
+Version:        4.19.1
 License:        BSD3
 License-File:   debian/copyright
 Author:         David Fox <dsf@seereason.com>
@@ -7,7 +7,14 @@
 Maintainer:     David Fox <dsf@seereason.com>
 Homepage:       https://github.com/ddssff/cabal-debian
 Build-Type:     Simple
-Synopsis:       Create a debianization for a cabal package
+Synopsis:       Create a Debianization for a Cabal package
+Description:
+ This package supports the generation of a package Debianization (i.e.
+ the files in the @debian@ subdirectory) for a cabal package,
+ either through a library API or using the cabal-debian executable.
+ For documentation of the executable, run
+ @cabal-debian --help@, for documentation of the library API follow
+ the link to the @Debian.Debianize@ module below.
 Cabal-Version: >= 1.8
 Extra-Source-Files:
   changelog
@@ -82,7 +89,6 @@
   test-data/artvaluereport-data/output/debian/watch
   test-data/artvaluereport-data/output/debian/extra-depends
   test-data/artvaluereport-data/output/debian/changelog
-  test-data/artvaluereport-data/output/debian/libghc-artvaluereport-data-doc.links
   test-data/artvaluereport-data/output/debian/Debianize.hs
   test-data/artvaluereport-data/output/debian/rules
   test-data/artvaluereport-data/output/debian/compat
@@ -127,27 +133,15 @@
   test-data/artvaluereport2/output/debian/artvaluereport2-backups.install
   test-data/artvaluereport2/output/debian/copyright
 
-Description:
- This package provides two methods for generating the debianization
- (i.e. the contents of the 'debian' subdirectory) for a cabal package.
- An executable named cabal-debian, and a library API to handle more
- complex packaging issues.  For documentation of the executable run
- @cabal-debian --help@, for documentation of the library API follow
- the link to the @Debian.Debianize@ module below.
-
 Flag tests
   Description: enable the unit test executable (disabled by default because it has a lot of wacky dependencies.)
   Default: False
   Manual: True
 
-Flag ghcjs-support
-  Description: Pulls in Cabal-1.21, which includes support for the ghcjs compiler.
-  Default: True
-
--- flag local-debian
---   Description: Link directly to the source of the debian library
---   Default: False
---   Manual: True
+flag local-debian
+  Description: Link directly to the source of the debian library
+  Default: False
+  Manual: True
 
 Source-Repository head
   type: git
@@ -158,6 +152,7 @@
  GHC-Options: -Wall -O2
  Build-Depends:
    base < 5,
+   Cabal >= 1.9,
    containers,
    data-lens,
    data-lens-template,
@@ -169,6 +164,7 @@
    HUnit,
    memoize,
    mtl,
+   network-uri,
    parsec >= 3,
    pretty,
    prettyclass,
@@ -181,10 +177,6 @@
    unix,
    Unixutils,
    utf8-string
- if flag(ghcjs-support)
-   Build-Depends: Cabal >= 1.21
- else
-   Build-Depends: Cabal >= 1.9 && < 1.21
  Exposed-Modules:
    Data.Algorithm.Diff.Context
    Data.Algorithm.Diff.Pretty
@@ -210,32 +202,35 @@
    Debian.Debianize.Types
    Debian.Debianize.Types.Atoms
    Debian.Debianize.Types.BinaryDebDescription
+   Debian.Debianize.Types.CopyrightDescription
    Debian.Debianize.Types.SourceDebDescription
    Debian.Debianize.VersionSplits
  Other-Modules:
    Debian.Orphans
---  if flag(local-debian)
---    Hs-Source-Dirs: ., ../../haskell-debian
---    Build-Depends: regex-compat, bytestring, process-listlike, network, old-locale, time
---  else
- Build-depends: debian >= 3.84
+ if flag(local-debian)
+   Hs-Source-Dirs: debian-haskell
+   Build-Depends: bytestring, exceptions, ListLike, network, network-uri, old-locale, process-extras, regex-compat, template-haskell, time
+ else
+   Build-depends: debian >= 3.85
 
 Executable cabal-debian
  Hs-Source-Dirs: .
  Main-is: CabalDebian.hs
  ghc-options: -threaded -Wall -O2
- Build-Depends: base, cabal-debian, data-lens, mtl, pretty
- if flag(ghcjs-support)
-   Build-Depends: Cabal >= 1.21
+ Build-Depends: base, Cabal >= 1.9, data-lens, mtl, pretty
+ if flag(local-debian)
+   Hs-Source-Dirs: src, debian-haskell
+   Build-depends: bytestring, containers, data-lens-template, deepseq, Diff, directory, exceptions, filepath, hsemail, ListLike, memoize, network, network-uri, old-locale, parsec, prettyclass, process, process-extras, pureMD5, regex-compat, regex-tdfa, set-extra, syb, template-haskell, text, time, unix, Unixutils, utf8-string
  else
-   Build-Depends: Cabal >= 1.9
+   Build-depends: debian >= 3.85, cabal-debian
 
 Executable cabal-debian-tests
  Hs-Source-Dirs: .
  Main-is: Tests.hs
  ghc-options: -threaded -Wall -O2
- Build-Depends: base, cabal-debian, containers, data-lens, debian >= 3.84, filepath, hsemail, HUnit, prettyclass, process, text
- if flag(ghcjs-support)
-   Build-Depends: Cabal >= 1.21
+ Build-Depends: base, Cabal >= 1.9, containers, data-lens, filepath, hsemail, HUnit, prettyclass, process, text
+ if flag(local-debian)
+   Hs-Source-Dirs: src, debian-haskell
+   Build-depends: bytestring, containers, data-lens-template, deepseq, Diff, directory, exceptions, filepath, hsemail, ListLike, memoize, mtl, network, network-uri, old-locale, parsec, pretty, prettyclass, process, process-extras, pureMD5, regex-compat, regex-tdfa, set-extra, syb, template-haskell, text, time, unix, Unixutils, utf8-string
  else
-   Build-Depends: Cabal >= 1.9
+   Build-depends: debian >= 3.85, cabal-debian
diff --git a/changelog b/changelog
--- a/changelog
+++ b/changelog
@@ -1,9 +1,26 @@
+haskell-cabal-debian (4.19) unstable; urgency=low
+
+  * Add remapCabal function here from a private package
+  * Remove debianVersionSplits, which has long been replaced by
+    debianDefaultAtoms.
+
+ -- David Fox <dsf@seereason.com>  Mon, 08 Dec 2014 10:07:06 -0800
+
+haskell-cabal-debian (4.18) unstable; urgency=low
+
+  * Add types to support machine readable copyright files.
+  * Add --debian-base-name option and overrideDebianBaseName lens.
+  * Add --omit-prof-version-deps option flag, have --official imply it
+
+ -- David Fox <dsf@seereason.com>  Thu, 27 Nov 2014 07:11:35 -0800
+
 haskell-cabal-debian (4.17.5) unstable; urgency=low
 
   * Use the prettyclass package and the PP wrappers in the latest
     debian package to do pretty printing.
   * Change default priority to extra
   * Use the new watch file suggested by nomeata
+  * Use the control file template suggested in issue #3
 
  -- David Fox <dsf@seereason.com>  Mon, 15 Sep 2014 13:28:36 -0700
 
@@ -977,4 +994,3 @@
   * Debianization generated by cabal-debian
 
  -- David Fox <dsf@seereason.com>  Sun, 18 Sep 2011 06:40:21 -0700
-
diff --git a/debian/Debianize.hs b/debian/Debianize.hs
--- a/debian/Debianize.hs
+++ b/debian/Debianize.hs
@@ -1,23 +1,34 @@
+-- To run the test: runhaskell -isrc -DMIN_VERSION_Cabal\(a,b,c\)=1 debian/Debianize.hs
+--
+-- This doesn't actually modify the debianization, it just sees
+-- whether the debianization it would have generated matches the one
+-- that is already in debian/.  If not it either means a bug was
+-- introduced, or the changes are good and need to be checked in.
+--
+-- Be sure to run it with the local-debian flag turned off!
+
+import Control.Exception (throw)
 import Control.Monad.State (get)
 import Data.Lens.Lazy (getL, access)
 import Data.List (intercalate)
 import Data.Monoid (mempty)
 import Data.Set (singleton)
-import Data.Text as Text (pack)
+import Data.Text as Text (Text, pack)
 import Debian.Changes (ChangeLog(ChangeLog))
 import Debian.Debianize (inputChangeLog, inputDebianization)
 import Debian.Debianize.Details (debianDefaultAtoms)
 import Debian.Debianize.Finalize (debianization)
 import Debian.Debianize.Types as T
     (changelog, compat, conflicts, control, depends, debianDescription, homepage,
-     installCabalExec, sourceFormat, standardsVersion, utilsPackageNameBase, copyright)
+     installCabalExec, sourceFormat, standardsVersion, utilsPackageNameBase, copyright, xDescription)
 import Debian.Debianize.Types.Atoms as T (Atoms, newAtoms, EnvSet(EnvSet))
 import Debian.Debianize.Monad (Atoms, DebT, execDebT, evalDebT, execDebM)
 import Debian.Debianize.Output (compareDebianization)
-import Debian.Debianize.Prelude ((~=), (~?=), (%=), (+=), (++=), (+++=))
+import Debian.Debianize.Prelude ((~=), (~?=), (%=), (+=), (++=))
+import Debian.Debianize.Types.CopyrightDescription (CopyrightDescription(..), FilesOrLicenseDescription(..), newCopyrightDescription)
 import Debian.Debianize.Types.SourceDebDescription (SourceDebDescription)
-import Debian.Policy (SourceFormat(Native3), StandardsVersion(StandardsVersion))
-import Debian.Relation (BinPkgName(BinPkgName), Relation(Rel), VersionReq(SLT, GRE))
+import Debian.Policy (SourceFormat(Native3), StandardsVersion(StandardsVersion), License(OtherLicense))
+import Debian.Relation (BinPkgName(BinPkgName), Relation(Rel), VersionReq(SLT, GRE), Relations, parseRelations)
 import Debian.Version (parseDebianVersion)
 import Distribution.Compiler(CompilerFlavor(GHC))
 import Prelude hiding (log)
@@ -28,6 +39,9 @@
     do -- Copy the changelog into the top directory so that hackage
        -- will see it.
        copyFile "debian/changelog" "changelog"
+       -- This is both a debianization script and a unit test - it
+       -- makes sure the debianization generated matches the one
+       -- checked into version control.
        log <- newAtoms >>= evalDebT (inputChangeLog >> access changelog)
        old <- newAtoms >>= execDebT (inputDebianization (T.EnvSet "/" "/" "/"))
        new <- newAtoms >>= execDebT (debianization debianDefaultAtoms (changelog ~?= log >> customize >> copyFirstLogEntry old))
@@ -44,30 +58,63 @@
           do sourceFormat ~= Just Native3
              standardsVersion ~= Just (StandardsVersion 3 9 3 Nothing)
              compat ~= Just 9
-             copyright ~= Just (pack (unlines [ "This package is not part of the Debian GNU/Linux distribution."
-                                              , ""
-                                              , "Copyright: (c) 2010-2011, SeeReason Partners LLC"
-                                              , "License: All Rights Reserved"]))
-             debianDescription (BinPkgName "cabal-debian") ~=
-                   Just (pack (intercalate "\n"
-                                  [ "Create a debianization for a cabal package"
-                                  , " 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."
-                                  , " ."
-                                  , "  Author: David Fox <dsf@seereason.com>"
-                                  , "  Upstream-Maintainer: David Fox <dsf@seereason.com>" ]))
-             conflicts (BinPkgName "cabal-debian") %= (++ [[Rel (BinPkgName "haskell-debian-utils") (Just (SLT (parseDebianVersion ("3.59" :: String)))) Nothing]])
-             depends (BinPkgName "cabal-debian") %= (++ [[Rel (BinPkgName "apt-file") Nothing Nothing]])
-             depends (BinPkgName "cabal-debian") %= (++ [[Rel (BinPkgName "debian-policy") Nothing Nothing]])
-             depends (BinPkgName "libghc-cabal-debian-dev") %= (++ [[Rel (BinPkgName "debian-policy") Nothing Nothing]])
-             depends (BinPkgName "cabal-debian") %= (++ [[Rel (BinPkgName "debhelper") Nothing Nothing]])
-             depends (BinPkgName "cabal-debian") %= (++ [[Rel (BinPkgName "haskell-devscripts") (Just (GRE (parseDebianVersion ("0.8.19" :: String)))) Nothing]])
-             installCabalExec +++= (BinPkgName "cabal-debian-tests", singleton ("cabal-debian-tests", "/usr/bin"))
-             installCabalExec +++= (BinPkgName "cabal-debian", singleton ("cabal-debian", "/usr/bin"))
              utilsPackageNameBase ~= Just "cabal-debian"
+             copyright %= copyrightFn
+             conflicts (BinPkgName "cabal-debian") %= (++ (rels "haskell-debian-utils (<< 3.59)"))
+             depends (BinPkgName "cabal-debian") %= (++ (rels "apt-file, debian-policy, debhelper, haskell-devscripts (>= 0.8.19)"))
+             depends (BinPkgName "libghc-cabal-debian-dev") %= (++ (rels "debian-policy"))
+             installCabalExec (BinPkgName "cabal-debian-tests") "cabal-debian-tests" "/usr/bin"
+             installCabalExec (BinPkgName "cabal-debian") "cabal-debian" "/usr/bin"
+             utilsPackageNameBase ~= Just "cabal-debian"
              -- extraDevDeps (BinPkgName "debian-policy")
              homepage ~= Just (pack "http://src.seereason.com/cabal-debian")
+
+rels :: String -> Relations
+rels = either (throw . userError . show) id . parseRelations
+
+-- | Demonstrates the structure of the new copyright type.
+copyrightFn :: CopyrightDescription -> CopyrightDescription
+copyrightFn =
+    const $ newCopyrightDescription
+                    { _filesAndLicenses =       [FilesDescription { _filesPattern = "*"
+                                                                  , _filesCopyright = pack (unlines [ "Copyright (c) 2007, David Fox"
+                                                                                                    , "Copyright (c) 2007, Jeremy Shaw" ])
+                                                                  , _filesLicense = OtherLicense "Proprietary"
+                                                                  , _filesComment = Just $ pack $ unlines
+                                                                                    [ "All rights reserved."
+                                                                                    , ""
+                                                                                    , "The packageing was adjusted to Debian conventions by Joachim Breitner"
+                                                                                    , "<nomeata@debian.org> on Sat, 01 May 2010 21:16:18 +0200, and is licenced under"
+                                                                                    , "the same terms as the package itself.."
+                                                                                    , ""
+                                                                                    , "Redistribution and use in source and binary forms, with or without"
+                                                                                    , "modification, are permitted provided that the following conditions are"
+                                                                                    , "met:"
+                                                                                    , ""
+                                                                                    , "    * Redistributions of source code must retain the above copyright"
+                                                                                    , "      notice, this list of conditions and the following disclaimer."
+                                                                                    , ""
+                                                                                    , "    * Redistributions in binary form must reproduce the above"
+                                                                                    , "      copyright notice, this list of conditions and the following"
+                                                                                    , "      disclaimer in the documentation and/or other materials provided"
+                                                                                    , "      with the distribution."
+                                                                                    , ""
+                                                                                    , "    * The names of contributors may not be used to endorse or promote"
+                                                                                    , "      products derived from this software without specific prior"
+                                                                                    , "      written permission."
+                                                                                    , ""
+                                                                                    , "THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS"
+                                                                                    , "\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT"
+                                                                                    , "LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR"
+                                                                                    , "A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT"
+                                                                                    , "OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,"
+                                                                                    , "SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT"
+                                                                                    , "LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,"
+                                                                                    , "DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY"
+                                                                                    , "THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT"
+                                                                                    , "(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE"
+                                                                                    , "OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." ] }]
+                    , _summaryComment = Just $ pack "This package is not part of the Debian GNU/Linux distribution." }
 
 -- | This copies the first log entry of deb1 into deb2.  Because the
 -- debianization process updates that log entry, we need to undo that
diff --git a/debian/copyright b/debian/copyright
--- a/debian/copyright
+++ b/debian/copyright
@@ -1,19 +1,19 @@
-This package was debianized by David Fox
-<dsf@seereason.com> on September 18, 2007.
-
-The packageing was adjusted to Debian conventions by Joachim Breitner
-<nomeata@debian.org> on Sat, 01 May 2010 21:16:18 +0200, and is licenced under
-the same terms as the package itself..
-
+Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Comment: This package is not part of the Debian GNU/Linux distribution.
 
-Copyright (c) 2007, David Fox
-Copyright (c) 2007, Jeremy Shaw
+Files: *
+Copyright: Copyright (c) 2007, David Fox
+ Copyright (c) 2007, Jeremy Shaw
+License: Proprietary
+Comment: All rights reserved.
 
-All rights reserved.
+ The packageing was adjusted to Debian conventions by Joachim Breitner
+ <nomeata@debian.org> on Sat, 01 May 2010 21:16:18 +0200, and is licenced under
+ the same terms as the package itself..
 
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
 
     * Redistributions of source code must retain the above copyright
       notice, this list of conditions and the following disclaimer.
@@ -27,14 +27,14 @@
       products derived from this software without specific prior
       written permission.
 
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/src/Debian/Debianize/BuildDependencies.hs b/src/Debian/Debianize/BuildDependencies.hs
--- a/src/Debian/Debianize/BuildDependencies.hs
+++ b/src/Debian/Debianize/BuildDependencies.hs
@@ -19,7 +19,7 @@
 import Debian.Debianize.Bundled (builtIn)
 import Debian.Debianize.DebianName (mkPkgName, mkPkgName')
 import Debian.Debianize.Monad as Monad (Atoms, DebT)
-import qualified Debian.Debianize.Types as T (buildDepends, buildDependsIndep, debianNameMap, epochMap, execMap, extraLibMap, missingDependencies, noDocumentationLibrary, noProfilingLibrary)
+import qualified Debian.Debianize.Types as T (buildDepends, buildDependsIndep, debianNameMap, epochMap, execMap, extraLibMap, missingDependencies, noDocumentationLibrary, noProfilingLibrary, omitProfVersionDeps)
 import Debian.Debianize.Types.Atoms (EnvSet(dependOS), buildEnv, compilerFlavors)
 import qualified Debian.Debianize.Types.BinaryDebDescription as B (PackageType(Development, Documentation, Profiling))
 import Debian.Debianize.VersionSplits (packageRangesFromVersionSplits)
@@ -35,6 +35,7 @@
 import Distribution.Version (anyVersion, asVersionIntervals, earlierVersion, foldVersionRange', fromVersionIntervals, intersectVersionRanges, isNoVersion, laterVersion, orEarlierVersion, orLaterVersion, toVersionIntervals, unionVersionRanges, VersionRange, withinVersion)
 import Distribution.Version.Invert (invertVersionRange)
 import Prelude hiding (init, log, map, unlines, unlines, writeFile)
+import System.Directory (findExecutable)
 import System.Exit (ExitCode(ExitSuccess))
 import System.IO.Unsafe (unsafePerformIO)
 import System.Process (readProcessWithExitCode)
@@ -154,7 +155,8 @@
 docDependencies :: (MonadIO m, Functor m) => Dependency_ -> DebT m D.Relations
 docDependencies (BuildDepends (Dependency name ranges)) =
     do hcs <- access compilerFlavors
-       concat <$> mapM (\ hc -> dependencies hc B.Documentation name ranges) (toList hcs)
+       omitProfDeps <- access T.omitProfVersionDeps
+       concat <$> mapM (\ hc -> dependencies hc B.Documentation name ranges omitProfDeps) (toList hcs)
 docDependencies _ = return []
 
 -- | The Debian build dependencies for a package include the profiling
@@ -162,7 +164,8 @@
 -- references.  Also the packages associated with extra libraries.
 buildDependencies :: (MonadIO m, Functor m) => Set (CompilerFlavor, B.PackageType) -> Dependency_ -> DebT m D.Relations
 buildDependencies hcTypePairs (BuildDepends (Dependency name ranges)) =
-    concat <$> mapM (\ (hc, typ) -> dependencies hc typ name ranges) (toList hcTypePairs)
+    access T.omitProfVersionDeps >>= \ omitProfDeps ->
+    concat <$> mapM (\ (hc, typ) -> dependencies hc typ name ranges omitProfDeps) (toList hcTypePairs)
 buildDependencies _ dep@(ExtraLibs _) =
     do mp <- access T.execMap
        return $ concat $ adapt mp dep
@@ -182,18 +185,21 @@
 adapt _flags (ExtraLibs x) = [x]
 adapt _flags (BuildDepends (Dependency (PackageName pkg) _)) = [[[D.Rel (D.BinPkgName pkg) Nothing Nothing]]]
 
--- There are two reasons this may not work, or may work
+-- There are three reasons this may not work, or may work
 -- incorrectly: (1) the build environment may be a different
 -- distribution than the parent environment (the environment the
 -- autobuilder was run from), so the packages in that
--- environment might have different names, and (2) the package
+-- environment might have different names, (2) the package
 -- we are looking for may not be installed in the parent
--- environment.
+-- environment, and (3) the apt-file executable is not installed.
 aptFile :: String -> [Relations] -- Maybe would probably be more correct
-aptFile pkg =
-    unsafePerformIO $
-    do ret <- readProcessWithExitCode "apt-file" ["-l", "search", pkg ++ ".pc"] ""
-       return $ case ret of
+aptFile pkg = unsafePerformIO $
+    findExecutable "apt-file" >>= aptFile'
+  where
+    aptFile' Nothing = error "The apt-file executable could not be found."
+    aptFile' (Just aptfile) = do
+        ret <- readProcessWithExitCode aptfile ["-l", "search", pkg ++ ".pc"] ""
+        return $ case ret of
                   (ExitSuccess, out, _) ->
                       case takeWhile (not . isSpace) out of
                         "" -> error $ "Unable to locate a debian package containing the build tool " ++ pkg ++
@@ -211,15 +217,15 @@
 -- | Turn a cabal dependency into debian dependencies.  The result
 -- needs to correspond to a single debian package to be installed,
 -- so we will return just an OrRelation.
-dependencies :: MonadIO m => CompilerFlavor -> B.PackageType -> PackageName -> VersionRange -> DebT m Relations
-dependencies hc typ name cabalRange =
-    do atoms <- get
+dependencies :: MonadIO m => CompilerFlavor -> B.PackageType -> PackageName -> VersionRange -> Bool -> DebT m Relations
+dependencies hc typ name cabalRange omitProfVersionDeps =
+    do nameMap <- access T.debianNameMap
        -- Compute a list of alternative debian dependencies for
        -- satisfying a cabal dependency.  The only caveat is that
        -- we may need to distribute any "and" dependencies implied
        -- by a version range over these "or" dependences.
        let alts :: [(BinPkgName, VersionRange)]
-           alts = case Map.lookup name (getL T.debianNameMap atoms) of
+           alts = case Map.lookup name nameMap of
                     -- If there are no splits for this package just
                     -- return the single dependency for the package.
                     Nothing -> [(mkPkgName hc name typ, cabalRange')]
@@ -256,8 +262,8 @@
             -- When we see a cabal equals dependency we need to turn it into
             -- a wildcard because the resulting debian version numbers have
             -- various suffixes added.
-      cabalRange' =
-          foldVersionRange'
+      cabalRange' | typ `elem` noVersionPackageType = anyVersion
+                  | otherwise = foldVersionRange'
             anyVersion
             withinVersion  -- <- Here we are turning equals into wildcard
             laterVersion
@@ -269,6 +275,7 @@
             intersectVersionRanges
             id
             cabalRange
+      noVersionPackageType = (if omitProfVersionDeps then [B.Profiling] else []) ++ [B.Documentation]
       simpler v1 v2 = minimumBy (compare `on` (length . asVersionIntervals)) [v1, v2]
       -- Simplify a VersionRange
       canon = fromVersionIntervals . toVersionIntervals
@@ -300,18 +307,26 @@
         let pver = maybe Nothing (Just . debianVersion'' atoms name) (builtIn splits hc root name)
         -- The name this library would have if it was in the compiler conflicts list.
         let naiveDebianName = mkPkgName hc name typ
-        return $ -- The compiler should appear in the build dependency
-                 -- if it provides a suitable version of the library,
-                 -- or if it conflicts with all versions of the
-                 -- library (which, if pver is Nothing, will certainly
-                 -- result in an error which needs to be corrected in
-                 -- the packaging.)
-                 (if isJust pver && (checkVersionReq req pver || (dname == naiveDebianName && conflictsWithHC naiveDebianName)) then [comp] else []) ++
-                 -- The library package can satisfy the dependency if
-                 -- the compiler doesn't provide a version, or if the
-                 -- compiler doesn't conflict with the package's
-                 -- debian name.
-                 (if isNothing pver || dname /= naiveDebianName || not (conflictsWithHC naiveDebianName) then [rel] else [])
+        -- The compiler should appear in the build dependency
+        -- if it provides a suitable version of the library,
+        -- or if it conflicts with all versions of the
+        -- library (which, if pver is Nothing, will certainly
+        -- result in an error which needs to be corrected in
+        -- the packaging.)
+        let compilerDependency = if isJust pver && (checkVersionReq req pver || (dname == naiveDebianName && conflictsWithHC naiveDebianName)) then [comp] else []
+        -- The library package can satisfy the dependency if
+        -- the compiler doesn't provide a version, or if the
+        -- compiler doesn't conflict with the package's
+        -- debian name.
+        let libraryDependency = if isNothing pver || dname /= naiveDebianName || not (conflictsWithHC naiveDebianName) then [rel] else []
+        -- Is the version number in the library dependency newer than
+        -- the compiler version?  If so it should appear to its left,
+        -- otherwise to its right.
+        return $ case req of
+                   Just (D.SLT lver) | Just lver < pver -> compilerDependency ++ libraryDependency
+                   Just (D.LTE lver) | Just lver < pver -> compilerDependency ++ libraryDependency
+                   Just (D.EEQ lver) | Just lver < pver -> compilerDependency ++ libraryDependency
+                   _ -> libraryDependency ++ compilerDependency
       compilerPackageName GHC B.Documentation = D.BinPkgName "ghc-doc"
       compilerPackageName GHC B.Profiling = D.BinPkgName "ghc-prof"
       compilerPackageName GHC B.Development = D.BinPkgName "ghc"
diff --git a/src/Debian/Debianize/DebianName.hs b/src/Debian/Debianize/DebianName.hs
--- a/src/Debian/Debianize/DebianName.hs
+++ b/src/Debian/Debianize/DebianName.hs
@@ -7,6 +7,7 @@
     , mkPkgName'
     , mapCabal
     , splitCabal
+    , remapCabal
     ) where
 
 import Control.Applicative ((<$>))
@@ -15,7 +16,7 @@
 import Data.Map as Map (lookup, alter)
 import Data.Version (Version, showVersion)
 import Debian.Debianize.Types.BinaryDebDescription as Debian (PackageType(..))
-import Debian.Debianize.Types.Atoms as T (debianNameMap, packageDescription, utilsPackageNameBase)
+import Debian.Debianize.Types.Atoms as T (debianNameMap, packageDescription, utilsPackageNameBase, overrideDebianNameBase)
 import Debian.Debianize.Monad (DebT)
 import Debian.Debianize.Prelude ((%=))
 import Debian.Debianize.VersionSplits (DebBase(DebBase, unDebBase), insertSplit, doSplits, VersionSplits, makePackage)
@@ -51,14 +52,16 @@
 -- is >= v.
 debianNameBase :: Monad m => DebT m DebBase
 debianNameBase =
-    do Just pkgDesc <- access packageDescription
+    do nameBase <- access T.overrideDebianNameBase
+       Just pkgDesc <- access packageDescription
        let pkgId = Cabal.package pkgDesc
        nameMap <- access T.debianNameMap
        let pname@(PackageName _) = pkgName pkgId
            version = (Just (D.EEQ (parseDebianVersion (showVersion (pkgVersion pkgId)))))
-       case Map.lookup (pkgName pkgId) nameMap of
-         Nothing -> return $ debianBaseName pname
-         Just splits -> return $ doSplits splits version
+       case (nameBase, Map.lookup (pkgName pkgId) nameMap) of
+         (Just base, _) -> return base
+         (Nothing, Nothing) -> return $ debianBaseName pname
+         (Nothing, Just splits) -> return $ doSplits splits version
 
 -- | Build a debian package name from a cabal package name and a
 -- debian package type.  Unfortunately, this does not enforce the
@@ -112,3 +115,11 @@
       f :: Maybe VersionSplits -> Maybe VersionSplits
       f Nothing = error $ "splitCabal - not mapped: " ++ show pname
       f (Just sp) = Just (insertSplit ver ltname sp)
+
+-- | Replace any existing mapping of the cabal name 'pname' with the
+-- debian name 'dname'.  (Use case: to change the debian package name
+-- so it differs from the package provided by ghc.)
+remapCabal :: Monad m => PackageName -> DebBase -> DebT m ()
+remapCabal pname dname = do
+  debianNameMap %= Map.alter (const Nothing) pname
+  mapCabal pname dname
diff --git a/src/Debian/Debianize/Details.hs b/src/Debian/Debianize/Details.hs
--- a/src/Debian/Debianize/Details.hs
+++ b/src/Debian/Debianize/Details.hs
@@ -1,40 +1,43 @@
+-- | Detailed information about the specific repositories such as
+-- debian or seereason - in particular how cabal names are mapped to
+-- debian.
 {-# OPTIONS -Wall #-}
 module Debian.Debianize.Details
     ( debianDefaultAtoms
-    , debianVersionSplits
     ) where
 
-import Data.Map as Map (Map, fromList)
 import Data.Version (Version(Version))
-import Debian.Debianize.DebianName (mapCabal, splitCabal)
-import Debian.Debianize.Types.Atoms as T (epochMap)
+import Debian.Relation (Relation(Rel), BinPkgName(BinPkgName))
+import Debian.Debianize.DebianName (mapCabal, {-remapCabal,-} splitCabal)
+import Debian.Debianize.Types.Atoms as T (epochMap, execMap)
 import Debian.Debianize.Monad (DebT)
 import Debian.Debianize.Prelude ((++=))
-import Debian.Debianize.VersionSplits (DebBase(DebBase), VersionSplits, makePackage, insertSplit)
+import Debian.Debianize.VersionSplits (DebBase(DebBase))
 import Distribution.Package (PackageName(PackageName))
 
--- | Some details about the debian repository - special cases for how
--- some cabal packages are mapped to debian package names.
+-- | Update the Atoms value in the DebT state with some details about
+-- the debian repository - special cases for how some cabal packages
+-- are mapped to debian package names.
 debianDefaultAtoms :: Monad m => DebT m ()
 debianDefaultAtoms =
-    do T.epochMap ++= (PackageName "HaXml", 1)
+    do -- These are the two epoch names I know about in the debian repo
+       T.epochMap ++= (PackageName "HaXml", 1)
        T.epochMap ++= (PackageName "HTTP", 1)
-       mapCabal (PackageName "Cabal") (DebBase "cabal")
+       -- The hsx2hs build tool is in an an eponymous deb
+       T.execMap ++= ("hsx2hs", [[Rel (BinPkgName "hsx2hs") Nothing Nothing]])
+       -- For now, use deb names like libghc-cabal-ghcjs-dev for any
+       -- Cabal >= 1.21, which is the ghcjs development branch of Cabal.
+       mapCabal (PackageName "Cabal") (DebBase "cabal-ghcjs")
+       splitCabal (PackageName "Cabal") (DebBase "cabal") (Version [1,21] [])
+       -- The parsec debs are suffixed with either "2" or "3"
        mapCabal (PackageName "parsec") (DebBase "parsec3")
        splitCabal (PackageName "parsec") (DebBase "parsec2") (Version [3] [])
+       -- Similar split for quickcheck
        mapCabal (PackageName "QuickCheck") (DebBase "quickcheck2")
        splitCabal (PackageName "QuickCheck") (DebBase "quickcheck1") (Version [2] [])
+       -- Something was required for this package at one time - it
+       -- looks like a no-op now
        mapCabal (PackageName "gtk2hs-buildtools") (DebBase "gtk2hs-buildtools")
-
--- | These are the instances of debian names changing that I know
--- about.  I know they really shouldn't be hard coded.  Send a patch.
--- Note that this inherits the lack of type safety of the mkPkgName
--- function.  (FIXME: Use combinators to construct this.)
-debianVersionSplits :: Map PackageName VersionSplits
-debianVersionSplits =
-    Map.fromList
-    [ (PackageName "Cabal", makePackage (DebBase "cabal"))
-    , (PackageName "parsec", insertSplit (Version [3] []) (DebBase "parsec3") (makePackage (DebBase "parsec2")))
-    , (PackageName "QuickCheck", insertSplit (Version [2] []) (DebBase "quickcheck2") (makePackage (DebBase "quickcheck1")))
-    -- This looks like a no-op - probably isn't needed.
-    , (PackageName "gtk2hs-buildtools", makePackage (DebBase "gtk2hs-buildtools")) ]
+       -- Upgrade transformers to 0.4 - no don't!
+       -- remapCabal (PackageName "transformers") (DebBase "transformers4")
+       -- remapCabal (PackageName "haskeline") (DebBase "haskeline0713")
diff --git a/src/Debian/Debianize/Files.hs b/src/Debian/Debianize/Files.hs
--- a/src/Debian/Debianize/Files.hs
+++ b/src/Debian/Debianize/Files.hs
@@ -1,6 +1,6 @@
 -- | Convert a Debianization into a list of files that can then be
 -- written out.
-{-# LANGUAGE FlexibleInstances, OverloadedStrings, ScopedTypeVariables, TupleSections #-}
+{-# LANGUAGE CPP, FlexibleInstances, OverloadedStrings, ScopedTypeVariables, TupleSections #-}
 module Debian.Debianize.Files
     ( debianizationFileMap
     ) where
@@ -9,13 +9,14 @@
 import Control.Monad.Trans (lift)
 import Control.Monad.Writer (WriterT, execWriterT, tell)
 import Debian.Control.Common ()
+import Data.Char (isSpace)
 import Data.Lens.Lazy (access, getL)
-import Data.List as List (map)
+import Data.List as List (map, dropWhileEnd, dropWhile)
 import Data.Map as Map (Map, map, toList, fromListWithKey, mapKeys, insertWith)
 import Data.Maybe
 import Data.Monoid ((<>), mempty)
 import Data.Set as Set (toList, member, fold)
-import Data.Text as Text (Text, pack, unpack, lines, unlines, strip, null)
+import Data.Text as Text (Text, pack, unpack, lines, unlines, null, intercalate, dropWhile, dropWhileEnd)
 import Debian.Control (Control'(Control, unControl), Paragraph'(Paragraph), Field'(Field))
 import Debian.Debianize.Goodies (makeRulesHead)
 import Debian.Debianize.Monad (DebT)
@@ -25,8 +26,7 @@
 import qualified Debian.Debianize.Types.SourceDebDescription as S
 import Debian.Pretty (PP(..), ppDisplay, ppPrint, ppDisplay')
 import Debian.Relation (Relations, BinPkgName(BinPkgName))
-import Distribution.License (License(AllRightsReserved))
-import Prelude hiding (init, unlines, writeFile, log)
+import Prelude hiding (init, unlines, writeFile, log, dropWhile)
 --import System.Directory (getCurrentDirectory)
 import System.FilePath ((</>))
 import Text.PrettyPrint.HughesPJClass (Pretty(pPrint), text, empty)
@@ -161,13 +161,7 @@
 copyright :: (Monad m, Functor m) => FilesT m [(FilePath, Text)]
 copyright =
     do copyrt <- lift $ access T.copyright
-       license <- lift $ access T.license
-       licenseFile <- lift $ access T.licenseFile
-       return [("debian/copyright", case (licenseFile, copyrt, license) of
-                                      (Just x, _, _) -> x <> "\n"
-                                      (_, Just x, y) -> x <> "\n" <> maybe mempty (\ z -> pack ("License: " <> (show  (ppPrint z)) <> "\n")) y
-                                      (_, _, Just x) -> pack ("License: " <> show (ppPrint x) <> "\n")
-                                      _ -> pack ("License: " <> show (ppPrint AllRightsReserved)))]
+       return [("debian/copyright", ppDisplay' copyrt)]
 
 controlFile :: S.SourceDebDescription -> Control' String
 controlFile src =
@@ -186,6 +180,7 @@
             depField "Build-Conflicts-Indep" (getL S.buildConflictsIndep src) ++
             mField "Standards-Version" (getL S.standardsVersion src) ++
             mField "Homepage" (getL S.homepage src) ++
+            mField "X-Description" (getL S.xDescription src) ++
             List.map vcsField (Set.toList (getL S.vcsFields src)) ++
             List.map xField (Set.toList (getL S.xFields src))) :
            List.map binary (getL S.binaryPackages src))
@@ -203,10 +198,11 @@
             [Field ("Description", " " ++ (unpack . ensureDescription . fromMaybe mempty . getL B.description $ bin))])
           where
             ensureDescription t =
-                case Text.lines t of
-                  [] -> "No description available."
-                  (short : long) | Text.null (strip short) -> Text.unlines ("No short description available" : long)
-                  _ -> t
+                case List.dropWhileEnd Text.null (List.dropWhile Text.null (List.map (Text.dropWhileEnd isSpace) (Text.lines t))) of
+                  [] -> "WARNING: No description available for package " <> ppDisplay' (getL B.package bin)
+                  (short : long) ->
+                      Text.intercalate "\n"
+                        ((if Text.null (Text.dropWhile isSpace short) then ("WARNING: No short description available for package " <> ppDisplay' (getL B.package bin)) else short) : long)
       mField tag = maybe [] (\ x -> [Field (tag, " " <> (show . ppPrint $ x))])
       lField _ [] = []
       lField tag xs = [Field (tag, " " <> (show . ppPrint $ xs))]
@@ -237,4 +233,4 @@
     depField "Built-Using" (getL B.builtUsing rels)
 
 depField :: [Char] -> Relations -> [Field' [Char]]
-depField tag rels = case rels of [] -> []; _ -> [Field (tag, " " ++ showDeps' (tag ++ ":") rels)]
+depField tag rels = case rels of [] -> []; _ -> [Field (tag, " " ++ showDeps' rels)]
diff --git a/src/Debian/Debianize/Finalize.hs b/src/Debian/Debianize/Finalize.hs
--- a/src/Debian/Debianize/Finalize.hs
+++ b/src/Debian/Debianize/Finalize.hs
@@ -6,12 +6,12 @@
     ) where
 
 import Control.Applicative ((<$>))
+import Control.Category ((.))
 import Control.Monad (when)
 import Control.Monad as List (mapM_)
 import Control.Monad.State (get, modify)
 import Control.Monad.Trans (liftIO, MonadIO)
 import Data.ByteString.Lazy.UTF8 (fromString)
-import Data.Char (toLower)
 import Data.Digest.Pure.MD5 (md5)
 import Data.Lens.Lazy (access, getL)
 import Data.List as List (intercalate, map, nub, unlines)
@@ -20,7 +20,7 @@
 import Data.Monoid ((<>), mempty)
 import Data.Set as Set (difference, filter, fromList, map, null, Set, singleton, toList, union, unions, fold)
 import Data.Set.Extra as Set (mapM_)
-import Data.Text as Text (pack, unlines, unpack)
+import Data.Text as Text (Text, pack, unlines, unpack, intercalate)
 import Debian.Changes (ChangeLog(..), ChangeLogEntry(..))
 import Debian.Debianize.BuildDependencies (debianBuildDeps, debianBuildDepsIndep)
 import Debian.Debianize.Changelog (dropFutureEntries)
@@ -29,14 +29,15 @@
 import Debian.Debianize.Input (dataDir, inputCabalization, inputChangeLog, inputMaintainer)
 import Debian.Debianize.Monad as Monad (DebT)
 import Debian.Debianize.Options (compileCommandlineArgs, compileEnvironmentArgs)
-import Debian.Debianize.Prelude ((%=), (+=), foldEmpty, fromEmpty, fromSingleton, (~=), (~?=))
-import qualified Debian.Debianize.Types as T (apacheSite, backups, binaryArchitectures, binaryPackages, binarySection, breaks, buildDepends, buildDependsIndep, buildDir, builtUsing, changelog, comments, compat, conflicts, debianDescription, debVersion, depends, epochMap, executable, extraDevDeps, extraLibMap, file, install, installCabalExec, installData, installDir, installTo, intermediateFiles, license, link, maintainer, noDocumentationLibrary, noProfilingLibrary, noHoogle, packageDescription, packageType, preDepends, provides, recommends, replaces, revision, rulesFragments, serverInfo, source, sourcePackageName, sourcePriority, sourceSection, suggests, utilsPackageNameBase, verbosity, watch, website)
+import Debian.Debianize.Prelude ((%=), (+=), fromEmpty, fromSingleton, (~=), (~?=))
+import qualified Debian.Debianize.Types as T (apacheSite, backups, binaryArchitectures, binaryPackages, binarySection, breaks, buildDepends, buildDependsIndep, buildDir, builtUsing, changelog, comments, compat, conflicts, debianDescription, debVersion, depends, epochMap, executable, extraDevDeps, extraLibMap, file, install, installCabalExec, installData, installDir, installTo, intermediateFiles, link, maintainer, noDocumentationLibrary, noProfilingLibrary, omitProfVersionDeps, packageDescription, packageType, preDepends, provides, recommends, replaces, revision, rulesFragments, serverInfo, standardsVersion, source, sourceFormat, sourcePackageName, sourcePriority, sourceSection, suggests, utilsPackageNameBase, verbosity, watch, website, control, homepage, official, vcsFields)
 import qualified Debian.Debianize.Types.Atoms as A (InstallFile(execName, sourceDir), showAtoms, compilerFlavors, Atom(..), atomSet)
 import qualified Debian.Debianize.Types.BinaryDebDescription as B (BinaryDebDescription, package, PackageType(Development, Documentation, Exec, Profiling, Source, HaskellSource, Utilities), PackageType)
+import qualified Debian.Debianize.Types.SourceDebDescription as S (xDescription, VersionControlSpec(..))
 import Debian.Debianize.VersionSplits (DebBase(DebBase))
 import Debian.Orphans ()
 import Debian.Pretty (ppDisplay, PP(..))
-import Debian.Policy (getDebhelperCompatLevel, haskellMaintainer, PackageArchitectures(Any, All), PackagePriority(Extra), Section(..))
+import Debian.Policy (getDebhelperCompatLevel, haskellMaintainer, PackageArchitectures(Any, All), PackagePriority(Extra), Section(..), SourceFormat(Quilt3), parseStandardsVersion)
 import Debian.Relation (BinPkgName, BinPkgName(BinPkgName), SrcPkgName(SrcPkgName), Relation(Rel), Relations)
 import qualified Debian.Relation as D (BinPkgName(BinPkgName), Relation(..))
 import Debian.Release (parseReleaseName)
@@ -49,9 +50,9 @@
 import Distribution.Package (Dependency(..), PackageIdentifier(..), PackageName(PackageName))
 import Distribution.PackageDescription (PackageDescription)
 import Distribution.PackageDescription as Cabal (allBuildInfo, BuildInfo(buildable, extraLibs), Executable(buildInfo, exeName))
-import qualified Distribution.PackageDescription as Cabal (PackageDescription(dataDir, dataFiles, executables, library, license, package))
-import Prelude hiding (init, log, map, unlines, unlines, writeFile)
-import System.FilePath ((<.>), (</>), makeRelative, splitFileName, takeDirectory, takeFileName)
+import qualified Distribution.PackageDescription as Cabal (PackageDescription(dataDir, dataFiles, executables, library, package))
+import Prelude hiding (init, log, map, unlines, unlines, writeFile, (.))
+import System.FilePath ((</>), (<.>), makeRelative, splitFileName, takeDirectory, takeFileName)
 import Text.PrettyPrint.HughesPJClass (Pretty(pPrint))
 
 -- | Given an Atoms value, get any additional configuration
@@ -88,16 +89,20 @@
 --        paramter type to Maybe PackageDescription and propagate down thru code
 finalizeDebianization  :: (MonadIO m, Functor m) => String -> Maybe Int -> DebT m ()
 finalizeDebianization date debhelperCompat =
-    do hcs <- Set.toList <$> access A.compilerFlavors
+    do -- In reality, hcs must be a singleton or many things won't work.  But some day...
+       hcs <- Set.toList <$> access A.compilerFlavors
+       finalizeSourceName B.HaskellSource
+       List.mapM_ checkOfficialSettings hcs
        List.mapM_ addExtraLibDependencies hcs
        Just pkgDesc <- access T.packageDescription
        T.watch ~?= Just (watchAtom (pkgName $ Cabal.package $ pkgDesc))
        T.sourceSection ~?= Just (MainSection "haskell")
        T.sourcePriority ~?= Just Extra
+       T.sourceFormat ~?= Just Quilt3
        T.compat ~?= debhelperCompat
        finalizeChangelog date
        finalizeControl
-       T.license ~?= Just (Cabal.license pkgDesc)
+       -- T.license ~?= Just (Cabal.license pkgDesc)
        expandAtoms
        -- Create the binary packages for the web sites, servers, backup packges, and other executables
        access T.executable >>= List.mapM_ (cabalExecBinaryPackage . fst) . Map.toList
@@ -111,19 +116,21 @@
        -- executed since the last expandAtoms.  Anyway, should be idempotent.
        expandAtoms
        -- Turn atoms related to priority, section, and description into debianization elements
-       finalizeDescriptions
+       -- finalizeDescriptions
 
 -- | Compute the final values of the BinaryDebDescription record
 -- description fields from the cabal descriptions and the values that
 -- have already been set.
+{-
 finalizeDescriptions :: (Monad m, Functor m) => DebT m ()
 finalizeDescriptions = access T.binaryPackages >>= List.mapM_ finalizeDescription
 
 finalizeDescription :: (Monad m, Functor m) => B.BinaryDebDescription -> DebT m ()
 finalizeDescription bdd =
     do let b = getL B.package bdd
-       cabDesc <- describe b
-       T.debianDescription b ~?= Just cabDesc
+       cabDesc <- describe
+       T.debianDescription ~?= Just cabDesc
+-}
 
 -- | Combine various bits of information to produce the debian version
 -- which will be used for the debian package.  If the override
@@ -147,8 +154,13 @@
          Just override -> return override
          Nothing ->
              do let ver = ppDisplay (pkgVersion pkgId)
-                rev <- get >>= return . getL T.revision >>= return . foldEmpty Nothing Just . fromMaybe ""
-                return $ buildDebianVersion epoch ver rev
+                rev <- access T.revision
+                let revMB = case rev of Nothing -> Nothing
+                                        Just "" -> Nothing
+                                        Just "-" -> Nothing
+                                        Just ('-':r) -> Just r
+                                        Just _ -> error "The Debian revision needs to start with a dash"
+                return $ buildDebianVersion epoch ver revMB
 
 -- | Return the Debian epoch number assigned to the given cabal
 -- package - the 1 in version numbers like 1:3.5-2.
@@ -172,12 +184,13 @@
 
 finalizeControl :: (Monad m, Functor m) => DebT m ()
 finalizeControl =
-    do finalizeSourceName B.HaskellSource
-       finalizeMaintainer
+    do finalizeMaintainer
        Just src <- access T.sourcePackageName
        maint <- access T.maintainer >>= return . fromMaybe (error "No maintainer")
        T.source ~= Just src
        T.maintainer ~= Just maint
+       desc <- describe
+       (S.xDescription . T.control) ~?= Just desc
        -- control %= (\ y -> y { D.source = Just src, D.maintainer = Just maint })
 
 -- | Make sure there is a changelog entry with the version number and
@@ -186,8 +199,7 @@
 -- version number is the exact one in our debianization.)
 finalizeChangelog :: (Monad m, Functor m) => String -> DebT m ()
 finalizeChangelog date =
-    do finalizeSourceName B.HaskellSource
-       finalizeMaintainer
+    do finalizeMaintainer
        ver <- debianVersion
        src <- access T.sourcePackageName
        Just maint <- access T.maintainer
@@ -205,7 +217,7 @@
       fixLog src ver cmts maint log =
           Just (ChangeLog (Entry { logPackage = show (pPrint (PP src))
                                  , logVersion = ver
-                                 , logDists = [parseReleaseName "unstable"]
+                                 , logDists = [parseReleaseName "UNRELEASED"]
                                  , logUrgency = "low"
                                  , logComments = List.unlines $ List.map (("  * " <>) . List.intercalate "\n    " . List.map unpack)
                                                  (fromMaybe [["Debianization generated by cabal-debian"]] cmts)
@@ -228,6 +240,30 @@
       devDep :: Map String Relations -> String -> Relations
       devDep libMap cab = maybe [[Rel (BinPkgName ("lib" ++ cab ++ "-dev")) Nothing Nothing]] id (Map.lookup cab libMap)
 
+-- | Applies a few settings to official packages (unless already set)
+checkOfficialSettings :: (Monad m, Functor m) => CompilerFlavor -> DebT m ()
+checkOfficialSettings flavor =
+    do o <- access T.official
+       when o $ case flavor of
+                  GHC -> officialSettings
+                  _ -> error $ "There is no official packaging for " ++ show flavor
+
+officialSettings :: (Monad m, Functor m) => DebT m ()
+officialSettings =
+    do pkgDesc <- access T.packageDescription >>= maybe (error "officialSettings: no PackageDescription") return
+       let PackageName cabal = pkgName (Cabal.package pkgDesc)
+
+       T.standardsVersion ~?= Just (parseStandardsVersion "3.9.5")
+       T.homepage ~?= Just ("http://hackage.haskell.org/package/" <> pack cabal)
+       T.omitProfVersionDeps ~= True
+       SrcPkgName src <- access T.sourcePackageName >>= maybe (error "officialSettings: no sourcePackageName") return
+
+       T.vcsFields %= Set.union (Set.fromList
+          [ S.VCSBrowser $ "http://darcs.debian.org/cgi-bin/darcsweb.cgi?r=pkg-haskell/" <> pack src
+          , S.VCSDarcs  $ "http://darcs.debian.org/pkg-haskell/" <> pack src
+          ])
+ 
+
 putBuildDeps :: (MonadIO m, Functor m) => PackageDescription -> DebT m ()
 putBuildDeps pkgDesc =
     do deps <- debianBuildDeps pkgDesc
@@ -240,48 +276,41 @@
     do T.packageType b ~?= Just B.Exec
        T.binaryArchitectures b ~?= Just Any
        T.binarySection b ~?= Just (MainSection "misc")
-       desc <- describe b
-       T.debianDescription b ~?= Just desc
+       T.debianDescription b ~?= Just desc -- yeah, this same line is all over the place.
        binaryPackageRelations b B.Exec
     where
 
 binaryPackageRelations :: Monad m => BinPkgName -> B.PackageType -> DebT m ()
 binaryPackageRelations b typ =
     do edds <- access T.extraDevDeps
-       T.depends b %= \ rels -> [anyrel "${shlibs:Depends}", anyrel "${haskell:Depends}", anyrel "${misc:Depends}"] ++
-                                (if typ == B.Development then edds else []) ++ rels
+       T.depends b %= \ rels ->
+          [anyrel "${haskell:Depends}", anyrel "${misc:Depends}"] ++
+          [anyrel "${shlibs:Depends}" | typ `notElem` [B.Profiling, B.Documentation] ] ++
+          edds ++ rels
        T.recommends b %= \ rels -> [anyrel "${haskell:Recommends}"] ++ rels
        T.suggests b %= \ rels -> [anyrel "${haskell:Suggests}"] ++ rels
        T.preDepends b ~= []
        T.breaks b ~= []
        T.conflicts b %= \ rels -> [anyrel "${haskell:Conflicts}"] ++ rels
-       T.provides b %= \ rels -> [anyrel "${haskell:Provides}"] ++ rels
-       T.replaces b %= \ rels -> [anyrel "${haskell:Replaces}"] ++ rels
+       T.provides b %= \ rels -> (if typ /= B.Documentation then [anyrel "${haskell:Provides}"] else []) ++ rels
+       -- T.replaces b %= \ rels -> [anyrel "${haskell:Replaces}"] ++ rels
        T.builtUsing b ~= []
 
 -- | Add the library paragraphs for a particular compiler flavor.
 librarySpecs :: (Monad m, Functor m) => PackageDescription -> CompilerFlavor -> DebT m ()
 librarySpecs pkgDesc hc =
-    do debName <- debianName B.Documentation hc
-       let dev = isJust (Cabal.library pkgDesc)
+    do let dev = isJust (Cabal.library pkgDesc)
        doc <- get >>= return . not . getL T.noDocumentationLibrary
        prof <- get >>= return . not . getL T.noProfilingLibrary
-       hoogle <- get >>= return . not . getL T.noHoogle
        when dev (librarySpec Any B.Development hc)
        when (dev && prof && hc == GHC) (librarySpec Any B.Profiling hc)
-       when (dev && doc && hoogle)
-            (do docSpecsParagraph hc
-                T.link debName ("/usr/share/doc" </> ppDisplay debName </> "html" </> cabal <.> "txt")
-                               ("/usr/lib/ghc-doc/hoogle" </> List.map toLower cabal <.> "txt"))
-    where
-      PackageName cabal = pkgName (Cabal.package pkgDesc)
+       when (dev && doc) (docSpecsParagraph hc)
 
 docSpecsParagraph :: (Monad m, Functor m) => CompilerFlavor -> DebT m ()
 docSpecsParagraph hc =
     do b <- debianName B.Documentation hc
-       binaryPackageRelations b B.Development -- not sure why this isn't Documentation, but I think there's a "good" reason
+       binaryPackageRelations b B.Documentation
        T.packageType b ~?= Just B.Documentation
-       desc <- describe b
        T.packageType b ~?= Just B.Documentation
        T.binaryArchitectures b ~= Just All
        T.binarySection b ~?= Just (MainSection "doc")
@@ -290,20 +319,28 @@
 librarySpec :: (Monad m, Functor m) => PackageArchitectures -> B.PackageType -> CompilerFlavor -> DebT m ()
 librarySpec arch typ hc =
     do b <- debianName typ hc
-       binaryPackageRelations b B.Development
+       binaryPackageRelations b typ
        T.packageType b ~?= Just typ
-       desc <- describe b
        T.packageType b ~?= Just typ
        T.binaryArchitectures b ~?= Just arch
        T.debianDescription b ~?= Just desc
 
+-- | This is the standard value for the Description field of a binary
+-- package control file stanza.
+desc :: Text
+desc = Text.intercalate "\n "
+         ["${haskell:ShortDescription}${haskell:ShortBlurb}",
+          " ${haskell:LongDescription}",
+          " .",
+          " ${haskell:Blurb}"]
+
 -- | Make sure all data and executable files are assigned to at least
 -- one binary package and make sure all binary packages are in the
 -- package list in the source deb description.  If there are left over
 -- files, assign them to the packages returned by the
 -- utilsPackageNames lens, and make sure those packages are in the
 -- source deb description.
-makeUtilsPackage :: forall m. (Monad m, Functor m) => PackageDescription -> CompilerFlavor -> DebT m ()
+makeUtilsPackage :: forall m. (MonadIO m, Functor m) => PackageDescription -> CompilerFlavor -> DebT m ()
 makeUtilsPackage pkgDesc hc =
     do -- Files the cabal package expects to be installed
        -- Files that are already assigned to any binary deb
@@ -349,8 +386,9 @@
            utilsExecMissing = Set.difference utilsExec installedExec
        -- If any files belong in the utils packages, make sure they exist
        when (not (Set.null utilsData && Set.null utilsExec)) $ do
+         T.debianDescription b ~?= Just desc
          -- This is really for all binary debs except the libraries - I'm not sure why
-         T.rulesFragments += (pack ("build" </> ppDisplay b ++ ":: build-ghc-stamp"))
+         T.rulesFragments += (pack ("build" </> ppDisplay b ++ ":: build-ghc-stamp\n"))
          T.binaryArchitectures b ~?= Just (if Set.null utilsExec then All else Any)
          T.binarySection b ~?= Just (MainSection "misc")
          binaryPackageRelations b B.Utilities
@@ -409,7 +447,7 @@
                      (Text.unlines
                         [ pack ("binary-fixup" </> ppDisplay b) <> "::"
                         , pack ("\t(cd " <> builddir </> name <> " && find " <> name <.> "jsexe" <> " -type f) |\\\n" <>
-                                       "\t  while read i; do install -Dp " <> builddir </> name </> "$$i debian" </> ppDisplay b </> makeRelative "/" dest </> "$$i; done") ])
+                                       "\t  while read i; do install -Dp " <> builddir </> name </> "$$i debian" </> ppDisplay b </> makeRelative "/" dest </> "$$i; done\n") ])
 #endif
             doAtom _ _ = return ()
 
diff --git a/src/Debian/Debianize/Goodies.hs b/src/Debian/Debianize/Goodies.hs
--- a/src/Debian/Debianize/Goodies.hs
+++ b/src/Debian/Debianize/Goodies.hs
@@ -19,28 +19,26 @@
     , makeRulesHead
     ) where
 
-import Data.Char (toLower)
+import Data.Char (toLower, isSpace)
 import Data.Lens.Lazy (modL, access)
-import Data.List as List (map, intersperse, intercalate)
+import Data.List as List (map, intersperse, intercalate, dropWhileEnd)
 import Data.Map as Map (insertWith)
 import Data.Maybe (fromMaybe)
 import Data.Monoid ((<>))
 import Data.Set as Set (insert, union, singleton, toList)
-import Data.Text as Text (Text, pack, unlines, intercalate)
+import Data.Text as Text (Text, pack, unlines)
 import Debian.Debianize.DebianName (debianNameBase)
 import Debian.Debianize.Monad (Atoms, DebT, execDebM)
-import Debian.Debianize.Prelude (trim, (%=), (+=), (++=), (+++=))
+import Debian.Debianize.Prelude (stripWith, (%=), (+=), (++=), (+++=))
 import qualified Debian.Debianize.Types as T
 import qualified Debian.Debianize.Types.Atoms as T
-import qualified Debian.Debianize.Types.BinaryDebDescription as B
 import Debian.Debianize.VersionSplits (DebBase(DebBase))
 import Debian.Orphans ()
 import Debian.Pretty (ppDisplay, ppDisplay')
 import Debian.Policy (apacheLogDirectory, apacheErrorLog, apacheAccessLog, databaseDirectory, serverAppLog, serverAccessLog)
 import Debian.Relation (BinPkgName(BinPkgName), Relation(Rel))
-import Distribution.Package (PackageIdentifier(..), PackageName(PackageName))
-import Distribution.PackageDescription as Cabal (PackageDescription(package, synopsis, description, author, maintainer, pkgUrl))
-import Distribution.Text (display)
+import Distribution.Package (PackageName(PackageName))
+import Distribution.PackageDescription as Cabal (PackageDescription(package, synopsis, description))
 import Prelude hiding (writeFile, init, unlines, log, map)
 import System.FilePath ((</>))
 
@@ -96,12 +94,11 @@
        T.depends bin %= (++ [[Rel (BinPkgName "anacron") Nothing Nothing]])
        -- depends +++= (bin, Rel (BinPkgName "anacron") Nothing Nothing)
 
-describe :: Monad m => BinPkgName -> DebT m Text
-describe b =
+describe :: Monad m => DebT m Text
+describe =
     do Just p <- access T.packageDescription
-       typ <- access (T.packageType b)
        return $
-          debianDescriptionBase p <> "\n" <>
+          debianDescriptionBase p {- <> "\n" <>
           case typ of
             Just B.Profiling ->
                 Text.intercalate "\n"
@@ -132,6 +129,7 @@
                         [" .",
                          " Files associated with the " <> pack (display (pkgName (Cabal.package p))) <> " package."]
             -- x -> error $ "Unexpected library package name suffix: " ++ show x
+-}
 
 -- | The Cabal package has one synopsis and one description field
 -- for the entire package, while in a Debian package there is a
@@ -140,19 +138,21 @@
 -- of the debian description, each of which is amended.
 debianDescriptionBase :: PackageDescription -> Text
 debianDescriptionBase p =
-    (pack . unwords . words $ Cabal.synopsis p) <>
-    case Cabal.description p of
-      "" -> ""
-      text ->
-          let text' = text ++ "\n" ++
-                      list "" ("\n Author: " ++) (Cabal.author p) ++
-                      list "" ("\n Upstream-Maintainer: " ++) (Cabal.maintainer p) ++
-                      list "" ("\n Url: " ++) (Cabal.pkgUrl p) in
-          "\n " <> (pack . trim . List.intercalate "\n " . List.map addDot . lines $ text')
+    pack $ List.intercalate "\n " $ (synop' : desc)
     where
-      addDot line = if all (flip elem " \t") line then "." else line
-      list :: b -> ([a] -> b) -> [a] -> b
-      list d f l = case l of [] -> d; _ -> f l
+      -- If we have a one line description and no synopsis, use
+      -- the description as the synopsis.
+      synop' = if null synop && length desc /= 1
+               then "WARNING: No synopsis available for package " ++ ppDisplay (package p)
+               else synop
+      synop :: String
+      -- I don't know why (unwords . words) was applied here.  Maybe I'll find out when
+      -- this version goes into production.  :-/  Ok, now I know, because sometimes the
+      -- short cabal description has more than one line.
+      synop = intercalate " " $ map (dropWhileEnd isSpace) $ lines $ Cabal.synopsis p
+      desc :: [String]
+      desc = List.map addDot . stripWith null $ map (dropWhileEnd isSpace) $ lines $ Cabal.description p
+      addDot line = if null line then "." else line
 
 oldClckwrksSiteFlags :: T.Site -> [String]
 oldClckwrksSiteFlags x =
@@ -335,7 +335,7 @@
 -- FIXME - use Atoms
 execAtoms :: BinPkgName -> T.InstallFile -> Atoms -> Atoms
 execAtoms b ifile r =
-    modL T.rulesFragments (Set.insert (pack ("build" </> ppDisplay b ++ ":: build-ghc-stamp"))) .
+    modL T.rulesFragments (Set.insert (pack ("build" </> ppDisplay b ++ ":: build-ghc-stamp\n"))) .
     fileAtoms b ifile $
     r
 
diff --git a/src/Debian/Debianize/Input.hs b/src/Debian/Debianize/Input.hs
--- a/src/Debian/Debianize/Input.hs
+++ b/src/Debian/Debianize/Input.hs
@@ -22,32 +22,36 @@
 import Control.Monad.Trans (MonadIO, liftIO)
 import Data.Char (isSpace, toLower)
 import Data.Lens.Lazy (getL, setL, modL, access)
-import Data.Maybe (fromMaybe)
+import Data.Maybe (fromMaybe, mapMaybe)
 import Data.Set as Set (Set, toList, fromList, insert, singleton)
 import Data.Text (Text, unpack, pack, lines, words, break, strip, null)
 import Data.Text.IO (readFile)
 --import Data.Version (showVersion, Version(Version))
 import Debian.Changes (ChangeLog(..), ChangeLogEntry(logWho), parseChangeLog)
 import Debian.Control (Control'(unControl), Paragraph'(..), stripWS, parseControlFromFile, Field, Field'(..), ControlFunctions)
-import qualified Debian.Debianize.Types as T (maintainer)
+import qualified Debian.Debianize.Types as T (maintainer, official)
 import qualified Debian.Debianize.Types.Atoms as T (changelog, makeAtoms, compilerFlavors)
 import Debian.Debianize.Types.BinaryDebDescription (BinaryDebDescription, newBinaryDebDescription)
 import qualified Debian.Debianize.Types.BinaryDebDescription as B
+import Debian.Debianize.Types.CopyrightDescription (readCopyrightDescription, CopyrightDescription(..), FilesOrLicenseDescription(..))
 import qualified Debian.Debianize.Types.SourceDebDescription as S
 import Debian.Debianize.Types.Atoms
     (control, warning, sourceFormat, watch, rulesHead, compat, packageDescription,
-     license, licenseFile, copyright, changelog, installInit, postInst, postRm, preInst, preRm,
+     copyright, changelog, installInit, postInst, postRm, preInst, preRm,
      logrotateStanza, link, install, installDir, intermediateFiles, cabalFlagAssignments, verbosity, buildEnv)
 import Debian.Debianize.Monad (DebT)
-import Debian.Debianize.Prelude (getDirectoryContents', readFileMaybe, read', intToVerbosity', (~=), (~?=), (+=), (++=), (+++=))
+import Debian.Debianize.Prelude (getDirectoryContents', readFileMaybe, read', intToVerbosity', (~=), (~?=), (+=), (++=), (+++=), (%=))
 import Debian.Debianize.Types.Atoms (EnvSet(dependOS))
 import Debian.GHC (newestAvailableCompilerId)
 import Debian.Orphans ()
 import Debian.Policy (Section(..), parseStandardsVersion, readPriority, readSection, parsePackageArchitectures, parseMaintainer,
-                      parseUploaders, readSourceFormat, getDebianMaintainer)
+                      parseUploaders, readSourceFormat, getDebianMaintainer, haskellMaintainer, fromCabalLicense)
 import Debian.Relation (Relations, BinPkgName(..), SrcPkgName(..), parseRelations)
 --import Debian.Version (DebianVersion, parseDebianVersion)
 import Distribution.Compiler (CompilerId)
+#if MIN_VERSION_Cabal(1,22,0)
+import Distribution.Compiler (unknownCompilerInfo, AbiTag(NoAbiTag))
+#endif
 import Distribution.Package (Package(packageId), PackageIdentifier(..), PackageName(PackageName), Dependency)
 import qualified Distribution.PackageDescription as Cabal (PackageDescription(maintainer, package, license, copyright {-, synopsis, description-}))
 #if MIN_VERSION_Cabal(1,19,0)
@@ -229,7 +233,7 @@
 inputAtoms debian name@"watch" = liftIO (readFile (debian </> name)) >>= \ text -> watch ~= Just text
 inputAtoms debian name@"rules" = liftIO (readFile (debian </> name)) >>= \ text -> rulesHead ~= (Just text)
 inputAtoms debian name@"compat" = liftIO (readFile (debian </> name)) >>= \ text -> compat ~= Just (read' (\ s -> error $ "compat: " ++ show s) (unpack text))
-inputAtoms debian name@"copyright" = liftIO (readFile (debian </> name)) >>= \ text -> copyright ~= Just text
+inputAtoms debian name@"copyright" = liftIO (readFile (debian </> name)) >>= \ text -> copyright ~= readCopyrightDescription text
 inputAtoms debian name@"changelog" =
     liftIO (readFile (debian </> name)) >>= return . parseChangeLog . unpack >>= \ log -> changelog ~= Just log
 inputAtoms debian name =
@@ -271,6 +275,9 @@
 readDir :: Monad m => BinPkgName -> Text -> DebT m ()
 readDir p line = installDir p (unpack line)
 
+nothingIf :: (a -> Bool) -> a -> Maybe a
+nothingIf p x = if p x then Nothing else Just x
+
 inputCabalization :: (MonadIO m, Functor m) => DebT m ()
 inputCabalization =
     do vb <- access verbosity >>= return . intToVerbosity'
@@ -286,27 +293,45 @@
                         -- This will contain either the contents of the file given in
                         -- the license-file: field or the contents of the license:
                         -- field.
-                        license ~?= (Just (Cabal.license pkgDesc))
+                        licenseFiles <- mapM (\ path -> liftIO (readFileMaybe path) >>= \ text -> return (path, text))
 #if MIN_VERSION_Cabal(1,19,0)
-                        licenseFileText <- liftIO $ case Cabal.licenseFiles pkgDesc of
-                                                      [] -> return Nothing
-                                                      (path : _) -> readFileMaybe path -- better than nothing
+                                             (Cabal.licenseFiles pkgDesc)
 #else
-                        licenseFileText <- liftIO $ case Cabal.licenseFile pkgDesc of
-                                                      "" -> return Nothing
-                                                      path -> readFileMaybe path
+                                             (case Cabal.licenseFile pkgDesc of
+                                                "" -> []
+                                                path -> [path])
 #endif
-                        licenseFile ~?= licenseFileText
-                        copyright ~?= (case Cabal.copyright pkgDesc of
-                                         "" -> Nothing
-                                         s -> Just (pack s))))
+                        -- It is possible we might interpret the license file path
+                        -- as a license name, so I hang on to it here.
+                        let licenseFiles' = mapMaybe (\ (path, text) -> maybe Nothing (\ t -> Just (path, t)) text) licenseFiles
+                        copyright %= cabalToCopyrightDescription pkgDesc licenseFiles'
+                      ))
              ePkgDescs
 
+cabalToCopyrightDescription :: PackageDescription -> [(FilePath, Text)] -> CopyrightDescription -> CopyrightDescription
+cabalToCopyrightDescription pkgDesc licenseFiles cdesc =
+    let triples = zip3 (repeat (nothingIf (null . strip) (pack (Cabal.copyright pkgDesc))))
+                       (repeat (Cabal.license pkgDesc))
+                       (case licenseFiles of
+                          [] -> [Nothing]
+                          xs -> map (Just. snd) xs)
+        fnls = map (\ (copyrt, license, comment) ->
+                         FilesDescription
+                                {_filesPattern = "*"
+                                , _filesCopyright = fromMaybe (pack "(No copyright field in cabal file)") copyrt
+                                , _filesLicense = fromCabalLicense license
+                                , _filesComment = comment }) triples in
+     cdesc { _filesAndLicenses = fnls }
+
 inputCabalization' :: Verbosity -> Set (FlagName, Bool) -> [CompilerId] -> IO [Either [Dependency] PackageDescription]
 inputCabalization' vb flags cids = do
          descPath <- defaultPackageDesc vb
          genPkgDesc <- readPackageDescription vb descPath
-         let finalized = map (\ cid -> finalizePackageDescription (toList flags) (const True) (Platform buildArch buildOS) cid [] genPkgDesc) cids
+         let finalized = map (\ cid -> finalizePackageDescription (toList flags) (const True) (Platform buildArch buildOS) cid [] genPkgDesc) $
+#if MIN_VERSION_Cabal(1,22,0)
+                             map (\ i -> unknownCompilerInfo i NoAbiTag)
+#endif
+                                                     cids
          mapM (either (return . Left)
                       (\ (pkgDesc, _) -> do bracket (setFileCreationMask 0o022) setFileCreationMask $ \ _ -> autoreconf vb pkgDesc
                                             return (Right pkgDesc)))
@@ -330,17 +355,22 @@
 -- chroot root task = useEnv root (return . force) task
 
 -- | Try to compute a string for the the debian "Maintainer:" field using, in this order
---    1. the maintainer explicitly specified using "Debian.Debianize.Monad.maintainer"
---    2. the maintainer field of the cabal package,
---    3. the value returned by getDebianMaintainer, which looks in several environment variables,
---    4. the signature from the latest entry in debian/changelog,
---    5. the Debian Haskell Group, @pkg-haskell-maintainers\@lists.alioth.debian.org@
+--    1. the Debian Haskell Group, @pkg-haskell-maintainers\@lists.alioth.debian.org@,
+--       if --official is set
+--    2. the maintainer explicitly specified using "Debian.Debianize.Monad.maintainer"
+--    3. the maintainer field of the cabal package, but only if --official is not set,
+--    4. the value returned by getDebianMaintainer, which looks in several environment variables,
+--    5. the signature from the latest entry in debian/changelog,
+--    6. the Debian Haskell Group, @pkg-haskell-maintainers\@lists.alioth.debian.org@
 inputMaintainer :: MonadIO m => DebT m ()
 inputMaintainer =
     do Just pkgDesc <- access packageDescription
        let cabalMaintainer = case Cabal.maintainer pkgDesc of
                                "" -> Nothing
                                x -> either (const Nothing) Just (parseMaintainer (takeWhile (\ c -> c /= ',' && c /= '\n') x))
+       o <- access T.official
+       when o $ T.maintainer ~?= Just haskellMaintainer
+
        T.maintainer ~?= cabalMaintainer
        debianMaintainer <- liftIO getDebianMaintainer
        T.maintainer ~?= debianMaintainer
diff --git a/src/Debian/Debianize/Options.hs b/src/Debian/Debianize/Options.hs
--- a/src/Debian/Debianize/Options.hs
+++ b/src/Debian/Debianize/Options.hs
@@ -17,13 +17,15 @@
 import Debian.Debianize.Monad (DebT)
 import Debian.Debianize.Prelude (read', maybeRead, (+=), (~=), (%=), (++=), (+++=))
 import Debian.Debianize.Types
-    (verbosity, dryRun, debAction, noDocumentationLibrary, noProfilingLibrary, noHoogle,
-     missingDependencies, sourcePackageName, cabalFlagAssignments, maintainer, buildDir, omitLTDeps,
+    (verbosity, dryRun, debAction, noDocumentationLibrary, noProfilingLibrary,
+     missingDependencies, sourcePackageName, overrideDebianNameBase, cabalFlagAssignments, maintainer, buildDir, omitProfVersionDeps, omitLTDeps,
      sourceFormat, buildDepends, buildDependsIndep, extraDevDeps, depends, conflicts, replaces, provides,
-     recommends, suggests, extraLibMap, debVersion, revision, epochMap, execMap, utilsPackageNameBase)
+     recommends, suggests, extraLibMap, debVersion, revision, epochMap, execMap, utilsPackageNameBase,
+     standardsVersion, official)
 import Debian.Debianize.Types.Atoms (Atoms, EnvSet(..), InstallFile(..), DebAction(..), setBuildEnv, compilerFlavors)
+import Debian.Debianize.VersionSplits (DebBase(DebBase))
 import Debian.Orphans ()
-import Debian.Policy (SourceFormat(Quilt3), parseMaintainer)
+import Debian.Policy (SourceFormat(Quilt3, Native3), parseMaintainer, parseStandardsVersion)
 import Debian.Relation (BinPkgName(..), SrcPkgName(..), Relations, Relation(..))
 import Debian.Relation.String (parseRelations)
 import Debian.Version (parseDebianVersion)
@@ -90,6 +92,9 @@
                       , "when a dependency package was built with the --disable-haddock option, because"
                       , "normally cabal-debian assumes that the -doc package exists and adds it as a"
                       , "build dependency."]),
+      Option "" ["debian-name-base"] (ReqArg (\ name -> overrideDebianNameBase ~= (Just (DebBase name))) "NAME")
+             (unlines [ "Use this name for the base of the debian binary packages - the string between 'libghc-'"
+                      , " and '-dev'.  Normally this is derived from the hackage package name."]),
       Option "" ["source-package-name"] (ReqArg (\ name -> sourcePackageName ~= (Just (SrcPkgName name))) "NAME")
              (unlines [ "Use this name for the debian source package, the name in the Source field at the top of the"
                       , "debian control file, and also at the very beginning of the debian/changelog file.  By default"
@@ -97,12 +102,10 @@
       Option "" ["disable-library-profiling"] (NoArg (noProfilingLibrary ~= True))
              (unlines [ "Don't generate profiling (-prof) library packages.  This has been used in one case"
                       , "where the package code triggered a compiler bug."]),
-      Option "" ["no-hoogle"] (NoArg (noHoogle ~= True))
-             (unlines [ "Do not create the link from /usr/lib/ghc-doc/hoogle/Package.txt to the top"
-                      , "of the package's html documentation tree.  This path does not contain"
-                      , "the package version, so it may conflict with libraries built into ghc."]),
       Option "" ["maintainer"] (ReqArg (\ maint -> either (error ("Invalid maintainer string: " ++ show maint)) ((maintainer ~=) . Just) (parseMaintainer maint)) "Maintainer Name <email addr>")
              (unlines [ "Override the Maintainer name and email given in $DEBEMAIL or $EMAIL or $DEBFULLNAME or $FULLNAME"]),
+      Option "" ["standards-version"] (ReqArg (\ sv -> standardsVersion ~= Just (parseStandardsVersion sv)) "VERSION")
+             "Claim compatibility to this version of the Debian policy (i.e. the value of the Standards-Version field)",
       Option "" ["build-dep"]
                  (ReqArg (\ name ->
                               case parseRelations name of
@@ -163,6 +166,8 @@
                                                (cab, (_ : deb)) -> execMap ++= (cab, rels deb)
                                                _ -> error "usage: --exec-map EXECNAME=RELATIONS") "EXECNAME=RELATIONS")
              "Specify a mapping from the name appearing in the Build-Tool field of the cabal file to a debian binary package name, e.g. --exec-map trhsx=haskell-hsx-utils",
+      Option "" ["omit-prof-version-deps"] (NoArg (omitProfVersionDeps ~= True))
+             "Do not put the version dependencies on the prof packages that we put on the dev packages.",
       Option "" ["omit-lt-deps"] (NoArg (omitLTDeps ~= True))
              (unlines [ "Remove all less-than dependencies from the generated control file.  Less-than"
                       , "dependencies are less useful and more troublesome for debian packages than cabal,"
@@ -170,6 +175,10 @@
                       , "google 'cabal hell'."]),
       Option "" ["quilt"] (NoArg (sourceFormat ~= Just Quilt3))
              "The package has an upstream tarball, write '3.0 (quilt)' into source/format.",
+      Option "" ["native"] (NoArg (sourceFormat ~= Just Native3))
+             "The package has an no upstream tarball, write '3.0 (native)' into source/format.",
+      Option "" ["official"] (NoArg (official ~= True))
+             "This packaging is created of the official Debian Haskell Group",
       Option "" ["builddir"] (ReqArg (\ s -> buildDir ~= singleton (s </> "build")) "PATH")
              (unlines [ "Subdirectory where cabal does its build, dist/build by default, dist-ghc when"
                       , "run by haskell-devscripts.  The build subdirectory is added to match the"
diff --git a/src/Debian/Debianize/Prelude.hs b/src/Debian/Debianize/Prelude.hs
--- a/src/Debian/Debianize/Prelude.hs
+++ b/src/Debian/Debianize/Prelude.hs
@@ -7,7 +7,8 @@
     , DebMap
     , buildDebVersionMap
     , (!)
-    , trim
+    , strip
+    , stripWith
     , strictReadF
     , replaceFile
     , modifyFile
@@ -52,10 +53,10 @@
 import Data.Char (isSpace)
 import qualified Data.Lens.Lazy as Lens ((~=), (%=))
 import Data.Lens.Lazy (getL, Lens, lens, modL, setL)
-import Data.List as List (isSuffixOf, intercalate, map, lines)
+import Data.List as List (isSuffixOf, intersperse, map, lines, dropWhileEnd)
 import Data.Map as Map (Map, foldWithKey, empty, fromList, findWithDefault, insert, map, lookup, insertWith)
 import Data.Maybe (catMaybes, mapMaybe, listToMaybe, fromMaybe, fromJust)
-import Data.Monoid (Monoid, (<>), mappend)
+import Data.Monoid (Monoid, (<>), mappend, mconcat)
 import Data.Set as Set (Set, toList)
 import qualified Data.Set as Set
 import Data.Text as Text (Text, unpack, lines)
@@ -97,9 +98,12 @@
 (!) :: DebMap -> D.BinPkgName -> DebianVersion
 m ! k = maybe (error ("No version number for " ++ (show . pPrint . PP $ k) ++ " in " ++ show (Map.map (maybe Nothing (Just . prettyDebianVersion)) m))) id (Map.findWithDefault Nothing k m)
 
-trim :: String -> String
-trim = dropWhile isSpace
+strip :: String -> String
+strip = stripWith isSpace
 
+stripWith :: (a -> Bool) -> [a] -> [a]
+stripWith f = dropWhile f . dropWhileEnd f
+
 strictReadF :: (Text -> r) -> FilePath -> IO r
 strictReadF f path = withFile path ReadMode (\h -> hGetContents h >>= (\x -> return $! f x))
 -- strictRead = strictReadF id
@@ -189,11 +193,9 @@
 showDeps :: D.Relations -> String
 showDeps = show . pPrint . PP
 
--- The extra space after prefix' is here for historical reasons(?)
-showDeps' :: [a] -> D.Relations -> String
-showDeps' prefix xss =
-    intercalate  ("\n" ++ prefix' ++ " ") . Prelude.lines . show . pPrint . PP $ xss
-    where prefix' = List.map (\ _ -> ' ') prefix
+showDeps' :: D.Relations -> String
+showDeps' xss = show $ mconcat $ intersperse (text "\n ") $
+    [pPrint (PP xs) <> text "," | xs <- xss ]
 
 -- | From Darcs.Utils - set the working directory and run an IO operation.
 withCurrentDirectory :: FilePath -> IO a -> IO a
diff --git a/src/Debian/Debianize/Types.hs b/src/Debian/Debianize/Types.hs
--- a/src/Debian/Debianize/Types.hs
+++ b/src/Debian/Debianize/Types.hs
@@ -19,12 +19,11 @@
 
     -- * Source Package Info
     , sourcePackageName
+    , overrideDebianNameBase
     , revision
     , debVersion
     , maintainer
     , copyright
-    , license
-    , licenseFile
     , sourceArchitectures
     , sourcePriority
     , sourceSection
@@ -35,14 +34,16 @@
     , standardsVersion
     , rulesHead
     , rulesFragments
+    , official
     , noProfilingLibrary
-    , noHoogle
     , noDocumentationLibrary
     , utilsPackageNameBase
     , buildDir
     , watch
+    , xDescription
 
     -- * Source Package Build Dependencies
+    , omitProfVersionDeps
     , omitLTDeps
     -- , compilerVersion
 
diff --git a/src/Debian/Debianize/Types/Atoms.hs b/src/Debian/Debianize/Types/Atoms.hs
--- a/src/Debian/Debianize/Types/Atoms.hs
+++ b/src/Debian/Debianize/Types/Atoms.hs
@@ -26,14 +26,14 @@
 import Data.Set as Set (Set, singleton, insert)
 import Data.Text (Text)
 import Debian.Changes (ChangeLog)
+import Debian.Debianize.Types.CopyrightDescription
 import qualified Debian.Debianize.Types.SourceDebDescription as S
-import Debian.Debianize.VersionSplits (VersionSplits)
+import Debian.Debianize.VersionSplits (VersionSplits, DebBase)
 import Debian.Orphans ()
 import Debian.Policy (PackageArchitectures, PackagePriority, Section, SourceFormat)
 import Debian.Relation (BinPkgName, Relations, SrcPkgName)
 import Debian.Version (DebianVersion)
 import Distribution.Compiler (CompilerFlavor(GHC))
-import Distribution.License (License)
 import Distribution.Package (PackageName)
 import Distribution.PackageDescription as Cabal (FlagName, PackageDescription)
 import Prelude hiding (init, init, log, log, unlines, (.))
@@ -62,8 +62,8 @@
       -- ^ Do not produce a libghc-foo-doc package.
       , noProfilingLibrary_ :: Bool
       -- ^ Do not produce a libghc-foo-prof package.
-      , noHoogle_ :: Bool
-      -- ^ Don't link the documentation for hoogle.
+      , omitProfVersionDeps_ :: Bool
+      -- ^ If present, Do not put the version dependencies on the prof packages that we put on the dev packages.
       , omitLTDeps_ :: Bool
       -- ^ If present, don't generate the << dependency when we see a cabal
       -- equals dependency.  (The implementation of this was somehow lost.)
@@ -94,6 +94,10 @@
       -- the name is constructed from the cabal package name.  Note that
       -- DebianNameMap could encode this information if we already knew
       -- the cabal package name, but we can't assume that.
+      , overrideDebianNameBase_ :: Maybe DebBase
+      -- ^ If given, use this name for the base of the debian binary
+      -- packages - the string between 'libghc-' and '-dev'.  Normally
+      -- this is derived from the hackage package name.
       , revision_ :: Maybe String
       -- ^ Specify the revision string to use when converting the
       -- cabal version to debian.
@@ -133,6 +137,8 @@
       , utilsPackageNameBase_ :: Maybe String
       -- ^ Name of a package that will get left-over data files and executables.
       -- If there are more than one, each package will get those files.
+      , xDescription_ :: Maybe Text
+      -- ^ The text for the X-Description field of the Source package stanza.
       , changelog_ :: Maybe ChangeLog
       -- ^ The changelog, first entry contains the source package name and version
       , comments_ :: Maybe [[Text]]
@@ -158,12 +164,9 @@
       -- ^ Supply some info about a cabal package.
       , compat_ :: Maybe Int
       -- ^ The debhelper compatibility level, from debian/compat.
-      , copyright_ :: Maybe Text
-      -- ^ Copyright information
-      , license_ :: Maybe License
-      -- ^ License information Cabal License value
-      , licenseFile_ :: Maybe Text
-      -- ^ The contents of the file specified in the cabal license-file: field
+      -- , copyright_ :: Maybe (Either CopyrightDescription Text)
+      , copyright_ :: CopyrightDescription
+      -- ^ Copyright and license information
       , apacheSite_ :: Map BinPkgName (String, FilePath, Text)
       -- ^ Have Apache configure a site using PACKAGE, DOMAIN, LOGDIR, and APACHECONFIGFILE
       , logrotateStanza_ :: Map BinPkgName (Set Text)
@@ -225,6 +228,8 @@
       -- ^ The result of reading a cabal configuration file.
       , compilerFlavors_ :: Set CompilerFlavor
       -- ^ Which compilers should we generate library packages for?
+      , official_ :: Bool
+      -- ^ Whether this packaging is created by the Debian Haskell Group
       } deriving (Eq, Show, Data, Typeable)
 
 data Atom
@@ -270,7 +275,7 @@
     Atoms
       { noDocumentationLibrary_ = False
       , noProfilingLibrary_ = False
-      , noHoogle_ = False
+      , omitProfVersionDeps_ = False
       , omitLTDeps_ = False
       , buildDir_ = mempty
       , buildEnv_ = envset
@@ -278,6 +283,7 @@
       , debianNameMap_ = mempty
       , control_ = S.newSourceDebDescription
       , sourcePackageName_ = Nothing
+      , overrideDebianNameBase_ = Nothing
       , revision_ = Nothing
       , debVersion_ = Nothing
       , maintainerOld_ = Nothing
@@ -290,6 +296,7 @@
       , warning_ = mempty
       , utilsPackageNameBase_ = Nothing
       , changelog_ = Nothing
+      , xDescription_ = Nothing
       , comments_ = Nothing
       , missingDependencies_ = mempty
       , extraLibMap_ = mempty
@@ -297,9 +304,7 @@
       , epochMap_ = mempty
       , packageInfo_ = mempty
       , compat_ = Nothing
-      , copyright_ = Nothing
-      , license_ = Nothing
-      , licenseFile_ = mempty
+      , copyright_ = newCopyrightDescription
       , apacheSite_ = mempty
       , logrotateStanza_ = mempty
       , postInst_ = mempty
@@ -332,6 +337,7 @@
       , extraDevDeps_ = mempty
       , packageDescription_ = Nothing
       , compilerFlavors_ = singleton GHC
+      , official_ = False
       }
 
 -- | This record supplies information about the task we want done -
@@ -521,6 +527,10 @@
 sourcePackageName :: Lens Atoms (Maybe SrcPkgName)
 sourcePackageName = lens sourcePackageName_ (\ a b -> b {sourcePackageName_ = a})
 
+-- | Override the default base of the debian binary package names.
+overrideDebianNameBase :: Lens Atoms (Maybe DebBase)
+overrideDebianNameBase = lens overrideDebianNameBase_ (\ a b -> b {overrideDebianNameBase_ = a})
+
 -- | Revision string used in constructing the debian verison number from the cabal version
 revision :: Lens Atoms (Maybe String)
 revision = lens revision_ (\ a b -> b {revision_ = a})
@@ -533,6 +543,10 @@
 packageInfo :: Lens Atoms (Map PackageName PackageInfo)
 packageInfo = lens packageInfo_ (\ a b -> b {packageInfo_ = a})
 
+-- | Do not put the version dependencies on the prof packages that we put on the dev packages.
+omitProfVersionDeps :: Lens Atoms Bool
+omitProfVersionDeps = lens omitProfVersionDeps_ (\ b a -> a {omitProfVersionDeps_ = b})
+
 -- | Set this to filter any less-than dependencies out of the generated debian
 -- dependencies.  (Not sure if this is implemented.)
 omitLTDeps :: Lens Atoms Bool
@@ -542,18 +556,19 @@
 noProfilingLibrary :: Lens Atoms Bool
 noProfilingLibrary = lens noProfilingLibrary_ (\ b a -> a {noProfilingLibrary_ = b})
 
--- | Set this to omit the hoogle documentation link
-noHoogle :: Lens Atoms Bool
-noHoogle = lens noHoogle_ (\ b a -> a {noHoogle_ = b})
-
 -- | Set this to omit the doc library deb.
 noDocumentationLibrary :: Lens Atoms Bool
 noDocumentationLibrary = lens noDocumentationLibrary_ (\ b a -> a {noDocumentationLibrary_ = b})
 
+-- | Set this to apply offical Debian settings
+official :: Lens Atoms Bool
+official = lens official_ (\ b a -> a {official_ = b})
+
 -- | The copyright information from the cabal file
-copyright :: Lens Atoms (Maybe Text)
+copyright :: Lens Atoms CopyrightDescription
 copyright = lens copyright_ (\ a b -> b {copyright_ = a})
 
+{-
 -- | The license information from the cabal file
 license :: Lens Atoms (Maybe License)
 license = lens license_ (\ a b -> b {license_ = a})
@@ -561,6 +576,7 @@
 -- | The value in the cabal file's license-file field
 licenseFile :: Lens Atoms (Maybe Text)
 licenseFile = lens licenseFile_ (\ a b -> b {licenseFile_ = a})
+-}
 
 -- | The architectures supported by this source package - @Any@,
 -- @All@, or some list of specific architectures.
@@ -615,6 +631,9 @@
 -- | the @debian\/changelog@ file
 changelog :: Lens Atoms (Maybe ChangeLog)
 changelog = lens changelog_ (\ a b -> b {changelog_ = a})
+
+xDescription :: Lens Atoms (Maybe Text)
+xDescription = lens xDescription_ (\ a b -> b {xDescription_ = a})
 
 -- | Comment entries for the latest changelog entry (DebLogComments [[Text]])
 comments :: Lens Atoms (Maybe [[Text]])
diff --git a/src/Debian/Debianize/Types/CopyrightDescription.hs b/src/Debian/Debianize/Types/CopyrightDescription.hs
new file mode 100644
--- /dev/null
+++ b/src/Debian/Debianize/Types/CopyrightDescription.hs
@@ -0,0 +1,162 @@
+-- | <https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/>
+{-# LANGUAGE DeriveDataTypeable, FlexibleInstances, OverloadedStrings, ScopedTypeVariables, TemplateHaskell, TupleSections #-}
+module Debian.Debianize.Types.CopyrightDescription
+    ( CopyrightDescription(..)
+    , FilesOrLicenseDescription(..)
+    , format
+    , upstreamName
+    , upstreamContact
+    , source
+    , disclaimer
+    , summaryComment
+    , summaryLicense
+    , summaryCopyright
+    , filesAndLicenses
+    , filesPattern
+    , filesCopyright
+    , filesLicense
+    , filesComment
+    , license
+    , comment
+    , newCopyrightDescription
+    , readCopyrightDescription
+    , parseCopyrightDescription
+    ) where
+
+import Data.Char (isSpace)
+import Data.Generics (Data, Typeable)
+import Data.Lens.Template (makeLenses)
+import Data.List (dropWhileEnd)
+import Data.Maybe (isJust, catMaybes, fromJust)
+import Data.Monoid ((<>))
+import Data.Text (Text, pack, unpack)
+import Debian.Control (Field'(Field), lookupP, Paragraph'(Paragraph), Control'(Control, unControl), parseControl)
+import Debian.Orphans ()
+import Debian.Policy (License(..), readLicense)
+import Debian.Pretty (PP(PP, unPP), display', ppDisplay', ppPrint)
+import Network.URI (URI, parseURI)
+import Prelude hiding (init, init, log, log, unlines, readFile)
+import Text.PrettyPrint.HughesPJClass (Pretty(pPrint), text)
+
+-- | Description of the machine readable debian/copyright file.  A
+-- special case is used to represeent the old style free format file -
+-- if the value is equal to newCopyrightDescription except for the
+-- field _summaryComment, the text in _summaryComment is the copyright
+-- file.
+data CopyrightDescription
+    = CopyrightDescription
+      { _format :: URI
+      , _upstreamName :: Maybe Text
+      , _upstreamContact :: Maybe Text
+      , _source :: Maybe Text
+      , _disclaimer :: Maybe Text
+      , _summaryComment :: Maybe Text
+      , _summaryLicense :: Maybe License
+      , _summaryCopyright :: Maybe Text
+      , _filesAndLicenses :: [FilesOrLicenseDescription]
+      } deriving (Eq, Ord, Show, Data, Typeable)
+
+data FilesOrLicenseDescription
+    = FilesDescription
+      { _filesPattern :: FilePath
+      , _filesCopyright :: Text
+      , _filesLicense :: License
+      , _filesComment :: Maybe Text
+      }
+    | LicenseDescription
+      { _license :: License
+      , _comment :: Maybe Text
+      } deriving (Eq, Ord, Show, Data, Typeable)
+
+instance Pretty (PP CopyrightDescription) where
+    -- Special case encodes free format debian/copyright file
+    pPrint (PP x@(CopyrightDescription {_summaryComment = Just t})) | x {_summaryComment = Nothing} == newCopyrightDescription = text (dropWhileEnd isSpace (unpack t) <> "\n")
+    pPrint x = ppPrint . toControlFile . unPP $ x
+
+newCopyrightDescription :: CopyrightDescription
+newCopyrightDescription =
+    CopyrightDescription
+    { _format = fromJust $ parseURI "http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/"
+    , _upstreamName = Nothing
+    , _upstreamContact = Nothing
+    , _source = Nothing
+    , _disclaimer = Nothing
+    , _summaryComment = Nothing
+    , _summaryLicense = Nothing
+    , _summaryCopyright = Nothing
+    , _filesAndLicenses = [] }
+
+-- | Try to read a CopyrightDescription from a file
+readCopyrightDescription :: Text -> CopyrightDescription
+readCopyrightDescription t =
+    case parseControl "debian/copyright" t of
+      Left _e -> newCopyrightDescription { _summaryComment = Just t }
+      Right ctl -> case parseCopyrightDescription (unControl ctl) of
+                     Just cpy -> cpy
+                     Nothing -> newCopyrightDescription { _summaryComment = Just t }
+
+parseCopyrightDescription :: [Paragraph' Text] -> Maybe CopyrightDescription
+parseCopyrightDescription (hd : tl) =
+    let (muri :: Maybe URI) = maybe Nothing (\ (Field (_, t)) -> parseURI . unpack $ t) (lookupP "Format" hd) in
+    case (muri, map parseFilesOrLicense tl) of
+      (Just uri, fnls) | all isJust fnls ->
+          Just $ CopyrightDescription
+                   { _format = uri
+                   , _upstreamName = fmap (\ (Field (_, x)) -> x) $ lookupP "Upstream-Name" hd
+                   , _upstreamContact = fmap (\ (Field (_, x)) -> x) $ lookupP "Upstream-Contact" hd
+                   , _source = fmap (\ (Field (_, x)) -> x) $ lookupP "Source" hd
+                   , _disclaimer = fmap (\ (Field (_, x)) -> x) $ lookupP "Disclaimer" hd
+                   , _summaryComment = fmap (\ (Field (_, x)) -> x) $ lookupP "Comment" hd
+                   , _summaryLicense = fmap (\ (Field (_, x)) -> readLicense x) $ lookupP "License" hd
+                   , _summaryCopyright = Nothing -- fmap (\ (Field (_, x)) -> x) $ lookupP "Copyright" hd
+                   , _filesAndLicenses = catMaybes fnls
+                   }
+      _ -> Nothing
+parseCopyrightDescription [] = Nothing
+
+parseFilesOrLicense :: Paragraph' Text -> Maybe (FilesOrLicenseDescription)
+parseFilesOrLicense p =
+    case (lookupP "Files" p, lookupP "Copyright" p, lookupP "License" p) of
+      (Just (Field (_, files)),
+       Just (Field (_, copyright)),
+       Just (Field (_, license))) ->
+          Just $ FilesDescription
+                 { _filesPattern = unpack files
+                 , _filesCopyright = copyright
+                 , _filesLicense = readLicense license
+                 , _filesComment = maybe Nothing (\ (Field (_, comment)) -> Just comment) (lookupP "Comment" p) }
+      (Nothing,
+       Nothing,
+       Just (Field (_, license))) ->
+          Just $ LicenseDescription
+                 { _license = readLicense license
+                 , _comment = maybe Nothing (\ (Field (_, comment)) -> Just comment) (lookupP "Comment" p) }
+      _ -> Nothing
+
+toControlFile :: CopyrightDescription -> Control' Text
+toControlFile d =
+    Control
+    ( Paragraph
+      ( [ Field ("Format", (" " <> ppDisplay' (_format d))) ] ++
+        maybe [] (\x -> [Field ("Upstream-Name", " " <> x)]) (_upstreamName d) ++
+        maybe [] (\x -> [Field ("Upstream-Contact", " " <> x)]) (_upstreamContact d) ++
+        maybe [] (\x -> [Field ("Source", " " <> x)]) (_source d) ++
+        maybe [] (\x -> [Field ("Disclaimer", " " <> x)]) (_disclaimer d) ++
+        maybe [] (\x -> [Field ("License", " " <> display' x)]) (_summaryLicense d) ++
+        maybe [] (\x -> [Field ("Copyright", " " <> x)]) (_summaryCopyright d) ++
+        maybe [] (\x -> [Field ("Comment", " " <> x)]) (_summaryComment d)) :
+      map toParagraph (_filesAndLicenses d) )
+
+toParagraph :: FilesOrLicenseDescription -> Paragraph' Text
+toParagraph fd@FilesDescription {} =
+    Paragraph $
+      [ Field ("Files", " " <> pack (_filesPattern fd))
+      , Field ("Copyright", " " <> _filesCopyright fd)
+      , Field ("License", " " <> display' (_filesLicense fd)) ] ++
+      maybe [] (\ t -> [Field ("Comment", " " <> t)]) (_filesComment fd)
+toParagraph ld@LicenseDescription {} =
+    Paragraph $
+      [ Field ("License", " " <> display' (_license ld)) ] ++
+      maybe [] (\ t -> [Field ("Comment", " " <> t)]) (_comment ld)
+
+$(makeLenses [''CopyrightDescription, ''FilesOrLicenseDescription])
diff --git a/src/Debian/Debianize/Types/SourceDebDescription.hs b/src/Debian/Debianize/Types/SourceDebDescription.hs
--- a/src/Debian/Debianize/Types/SourceDebDescription.hs
+++ b/src/Debian/Debianize/Types/SourceDebDescription.hs
@@ -18,6 +18,7 @@
     , homepage
     , vcsFields
     , xFields
+    , xDescription
     , binaryPackages
     , VersionControlSpec(..)
     , XField(..)
@@ -67,6 +68,7 @@
       , _buildConflicts :: Relations
       , _buildDependsIndep :: Relations
       , _buildConflictsIndep :: Relations
+      , _xDescription :: Maybe Text
       , _binaryPackages :: [BinaryDebDescription]
       -- ^ The binary debs.  This should be a map, but we may need to preserve the order
       } deriving (Eq, Ord, Show, Data, Typeable)
@@ -89,6 +91,7 @@
       , _homepage = Nothing
       , _vcsFields = Set.empty
       , _xFields = Set.empty
+      , _xDescription = Nothing -- Quick hack, I should maybe put this into _xFields
       , _binaryPackages = [] }
 
 newSourceDebDescription' :: SrcPkgName -> NameAddr -> SourceDebDescription
diff --git a/src/Debian/GHC.hs b/src/Debian/GHC.hs
--- a/src/Debian/GHC.hs
+++ b/src/Debian/GHC.hs
@@ -107,9 +107,6 @@
 compilerIdFromDebianVersion hc debVersion =
     let (Version ds ts) = greatestLowerBound debVersion (map (\ d -> Version [d] []) [0..]) in
     CompilerId hc (greatestLowerBound debVersion (map (\ d -> Version (ds ++ [d]) ts) [0..]))
-#if MIN_VERSION_Cabal(1,21,0)
-               Nothing
-#endif
     where
       greatestLowerBound :: DebianVersion -> [Version] -> Version
       greatestLowerBound b xs = last $ takeWhile (\ v -> parseDebianVersion (showVersion v) < b) xs
diff --git a/src/Debian/Orphans.hs b/src/Debian/Orphans.hs
--- a/src/Debian/Orphans.hs
+++ b/src/Debian/Orphans.hs
@@ -15,11 +15,18 @@
 #if !MIN_VERSION_Cabal(1,18,0)
 import Distribution.Compiler (CompilerFlavor(..))
 #endif
+#if MIN_VERSION_Cabal(1,22,0)
+import Distribution.Compiler (AbiTag(..))
+#endif
 import Distribution.License (License(..))
 import Distribution.PackageDescription (PackageDescription(package), Executable(..))
 import Distribution.Simple.Compiler (Compiler(..))
 import Distribution.Version (VersionRange(..), foldVersionRange')
-import Language.Haskell.Extension (Extension(..), KnownExtension(..), Language(..))
+import Language.Haskell.Extension (Language(..))
+#if !MIN_VERSION_Cabal(1,21,1)
+import Language.Haskell.Extension (Extension(..), KnownExtension(..))
+#endif
+import Network.URI (URI)
 import Text.ParserCombinators.Parsec.Rfc2822 (NameAddr(..))
 import Text.PrettyPrint.HughesPJClass (Pretty(pPrint), text, hcat)
 
@@ -33,6 +40,13 @@
 deriving instance Typeable KnownExtension
 #endif
 
+#if MIN_VERSION_Cabal(1,22,0)
+deriving instance Typeable AbiTag
+deriving instance Data AbiTag
+deriving instance Eq AbiTag
+deriving instance Ord AbiTag
+#endif
+
 deriving instance Data Compiler
 deriving instance Data CompilerId
 
@@ -44,8 +58,10 @@
 #endif
 
 deriving instance Ord Language
+#if !MIN_VERSION_Cabal(1,21,1)
 deriving instance Ord KnownExtension
 deriving instance Ord Extension
+#endif
 deriving instance Eq Compiler
 deriving instance Ord Compiler
 deriving instance Ord NameAddr
@@ -126,3 +142,6 @@
 
 instance Pretty (PP Version) where
     pPrint = text . showVersion . unPP
+
+instance Pretty (PP URI) where
+    pPrint = text . show . unPP
diff --git a/src/Debian/Policy.hs b/src/Debian/Policy.hs
--- a/src/Debian/Policy.hs
+++ b/src/Debian/Policy.hs
@@ -1,6 +1,6 @@
 -- | Code pulled out of cabal-debian that straightforwardly implements
 -- parts of the Debian policy manual, or other bits of Linux standards.
-{-# LANGUAGE DeriveDataTypeable, FlexibleInstances, OverloadedStrings #-}
+{-# LANGUAGE CPP, DeriveDataTypeable, FlexibleInstances, OverloadedStrings #-}
 module Debian.Policy
     ( -- * Paths
       databaseDirectory
@@ -33,6 +33,10 @@
     , parseMaintainer
     , getDebianMaintainer
     , haskellMaintainer
+    , License(..)
+    , fromCabalLicense
+    , toCabalLicense
+    , readLicense
     ) where
 
 import Codec.Binary.UTF8.String (decodeString)
@@ -41,19 +45,21 @@
 import Data.Char (toLower, isSpace)
 import Data.List (groupBy, intercalate)
 import Data.Generics (Data, Typeable)
-import Data.Maybe (mapMaybe)
+import Data.Maybe (fromMaybe, mapMaybe)
 import Data.Monoid ((<>))
 import Data.Text (Text, pack, unpack, strip)
 import Debian.Debianize.Prelude (read')
 import Debian.Pretty (PP(..))
 import Debian.Relation (BinPkgName)
 import Debian.Version (DebianVersion, parseDebianVersion, version)
+import qualified Distribution.License as Cabal
 import System.Environment (getEnvironment)
 import System.FilePath ((</>))
 import System.Process (readProcess)
 import Text.Parsec (parse)
 import Text.ParserCombinators.Parsec.Rfc2822 (NameAddr(..), address)
 import Text.PrettyPrint.HughesPJClass (Pretty(pPrint), text)
+import Text.Read (readMaybe)
 
 databaseDirectory :: BinPkgName -> String
 databaseDirectory x = "/srv" </> show (pPrint . PP $ x)
@@ -273,3 +279,117 @@
       Right [y] -> Right y
       Right [] -> Left $ "Missing maintainer: " ++ show x
       Right ys -> Left $ "Too many maintainers: " ++ show ys
+
+-- | Official Debian license types as described in
+-- <https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/#license-specification>.
+data License
+    = Public_Domain	-- ^ No license required for any purpose; the work is not subject to copyright in any jurisdiction.
+    | Apache		-- ^ Apache license 1.0, 2.0.
+    | Artistic		-- ^ Artistic license 1.0, 2.0.
+    | BSD_2_Clause	-- ^ Berkeley software distribution license, 2-clause version.
+    | BSD_3_Clause	-- ^ Berkeley software distribution license, 3-clause version.
+    | BSD_4_Clause	-- ^ Berkeley software distribution license, 4-clause version.
+    | ISC		-- ^ Internet Software Consortium, sometimes also known as the OpenBSD License.
+    | CC_BY		-- ^ Creative Commons Attribution license 1.0, 2.0, 2.5, 3.0.
+    | CC_BY_SA		-- ^ Creative Commons Attribution Share Alike license 1.0, 2.0, 2.5, 3.0.
+    | CC_BY_ND		-- ^ Creative Commons Attribution No Derivatives license 1.0, 2.0, 2.5, 3.0.
+    | CC_BY_NC		-- ^ Creative Commons Attribution Non-Commercial license 1.0, 2.0, 2.5, 3.0.
+    | CC_BY_NC_SA	-- ^ Creative Commons Attribution Non-Commercial Share Alike license 1.0, 2.0, 2.5, 3.0.
+    | CC_BY_NC_ND	-- ^ Creative Commons Attribution Non-Commercial No Derivatives license 1.0, 2.0, 2.5, 3.0.
+    | CC0		-- ^ Creative Commons Zero 1.0 Universal. Omit "Universal" from the license version when forming the short name.
+    | CDDL		-- ^ Common Development and Distribution License 1.0.
+    | CPL		-- ^ IBM Common Public License.
+    | EFL		-- ^ The Eiffel Forum License 1.0, 2.0.
+    | Expat		-- ^ The Expat license.
+    | GPL		-- ^ GNU General Public License 1.0, 2.0, 3.0.
+    | LGPL		-- ^ GNU Lesser General Public License 2.1, 3.0, or GNU Library General Public License 2.0.
+    | GFDL		-- ^ GNU Free Documentation License 1.0, 1.1, 1.2, or 1.3. Use GFDL-NIV instead if there are no Front-Cover or Back-Cover Texts or Invariant Sections.
+    | GFDL_NIV		-- ^ GNU Free Documentation License, with no Front-Cover or Back-Cover Texts or Invariant Sections. Use the same version numbers as GFDL.
+    | LPPL		-- ^ LaTeX Project Public License 1.0, 1.1, 1.2, 1.3c.
+    | MPL		-- ^ Mozilla Public License 1.1.
+    | Perl		-- ^ erl license (use "GPL-1+ or Artistic-1" instead)
+    | Python		-- ^ Python license 2.0.
+    | QPL		-- ^ Q Public License 1.0.
+    | W3C		-- ^ W3C Software License For more information, consult the W3C Intellectual Rights FAQ.
+    | Zlib		-- ^ zlib/libpng license.
+    | Zope		-- ^ Zope Public License 1.0, 1.1, 2.0, 2.1.
+    | OtherLicense String
+			-- ^ A license name associated with the subsequent text of the License: field or in
+			-- a Files paragraph of the same debian/copyright file, or in a License: paragraph.
+    deriving (Read, Show, Eq, Ord, Data, Typeable)
+
+-- We need a license parse function that converts these strings back
+-- into License values.
+instance Pretty License where
+    pPrint Public_Domain = text "public-domain"
+    pPrint Apache = text "Apache"
+    pPrint Artistic = text "Artistic"
+    pPrint BSD_2_Clause = text "BSD2"
+    pPrint BSD_3_Clause = text "BSD3"
+    pPrint BSD_4_Clause = text "BSD4"
+    pPrint ISC = text "ISC"
+    pPrint CC_BY = text "CC-BY"
+    pPrint CC_BY_SA = text "CC-BY-SA"
+    pPrint CC_BY_ND = text "CC-BY-ND"
+    pPrint CC_BY_NC = text "CC-BY-NC"
+    pPrint CC_BY_NC_SA = text "CC-BY-NC-SA"
+    pPrint CC_BY_NC_ND = text "CC-BY-NC-ND"
+    pPrint CC0 = text "CC0"
+    pPrint CDDL = text "CDDL"
+    pPrint CPL = text "CPL"
+    pPrint EFL = text "EFL"
+    pPrint Expat = text "Expat"
+    pPrint GPL = text "GPL"
+    pPrint LGPL = text "LGPL"
+    pPrint GFDL = text "GFDL"
+    pPrint GFDL_NIV = text "GFDL-NIV"
+    pPrint LPPL = text "LPPL"
+    pPrint MPL = text "MPL"
+    pPrint Perl = text "Perl"
+    pPrint Python = text "Python"
+    pPrint QPL = text "QPL"
+    pPrint W3C = text "W3C"
+    pPrint Zlib = text "Zlib"
+    pPrint Zope = text "Zope"
+    pPrint (OtherLicense s) = text s
+
+fromCabalLicense :: Cabal.License -> License
+fromCabalLicense x =
+    case x of
+      Cabal.GPL mver -> GPL -- FIXME - what about the version number?  same below
+      Cabal.AGPL mver -> OtherLicense (show x)
+      Cabal.LGPL mver -> LGPL
+      Cabal.BSD3 -> BSD_3_Clause
+      Cabal.BSD4 -> BSD_4_Clause
+      Cabal.MIT -> OtherLicense (show x)
+      Cabal.Apache mver -> Apache
+      Cabal.PublicDomain -> Public_Domain
+      Cabal.AllRightsReserved -> OtherLicense "AllRightsReserved"
+#if MIN_VERSION_Cabal(1,19,2)
+      Cabal.BSD2 -> BSD_2_Clause
+      Cabal.MPL ver -> MPL
+#endif
+#if MIN_VERSION_Cabal(1,21,1)
+      Cabal.UnspecifiedLicense -> OtherLicense (show x)
+#endif
+      Cabal.OtherLicense -> OtherLicense (show x)
+      Cabal.UnknownLicense s -> OtherLicense (show x)
+
+toCabalLicense :: License -> Cabal.License
+toCabalLicense x =
+    -- This needs to be finished
+    case x of
+#if MIN_VERSION_Cabal(1,19,2)
+      BSD_2_Clause -> Cabal.BSD2
+#endif
+      BSD_3_Clause -> Cabal.BSD3
+      BSD_4_Clause -> Cabal.BSD4
+      OtherLicense s -> Cabal.UnknownLicense s
+      _ -> Cabal.UnknownLicense (show x)
+
+invalidLicense :: Text -> License
+invalidLicense = OtherLicense . unpack
+
+-- | I think we need an actual parser for license names.
+readLicense :: Text -> License
+readLicense t = let s = unpack (strip t) in fromMaybe (invalidLicense t) (readMaybe s)
diff --git a/test-data/alex/output/debian/changelog b/test-data/alex/output/debian/changelog
--- a/test-data/alex/output/debian/changelog
+++ b/test-data/alex/output/debian/changelog
@@ -1,4 +1,4 @@
-haskell-alex (3.0.2-1~hackage1) unstable; urgency=low
+haskell-alex (3.0.2-1~hackage1) UNRELEASED; urgency=low
 
   * Debianization generated by cabal-debian
 
diff --git a/test-data/alex/output/debian/control b/test-data/alex/output/debian/control
--- a/test-data/alex/output/debian/control
+++ b/test-data/alex/output/debian/control
@@ -2,30 +2,31 @@
 Priority: extra
 Section: haskell
 Maintainer: Simon Marlow <marlowsd@gmail.com>
-Build-Depends: debhelper (>= 7.0)
-               , haskell-devscripts (>= 0.8)
-               , cdbs
-               , ghc
-               , ghc-prof
-               , alex
-               , libghc-quickcheck2-dev (>= 2)
-               , libghc-quickcheck2-prof (>= 2)
+Build-Depends: debhelper (>= 7.0),
+               haskell-devscripts (>= 0.8),
+               cdbs,
+               ghc,
+               ghc-prof,
+               alex,
+               libghc-quickcheck2-dev (>= 2),
+               libghc-quickcheck2-prof (>= 2),
 Build-Depends-Indep: ghc-doc
-                     , libghc-quickcheck2-doc (>= 2)
+                     , libghc-quickcheck2-doc (>= 2) | libghc-quickcheck1-doc (<< 2)
 Standards-Version: 3.9.3
 Homepage: http://www.haskell.org/alex/
+X-Description: Alex is a tool for generating lexical analysers in Haskell
 
 Package: alex
 Architecture: any
 Section: misc
-Depends: ${shlibs:Depends}
-        , ${haskell:Depends}
-        , ${misc:Depends}
+Depends: ${haskell:Depends},
+ ${misc:Depends},
+ ${shlibs:Depends},
 Recommends: ${haskell:Recommends}
 Suggests: ${haskell:Suggests}
 Conflicts: ${haskell:Conflicts}
 Provides: ${haskell:Provides}
-Replaces: ${haskell:Replaces}
-Description: Alex is a tool for generating lexical analysers in Haskell
- .
- An executable built from the alex package.
+Description: ${haskell:ShortDescription}${haskell:ShortBlurb}
+  ${haskell:LongDescription}
+  .
+  ${haskell:Blurb}
diff --git a/test-data/alex/output/debian/copyright b/test-data/alex/output/debian/copyright
--- a/test-data/alex/output/debian/copyright
+++ b/test-data/alex/output/debian/copyright
@@ -1,10 +1,15 @@
-Copyright (c) 1995-2011, Chris Dornan and Simon Marlow
-All rights reserved.
+Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
 
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
+Files: *
+Copyright: (c) Chis Dornan, Simon Marlow
+License: BSD3
+Comment: Copyright (c) 1995-2011, Chris Dornan and Simon Marlow
+ All rights reserved.
 
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
+
     * Redistributions of source code must retain the above copyright
       notice, this list of conditions and the following disclaimer.
 
@@ -17,14 +22,14 @@
       contributors may be used to endorse or promote products derived
       from this software without specific prior written permission.
 
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/test-data/alex/output/debian/rules b/test-data/alex/output/debian/rules
--- a/test-data/alex/output/debian/rules
+++ b/test-data/alex/output/debian/rules
diff --git a/test-data/archive/output/debian/control b/test-data/archive/output/debian/control
--- a/test-data/archive/output/debian/control
+++ b/test-data/archive/output/debian/control
@@ -15,24 +15,22 @@
                , libghc-network-prof
 Build-Depends-Indep: ghc-doc
                      , libghc-extra-doc
-                     , libghc-archive-doc (>= 1.7)
+                     , libghc-archive-doc
                      , libghc-network-doc
 Standards-Version: 3.8.1
+X-Description: Backups of the seereason darcs repositories
+ Install this somewhere other than where the server is running get
+ automated backups of the database.
 
 Package: seereason-darcs-backups
 Architecture: any
 Section: misc
-Depends: ${shlibs:Depends}, ${haskell:Depends}, ${misc:Depends}, anacron
+Depends: ${haskell:Depends}, ${misc:Depends}, ${shlibs:Depends}, anacron
 Recommends: ${haskell:Recommends}
 Suggests: ${haskell:Suggests}
 Conflicts: ${haskell:Conflicts}
 Provides: ${haskell:Provides}
-Replaces: ${haskell:Replaces}
-Description: Backups of the seereason darcs repositories
- Install this somewhere other than where the server is running get
- automated backups of the database.
- .
-  Author: SeeReason Partners <partners@seereason.com>
-  Upstream-Maintainer: SeeReason Partners <partners@seereason.com>
- .
- Files associated with the seereason-darcs-backups package.
+Description: ${haskell:ShortDescription}${haskell:ShortBlurb}
+  ${haskell:LongDescription}
+  .
+  ${haskell:Blurb}
diff --git a/test-data/archive/output/debian/copyright b/test-data/archive/output/debian/copyright
--- a/test-data/archive/output/debian/copyright
+++ b/test-data/archive/output/debian/copyright
@@ -1,4 +1,9 @@
-This package is not part of the Debian GNU/Linux distribution.
+Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
 
+Files: *
 Copyright: (c) 2010-2011, SeeReason Partners LLC
-License: All Rights Reserved
+License: AllRightsReserved
+Comment: This package is not part of the Debian GNU/Linux distribution.
+
+ Copyright: (c) 2010-2011, SeeReason Partners LLC
+ License: All Rights Reserved
diff --git a/test-data/archive/output/debian/rules b/test-data/archive/output/debian/rules
--- a/test-data/archive/output/debian/rules
+++ b/test-data/archive/output/debian/rules
diff --git a/test-data/artvaluereport-data/output/debian/control b/test-data/artvaluereport-data/output/debian/control
--- a/test-data/artvaluereport-data/output/debian/control
+++ b/test-data/artvaluereport-data/output/debian/control
@@ -93,17 +93,17 @@
 Build-Depends-Indep: ghc-doc
                      , libghc-extra-doc
                      , libghc-hunit-doc
-                     , libghc-hatex-doc (>= 3.4)
-                     , libghc-haxml-doc (>= 1:1.22.5)
+                     , libghc-hatex-doc
+                     , libghc-haxml-doc
                      , libghc-listlike-doc
                      , libghc-rjson-doc
-                     , libghc-unixutils-doc (>= 1.50)
+                     , libghc-unixutils-doc
                      , libghc-acid-state-doc
                      , libghc-applicative-extras-doc
                      , libghc-cabal-debian-doc
                      , libghc-cereal-doc
-                     , libghc-cryptohash-doc (>= 0.7)
-                     , libghc-debian-doc (>= 3.67)
+                     , libghc-cryptohash-doc
+                     , libghc-debian-doc
                      , libghc-formlets-doc
                      , libghc-happstack-extra-doc
                      , libghc-happstack-hsp-doc
@@ -112,21 +112,21 @@
                      , libghc-hslogger-doc
                      , libghc-hsp-doc
                      , libghc-hsx-doc
-                     , libghc-html-entities-doc (>= 1.3)
+                     , libghc-html-entities-doc
                      , libghc-ixset-doc
                      , libghc-listlike-instances-doc
                      , libghc-maccatcher-doc
                      , libghc-mtl-doc
-                     , libghc-network-doc (>= 2.4)
+                     , libghc-network-doc
                      , libghc-pandoc-doc
                      , libghc-pandoc-types-doc
                      , libghc-parsec3-doc (>= 3) | libghc-parsec2-doc (<< 3)
-                     , libghc-process-extras-doc (>= 0.6)
+                     , libghc-process-extras-doc
                      , libghc-process-progress-doc
                      , libghc-puremd5-doc
                      , libghc-random-doc
                      , libghc-regex-compat-doc
-                     , libghc-revision-doc (>= 0.8)
+                     , libghc-revision-doc
                      , libghc-safecopy-doc
                      , libghc-syb-doc
                      , libghc-syb-with-class-doc
@@ -134,65 +134,46 @@
                      , libghc-utf8-string-doc
 Standards-Version: 3.9.3
 Homepage: http://artvaluereportonline.com
+X-Description: Data structures used by the fine art appraisal application
+ Data structures used by the fine art appraisal application
 
 Package: libghc-artvaluereport-data-dev
 Architecture: any
-Depends: ${shlibs:Depends}
-         , ${haskell:Depends}
+Depends: ${haskell:Depends}
          , ${misc:Depends}
+         , ${shlibs:Depends}
 Conflicts: ${haskell:Conflicts}
 Provides: ${haskell:Provides}
-Replaces: ${haskell:Replaces}
 Recommends: ${haskell:Recommends}
 Suggests: ${haskell:Suggests}
-Description: Data structures used by the fine art appraisal application
- Data structures used by the fine art appraisal application
- .
-  Author: David Fox <dsf@seereason.com>
-  Upstream-Maintainer: David Fox <dsf@seereason.com>
- .
- This package provides a library for the Haskell programming language.
- See http:///www.haskell.org/ for more information on Haskell.
-
+Description: ${haskell:ShortDescription}${haskell:ShortBlurb}
+  ${haskell:LongDescription}
+  .
+  ${haskell:Blurb}
 
 Package: libghc-artvaluereport-data-prof
 Architecture: any
-Depends: ${shlibs:Depends}
-         , ${haskell:Depends}
+Depends: ${haskell:Depends}
          , ${misc:Depends}
 Conflicts: ${haskell:Conflicts}
 Provides: ${haskell:Provides}
-Replaces: ${haskell:Replaces}
 Recommends: ${haskell:Recommends}
 Suggests: ${haskell:Suggests}
-Description: Data structures used by the fine art appraisal application
- Data structures used by the fine art appraisal application
- .
-  Author: David Fox <dsf@seereason.com>
-  Upstream-Maintainer: David Fox <dsf@seereason.com>
- .
- This package provides a library for the Haskell programming language, compiled
- for profiling.  See http:///www.haskell.org/ for more information on Haskell.
-
+Description: ${haskell:ShortDescription}${haskell:ShortBlurb}
+  ${haskell:LongDescription}
+  .
+  ${haskell:Blurb}
 
 Package: libghc-artvaluereport-data-doc
 Architecture: all
 Section: doc
-Depends: ${shlibs:Depends}
-         , ${haskell:Depends}
+Depends: ${haskell:Depends}
          , ${misc:Depends}
 Conflicts: ${haskell:Conflicts}
-Provides: ${haskell:Provides}
-Replaces: ${haskell:Replaces}
 Recommends: ${haskell:Recommends}
 Suggests: ${haskell:Suggests}
-Description: Data structures used by the fine art appraisal application
- Data structures used by the fine art appraisal application
- .
-  Author: David Fox <dsf@seereason.com>
-  Upstream-Maintainer: David Fox <dsf@seereason.com>
- .
- This package provides the documentation for a library for the Haskell
- programming language.
- See http:///www.haskell.org/ for more information on Haskell.
+Description: ${haskell:ShortDescription}${haskell:ShortBlurb}
+  ${haskell:LongDescription}
+  .
+  ${haskell:Blurb}
 
diff --git a/test-data/artvaluereport-data/output/debian/copyright b/test-data/artvaluereport-data/output/debian/copyright
--- a/test-data/artvaluereport-data/output/debian/copyright
+++ b/test-data/artvaluereport-data/output/debian/copyright
@@ -1,2 +1,5 @@
-(c) 2008-2011, SeeReason Partners LLC
-License: Proprietary
+Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+
+Files: *
+Copyright: (c) 2008-2011, SeeReason Partners LLC
+License: AllRightsReserved
diff --git a/test-data/artvaluereport-data/output/debian/libghc-artvaluereport-data-doc.links b/test-data/artvaluereport-data/output/debian/libghc-artvaluereport-data-doc.links
deleted file mode 100644
--- a/test-data/artvaluereport-data/output/debian/libghc-artvaluereport-data-doc.links
+++ /dev/null
@@ -1,1 +0,0 @@
-/usr/share/doc/libghc-artvaluereport-data-doc/html/artvaluereport-data.txt /usr/lib/ghc-doc/hoogle/artvaluereport-data.txt
diff --git a/test-data/artvaluereport2/input/debian/Debianize.hs b/test-data/artvaluereport2/input/debian/Debianize.hs
--- a/test-data/artvaluereport2/input/debian/Debianize.hs
+++ b/test-data/artvaluereport2/input/debian/Debianize.hs
@@ -5,21 +5,20 @@
 import Data.Set (singleton)
 import Data.Text as Text (intercalate)
 import Debian.Changes (ChangeLog(..))
-import Debian.Debianize (debianization, doBackups, doExecutable, doServer, doWebsite, inputChangeLog, inputDebianization, seereasonDefaultAtoms)
+import Debian.Debianize (debianization, doBackups, doExecutable, doServer, doWebsite, inputChangeLog, inputDebianization, debianDefaultAtoms)
 import Debian.Debianize.Types as T
     (changelog, binaryArchitectures, buildDependsIndep, changelog, compat, control, depends, debianDescription,
      installCabalExec, installData, sourcePackageName, homepage, standardsVersion)
 import Debian.Debianize.Types.Atoms as T
-    (Atoms, newAtoms, InstallFile(..), Server(..), Site(..))
+    (Atoms, newAtoms, InstallFile(..), Server(..), Site(..), EnvSet(..))
 import Debian.Debianize.Monad (execDebT, evalDebT, DebT, execDebM)
-import Debian.Debianize.Types (Top(Top))
 import Debian.Debianize.Types.SourceDebDescription (SourceDebDescription)
 import Debian.Debianize.Output (compareDebianization)
-import Debian.Debianize.Prelude ((~=), (%=), (+=), (++=), (+++=), (~?=))
+import Debian.Debianize.Prelude ((~=), (%=), (+=), (++=), (+++=), (~?=), withCurrentDirectory)
+import Debian.Pretty (ppDisplay)
 import Debian.Policy (databaseDirectory, PackageArchitectures(All), StandardsVersion(StandardsVersion))
 import Debian.Relation (BinPkgName(BinPkgName), Relation(Rel), SrcPkgName(..), VersionReq(SLT))
 import Debian.Version (parseDebianVersion)
-import Text.PrettyPrint.ANSI.Leijen (Pretty(pretty))
 
 -- This looks just like a "real" Debianize.hs file except that it
 -- returns the comparison string instead of doing a
@@ -28,9 +27,9 @@
 -- copyFirstLogEntry.
 main :: IO ()
 main =
-    do log <- evalDebT (inputChangeLog (Top "test-data/artvaluereport2/input") >> access changelog) newAtoms
-       new <- execDebT (debianization (Top "test-data/artvaluereport2/input") seereasonDefaultAtoms (customize log)) newAtoms
-       old <- execDebT (inputDebianization (Top "test-data/artvaluereport2/output")) newAtoms
+    do log <- withCurrentDirectory "test-data/artvaluereport2/input" $ newAtoms >>= evalDebT (inputChangeLog >> access changelog)
+       new <- withCurrentDirectory "test-data/artvaluereport2/input" $ newAtoms >>= execDebT (debianization debianDefaultAtoms (customize log))
+       old <- withCurrentDirectory "test-data/artvaluereport2/output" $ newAtoms >>= execDebT (inputDebianization (T.EnvSet "/" "/" "/"))
        -- The newest log entry gets modified when the Debianization is
        -- generated, it won't match so drop it for the comparison.
        compareDebianization old (copyFirstLogEntry old new) >>= putStr
@@ -38,7 +37,7 @@
       customize :: Maybe ChangeLog -> DebT IO ()
       customize log =
           do T.changelog ~?= log
-             installCabalExec +++= (BinPkgName "appraisalscope", singleton ("lookatareport", "usr/bin"))
+             installCabalExec (BinPkgName "appraisalscope") "lookatareport" "usr/bin"
              doExecutable (BinPkgName "appraisalscope") (InstallFile {execName = "appraisalscope", sourceDir = Nothing, destDir = Nothing, destName = "appraisalscope"})
              doServer (BinPkgName "artvaluereport2-development") (theServer (BinPkgName "artvaluereport2-development"))
              doServer (BinPkgName "artvaluereport2-staging") (theServer (BinPkgName "artvaluereport2-staging"))
@@ -75,10 +74,10 @@
       addServerData :: DebT IO ()
       addServerData = mapM_ addData (map BinPkgName ["artvaluereport2-development", "artvaluereport2-staging", "artvaluereport2-production"])
       addData p =
-          do installData +++= (p, singleton ("theme/ArtValueReport_SunsetSpectrum.ico", "ArtValueReport_SunsetSpectrum.ico"))
+          do installData p "theme/ArtValueReport_SunsetSpectrum.ico" "ArtValueReport_SunsetSpectrum.ico"
              mapM_ (addDataFile p) ["Udon.js", "flexbox.css", "DataTables-1.8.2", "html5sortable", "jGFeed", "searchMag.png",
                                     "Clouds.jpg", "tweaks.css", "verticalTabs.css", "blueprint", "jquery.blockUI", "jquery.tinyscrollbar"]
-      addDataFile p path = installData +++= (p, singleton (path, path))
+      addDataFile p path = installData p path path
 
       theSite :: BinPkgName -> Site
       theSite deb =
@@ -100,7 +99,7 @@
                                        BinPkgName "artvaluereport2-production" -> "http://" ++ hostname' ++ "/"
                                        _ -> "http://seereason.com:" ++ show (portNum deb) ++ "/"
                      , "--top", databaseDirectory deb
-                     , "--logs", "/var/log/" ++ show (pretty deb)
+                     , "--logs", "/var/log/" ++ ppDisplay deb
                      , "--log-mode", case deb of
                                        BinPkgName "artvaluereport2-production" -> "Production"
                                        _ -> "Development"
@@ -115,7 +114,7 @@
                      , "--json2-path",json2Path ] -})
                  , installFile =
                      InstallFile { execName   = "artvaluereport2-server"
-                                 , destName   = show (pretty deb)
+                                 , destName   = ppDisplay deb
                                  , sourceDir  = Nothing
                                  , destDir    = Nothing }
                  }
diff --git a/test-data/artvaluereport2/output/debian/artvaluereport2-production.logrotate b/test-data/artvaluereport2/output/debian/artvaluereport2-production.logrotate
--- a/test-data/artvaluereport2/output/debian/artvaluereport2-production.logrotate
+++ b/test-data/artvaluereport2/output/debian/artvaluereport2-production.logrotate
@@ -1,4 +1,5 @@
 /var/log/apache2/artvaluereport2-production/access.log {
+  copytruncate
   weekly
   rotate 5
   compress
@@ -6,6 +7,7 @@
 }
 
 /var/log/apache2/artvaluereport2-production/error.log {
+  copytruncate
   weekly
   rotate 5
   compress
diff --git a/test-data/artvaluereport2/output/debian/control b/test-data/artvaluereport2/output/debian/control
--- a/test-data/artvaluereport2/output/debian/control
+++ b/test-data/artvaluereport2/output/debian/control
@@ -1,5 +1,5 @@
 Source: haskell-artvaluereport2
-Priority: optional
+Priority: extra
 Section: haskell
 Maintainer: Clifford Beshers <beshers@seereason.com>
 Build-Depends: debhelper (>= 7.0)
@@ -29,20 +29,12 @@
                , libghc-artvaluereport-data-prof (>= 1.66)
                , libghc-authenticate-dev
                , libghc-authenticate-prof
-               , libghc-base-dev | ghc
-               , libghc-base-prof | ghc-prof
-               , libghc-binary-dev | ghc
-               , libghc-binary-prof | ghc-prof
-               , libghc-blaze-html-dev (>= 0.6) | libghc-blaze-html-5-dev (<< 0.6)
-               , libghc-blaze-html-prof (>= 0.6) | libghc-blaze-html-5-prof (<< 0.6)
+               , libghc-blaze-html-dev
+               , libghc-blaze-html-prof
                , libghc-blaze-markup-dev
                , libghc-blaze-markup-prof
-               , libghc-bytestring-dev | ghc
-               , libghc-bytestring-prof | ghc-prof
                , libghc-cereal-dev
                , libghc-cereal-prof
-               , libghc-containers-dev | ghc
-               , libghc-containers-prof | ghc-prof
                , libghc-data-accessor-dev
                , libghc-data-accessor-prof
                , libghc-debian-dev
@@ -53,20 +45,16 @@
                , libghc-digestive-functors-prof
                , libghc-digestive-functors-happstack-dev
                , libghc-digestive-functors-happstack-prof
-               , libghc-directory-dev | ghc
-               , libghc-directory-prof | ghc-prof
                , libghc-directory-tree-dev
                , libghc-directory-tree-prof
                , libghc-fb-dev
                , libghc-fb-prof
-               , libghc-filepath-dev | ghc
-               , libghc-filepath-prof | ghc-prof
                , libghc-groom-dev
                , libghc-groom-prof
                , libghc-happstack-dev
                , libghc-happstack-prof
-               , libghc-happstack-authenticate-dev (>= 0.10) | libghc-happstack-authenticate-9-dev (<< 0.10)
-               , libghc-happstack-authenticate-prof (>= 0.10) | libghc-happstack-authenticate-9-prof (<< 0.10)
+               , libghc-happstack-authenticate-dev
+               , libghc-happstack-authenticate-prof
                , libghc-happstack-extra-dev
                , libghc-happstack-extra-prof
                , libghc-happstack-hsp-dev
@@ -103,18 +91,10 @@
                , libghc-mtl-prof
                , libghc-network-dev (>= 2.4)
                , libghc-network-prof (>= 2.4)
-               , libghc-old-locale-dev | ghc
-               , libghc-old-locale-prof | ghc-prof
-               , libghc-old-time-dev | ghc
-               , libghc-old-time-prof | ghc-prof
                , libghc-pandoc-dev
                , libghc-pandoc-prof
                , libghc-parsec3-dev (>= 3) | libghc-parsec2-dev (<< 3)
                , libghc-parsec3-prof (>= 3) | libghc-parsec2-prof (<< 3)
-               , libghc-pretty-dev | ghc
-               , libghc-pretty-prof | ghc-prof
-               , libghc-process-dev | ghc
-               , libghc-process-prof | ghc-prof
                , libghc-process-extras-dev (>= 0.5)
                , libghc-process-extras-prof (>= 0.5)
                , libghc-puremd5-dev
@@ -137,14 +117,8 @@
                , libghc-tagged-prof
                , libghc-text-dev
                , libghc-text-prof
-               , libghc-time-dev | ghc
-               , libghc-time-prof | ghc-prof
-               , libghc-transformers-dev
-               , libghc-transformers-prof
                , libghc-uniplate-dev
                , libghc-uniplate-prof
-               , libghc-unix-dev | ghc
-               , libghc-unix-prof | ghc-prof
                , libghc-utf8-string-dev
                , libghc-utf8-string-prof
                , libghc-web-routes-dev
@@ -155,99 +129,86 @@
                , libghc-web-routes-hsp-prof
                , libghc-web-routes-th-dev
                , libghc-web-routes-th-prof
-               , libghc-xhtml-dev
-               , libghc-xhtml-prof
+               , libghc-extra-dev
+               , libghc-extra-prof
 Build-Depends-Indep: ghc-doc
                      , libjs-jquery-ui (<< 1.10)
                      , libjs-jquery
                      , libjs-jcrop
-                     , libghc-extra-doc (>= 1.35)
+                     , libghc-extra-doc
                      , libghc-hjscript-doc
                      , libghc-hatex-doc
-                     , libghc-quickcheck2-doc (>= 2)
+                     , libghc-quickcheck2-doc (>= 2) | libghc-quickcheck1-doc (<< 2)
                      , libghc-rjson-doc
                      , libghc-unixutils-doc
-                     , libghc-acid-state-doc (>= 0.6)
-                     , libghc-applicative-extras-doc (>= 0.1.5)
-                     , libghc-archive-doc (>= 1.2.9)
-                     , libghc-artvaluereport-data-doc (>= 1.66)
+                     , libghc-acid-state-doc
+                     , libghc-applicative-extras-doc
+                     , libghc-archive-doc
+                     , libghc-artvaluereport-data-doc
                      , libghc-authenticate-doc
-                     , libghc-base-doc | ghc-doc
-                     , libghc-binary-doc | ghc-doc
-                     , libghc-blaze-html-doc (>= 0.6) | libghc-blaze-html-5-doc (<< 0.6)
+                     , libghc-blaze-html-doc
                      , libghc-blaze-markup-doc
-                     , libghc-bytestring-doc | ghc-doc
                      , libghc-cereal-doc
-                     , libghc-containers-doc | ghc-doc
                      , libghc-data-accessor-doc
                      , libghc-debian-doc
-                     , libghc-debian-packaging-doc (>= 0.8)
+                     , libghc-debian-packaging-doc
                      , libghc-digestive-functors-doc
                      , libghc-digestive-functors-happstack-doc
-                     , libghc-directory-doc | ghc-doc
                      , libghc-directory-tree-doc
                      , libghc-fb-doc
-                     , libghc-filepath-doc | ghc-doc
                      , libghc-groom-doc
                      , libghc-happstack-doc
-                     , libghc-happstack-authenticate-doc (>= 0.10)
+                     , libghc-happstack-authenticate-doc
                      , libghc-happstack-extra-doc
                      , libghc-happstack-hsp-doc
-                     , libghc-happstack-scaffolding-doc (>= 0.23)
+                     , libghc-happstack-scaffolding-doc
                      , libghc-happstack-server-doc
                      , libghc-happstack-util-doc
                      , libghc-harp-doc
                      , libghc-hslogger-doc
-                     , libghc-hsp-doc (>= 0.4.4)
+                     , libghc-hsp-doc
                      , libghc-hsx-doc
                      , libghc-html-doc
                      , libghc-html-entities-doc
                      , libghc-ixset-doc
-                     , libghc-jmacro-doc (>= 0.6.2)
+                     , libghc-jmacro-doc
                      , libghc-json-doc
 		     , libghc-language-css-doc
                      , libghc-lifted-base-doc
                      , libghc-mtl-doc
-                     , libghc-network-doc (>= 2.4)
-                     , libghc-old-locale-doc | ghc-doc
-                     , libghc-old-time-doc | ghc-doc
+                     , libghc-network-doc
                      , libghc-pandoc-doc
                      , libghc-parsec3-doc (>= 3) | libghc-parsec2-doc (<< 3)
-                     , libghc-pretty-doc | ghc-doc
-                     , libghc-process-doc | ghc-doc
-                     , libghc-process-extras-doc (>= 0.5)
+                     , libghc-process-extras-doc
                      , libghc-puremd5-doc
                      , libghc-random-doc
                      , libghc-regex-compat-doc
                      , libghc-revision-doc
                      , libghc-safe-doc
-                     , libghc-safecopy-doc (>= 0.5.1)
+                     , libghc-safecopy-doc
                      , libghc-syb-doc
                      , libghc-syb-with-class-doc
                      , libghc-tagged-doc
                      , libghc-text-doc
-                     , libghc-time-doc | ghc-doc
-                     , libghc-transformers-doc
                      , libghc-uniplate-doc
-                     , libghc-unix-doc | ghc-doc
                      , libghc-utf8-string-doc
                      , libghc-web-routes-doc
                      , libghc-web-routes-happstack-doc
                      , libghc-web-routes-hsp-doc
                      , libghc-web-routes-th-doc
-                     , libghc-xhtml-doc
 Standards-Version: 3.9.1
 Homepage: http://appraisalreportonline.com
+X-Description: Haskell modules for fine art appraisal applications
+ Haskell modules for fine art appraisal applications
 
 Package: artvaluereport2-backups
 Architecture: any
 Section: misc
-Depends: ${shlibs:Depends}, ${haskell:Depends}, ${misc:Depends}, anacron
+Depends: ${haskell:Depends}, ${misc:Depends}, ${shlibs:Depends}, anacron
 Recommends: ${haskell:Recommends}
 Suggests: ${haskell:Suggests}
 Conflicts: ${haskell:Conflicts}
 Provides: ${haskell:Provides}
-Replaces: ${haskell:Replaces}
 Description: backup program for the appraisalreportonline.com site
   Install this somewhere other than where the server is running get
   automated backups of the database.
@@ -255,61 +216,48 @@
 Package: artvaluereport2-production
 Architecture: all
 Section: misc
-Depends: ${shlibs:Depends}, ${haskell:Depends}, ${misc:Depends}, apache2, libjpeg-progs, libjs-jcrop, libjs-jquery, libjs-jquery-ui, netpbm, texlive-fonts-extra, texlive-fonts-recommended, texlive-latex-extra, texlive-latex-recommended
+Depends: ${haskell:Depends}, ${misc:Depends}, ${shlibs:Depends}, apache2, libjpeg-progs, libjs-jcrop, libjs-jquery, libjs-jquery-ui, netpbm, texlive-fonts-extra, texlive-fonts-recommended, texlive-latex-extra, texlive-latex-recommended
 Recommends: ${haskell:Recommends}
 Suggests: ${haskell:Suggests}
 Conflicts: ${haskell:Conflicts}
 Provides: ${haskell:Provides}
-Replaces: ${haskell:Replaces}
-Description: Haskell modules for fine art appraisal applications
- Haskell modules for fine art appraisal applications
- .
-  Author: David Fox <dsf@seereason.com>, Clifford Beshers <beshers@seereason.com>
-  Upstream-Maintainer: Clifford Beshers <beshers@seereason.com>
- .
- An executable built from the ArtValueReport package.
+Description: ${haskell:ShortDescription}${haskell:ShortBlurb}
+  ${haskell:LongDescription}
+  .
+  ${haskell:Blurb}
 
 Package: artvaluereport2-development
 Architecture: all
 Section: misc
-Depends: ${shlibs:Depends}, ${haskell:Depends}, ${misc:Depends}, libjpeg-progs, libjs-jcrop, libjs-jquery, libjs-jquery-ui, netpbm, texlive-fonts-extra, texlive-fonts-recommended, texlive-latex-extra, texlive-latex-recommended
+Depends: ${haskell:Depends}, ${misc:Depends}, ${shlibs:Depends}, libjpeg-progs, libjs-jcrop, libjs-jquery, libjs-jquery-ui, netpbm, texlive-fonts-extra, texlive-fonts-recommended, texlive-latex-extra, texlive-latex-recommended
 Recommends: ${haskell:Recommends}
 Suggests: ${haskell:Suggests}
 Conflicts: ${haskell:Conflicts}
 Provides: ${haskell:Provides}
-Replaces: ${haskell:Replaces}
-Description: Haskell modules for fine art appraisal applications
- Haskell modules for fine art appraisal applications
- .
-  Author: David Fox <dsf@seereason.com>, Clifford Beshers <beshers@seereason.com>
-  Upstream-Maintainer: Clifford Beshers <beshers@seereason.com>
- .
- An executable built from the ArtValueReport package.
+Description: ${haskell:ShortDescription}${haskell:ShortBlurb}
+  ${haskell:LongDescription}
+  .
+  ${haskell:Blurb}
 
 Package: artvaluereport2-staging
 Architecture: all
 Section: misc
-Depends: ${shlibs:Depends}, ${haskell:Depends}, ${misc:Depends}, libjpeg-progs, libjs-jcrop, libjs-jquery, libjs-jquery-ui, netpbm, texlive-fonts-extra, texlive-fonts-recommended, texlive-latex-extra, texlive-latex-recommended
+Depends: ${haskell:Depends}, ${misc:Depends}, ${shlibs:Depends}, libjpeg-progs, libjs-jcrop, libjs-jquery, libjs-jquery-ui, netpbm, texlive-fonts-extra, texlive-fonts-recommended, texlive-latex-extra, texlive-latex-recommended
 Recommends: ${haskell:Recommends}
 Suggests: ${haskell:Suggests}
 Conflicts: ${haskell:Conflicts}
 Provides: ${haskell:Provides}
-Replaces: ${haskell:Replaces}
-Description: Haskell modules for fine art appraisal applications
- Haskell modules for fine art appraisal applications
- .
-  Author: David Fox <dsf@seereason.com>, Clifford Beshers <beshers@seereason.com>
-  Upstream-Maintainer: Clifford Beshers <beshers@seereason.com>
- .
- An executable built from the ArtValueReport package.
+Description: ${haskell:ShortDescription}${haskell:ShortBlurb}
+  ${haskell:LongDescription}
+  .
+  ${haskell:Blurb}
 
 Package: appraisalscope
 Architecture: any
 Section: misc
-Depends: ${shlibs:Depends}, ${haskell:Depends}, ${misc:Depends}
+Depends: ${haskell:Depends}, ${misc:Depends}, ${shlibs:Depends}
 Recommends: ${haskell:Recommends}
 Suggests: ${haskell:Suggests}
 Conflicts: ${haskell:Conflicts}
 Provides: ${haskell:Provides}
-Replaces: ${haskell:Replaces}
 Description: Offline manipulation of appraisal database
diff --git a/test-data/artvaluereport2/output/debian/copyright b/test-data/artvaluereport2/output/debian/copyright
--- a/test-data/artvaluereport2/output/debian/copyright
+++ b/test-data/artvaluereport2/output/debian/copyright
@@ -1,2 +1,5 @@
-(c) 2008-2011, SeeReason Partners LLC
-License: Proprietary
+Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+
+Files: *
+Copyright: (c) 2008-2011, SeeReason Partners LLC
+License: AllRightsReserved
diff --git a/test-data/artvaluereport2/output/debian/rules b/test-data/artvaluereport2/output/debian/rules
--- a/test-data/artvaluereport2/output/debian/rules
+++ b/test-data/artvaluereport2/output/debian/rules
@@ -1,15 +1,21 @@
 #!/usr/bin/make -f
 
 DEB_CABAL_PACKAGE = artvaluereport
+DEB_DEFAULT_COMPILER = ghc
 
 include /usr/share/cdbs/1/rules/debhelper.mk
 include /usr/share/cdbs/1/class/hlibrary.mk
 
 build/artvaluereport2-staging:: build-ghc-stamp
+
 build/artvaluereport2-production:: build-ghc-stamp
+
 build/artvaluereport2-development:: build-ghc-stamp
+
 build/artvaluereport2-backups:: build-ghc-stamp
+
 build/appraisalscope:: build-ghc-stamp
+
 binary-fixup/artvaluereport2-staging::
 	install -Dps dist-ghc/build/artvaluereport2-server/artvaluereport2-server debian/artvaluereport2-staging/usr/bin/artvaluereport2-staging
 
diff --git a/test-data/artvaluereport2/output/debian/watch b/test-data/artvaluereport2/output/debian/watch
--- a/test-data/artvaluereport2/output/debian/watch
+++ b/test-data/artvaluereport2/output/debian/watch
@@ -1,5 +1,2 @@
 version=3
-opts="downloadurlmangle=s|archive/([\w\d_-]+)/([\d\.]+)/|archive/$1/$2/$1-$2.tar.gz|,\
-filenamemangle=s|(.*)/$|ArtValueReport-$1.tar.gz|" \
-    http://hackage.haskell.org/package/ArtValueReport \
-    ([\d\.]*\d)/
+http://hackage.haskell.org/package/ArtValueReport/distro-monitor .*-([0-9\.]+)\.(?:zip|tgz|tbz|txz|(?:tar\.(?:gz|bz2|xz)))
diff --git a/test-data/clckwrks-dot-com/input/clckwrks-dot-com.cabal b/test-data/clckwrks-dot-com/input/clckwrks-dot-com.cabal
--- a/test-data/clckwrks-dot-com/input/clckwrks-dot-com.cabal
+++ b/test-data/clckwrks-dot-com/input/clckwrks-dot-com.cabal
@@ -4,6 +4,7 @@
 homepage:            http://www.clckwrks.com/
 license:             BSD3
 license-file:        LICENSE
+copyright:           Copyright (c) 2012, Jeremy Shaw
 author:              Jeremy Shaw
 maintainer:          Jeremy Shaw <jeremy@n-heptane.com>
 category:            Clckwrks
diff --git a/test-data/clckwrks-dot-com/output/debian/control b/test-data/clckwrks-dot-com/output/debian/control
--- a/test-data/clckwrks-dot-com/output/debian/control
+++ b/test-data/clckwrks-dot-com/output/debian/control
@@ -44,52 +44,45 @@
                , libghc-web-plugins-prof (>= 0.1)
                , libghc-web-plugins-prof (<< 0.2)
 Build-Depends-Indep: ghc-doc
-                     , libghc-clckwrks-doc (>= 0.13)
-                     , libghc-clckwrks-doc (<< 0.15)
-                     , libghc-clckwrks-plugin-bugs-doc (>= 0.3)
-                     , libghc-clckwrks-plugin-bugs-doc (<< 0.4)
-                     , libghc-clckwrks-plugin-media-doc (>= 0.3)
-                     , libghc-clckwrks-plugin-media-doc (<< 0.4)
-                     , libghc-happstack-server-doc (>= 7.0)
-                     , libghc-happstack-server-doc (<< 7.2)
-                     , libghc-hsp-doc (>= 0.7)
-                     , libghc-hsp-doc (<< 0.8)
-                     , libghc-mtl-doc (>= 2.0)
-                     , libghc-mtl-doc (<< 2.2)
-                     , libghc-text-doc (>= 0.11)
-                     , libghc-text-doc (<< 0.12)
-                     , libghc-web-plugins-doc (>= 0.1)
-                     , libghc-web-plugins-doc (<< 0.2)
+                     , libghc-clckwrks-doc
+                     , libghc-clckwrks-plugin-bugs-doc
+                     , libghc-clckwrks-plugin-media-doc
+                     , libghc-happstack-server-doc
+                     , libghc-hsp-doc
+                     , libghc-mtl-doc
+                     , libghc-text-doc
+                     , libghc-web-plugins-doc
 Standards-Version: 3.9.4
 Homepage: http://www.clckwrks.com/
+X-Description: clckwrks.com
 
 Package: clckwrks-dot-com-production
 Architecture: any
 Section: misc
-Depends: ${shlibs:Depends}
-         , ${haskell:Depends}
-         , ${misc:Depends}
+Depends: ${haskell:Depends},
+ ${misc:Depends},
+ ${shlibs:Depends},
 Recommends: ${haskell:Recommends}
 Suggests: ${haskell:Suggests}
 Conflicts: ${haskell:Conflicts}
 Provides: ${haskell:Provides}
-Replaces: ${haskell:Replaces}
-Description: clckwrks.com
- .
- An executable built from the clckwrks-dot-com package.
+Description: ${haskell:ShortDescription}${haskell:ShortBlurb}
+  ${haskell:LongDescription}
+  .
+  ${haskell:Blurb}
 
 Package: clckwrks-dot-com-backups
 Architecture: any
 Section: misc
-Depends: ${shlibs:Depends}
-         , ${haskell:Depends}
-         , ${misc:Depends}
-         , anacron
+Depends: ${haskell:Depends},
+ ${misc:Depends},
+ ${shlibs:Depends},
+ anacron
 Recommends: ${haskell:Recommends}
 Suggests: ${haskell:Suggests}
 Conflicts: ${haskell:Conflicts}
 Provides: ${haskell:Provides}
-Replaces: ${haskell:Replaces}
-Description: clckwrks.com
- .
- An executable built from the clckwrks-dot-com package.
+Description: ${haskell:ShortDescription}${haskell:ShortBlurb}
+  ${haskell:LongDescription}
+  .
+  ${haskell:Blurb}
diff --git a/test-data/clckwrks-dot-com/output/debian/copyright b/test-data/clckwrks-dot-com/output/debian/copyright
--- a/test-data/clckwrks-dot-com/output/debian/copyright
+++ b/test-data/clckwrks-dot-com/output/debian/copyright
@@ -1,10 +1,15 @@
-Copyright (c) 2012, Jeremy Shaw
+Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
 
-All rights reserved.
+Files: *
+Copyright: Copyright (c) 2012, Jeremy Shaw
+License: BSD3
+Comment: Copyright (c) 2012, Jeremy Shaw
 
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
+ All rights reserved.
 
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
     * Redistributions of source code must retain the above copyright
       notice, this list of conditions and the following disclaimer.
 
@@ -17,14 +22,14 @@
       contributors may be used to endorse or promote products derived
       from this software without specific prior written permission.
 
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/test-data/clckwrks-dot-com/output/debian/rules b/test-data/clckwrks-dot-com/output/debian/rules
--- a/test-data/clckwrks-dot-com/output/debian/rules
+++ b/test-data/clckwrks-dot-com/output/debian/rules
@@ -9,7 +9,9 @@
 include /usr/share/cdbs/1/class/hlibrary.mk
 
 build/clckwrks-dot-com-production:: build-ghc-stamp
+
 build/clckwrks-dot-com-backups:: build-ghc-stamp
+
 binary-fixup/clckwrks-dot-com-production::
 	install -Dps dist-ghc/build/clckwrks-dot-com-server/clckwrks-dot-com-server debian/clckwrks-dot-com-production/usr/bin/clckwrks-dot-com-production
 
diff --git a/test-data/creativeprompts/output/debian/control b/test-data/creativeprompts/output/debian/control
--- a/test-data/creativeprompts/output/debian/control
+++ b/test-data/creativeprompts/output/debian/control
@@ -97,28 +97,24 @@
                      , libghc-hjscript-doc
                      , libghc-http-doc
                      , libghc-quickcheck2-doc (>= 2) | libghc-quickcheck1-doc (<< 2)
-                     , libghc-unixutils-doc (>= 1.29)
+                     , libghc-unixutils-doc
                      , libghc-unixutils-shadow-doc
-                     , libghc-acid-state-doc (>= 0.6.0)
-                     , libghc-archive-doc (>= 1.2.9)
-                     , libghc-authenticate-doc (>= 0.8.0)
-                     , libghc-blaze-html-doc (>= 0.5)
+                     , libghc-acid-state-doc
+                     , libghc-archive-doc
+                     , libghc-authenticate-doc
+                     , libghc-blaze-html-doc
                      , libghc-blaze-markup-doc
-                     , libghc-debian-packaging-doc (>= 0.8)
-                     , libghc-digestive-functors-doc (>= 0.2)
-                     , libghc-digestive-functors-happstack-doc (>= 0.1)
-                     , libghc-digestive-functors-hsp-doc (>= 0.3.1)
+                     , libghc-debian-packaging-doc
+                     , libghc-digestive-functors-doc
+                     , libghc-digestive-functors-happstack-doc
+                     , libghc-digestive-functors-hsp-doc
                      , libghc-extensible-exceptions-doc
-                     , libghc-happstack-authenticate-doc (>= 0.6)
-                     , libghc-happstack-hsp-doc (>= 7.1)
-                     , libghc-happstack-hsp-doc (<< 7.2)
-                     , libghc-happstack-server-doc (>= 7.0)
-                     , libghc-happstack-server-doc (<< 7.1)
+                     , libghc-happstack-authenticate-doc
+                     , libghc-happstack-hsp-doc
+                     , libghc-happstack-server-doc
                      , libghc-hslogger-doc
-                     , libghc-hsp-doc (>= 0.7.1)
-                     , libghc-hsp-doc (<< 0.8)
-                     , libghc-hsx-doc (>= 0.10.2)
-                     , libghc-hsx-doc (<< 0.11)
+                     , libghc-hsp-doc
+                     , libghc-hsx-doc
                      , libghc-ixset-doc
                      , libghc-jmacro-doc
                      , libghc-json-doc
@@ -126,43 +122,43 @@
                      , libghc-network-doc
                      , libghc-parsec3-doc (>= 3) | libghc-parsec2-doc (<< 3)
                      , libghc-random-doc
-                     , libghc-safecopy-doc (>= 0.6.0)
+                     , libghc-safecopy-doc
                      , libghc-syb-doc
-                     , libghc-text-doc (>= 0.11)
+                     , libghc-text-doc
                      , libghc-utf8-string-doc
-                     , libghc-web-routes-doc (>= 0.26.2)
+                     , libghc-web-routes-doc
                      , libghc-web-routes-happstack-doc
                      , libghc-web-routes-hsp-doc
                      , libghc-web-routes-th-doc
-                     , libghc-xss-sanitize-doc (>= 0.3.0.1)
+                     , libghc-xss-sanitize-doc
 Standards-Version: 3.8.1
+X-Description: creativeprompts.com
+ A social site for sharing story ideas.
 
 Package: creativeprompts-data
 Architecture: all
 Section: misc
-Depends: ${shlibs:Depends}
-         , ${haskell:Depends}
-         , ${misc:Depends}
+Depends: ${haskell:Depends},
+ ${misc:Depends},
+ ${shlibs:Depends},
 Recommends: ${haskell:Recommends}
 Suggests: ${haskell:Suggests}
 Conflicts: ${haskell:Conflicts}
 Provides: ${haskell:Provides}
-Replaces: ${haskell:Replaces}
 Description:  creativeprompts.com data files
   Static data files for creativeprompts.com
 
 Package: creativeprompts-production
 Architecture: all
 Section: misc
-Depends: ${shlibs:Depends}
-         , ${haskell:Depends}
-         , ${misc:Depends}
-         , markdown
+Depends: ${haskell:Depends},
+ ${misc:Depends},
+ ${shlibs:Depends},
+ markdown,
 Recommends: ${haskell:Recommends}
 Suggests: ${haskell:Suggests}
 Conflicts: ${haskell:Conflicts}
 Provides: ${haskell:Provides}
-Replaces: ${haskell:Replaces}
 Description:  Configuration for running the creativeprompts.com server
   Production version of the blog server, runs on port
   9021 with HTML validation turned off.
@@ -170,15 +166,14 @@
 Package: creativeprompts-development
 Architecture: all
 Section: misc
-Depends: ${shlibs:Depends}
-         , ${haskell:Depends}
-         , ${misc:Depends}
-         , markdown
+Depends: ${haskell:Depends}
+ ${misc:Depends},
+ ${shlibs:Depends},
+ markdown,
 Recommends: ${haskell:Recommends}
 Suggests: ${haskell:Suggests}
 Conflicts: ${haskell:Conflicts}
 Provides: ${haskell:Provides}
-Replaces: ${haskell:Replaces}
 Description:  Configuration for running the creativeprompts.com server
   Testing version of the blog server, runs on port
   8000 with HTML validation turned on.
@@ -186,15 +181,14 @@
 Package: creativeprompts-backups
 Architecture: any
 Section: misc
-Depends: ${shlibs:Depends}
-         , ${haskell:Depends}
-         , ${misc:Depends}
-         , anacron
+Depends: ${haskell:Depends},
+ ${misc:Depends},
+ ${shlibs:Depends},
+ anacron
 Recommends: ${haskell:Recommends}
 Suggests: ${haskell:Suggests}
 Conflicts: ${haskell:Conflicts}
 Provides: ${haskell:Provides}
-Replaces: ${haskell:Replaces}
 Description: backup program for creativeprompts.com
   Install this somewhere other than creativeprompts.com to run automated
   backups of the database.
diff --git a/test-data/creativeprompts/output/debian/copyright b/test-data/creativeprompts/output/debian/copyright
--- a/test-data/creativeprompts/output/debian/copyright
+++ b/test-data/creativeprompts/output/debian/copyright
@@ -1,4 +1,9 @@
-This package is not part of the Debian GNU/Linux distribution.
+Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
 
-Copyright: (c) 2010-2011, SeeReason Partners LLC
-License: All Rights Reserved
+Files: *
+Copyright: (c) 2010-2011 SeeReason Partners LLC
+License: AllRightsReserved
+Comment: This package is not part of the Debian GNU/Linux distribution.
+
+ Copyright: (c) 2010-2011, SeeReason Partners LLC
+ License: All Rights Reserved
diff --git a/test-data/creativeprompts/output/debian/rules b/test-data/creativeprompts/output/debian/rules
--- a/test-data/creativeprompts/output/debian/rules
+++ b/test-data/creativeprompts/output/debian/rules
@@ -7,9 +7,13 @@
 include /usr/share/cdbs/1/class/hlibrary.mk
 
 build/creativeprompts-production:: build-ghc-stamp
+
 build/creativeprompts-development:: build-ghc-stamp
+
 build/creativeprompts-data:: build-ghc-stamp
+
 build/creativeprompts-backups:: build-ghc-stamp
+
 binary-fixup/creativeprompts-production::
 	install -Dps dist-ghc/build/creativeprompts-server/creativeprompts-server debian/creativeprompts-production/usr/bin/creativeprompts-production
 
