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:        3.4.1
+Version:        3.4.2
 License:        BSD3
 License-File:   debian/copyright
 Author:         David Fox <dsf@seereason.com>
diff --git a/debian/changelog b/debian/changelog
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,602 +1,12 @@
-haskell-cabal-debian (3.4.1) unstable; urgency=low
-
-  * Remove call to test script in Setup.hs
-  * Remove unused dependencies
-
- -- David Fox <dsf@seereason.com>  Mon, 10 Jun 2013 09:12:38 -0700
-
-haskell-cabal-debian (3.4) unstable; urgency=low
-
-  * Add support for modifying the Provides and Replaces fields.
-
- -- David Fox <dsf@seereason.com>  Sun, 09 Jun 2013 14:18:39 -0700
-
-haskell-cabal-debian (3.3.2) unstable; urgency=low
-
-  * Changes for debian-3.71
-
- -- David Fox <dsf@seereason.com>  Sun, 14 Apr 2013 13:32:04 -0700
-
-haskell-cabal-debian (3.3.1) unstable; urgency=low
-
-  * Don't fail during dry run if the existing debianization has no
-    copyright file.
-
- -- David Fox <dsf@seereason.com>  Wed, 13 Mar 2013 10:00:25 -0700
-
-haskell-cabal-debian (3.3) unstable; urgency=low
-
-  * Add Debian.Debianize.Details, with default Atoms values for Debian and
-    SeeReason.
-
- -- David Fox <dsf@seereason.com>  Mon, 11 Mar 2013 11:44:10 -0700
-
-haskell-cabal-debian (3.2.5) unstable; urgency=low
-
-  * Add move the VersionSplits type into a module, and fix the code that
-    splits the mapping of cabal to debian names over a version range.
-
- -- David Fox <dsf@seereason.com>  Tue, 05 Mar 2013 05:17:03 -0800
-
-haskell-cabal-debian (3.2.4) unstable; urgency=low
-
-  * Fix long standing bug in Debian.Debianize.Interspersed.foldTriples.
-
- -- David Fox <dsf@seereason.com>  Sun, 03 Mar 2013 09:45:14 -0800
-
-haskell-cabal-debian (3.2.3) unstable; urgency=low
-
-  * Clean up mapping from cabal names to debian names.
-
- -- David Fox <dsf@seereason.com>  Sat, 02 Mar 2013 07:36:16 -0800
-
-haskell-cabal-debian (3.2.2) unstable; urgency=low
-
-  * Remove unused Debian.Debianize.Generic and Triplets modules.
-
- -- David Fox <dsf@seereason.com>  Fri, 01 Mar 2013 11:14:33 -0800
-
-haskell-cabal-debian (3.2.1) unstable; urgency=low
-
-  * Do not add the options +RTS -IO -RTS to the server options, this
-    is a security risk.  Instead, server executables should built with
-    -with-rtsopts=-IO.
-
- -- David Fox <dsf@seereason.com>  Thu, 28 Feb 2013 09:02:39 -0800
-
-haskell-cabal-debian (3.2) unstable; urgency=low
-
-  * Strip executables when installing (well, at least some.  There
-    may be more work to do here.)
-  * Change the build dependency type from BinPkgName to Relation, so we
-    can specify version dependencies (though as yet not or relations.)
-
- -- David Fox <dsf@seereason.com>  Tue, 26 Feb 2013 07:17:30 -0800
-
-haskell-cabal-debian (3.1.1) unstable; urgency=low
-
-  * Fix the code in the init file that checks for and sources a
-    file in /etc/default.
-
- -- David Fox <dsf@seereason.com>  Mon, 25 Feb 2013 14:46:02 -0800
-
-haskell-cabal-debian (3.1) unstable; urgency=low
-
-  * Create a Top type to represent the top directory of a debianization
-  * Change the signature of Debian.Debianize.debianization so it notices
-    command line arguments and environment arguments.
-
- -- David Fox <dsf@seereason.com>  Fri, 22 Feb 2013 13:28:30 -0800
-
-haskell-cabal-debian (3.0.7) unstable; urgency=low
-
-  * Fix to copyright/license code
-  * have the init script load /etc/default/packagename if available
-  * Add an alternative function to showCommandForUser (called showCommand)
-    that uses double quotes instead of single quotes so you can reference
-    shell variables.
-
- -- David Fox <dsf@seereason.com>  Wed, 20 Feb 2013 09:29:11 -0800
-
-haskell-cabal-debian (3.0.6) unstable; urgency=low
-
-  * When packaging a web site or server, don't add code to the postinst
-    to start a server, it gets generated by debhelper.
-  * Add the changelog and the Debianize.hs file to extra-source-files.
-  * Add HTTP=1 to the list of known epoch mappings.
-
- -- David Fox <dsf@seereason.com>  Thu, 14 Feb 2013 14:41:17 -0800
-
-haskell-cabal-debian (3.0.5) unstable; urgency=low
-
-  * Compatibility with ghc-7.4
-
- -- David Fox <dsf@seereason.com>  Wed, 13 Feb 2013 10:48:19 -0800
-
-haskell-cabal-debian (3.0.4) unstable; urgency=low
-
-  * Add dependency on debian-policy, so we can compute the latest
-    standards-version.
-  * Documentation improvements
-  * Test case improvements
-  * Error message improvements
-
- -- David Fox <dsf@seereason.com>  Sun, 10 Feb 2013 11:03:55 -0800
-
-haskell-cabal-debian (3.0.3) unstable; urgency=low
-
-  * Due to a typo, the noDocumentationLibrary lens was turning off
-    profiling rather than documentation.
-
- -- David Fox <dsf@seereason.com>  Fri, 08 Feb 2013 17:14:09 -0800
-
-haskell-cabal-debian (3.0.2) unstable; urgency=low
-
-  * Fix argument and exception handling in cabal-debian
-  * Make Standards-Version field non-mandatory
-  * Make sure every binary deb paragraph has a non-empty description
-
- -- David Fox <dsf@seereason.com>  Thu, 07 Feb 2013 10:03:25 -0800
-
-haskell-cabal-debian (3.0.1) unstable; urgency=low
-
-  * Don't build Debian version numbers with revision (Just "").
-  * Output the descriptions of the binary packages.
-
- -- David Fox <dsf@seereason.com>  Tue, 05 Feb 2013 14:48:33 -0800
-
-haskell-cabal-debian (3.0) unstable; urgency=low
-
-  * Moved the Distribution.Debian modules to Debian.Cabal and
-    Debian.Debianize.
-  * Refactored the debianize function for easier testing
-  * Added test cases.
-  * Add a Debianization type that intends to fully describe a debian
-    package, with functions to read, build, modify, and write a
-    Debianization.
-
- -- David Fox <dsf@seereason.com>  Wed, 26 Dec 2012 05:45:35 -0800
-
-haskell-cabal-debian (2.6.3) unstable; urgency=low
-
-  * Fix pretty printing of Relations (i.e. dependency lists.)  There
-    is an instance for printing lists in ansi-wl-pprint which prevents
-    us from writing customized Pretty instances for type aliases like
-    Relations, AndRelation, and OrRelation.
-
- -- David Fox <dsf@seereason.com>  Fri, 04 Jan 2013 09:30:48 -0800
-
-haskell-cabal-debian (2.6.2) unstable; urgency=low
-
-  * Fix a bug constructing the destination pathnames that was dropping
-    files that were supposed to be installed into packages.
-
- -- David Fox <dsf@seereason.com>  Thu, 20 Dec 2012 06:49:25 -0800
-
-haskell-cabal-debian (2.6.1) unstable; urgency=low
-
-  * Remove the modifyAtoms field from the Flags record, we want to
-    be able to create instances like Read and Show for this type.
-    The modifyAtoms function is now passed separately to debianize.
-  * The flags field of Server was renamed serverFlags because the
-    newly exported Config record has a flags field.
-
- -- David Fox <dsf@seereason.com>  Wed, 19 Dec 2012 09:45:22 -0800
-
-haskell-cabal-debian (2.5.10) unstable; urgency=low
-
-  * Filter cabal self dependencies out before generating
-    Build-Depends-Indep, just as we added code to filter them out
-    of Build-Depends in version 2.5.7.
-
- -- David Fox <dsf@seereason.com>  Tue, 18 Dec 2012 13:23:39 -0800
-
-haskell-cabal-debian (2.5.9) unstable; urgency=low
-
-  * Always add +RTS -IO -RTS to server flags.
-
- -- David Fox <dsf@seereason.com>  Sun, 16 Dec 2012 10:40:52 -0800
-
-haskell-cabal-debian (2.5.8) unstable; urgency=low
-
-  * Add a builtin list for ghc-7.6.1.
-
- -- David Fox <dsf@seereason.com>  Sat, 15 Dec 2012 07:04:49 -0800
-
-haskell-cabal-debian (2.5.7) unstable; urgency=low
-
-  * Filter out cabal self-dependencies before building the debian
-    dependencies.  In cabal a self dependency means you need the library
-    to build an executable, while in debian it means you need an older
-    version installed to build the current version.
-
- -- David Fox <dsf@seereason.com>  Thu, 29 Nov 2012 08:42:30 -0800
-
-haskell-cabal-debian (2.5.6) unstable; urgency=low
-
-  * Don't add --base-uri and --http-port arguments automatically, they can be
-    computed by calling the oldClckwrksFlags function and adding the value to
-    the flags field.  Clckwrks-0.3 no longer needs the --base-uri argument.
-
- -- David Fox <dsf@seereason.com>  Tue, 27 Nov 2012 13:34:31 -0800
-
-haskell-cabal-debian (2.5.5) unstable; urgency=low
-
-  * Have the debianize function return False if there is no debian/Debianize.hs file,
-    but throw an exception if running it failed, so we notice bad debianization code.
-
- -- David Fox <dsf@seereason.com>  Tue, 27 Nov 2012 07:34:51 -0800
-
-haskell-cabal-debian (2.5.4) unstable; urgency=low
-
-  * Insert "SetEnv proxy-sendcl 1" line into Apache config.
-
- -- David Fox <dsf@seereason.com>  Tue, 20 Nov 2012 13:43:54 -0800
-
-haskell-cabal-debian (2.5.3) unstable; urgency=low
-
-  * Remove extra copy of binary from the executable debs
-  * Add a sourcePackageName field to Flags, and a --source-package-name
-    command line option.
-
- -- David Fox <dsf@seereason.com>  Sat, 17 Nov 2012 00:16:21 -0800
-
-haskell-cabal-debian (2.5.2) unstable; urgency=low
-
-  * Fix the path to where the DHInstallTo and DHInstallCabalExecTo
-    DebAtoms put their files.
-
- -- David Fox <dsf@seereason.com>  Fri, 16 Nov 2012 18:11:45 -0800
-
-haskell-cabal-debian (2.5.1) unstable; urgency=low
-
-  * Add a destName field to Executable so we can give installed
-    executables a different name than they had in the build.
-
- -- David Fox <dsf@seereason.com>  Fri, 16 Nov 2012 15:37:16 -0800
-
-haskell-cabal-debian (2.5) unstable; urgency=low
-
-  * Add a debName field to the Executable record, before the deb
-    package name had to equal the executable name.
-
- -- David Fox <dsf@seereason.com>  Fri, 16 Nov 2012 12:32:39 -0800
-
-haskell-cabal-debian (2.4.2) unstable; urgency=low
-
-  * Move location of cabal install files from dist/build/install to
-    debian/cabalInstall, the dist directory was getting wiped at bad
-    moments.
-  * Split the autobuilder function autobuilderDebianize into two
-    new functions in cabal-debian: runDebianize and callDebianize.
-  * Custom debianization code now goes in debian/Debianize.hs rather than
-    in setup, so we can distinguish it failing from it not existing more
-    easily.
-
- -- David Fox <dsf@seereason.com>  Thu, 15 Nov 2012 11:00:08 -0800
-
-haskell-cabal-debian (2.4.1) unstable; urgency=low
-
-  * We need to verify that debian/compat was created after running the
-    debianize function, because ghc still exits with ExitSuccess
-
- -- David Fox <dsf@seereason.com>  Thu, 15 Nov 2012 06:34:02 -0800
-
-haskell-cabal-debian (2.4.0) unstable; urgency=low
-
-  * You can run a function in Setup.hs other than main using ghc -e, so we
-    will use this trick to run the debianize function directly rather than
-    running main.
-  * Eliminate the autobuilderDebianize function.
-
- -- David Fox <dsf@seereason.com>  Thu, 15 Nov 2012 04:05:49 -0800
-
-haskell-cabal-debian (2.3.4) unstable; urgency=low
-
-  * Fix the builddir used when running the cabal-debian standalone
-    executable - it was dist-cabal/build, so the resulting debianization
-    had files in places where cabal didn't expect them.
-
- -- David Fox <dsf@seereason.com>  Tue, 13 Nov 2012 06:20:51 -0800
-
-haskell-cabal-debian (2.3.3) unstable; urgency=low
-
-  * Eliminate class MonadBuild and the BuildT monad.
-
- -- David Fox <dsf@seereason.com>  Sun, 11 Nov 2012 17:46:31 -0800
-
-haskell-cabal-debian (2.3.2) unstable; urgency=low
-
-  * Fix exception that was keeping changelogs from being preserved.
-
- -- David Fox <dsf@seereason.com>  Sat, 10 Nov 2012 10:07:50 -0800
-
-haskell-cabal-debian (2.3.1) unstable; urgency=low
-
-  * Fix the extension of the debhelper links files
-  * Add a general mechanism for installing a file into a deb when
-    we have the file's text in a String (rather than in a file.)
-
- -- David Fox <dsf@seereason.com>  Sat, 10 Nov 2012 07:35:09 -0800
-
-haskell-cabal-debian (2.3) unstable; urgency=low
-
-  * Add MonadBuild.
-
- -- David Fox <dsf@seereason.com>  Fri, 09 Nov 2012 12:21:14 -0800
-
-haskell-cabal-debian (2.2.1) unstable; urgency=low
-
-  * Add a modifyAtoms function to Flags that is applied to final list of
-    DebAtom before writing the debianization.
-  * Add DHApacheSite and DHInstallCabalExec atoms so atoms don't depend on
-    the build directory
-  * Add #DEBHELPER# and exit 0 to default web server postinst.
-
- -- David Fox <dsf@seereason.com>  Fri, 09 Nov 2012 10:25:32 -0800
-
-haskell-cabal-debian (2.2.0) unstable; urgency=low
-
-  * Append a trailing slash to the --base-uri argument passed to the
-    server.  This is required by Web.Routes.Site.runSite.
-
- -- David Fox <dsf@seereason.com>  Thu, 08 Nov 2012 04:40:08 -0800
-
-haskell-cabal-debian (2.1.4) unstable; urgency=low
-
-  * Merge the Executable and Script constructors of the Executable type
-  * Add a destDir field to Executable to specify the destination.
-
- -- David Fox <dsf@seereason.com>  Tue, 06 Nov 2012 13:24:25 -0800
-
-haskell-cabal-debian (2.1.3) unstable; urgency=low
-
-  * Don't append a slash to the base-uri.
-  * Construct the name of the data directory in /usr/share from the cabal
-    package name rather than the debian source package name.
-  * Add a --self-depend flag to include a build dependency on this library
-    in all generated debianizations.
-
- -- David Fox <dsf@seereason.com>  Tue, 06 Nov 2012 07:07:57 -0800
-
-haskell-cabal-debian (2.1.2) unstable; urgency=low
-
-  * Output the server support files.
-
- -- David Fox <dsf@seereason.com>  Tue, 06 Nov 2012 06:37:18 -0800
-
-haskell-cabal-debian (2.1.1) unstable; urgency=low
-
-  * Restore code that checks for version number match when validating
-    a debianization.  The autobuilder can now pass the version number
-    to cabal-debian, so it should match.
-
- -- David Fox <dsf@seereason.com>  Mon, 05 Nov 2012 17:42:32 -0800
-
-haskell-cabal-debian (2.1.0) unstable; urgency=low
-
-  * Enable processing of Script, Server and WebSite executables.
-
- -- David Fox <dsf@seereason.com>  Mon, 05 Nov 2012 12:45:42 -0800
-
-haskell-cabal-debian (2.0.9) unstable; urgency=low
-
-  * Add a Library section, export all the modules.
-
- -- David Fox <dsf@seereason.com>  Mon, 05 Nov 2012 06:41:25 -0800
-
-haskell-cabal-debian (2.0.8) unstable; urgency=low
-
-  * Bypass abandoned versions.
-
- -- David Fox <dsf@seereason.com>  Sat, 03 Nov 2012 06:13:27 -0700
-
-haskell-cabal-debian (1.26) unstable; urgency=low
-
-  * Don't try to update the existing debianization, except for the
-    changelog where we retain entries that look older than the one
-    we generate.
-  * Use .install files instead of adding rules to debian/rules
-  * Add --depends and --conflicts options
-
- -- David Fox <dsf@seereason.com>  Thu, 25 Oct 2012 12:03:49 -0700
-
-haskell-cabal-debian (1.25) unstable; urgency=low
-
-  * If the --disable-haddock flag is given omit the doc package from the
-    control file.
-  * The tarball that was uploaded to Hackage as version 1.24 had a (buggy)
-    change which was not pushed to darcs.  This resolves that confusion.
-
- -- David Fox <dsf@seereason.com>  Sat, 16 Jun 2012 14:42:12 -0700
-
-haskell-cabal-debian (1.24) unstable; urgency=low
-
-  * No wonder it doesn't build on hackage - none of the source
-    modules were shipped.
-
- -- David Fox <dsf@seereason.com>  Thu, 14 Jun 2012 08:19:19 -0700
-
-haskell-cabal-debian (1.23) unstable; urgency=low
-
-  * Add a --quilt option to switch from native to quilt format.
-    Without this option the file debian/source/format will contain
-    '3.0 (native)', with it '3.0 (quilt)'.
-
- -- David Fox <dsf@seereason.com>  Fri, 01 Jun 2012 05:53:36 -0700
-
-haskell-cabal-debian (1.22) unstable; urgency=low
-
-  * Bump version to make sure all changes are uploaded.
-
- -- David Fox <dsf@seereason.com>  Wed, 23 May 2012 19:54:17 -0700
-
-haskell-cabal-debian (1.21) unstable; urgency=low
-
-  * fix conversion of wildcards into intersected ranges
-
- -- David Fox <dsf@seereason.com>  Wed, 23 May 2012 19:51:34 -0700
-
-haskell-cabal-debian (1.20) unstable; urgency=low
-
-  * Fix generation of debian library dependencies from the Extra-Libraries
-    field of the cabal file.
-
- -- David Fox <dsf@seereason.com>  Wed, 23 May 2012 19:50:39 -0700
-
-haskell-cabal-debian (1.19) unstable; urgency=low
-
-  * Handle cabal equals dependencies.
-
- -- David Fox <dsf@seereason.com>  Tue, 20 Mar 2012 14:34:58 -0700
-
-haskell-cabal-debian (1.18) unstable; urgency=low
-
-  * High level of confidence this time.  Interesting new Interspersed
-    class, and an implementation of invertVersionRanges which should be
-    forwarded to the Cabal folks.
-  * Removes dependency on logic-classes
-
- -- David Fox <dsf@seereason.com>  Tue, 20 Mar 2012 08:17:25 -0700
-
-haskell-cabal-debian (1.17) unstable; urgency=low
-
-  * Restore code to downcase cabal package name before using it as the
-    base of the debian package name.
-
- -- David Fox <dsf@seereason.com>  Sun, 18 Mar 2012 15:32:04 -0700
-
-haskell-cabal-debian (1.16) unstable; urgency=low
-
-  * Remove code that implements a special case for the debian name of the
-    haskell-src-exts package.
-
- -- David Fox <dsf@seereason.com>  Sun, 18 Mar 2012 14:11:21 -0700
-
-haskell-cabal-debian (1.15) unstable; urgency=low
-
-  * Yet another stab at fixing the code for converting cabal dependencies
-    to debian dependencies, with support for splitting version ranges of
-    cabal files among different debian packages.
-
- -- David Fox <dsf@seereason.com>  Fri, 16 Mar 2012 17:59:28 -0700
-
-haskell-cabal-debian (1.14) unstable; urgency=low
-
-  * Don't try to strip data files
-  * Use permissions 644 for data files, not 755.
-
- -- David Fox <dsf@seereason.com>  Wed, 07 Mar 2012 14:46:04 -0800
-
-haskell-cabal-debian (1.13) unstable; urgency=low
-
-  * Append the version number when constructing the directory for data
-    files.
-
- -- David Fox <dsf@seereason.com>  Wed, 07 Mar 2012 08:56:39 -0800
-
-haskell-cabal-debian (1.12) unstable; urgency=low
-
-  * Include any files listed in the Data-Files field of the cabal file
-    in the utils package.
-
- -- David Fox <dsf@seereason.com>  Tue, 06 Mar 2012 11:31:47 -0800
-
-haskell-cabal-debian (1.11) unstable; urgency=low
-
-  * Replace --epoch flag with --epoch-map, so we can specify epoch numbers
-    for both the package being built and for dependency packages.
-
- -- David Fox <dsf@seereason.com>  Thu, 09 Feb 2012 07:01:19 -0800
-
-haskell-cabal-debian (1.10) unstable; urgency=low
-
-  * Add bundled package list for ghc 7.4.1.
-
- -- David Fox <dsf@seereason.com>  Sat, 04 Feb 2012 14:44:33 -0800
-
-haskell-cabal-debian (1.9) unstable; urgency=low
-
-  * Add --dep-map flag to allow mapping of cabal package names to the base
-    of a debian package name.  This modifies the name to which the prefix
-    "lib" and the suffix "-dev" are added.
-  * Fix dependency generation bug introduced in 1.8.
-
- -- David Fox <dsf@seereason.com>  Mon, 23 Jan 2012 14:13:05 -0800
-
-haskell-cabal-debian (1.8) unstable; urgency=low
-
-  * Add a --dev-dep flag to make one or more packages install dependencies
-    of the dev package.
-
- -- David Fox <dsf@seereason.com>  Mon, 23 Jan 2012 05:00:46 -0800
-
-haskell-cabal-debian (1.7) unstable; urgency=low
-
-  * Add info about ghc 7.4.0 pre-release.
-
- -- David Fox <dsf@seereason.com>  Wed, 11 Jan 2012 09:57:45 -0800
-
-haskell-cabal-debian (1.6) unstable; urgency=low
-
-  * Don't omit dependencies built into ghc, they should be satisfied by
-    the Provides in the compiler if they are not available in the
-    repository.  However, we do need to make ghc an alterantive to any
-    versioned dependencies that are bundled with the compiler, since the
-    built in dependencies are virtual packages and thus unversioned.
-
- -- David Fox <dsf@seereason.com>  Wed, 07 Dec 2011 06:10:17 -0800
-
-haskell-cabal-debian (1.5) unstable; urgency=low
-
-  * Fix the generation of build dependency version ranges by using an
-    intermediate version range type.
-  * If the version range for the cabal file touches two different debian
-    package, don't try to write build dependencies that allow either one,
-    it can't really be done.  Just give the allowable versions of the
-    newer package (e.g. libghc-parsec3-dev rather than libghc-parsec2-dev.)
-
- -- David Fox <dsf@seereason.com>  Sun, 04 Dec 2011 05:59:25 -0800
-
-haskell-cabal-debian (1.4) unstable; urgency=low
-
-  * Add a --revision <suffix> flag which appends a (perhaps empty) string
-    cabal version number to get the debian version number.  Without this
-    flag the string "-1~hackage1" is appended.
-  * Make it an error to specify a debian version via --deb-version that is
-    older than the current cabal version.
-
- -- David Fox <dsf@seereason.com>  Sun, 20 Nov 2011 06:45:33 -0800
-
-haskell-cabal-debian (1.3) unstable; urgency=low
-
-  * Fix error message when compiler version is not in bundled package list.
-  * Add bundled package list for compiler 7.0.4 (same as 7.0.3.)
-
- -- David Fox <dsf@seereason.com>  Sat, 08 Oct 2011 07:58:19 -0700
-
-haskell-cabal-debian (1.2) unstable; urgency=low
-
-  * When computing the debian name from a package's cabal name, if we
-    have no particular version number we are comparing to, use the name
-    from the version split that corresponds to newer version numbers.
-  * Add code to make the cabal package haskell-src-exts map to the debian
-    packages libghc-src-exts-dev etc.  Normally it would map to
-    libghc-haskell-src-exts-dev.
-
- -- David Fox <dsf@seereason.com>  Thu, 06 Oct 2011 09:27:02 -0700
-
-haskell-cabal-debian (1.1) unstable; urgency=low
+haskell-cabal-debian (3.4.2) unstable; urgency=low
 
-  * Use propositional logic package to compute normal form for dependencies
-  * Make sure to correct format of cabal package synopsis before using as debian
-    package description.
+  * Notify user when debhelper isn't installed.
+  * Avoid use of partial function read
 
- -- David Fox <dsf@seereason.com>  Fri, 30 Sep 2011 06:16:34 -0700
+ -- David Fox <dsf@seereason.com>  Mon, 24 Jun 2013 13:51:51 -0700
 
-haskell-cabal-debian (1.0) unstable; urgency=low
+haskell-cabal-debian (3.4.1) unstable; urgency=low
 
   * Debianization generated by cabal-debian
 
- -- David Fox <dsf@seereason.com>  Sun, 18 Sep 2011 06:40:21 -0700
-
+ -- David Fox <dsf@seereason.com>  Sun, 23 Jun 2013 05:15:05 -0700
diff --git a/src/Debian/Debianize/Debianize.hs b/src/Debian/Debianize/Debianize.hs
--- a/src/Debian/Debianize/Debianize.hs
+++ b/src/Debian/Debianize/Debianize.hs
@@ -42,7 +42,7 @@
 import Debian.Debianize.Options (options, compileArgs)
 import Debian.Debianize.SubstVars (substvars)
 import Debian.Debianize.Types (DebAction(..), Top(Top, unTop))
-import Debian.Debianize.Utility (withCurrentDirectory, foldEmpty, replaceFile, zipMaps, indent)
+import Debian.Debianize.Utility (withCurrentDirectory, foldEmpty, replaceFile, zipMaps, indent, read')
 import Debian.Policy (PackagePriority(Optional), Section(MainSection), getDebhelperCompatLevel)
 import Debian.Relation (SrcPkgName(..), BinPkgName(BinPkgName), Relation(Rel))
 import Debian.Release (parseReleaseName)
@@ -82,7 +82,7 @@
 
 compileEnvironmentArgs :: Atoms -> IO Atoms
 compileEnvironmentArgs atoms0 =
-    (compileArgs <$> (read <$> getEnv "CABALDEBIAN") <*> pure atoms0) `catchIOError` const (return atoms0)
+    (compileArgs <$> (read' (\ s -> error $ "compileEnvrionmentArgs: " ++ show s) <$> getEnv "CABALDEBIAN") <*> pure atoms0) `catchIOError` const (return atoms0)
 
 compileCommandlineArgs :: Atoms -> IO Atoms
 compileCommandlineArgs atoms0 = compileArgs <$> getArgs <*> pure atoms0
@@ -161,13 +161,13 @@
 debianization' :: String              -- ^ current date
                -> Maybe Text          -- ^ copyright
                -> NameAddr            -- ^ maintainer
-               -> Int		      -- ^ Default standards version
+               -> Maybe Int	      -- ^ Default standards version
                -> Maybe ChangeLog
                -> Atoms               -- ^ Debianization specification
                -> Atoms               -- ^ New debianization
 debianization' date copy maint level log deb =
     finalizeDebianization $
-    modL compat (maybe (Just level) Just) $
+    modL compat (maybe level Just) $
     modL changelog (maybe log Just) $
     setL sourcePriority (Just Optional) $
     setL sourceSection (Just (MainSection "haskell")) $
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
@@ -108,7 +108,7 @@
       [("debian/control", pack (show (pretty (controlFile d)))),
        ("debian/changelog", pack (show (pretty (fromMaybe (error "Missing debian/changelog") (getL changelog atoms))))),
        ("debian/rules", rules atoms),
-       ("debian/compat", pack (show (fromMaybe (error "Missing DebCompat atom") $ getL compat atoms) <> "\n")),
+       ("debian/compat", pack (show (fromMaybe (error "Missing DebCompat atom - is debhelper installed?") $ getL compat atoms) <> "\n")),
        ("debian/copyright", either (\ x -> pack (show (pretty x))) id (fromMaybe (error ("No DebCopyright atom: " ++ show atoms)) $ getL copyright atoms))] ++
       sourceFormatFiles atoms ++
       watchFile atoms ++
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
@@ -33,7 +33,7 @@
 import Debian.Debianize.ControlFile (SourceDebDescription(..), BinaryDebDescription(..), PackageRelations(..),
                                      VersionControlSpec(..), XField(..), newSourceDebDescription', newBinaryDebDescription)
 import Debian.Debianize.Types (Top(Top, unTop))
-import Debian.Debianize.Utility (getDirectoryContents', withCurrentDirectory, readFileMaybe)
+import Debian.Debianize.Utility (getDirectoryContents', withCurrentDirectory, readFileMaybe, read')
 import Debian.Orphans ()
 import Debian.Policy (Section(..), parseStandardsVersion, readPriority, readSection, parsePackageArchitectures, parseMaintainer,
                       parseUploaders, readSourceFormat, getDebianMaintainer, haskellMaintainer)
@@ -115,7 +115,7 @@
       readField (Field ("Vcs-Svn", s)) (desc, unrecognized) = (desc {vcsFields = insert (VCSSvn (pack s)) (vcsFields desc)}, unrecognized)
       readField field@(Field ('X' : fld, value)) (desc, unrecognized) =
           case span (`elem` "BCS") fld of
-            (xs, '-' : more) -> (desc {xFields = insert (XField (fromList (map (read' . (: [])) xs)) (pack more) (pack value)) (xFields desc)}, unrecognized)
+            (xs, '-' : more) -> (desc {xFields = insert (XField (fromList (map (read' (\ s -> error $ "parseSourceDebDescription: " ++ show s) . (: [])) xs)) (pack more) (pack value)) (xFields desc)}, unrecognized)
             _ -> (desc, field : unrecognized)
       readField field (desc, unrecognized) = (desc, field : unrecognized)
 
@@ -160,9 +160,6 @@
       findMap' (Field (fld, val)) x = if fld == field then Just (f val) else x
       findMap' _ x = x
 
-read' :: Read a => String -> a
-read' s = trace ("read " ++ show s) (read s)
-
 stripField :: ControlFunctions a => Field' a -> Field' a
 stripField (Field (a, b)) = Field (a, stripWS b)
 stripField x = x
@@ -201,7 +198,7 @@
 inputAtoms debian name@"source/format" xs = readFile (debian </> name) >>= \ text -> return $ (either (modL warning . Set.insert) (setL sourceFormat . Just) (readSourceFormat text)) xs
 inputAtoms debian name@"watch" xs = readFile (debian </> name) >>= \ text -> return $ setL watch (Just text) xs
 inputAtoms debian name@"rules" xs = readFile (debian </> name) >>= \ text -> return $ setL rulesHead (Just text) xs
-inputAtoms debian name@"compat" xs = readFile (debian </> name) >>= \ text -> return $ setL compat (Just (read (unpack text))) xs
+inputAtoms debian name@"compat" xs = readFile (debian </> name) >>= \ text -> return $ setL compat (Just (read' (\ s -> error $ "compat: " ++ show s) (unpack text))) xs
 inputAtoms debian name@"copyright" xs = readFile (debian </> name) >>= \ text -> return $ setL copyright (Just (Right text)) xs
 inputAtoms debian name@"changelog" xs =
     readFile (debian </> name) >>= return . parseChangeLog . unpack >>= \ log -> return $ setL changelog (Just log) xs
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
@@ -11,6 +11,7 @@
 import Debian.Debianize.Atoms -- (Atoms, depends, conflicts)
 import Debian.Debianize.Goodies (doExecutable)
 import Debian.Debianize.Types (InstallFile(..), DebAction(..))
+import Debian.Debianize.Utility (read')
 import Debian.Orphans ()
 import Debian.Policy (SourceFormat(Quilt3), parseMaintainer)
 import Debian.Relation (BinPkgName(..), SrcPkgName(..), Relation(..))
@@ -34,7 +35,7 @@
 -- | Options that modify other atoms.
 options :: [OptDescr (Atoms -> Atoms)]
 options =
-    [ Option "v" ["verbose"] (ReqArg (\ s atoms -> setL verbosity (read s) atoms) "n")
+    [ Option "v" ["verbose"] (ReqArg (\ s atoms -> setL verbosity (read' (\ s -> error $ "verbose: " ++ show s) s) atoms) "n")
              "Change build verbosity",
       Option "n" ["dry-run", "compare"] (NoArg (\ atoms -> setL dryRun True atoms))
              "Just compare the existing debianization to the one we would generate.",
@@ -42,7 +43,7 @@
              "Show this help text",
       Option "" ["debianize"] (NoArg (\ atoms -> setL debAction Debianize atoms))
              "Generate a new debianization, replacing any existing one.  One of --debianize or --substvar is required.",
-      Option "" ["substvar"] (ReqArg (\ name atoms -> setL debAction (SubstVar (read name)) atoms) "Doc, Prof, or Dev")
+      Option "" ["substvar"] (ReqArg (\ name atoms -> setL debAction (SubstVar (read' (\ s -> error $ "substvar: " ++ show s) name)) atoms) "Doc, Prof, or Dev")
              (unlines ["Write out the list of dependencies required for the dev, prof or doc package depending",
                        "on the argument.  This value can be added to the appropriate substvars file."]),
       Option "" ["executable"] (ReqArg (\ path x -> executableOption path (\ bin e -> doExecutable bin e x)) "SOURCEPATH or SOURCEPATH:DESTDIR")
diff --git a/src/Debian/Debianize/Tests.hs b/src/Debian/Debianize/Tests.hs
--- a/src/Debian/Debianize/Tests.hs
+++ b/src/Debian/Debianize/Tests.hs
@@ -60,21 +60,21 @@
 -- | Create a Debianization based on a changelog entry and a license
 -- value.  Uses the currently installed versions of debhelper and
 -- debian-policy to set the compatibility levels.
-newDebianization :: ChangeLog -> Int -> StandardsVersion -> Atoms
+newDebianization :: ChangeLog -> Maybe Int -> Maybe StandardsVersion -> Atoms
 newDebianization (ChangeLog (WhiteSpace {} : _)) _ _ = error "defaultDebianization: Invalid changelog entry"
 newDebianization (log@(ChangeLog (entry : _))) level standards =
     setL changelog (Just log) $
-    setL compat (Just level) $
+    setL compat level $
     modL control (\ x -> x { source = Just (SrcPkgName (logPackage entry))
                            , maintainer = (either error Just (parseMaintainer (logWho entry)))
-                           , standardsVersion = Just standards }) $
+                           , standardsVersion = standards }) $
     defaultAtoms
 newDebianization _ _ _ = error "Invalid changelog"
 
-newDebianization' :: Int -> StandardsVersion -> Atoms -> Atoms
+newDebianization' :: Maybe Int -> Maybe StandardsVersion -> Atoms -> Atoms
 newDebianization' level standards atoms =
-    setL compat (Just level) .
-    modL control (\ x -> x { standardsVersion = Just standards }) $ atoms
+    setL compat level .
+    modL control (\ x -> x { standardsVersion = standards }) $ atoms
 
 tests :: Test
 tests = TestLabel "Debianization Tests" (TestList [test1, test2, test3, test4, test5, test6, test7, test8, test9])
@@ -83,7 +83,7 @@
 test1 =
     TestLabel "test1" $
     TestCase (do level <- getDebhelperCompatLevel
-                 standards <- getDebianStandardsVersion
+                 standards <- getDebianStandardsVersion :: IO (Maybe StandardsVersion)
                  let deb = finalizeDebianization $ setL copyright (Just (Left BSD3)) $
                            newDebianization (ChangeLog [testEntry]) level standards
                  assertEqual "test1" [] (diffDebianizations testDeb1 deb))
@@ -108,7 +108,7 @@
                                                   [Rel (BinPkgName "ghc-prof") Nothing Nothing]]
                         , buildDependsIndep = [[Rel (BinPkgName "ghc-doc") Nothing Nothing]]
                         }) $
-          (newDebianization log 9 (StandardsVersion 3 9 3 (Just 1)))
+          (newDebianization log (Just 9) (Just (StandardsVersion 3 9 3 (Just 1))))
       log = ChangeLog [Entry { logPackage = "haskell-cabal-debian"
                              , logVersion = buildDebianVersion Nothing "2.6.2" Nothing
                              , logDists = [ReleaseName {relName = "unstable"}]
@@ -145,7 +145,7 @@
                                   [Rel (BinPkgName "ghc-prof") Nothing Nothing]],
                   buildDependsIndep = [[Rel (BinPkgName "ghc-doc") Nothing Nothing]]
                 }) $
-          (newDebianization log 9 (StandardsVersion 3 9 3 (Just 1)))
+          (newDebianization log (Just 9) (Just (StandardsVersion 3 9 3 (Just 1))))
       log = ChangeLog [Entry {logPackage = "haskell-cabal-debian",
                               logVersion = Debian.Version.parseDebianVersion ("2.6.2" :: String),
                               logDists = [ReleaseName {relName = "unstable"}],
@@ -216,7 +216,7 @@
                                                              , provides_ = []
                                                              , replaces_ = []
                                                              , builtUsing = [] }}]}) $
-          (newDebianization log 7 (StandardsVersion 3 9 4 Nothing))
+          (newDebianization log (Just 7) (Just (StandardsVersion 3 9 4 Nothing)))
       log = ChangeLog [Entry { logPackage = "haskell-devscripts"
                              , logVersion = Debian.Version.parseDebianVersion ("0.8.13" :: String)
                              , logDists = [ReleaseName {relName = "experimental"}]
@@ -243,7 +243,7 @@
       customize old atoms =
           inputCabalization (Top "test-data/clckwrks-dot-com/input") atoms >>=
           return .
-          newDebianization' 7 (StandardsVersion 3 9 4 Nothing) .
+          newDebianization' (Just 7) (Just (StandardsVersion 3 9 4 Nothing)) .
           modL control (\ y -> y {homepage = Just "http://www.clckwrks.com/"}) .
           setL sourceFormat (Just Native3) .
           modL missingDependencies (insert (BinPkgName "libghc-clckwrks-theme-clckwrks-doc")) .
@@ -333,8 +333,8 @@
 test5 =
     TestLabel "test5" $
     TestCase (do old <- inputDebianization (Top "test-data/creativeprompts/output")
-                 let standards = fromMaybe (error "test5") (standardsVersion (getL control old))
-                     level = fromMaybe (error "test5") (getL compat old)
+                 let standards = standardsVersion (getL control old)
+                     level = getL compat old
                  new <- debianization (Top "test-data/creativeprompts/input")
                           (return .
                            setL sourceFormat (Just Native3) .
@@ -443,7 +443,7 @@
                             modL control (\ y -> y {homepage = Just "http://artvaluereportonline.com"}) .
                             setL sourceFormat (Just Native3) .
                             setL changelog (Just log) .
-                            (newDebianization' 7 (StandardsVersion 3 9 3 Nothing)))
+                            (newDebianization' (Just 7) (Just (StandardsVersion 3 9 3 Nothing))))
                            defaultAtoms
                   assertEqual "test8" [] (diffDebianizations old (copyChangelog old new))
              )
@@ -475,7 +475,7 @@
                                               , "AlexWrapper-posn"
                                               , "AlexWrapper-posn-bytestring"
                                               , "AlexWrapper-strict-bytestring"]) .
-                            newDebianization' 7 (StandardsVersion 3 9 3 Nothing))
+                            newDebianization' (Just 7) (Just (StandardsVersion 3 9 3 Nothing)))
                            defaultAtoms
                   assertEqual "test9" [] (diffDebianizations old (copyFirstLogEntry old new)))
 
diff --git a/src/Debian/Debianize/Utility.hs b/src/Debian/Debianize/Utility.hs
--- a/src/Debian/Debianize/Utility.hs
+++ b/src/Debian/Debianize/Utility.hs
@@ -26,6 +26,8 @@
     , foldEmpty
     , maybeL
     , indent
+    , maybeRead
+    , read'
     ) where
 
 import Control.Applicative ((<$>))
@@ -36,7 +38,7 @@
 import Data.List as List (isSuffixOf, intercalate, map, lines)
 import Data.Lens.Lazy (Lens, modL)
 import Data.Map as Map (Map, foldWithKey, empty, fromList, findWithDefault, insert, map, lookup)
-import Data.Maybe (catMaybes, mapMaybe)
+import Data.Maybe (catMaybes, mapMaybe, listToMaybe, fromMaybe)
 import Data.Set (Set, toList)
 import qualified Data.Set as Set
 import Data.Text as Text (Text, unpack, lines)
@@ -234,3 +236,12 @@
 
 indent :: [Char] -> String -> String
 indent prefix text = unlines (List.map (prefix ++) (List.lines text))
+
+maybeRead :: Read a => String -> Maybe a
+maybeRead = fmap fst . listToMaybe . reads
+
+read' :: Read a => (String -> a) -> String -> a
+read' f s = fromMaybe (f s) (maybeRead s)
+
+-- read' :: Read a => String -> a
+-- read' s = trace ("read " ++ show s) (read s)
diff --git a/src/Debian/Policy.hs b/src/Debian/Policy.hs
--- a/src/Debian/Policy.hs
+++ b/src/Debian/Policy.hs
@@ -44,6 +44,7 @@
 import Data.Maybe (mapMaybe)
 import Data.Monoid ((<>))
 import Data.Text (Text, pack, unpack, strip)
+import Debian.Debianize.Utility (read')
 import Debian.Relation (BinPkgName)
 import Debian.Version (DebianVersion, parseDebianVersion, version)
 import System.Environment (getEnvironment)
@@ -83,15 +84,19 @@
 accessLogBaseName :: String
 accessLogBaseName = "access.log"
 
-debianPackageVersion :: String -> IO DebianVersion
+debianPackageVersion :: String -> IO (Maybe DebianVersion)
 debianPackageVersion name =
     readProcess "dpkg-query" ["--show", "--showformat=${version}", name] "" >>=
-    return . parseDebianVersion
+    return . parseDebianVersion'
+    where
+      -- This should maybe be the real parseDebianVersion
+      parseDebianVersion' "" = Nothing
+      parseDebianVersion' s = Just (parseDebianVersion s)
 
 -- | Assumes debhelper is installed
-getDebhelperCompatLevel :: IO Int
+getDebhelperCompatLevel :: IO (Maybe Int)
 getDebhelperCompatLevel =
-    debianPackageVersion "debhelper" >>= return . read . takeWhile (/= '.') . version
+    debianPackageVersion "debhelper" >>= return . fmap (read . takeWhile (/= '.') . version)
 
 data StandardsVersion = StandardsVersion Int Int Int (Maybe Int) deriving (Eq, Ord, Show, Data, Typeable)
 
@@ -100,14 +105,19 @@
     pretty (StandardsVersion a b c Nothing) = text $ show a <> "." <> show b <> "." <> show c
 
 -- | Assumes debian-policy is installed
-getDebianStandardsVersion :: IO StandardsVersion
-getDebianStandardsVersion = debianPackageVersion "debian-policy" >>= \ v -> return (parseStandardsVersion (version v))
+getDebianStandardsVersion :: IO (Maybe StandardsVersion)
+getDebianStandardsVersion = debianPackageVersion "debian-policy" >>= return . fmap (parseStandardsVersion . version)
 
 parseStandardsVersion :: String -> StandardsVersion
 parseStandardsVersion s =
     case filter (/= ".") (groupBy (\ a b -> (a == '.') == (b == '.')) s) of
-      (a : b : c : d : _) -> StandardsVersion (read a) (read b) (read c) (Just (read d))
-      (a : b : c : _) -> StandardsVersion (read a) (read b) (read c) Nothing
+      (a : b : c : d : _) -> StandardsVersion (read' (\ s -> error $ "StandardsVersion" ++ show s) a)
+                                              (read' (\ s -> error $ "StandardsVersion" ++ show s) b)
+                                              (read' (\ s -> error $ "StandardsVersion" ++ show s) c)
+                                              (Just (read' (\ s -> error $ "StandardsVersion" ++ show s) d))
+      (a : b : c : _) -> StandardsVersion (read' (\ s -> error $ "StandardsVersion" ++ show s) a)
+                                          (read' (\ s -> error $ "StandardsVersion" ++ show s) b)
+                                          (read' (\ s -> error $ "StandardsVersion" ++ show s) c) Nothing
       _ -> error $ "Invalid Standards-Version string: " ++ show s
 
 data SourceFormat
