packages feed

cabal-debian 4.17.4 → 4.17.5

raw patch · 23 files changed

+191/−202 lines, 23 filesdep +prettydep +prettyclassdep ~debianPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependencies added: pretty, prettyclass

Dependency ranges changed: debian

API changes (from Hackage documentation)

- Debian.Debianize.Prelude: class Pretty a
- Debian.Debianize.Prelude: instance Pretty PackageIdentifier
- Debian.Debianize.Prelude: instance Pretty PackageName
- Debian.Debianize.Prelude: pretty :: Pretty a => a -> Doc
- Debian.Policy: instance Pretty (Maybe PackageArchitectures)
- Debian.Policy: instance Pretty Area
- Debian.Policy: instance Pretty PackageArchitectures
- Debian.Policy: instance Pretty PackagePriority
- Debian.Policy: instance Pretty Section
- Debian.Policy: instance Pretty SourceFormat
- Debian.Policy: instance Pretty StandardsVersion
+ Data.Algorithm.Diff.Pretty: prettyChange :: (c -> Doc) -> Diff [c] -> [Doc]
+ Data.Algorithm.Diff.Pretty: prettyHunk :: (c -> Doc) -> [Diff [c]] -> [Doc]
+ Debian.Debianize.Files: instance Pretty (PP Bool)
+ Debian.Debianize.Prelude: instance Pretty (PP PackageIdentifier)
+ Debian.Debianize.Prelude: instance Pretty (PP PackageName)
+ Debian.Policy: instance Pretty (PP Area)
+ Debian.Policy: instance Pretty (PP PackageArchitectures)
+ Debian.Policy: instance Pretty (PP PackagePriority)
+ Debian.Policy: instance Pretty (PP Section)
+ Debian.Policy: instance Pretty (PP SourceFormat)
+ Debian.Policy: instance Pretty (PP StandardsVersion)
- Data.Algorithm.Diff.Pretty: prettyDiff :: (Pretty a, Pretty b, Pretty c) => a -> b -> [[Diff [c]]] -> Doc
+ Data.Algorithm.Diff.Pretty: prettyDiff :: Doc -> Doc -> (c -> Doc) -> [[Diff [c]]] -> Doc
- Debian.Debianize.Prelude: showDeps :: [[Relation]] -> String
+ Debian.Debianize.Prelude: showDeps :: Relations -> String
- Debian.Debianize.Prelude: showDeps' :: [a] -> [[Relation]] -> String
+ Debian.Debianize.Prelude: showDeps' :: [a] -> Relations -> String

Files

Tests.hs view
@@ -16,7 +16,7 @@ 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)+import Data.Text as Text (intercalate, lines, split, Text, unlines, unpack) import Data.Version (Version(Version, versionBranch)) import Debian.Changes (ChangeLog(..), ChangeLogEntry(..), parseEntry) import Debian.Debianize.DebianName (mapCabal, splitCabal)@@ -31,8 +31,8 @@ import qualified Debian.Debianize.Types.BinaryDebDescription as B 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.Pretty (pretty, text, Doc) import Debian.Relation (BinPkgName(..), Relation(..), SrcPkgName(..), VersionReq(..)) import Debian.Release (ReleaseName(ReleaseName, relName)) import Debian.Version (parseDebianVersion, buildDebianVersion)@@ -45,6 +45,7 @@ import System.Process (readProcessWithExitCode) import Test.HUnit hiding ((~?=)) import Text.ParserCombinators.Parsec.Rfc2822 (NameAddr(..))+import Text.PrettyPrint.HughesPJClass (pPrint, text, Doc)  -- | A suitable defaultAtoms value for the debian repository. defaultAtoms :: Monad m => DebT m ()@@ -465,7 +466,7 @@                      ]                  , installFile =                      InstallFile { execName   = "clckwrks-dot-com-server"-                                 , destName   = show (pretty deb)+                                 , destName   = ppDisplay deb                                  , sourceDir  = Nothing                                  , destDir    = Nothing }                  }@@ -554,7 +555,7 @@                      ]                  , installFile =                      InstallFile { execName   = "creativeprompts-server"-                                 , destName   = show (pretty deb)+                                 , destName   = ppDisplay deb                                  , sourceDir  = Nothing                                  , destDir    = Nothing }                  }@@ -694,21 +695,18 @@       isUnchanged (Unchanged _ _) = True       isUnchanged _ = False       prettyChange :: Change FilePath Text -> Doc-      prettyChange (Unchanged p _) = text "Unchanged: " <> pretty p <> text "\n"-      prettyChange (Deleted p _) = text "Deleted: " <> pretty p <> text "\n"+      prettyChange (Unchanged p _) = text "Unchanged: " <> pPrint p <> text "\n"+      prettyChange (Deleted p _) = text "Deleted: " <> pPrint p <> text "\n"       prettyChange (Created p b) =-          text "Created: " <> pretty p <> text "\n" <>-          prettyDiff ("old" </> p) ("new" </> p)+          text "Created: " <> pPrint p <> text "\n" <>+          prettyDiff (text ("old" </> p)) (text ("new" </> p)) (text . unpack)                      -- We use split here instead of lines so we can                      -- detect whether the file has a final newline                      -- character.                      (contextDiff 2 mempty (split (== '\n') b))       prettyChange (Modified p a b) =-          text "Modified: " <> pretty p <> text "\n" <>-          prettyDiff ("old" </> p) ("new" </> p)-                     -- We use split here instead of lines so we can-                     -- detect whether the file has a final newline-                     -- character.+          text "Modified: " <> pPrint p <> text "\n" <>+          prettyDiff (text ("old" </> p)) (text ("new" </> p)) (text . unpack)                      (contextDiff 2 (split (== '\n') a) (split (== '\n') b))  sortBinaryDebs :: DebT IO ()
cabal-debian.cabal view
@@ -1,5 +1,5 @@ Name:           cabal-debian-Version:        4.17.4+Version:        4.17.5 License:        BSD3 License-File:   debian/copyright Author:         David Fox <dsf@seereason.com>@@ -170,6 +170,8 @@    memoize,    mtl,    parsec >= 3,+   pretty,+   prettyclass,    process,    pureMD5,    regex-tdfa,@@ -216,13 +218,13 @@ --    Hs-Source-Dirs: ., ../../haskell-debian --    Build-Depends: regex-compat, bytestring, process-listlike, network, old-locale, time --  else- Build-depends: debian >= 3.83.2+ Build-depends: debian >= 3.84  Executable cabal-debian  Hs-Source-Dirs: .  Main-is: CabalDebian.hs  ghc-options: -threaded -Wall -O2- Build-Depends: base, cabal-debian, data-lens, mtl+ Build-Depends: base, cabal-debian, data-lens, mtl, pretty  if flag(ghcjs-support)    Build-Depends: Cabal >= 1.21  else@@ -232,7 +234,7 @@  Hs-Source-Dirs: .  Main-is: Tests.hs  ghc-options: -threaded -Wall -O2- Build-Depends: base, cabal-debian, containers, data-lens, debian, filepath, hsemail, HUnit, process, text+ 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  else
changelog view
@@ -1,3 +1,12 @@+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++ -- David Fox <dsf@seereason.com>  Mon, 15 Sep 2014 13:28:36 -0700+ haskell-cabal-debian (4.17.4) unstable; urgency=low    * Add missing ifdefs to hide the GHCJS constructor when ghcjs-support
src/Data/Algorithm/Diff/Pretty.hs view
@@ -1,20 +1,29 @@-{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE OverloadedStrings, ScopedTypeVariables #-} module Data.Algorithm.Diff.Pretty     ( prettyDiff+    , prettyHunk+    , prettyChange     ) where  import Data.Algorithm.Diff (Diff(..))-import Data.Monoid (mconcat, (<>))-import Debian.Pretty (Pretty(pretty), Doc, text, empty)+import Data.Monoid ((<>))+import Text.PrettyPrint (Doc, text, empty, hcat) --- | Format the output of 'contextDiff' to look approximately like the--- output of the unix diff command.-prettyDiff :: (Pretty a, Pretty b, Pretty c) => a -> b -> [[Diff [c]]] -> Doc-prettyDiff _ _ [] = empty-prettyDiff old new hunks =-    text "--- " <> pretty old <> text "\n+++ " <> pretty new <> text "\n" <> mconcat (map (\ hunk -> text "@@\n" <> p hunk) hunks)-    where-      p (Both ts _ : more) = mconcat (map (\ l -> text " " <> pretty l <> text "\n") ts) <> p more-      p (First ts : more)  = mconcat (map (\ l -> text "-" <> pretty l <> text "\n") ts) <> p more-      p (Second ts : more) = mconcat (map (\ l -> text "+" <> pretty l <> text "\n") ts) <> p more-      p [] = empty+-- | Pretty print a list of hunks.+prettyDiff :: forall c. Doc -> Doc -> (c -> Doc) -> [[Diff [c]]] -> Doc+prettyDiff _ _ _ [] = empty+prettyDiff old new prettyElem hunks =+    hcat . map (<> text "\n") $ (text "--- " <> old :+                                 text "+++ " <> new :+                                 concatMap (prettyHunk prettyElem) hunks)++-- | Pretty print a hunk of adjacent changes+prettyHunk :: (c -> Doc) -> [Diff [c]] -> [Doc]+prettyHunk prettyElem hunk =+    text "@@" : concatMap (prettyChange prettyElem) hunk++-- | Pretty print a single change (e.g. a line of a text file)+prettyChange :: (c -> Doc) -> Diff [c] -> [Doc]+prettyChange prettyElem (Both ts _) = map (\ l -> text " " <> prettyElem l) ts+prettyChange prettyElem (First ts)  = map (\ l -> text "-" <> prettyElem l) ts+prettyChange prettyElem (Second ts) = map (\ l -> text "+" <> prettyElem l) ts
src/Debian/Debianize/Bundled.hs view
@@ -23,7 +23,7 @@ import Data.Version (Version(..), parseVersion) import Debian.Debianize.VersionSplits (DebBase(DebBase), VersionSplits, cabalFromDebian') import Debian.GHC ({- Memoizable instances -})-import Debian.Relation (BinPkgName(..), parseRelations)+import Debian.Relation (BinPkgName(..)) import Debian.Relation.ByteString() import Debian.Version (DebianVersion, parseDebianVersion, prettyDebianVersion) import Distribution.Simple.Compiler (CompilerFlavor(..), {-PackageDB(GlobalPackageDB), compilerFlavor-})
src/Debian/Debianize/Files.hs view
@@ -1,6 +1,6 @@ -- | Convert a Debianization into a list of files that can then be -- written out.-{-# LANGUAGE OverloadedStrings, ScopedTypeVariables, TupleSections #-}+{-# LANGUAGE FlexibleInstances, OverloadedStrings, ScopedTypeVariables, TupleSections #-} module Debian.Debianize.Files     ( debianizationFileMap     ) where@@ -8,6 +8,7 @@ import Control.Applicative ((<$>)) import Control.Monad.Trans (lift) import Control.Monad.Writer (WriterT, execWriterT, tell)+import Debian.Control.Common () import Data.Lens.Lazy (access, getL) import Data.List as List (map) import Data.Map as Map (Map, map, toList, fromListWithKey, mapKeys, insertWith)@@ -22,15 +23,19 @@ import qualified Debian.Debianize.Types.Atoms as T import qualified Debian.Debianize.Types.BinaryDebDescription as B import qualified Debian.Debianize.Types.SourceDebDescription as S-import Debian.Pretty (pretty)+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 System.Directory (getCurrentDirectory) import System.FilePath ((</>))+import Text.PrettyPrint.HughesPJClass (Pretty(pPrint), text, empty)  type FilesT m = WriterT [(FilePath, Text)] (DebT m) +instance Pretty (PP Bool) where+    pPrint = text . show . unPP+ -- | Turn the Debianization into a list of files, making sure the text -- associated with each path is unique.  Assumes that -- finalizeDebianization has already been called.  (Yes, I'm@@ -62,7 +67,7 @@  sourceFormatFiles :: (Monad m, Functor m) => FilesT m [(FilePath, Text)] sourceFormatFiles =-    maybe [] (\ x -> [("debian/source/format", pack (show (pretty x)))]) <$> (lift $ access T.sourceFormat)+    maybe [] (\ x -> [("debian/source/format", pack (ppDisplay x))]) <$> (lift $ access T.sourceFormat)  watchFile :: (Monad m, Functor m) => FilesT m [(FilePath, Text)] watchFile = maybe [] (\ x -> [("debian/watch", x)]) <$> (lift $ access T.watch)@@ -76,7 +81,7 @@     where       doAtom (T.Install b from dest) mp = Map.insertWith (++) (pathf b) [pack (from <> " " <> dest)] mp       doAtom _ mp = mp-      pathf name = "debian" </> show (pretty name) ++ ".install"+      pathf name = "debian" </> show (ppPrint name) ++ ".install"  dirs :: (Monad m, Functor m) => FilesT m [(FilePath, Text)] dirs =@@ -84,53 +89,53 @@     where       doAtom (T.InstallDir b dir) mp = Map.insertWith (++) (pathf b) [pack dir] mp       doAtom _ mp = mp-      pathf name = "debian" </> show (pretty name) ++ ".dirs"+      pathf name = "debian" </> show (ppPrint name) ++ ".dirs"  init :: (Monad m, Functor m) => FilesT m [(FilePath, Text)] init =     (Map.toList . mapKeys pathf) <$> (lift $ access T.installInit)     where-      pathf name = "debian" </> show (pretty name) ++ ".init"+      pathf name = "debian" </> show (ppPrint name) ++ ".init"  -- FIXME - use a map and insertWith, check for multiple entries logrotate :: (Monad m, Functor m) => FilesT m [(FilePath, Text)] logrotate =     (Map.toList . Map.map (\ stanzas -> Text.unlines (Set.toList stanzas)) . mapKeys pathf) <$> (lift $ access T.logrotateStanza)     where-      pathf name = "debian" </> show (pretty name) ++ ".logrotate"+      pathf name = "debian" </> show (ppPrint name) ++ ".logrotate"  -- | Assemble all the links by package and output one file each links :: (Monad m, Functor m) => FilesT m [(FilePath, Text)] links =     (Map.toList . Map.map unlines . Set.fold doAtom mempty) <$> (lift $ access T.atomSet)     where-      doAtom (T.Link b loc text) mp = Map.insertWith (++) (pathf b) [pack loc <> " " <> pack text] mp+      doAtom (T.Link b loc t) mp = Map.insertWith (++) (pathf b) [pack loc <> " " <> pack t] mp       doAtom _ mp = mp-      pathf name = "debian" </> show (pretty name) ++ ".links"+      pathf name = "debian" </> show (ppPrint name) ++ ".links"  postinstFiles :: (Monad m, Functor m) => FilesT m [(FilePath, Text)] postinstFiles =      (Map.toList . mapKeys pathf) <$> (lift $ access T.postInst)     where-      pathf (BinPkgName name) = "debian" </> show (pretty name) ++ ".postinst"+      pathf (BinPkgName name) = "debian" </> name <> ".postinst"  postrmFiles :: (Monad m, Functor m) => FilesT m [(FilePath, Text)] postrmFiles =     (Map.toList . mapKeys pathf) <$> (lift $ access T.postRm)     where-      pathf name = "debian" </> show (pretty name) ++ ".postrm"+      pathf name = "debian" </> show (ppPrint name) ++ ".postrm"  preinstFiles :: (Monad m, Functor m) => FilesT m [(FilePath, Text)] preinstFiles =     (Map.toList . mapKeys pathf) <$> (lift $ access T.preInst)     where-      pathf name = "debian" </> show (pretty name) ++ ".preinst"+      pathf name = "debian" </> show (ppPrint name) ++ ".preinst"  prermFiles :: (Monad m, Functor m) => FilesT m [(FilePath, Text)] prermFiles =     (Map.toList . mapKeys pathf) <$> (lift $ access T.preRm)     where-      pathf name = "debian" </> show (pretty name) ++ ".prerm"+      pathf name = "debian" </> show (ppPrint name) ++ ".prerm"  rules :: (Monad m, Functor m) => FilesT m [(FilePath, Text)] rules =@@ -141,17 +146,17 @@ changelog :: (Monad m, Functor m) => FilesT m [(FilePath, Text)] changelog =     do log <- lift $ access T.changelog-       return [("debian/changelog", pack (show (pretty (fromMaybe (error "No changelog in debianization") log))))]+       return [("debian/changelog", pack (show (ppPrint (fromMaybe (error "No changelog in debianization") log))))]  control :: (Monad m, Functor m) => FilesT m [(FilePath, Text)] control =     do d <- lift $ access T.control-       return [("debian/control", pack (show (pretty (controlFile d))))]+       return [("debian/control", ppDisplay' (controlFile d))]  compat :: (Monad m, Functor m) => FilesT m [(FilePath, Text)] compat =-    do text <- lift $ access T.compat-       return [("debian/compat", pack (show (fromMaybe (error "Missing DebCompat atom - is debhelper installed?") $ text) <> "\n"))]+    do t <- lift $ access T.compat+       return [("debian/compat", pack (show (fromMaybe (error "Missing DebCompat atom - is debhelper installed?") $ t) <> "\n"))]  copyright :: (Monad m, Functor m) => FilesT m [(FilePath, Text)] copyright =@@ -160,17 +165,17 @@        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  (pretty z)) <> "\n")) y-                                      (_, _, Just x) -> pack ("License: " <> show (pretty x) <> "\n")-                                      _ -> pack ("License: " <> show (pretty AllRightsReserved)))]+                                      (_, 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)))]  controlFile :: S.SourceDebDescription -> Control' String controlFile src =     Control     { unControl =           (Paragraph-           ([Field ("Source", " " ++ show (pretty (getL S.source src))),-             Field ("Maintainer", " " <> show (pretty (getL S.maintainer src)))] +++           ([Field ("Source", " " ++ (show . maybe empty ppPrint . getL S.source $ src)),+             Field ("Maintainer", " " <> (show . maybe empty ppPrint . getL S.maintainer $ src))] ++             lField "Uploaders" (getL S.uploaders src) ++             (case getL S.dmUploadAllowed src of True -> [Field ("DM-Upload-Allowed", " yes")]; False -> []) ++             mField "Priority" (getL S.priority src) ++@@ -189,8 +194,8 @@       binary :: B.BinaryDebDescription -> Paragraph' String       binary bin =           Paragraph-           ([Field ("Package", " " ++ show (pretty (getL B.package bin))),-             Field ("Architecture", " " ++ show (pretty (getL B.architecture bin)))] +++           ([Field ("Package", " " ++ (show . ppPrint . getL B.package $ bin)),+             Field ("Architecture", " " ++ (show . maybe empty ppPrint . getL B.architecture $ bin))] ++             mField "Section" (getL B.binarySection bin) ++             mField "Priority" (getL B.binaryPriority bin) ++             mField "Essential" (getL B.essential bin) ++@@ -202,9 +207,9 @@                   [] -> "No description available."                   (short : long) | Text.null (strip short) -> Text.unlines ("No short description available" : long)                   _ -> t-      mField tag = maybe [] (\ x -> [Field (tag, " " <> show (pretty x))])+      mField tag = maybe [] (\ x -> [Field (tag, " " <> (show . ppPrint $ x))])       lField _ [] = []-      lField tag xs = [Field (tag, " " <> show (pretty xs))]+      lField tag xs = [Field (tag, " " <> (show . ppPrint $ xs))]       vcsField (S.VCSBrowser t) = Field ("Vcs-Browser", " " ++ unpack t)       vcsField (S.VCSArch t) = Field ("Vcs-Arch", " " ++ unpack t)       vcsField (S.VCSBzr t) = Field ("Vcs-Bzr", " " ++ unpack t)
src/Debian/Debianize/Finalize.hs view
@@ -1,5 +1,5 @@ -- | Compute the debianization of a cabal package.-{-# LANGUAGE CPP, OverloadedStrings, ScopedTypeVariables #-}+{-# LANGUAGE CPP, FlexibleInstances, OverloadedStrings, ScopedTypeVariables #-} module Debian.Debianize.Finalize     ( debianization     , finalizeDebianization' -- external use deprecated - used in test script@@ -35,8 +35,8 @@ import qualified Debian.Debianize.Types.BinaryDebDescription as B (BinaryDebDescription, package, PackageType(Development, Documentation, Exec, Profiling, Source, HaskellSource, Utilities), PackageType) import Debian.Debianize.VersionSplits (DebBase(DebBase)) import Debian.Orphans ()-import Debian.Policy (getDebhelperCompatLevel, haskellMaintainer, PackageArchitectures(Any, All), PackagePriority(Optional), Section(..))-import Debian.Pretty (pretty)+import Debian.Pretty (ppDisplay, PP(..))+import Debian.Policy (getDebhelperCompatLevel, haskellMaintainer, PackageArchitectures(Any, All), PackagePriority(Extra), Section(..)) import Debian.Relation (BinPkgName, BinPkgName(BinPkgName), SrcPkgName(SrcPkgName), Relation(Rel), Relations) import qualified Debian.Relation as D (BinPkgName(BinPkgName), Relation(..)) import Debian.Release (parseReleaseName)@@ -52,6 +52,7 @@ 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 Text.PrettyPrint.HughesPJClass (Pretty(pPrint))  -- | Given an Atoms value, get any additional configuration -- information from the environment, read the cabal package@@ -92,7 +93,7 @@        Just pkgDesc <- access T.packageDescription        T.watch ~?= Just (watchAtom (pkgName $ Cabal.package $ pkgDesc))        T.sourceSection ~?= Just (MainSection "haskell")-       T.sourcePriority ~?= Just Optional+       T.sourcePriority ~?= Just Extra        T.compat ~?= debhelperCompat        finalizeChangelog date        finalizeControl@@ -139,13 +140,13 @@        debVer <- access T.debVersion        case debVer of          Just override-             | override < parseDebianVersion (show (pretty (pkgVersion pkgId))) ->-                 error ("Version from --deb-version (" ++ show (pretty override) ++-                        ") is older than hackage version (" ++ show (pretty (pkgVersion pkgId)) +++             | override < parseDebianVersion (ppDisplay (pkgVersion pkgId)) ->+                 error ("Version from --deb-version (" ++ ppDisplay override +++                        ") is older than hackage version (" ++ ppDisplay (pkgVersion pkgId) ++                         "), maybe you need to unpin this package?")          Just override -> return override          Nothing ->-             do let ver = show (pretty (pkgVersion pkgId))+             do let ver = ppDisplay (pkgVersion pkgId)                 rev <- get >>= return . getL T.revision >>= return . foldEmpty Nothing Just . fromMaybe ""                 return $ buildDebianVersion epoch ver rev @@ -196,19 +197,19 @@     where       -- Ensure that the package name is correct in the first log entry.       fixLog src ver cmts _maint (Just (ChangeLog (entry : older))) | logVersion entry == ver =-          Just (ChangeLog (entry { logPackage = show (pretty src)+          Just (ChangeLog (entry { logPackage = show (pPrint (PP src))                                  , logComments = logComments entry ++ "\n" ++                                                  (List.unlines $ List.map (("  * " <>) . List.intercalate "\n    " . List.map unpack) (fromMaybe [] cmts))                                  } : older))       -- The newest log entry isn't exactly ver, build a new entry.       fixLog src ver cmts maint log =-          Just (ChangeLog (Entry { logPackage = show (pretty src)+          Just (ChangeLog (Entry { logPackage = show (pPrint (PP src))                                  , logVersion = ver                                  , logDists = [parseReleaseName "unstable"]                                  , logUrgency = "low"                                  , logComments = List.unlines $ List.map (("  * " <>) . List.intercalate "\n    " . List.map unpack)                                                  (fromMaybe [["Debianization generated by cabal-debian"]] cmts)-                                 , logWho = show (pretty maint)+                                 , logWho = ppDisplay maint                                  , logDate = date } : maybe [] (\ (ChangeLog entries) -> entries) log))  -- | Convert the extraLibs field of the cabal build info into debian@@ -270,7 +271,7 @@        when (dev && prof && hc == GHC) (librarySpec Any B.Profiling hc)        when (dev && doc && hoogle)             (do docSpecsParagraph hc-                T.link debName ("/usr/share/doc" </> show (pretty debName) </> "html" </> cabal <.> "txt")+                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)@@ -349,7 +350,7 @@        -- If any files belong in the utils packages, make sure they exist        when (not (Set.null utilsData && Set.null utilsExec)) $ do          -- This is really for all binary debs except the libraries - I'm not sure why-         T.rulesFragments += (pack ("build" </> show (pretty b) ++ ":: build-ghc-stamp"))+         T.rulesFragments += (pack ("build" </> ppDisplay b ++ ":: build-ghc-stamp"))          T.binaryArchitectures b ~?= Just (if Set.null utilsExec then All else Any)          T.binarySection b ~?= Just (MainSection "misc")          binaryPackageRelations b B.Utilities@@ -406,9 +407,9 @@             doAtom [GHCJS] (A.InstallCabalExec b name dest) =                 T.rulesFragments +=                      (Text.unlines-                        [ pack ("binary-fixup" </> show (pretty b)) <> "::"+                        [ 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" </> show (pretty b) </> makeRelative "/" dest </> "$$i; done") ])+                                       "\t  while read i; do install -Dp " <> builddir </> name </> "$$i debian" </> ppDisplay b </> makeRelative "/" dest </> "$$i; done") ]) #endif             doAtom _ _ = return () @@ -420,9 +421,9 @@           where             doAtom [GHC] (A.InstallCabalExecTo b name dest) =                 T.rulesFragments += (Text.unlines-                                       [ pack ("binary-fixup" </> show (pretty b)) <> "::"+                                       [ pack ("binary-fixup" </> ppDisplay b) <> "::"                                        , "\tinstall -Dps " <> pack (builddir </> name </> name) <> " "-                                                           <> pack ("debian" </> show (pretty b) </> makeRelative "/" dest) ])+                                                           <> pack ("debian" </> ppDisplay b </> makeRelative "/" dest) ])             doAtom hcs (A.InstallCabalExecTo b name dest) = error $ "expandInstallCabalExecTo " ++ show hcs ++ " " ++ show (A.InstallCabalExecTo b name dest)             doAtom _ _ = return () @@ -443,8 +444,8 @@           access A.atomSet >>= List.mapM_ doAtom . Set.toList           where             doAtom (A.InstallTo b from dest) =-                T.rulesFragments += (Text.unlines [ pack ("binary-fixup" </> show (pretty b)) <> "::"-                                                  , "\tinstall -Dp " <> pack from <> " " <> pack ("debian" </> show (pretty b) </> makeRelative "/" dest) ])+                T.rulesFragments += (Text.unlines [ pack ("binary-fixup" </> ppDisplay b) <> "::"+                                                  , "\tinstall -Dp " <> pack from <> " " <> pack ("debian" </> ppDisplay b </> makeRelative "/" dest) ])             doAtom _ = return ()        -- Turn A.File into an intermediateFile and an A.Install
src/Debian/Debianize/Goodies.hs view
@@ -35,7 +35,7 @@ import qualified Debian.Debianize.Types.BinaryDebDescription as B import Debian.Debianize.VersionSplits (DebBase(DebBase)) import Debian.Orphans ()-import Debian.Pretty (Pretty(pretty))+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))@@ -75,7 +75,7 @@       equals (installed, dependent) = "\tdpkg-query -W -f='" <> display' dependent <> " (=$${Version})' " <>  display' installed <> " >> debian/" <> name <> ".substvars"       newer  (installed, dependent) = "\tdpkg-query -W -f='" <> display' dependent <> " (>>$${Version})' " <> display' installed <> " >> debian/" <> name <> ".substvars"       name = display' p-      display' = pack . show . pretty+      display' = ppDisplay'  -- | Add a debian binary package to the debianization containing a cabal executable file. doExecutable :: Monad m => BinPkgName -> T.InstallFile -> DebT m ()@@ -167,9 +167,7 @@  watchAtom :: PackageName -> Text watchAtom (PackageName pkgname) =-    pack $ "version=3\nopts=\"downloadurlmangle=s|archive/([\\w\\d_-]+)/([\\d\\.]+)/|archive/$1/$2/$1-$2.tar.gz|,\\\nfilenamemangle=s|(.*)/$|" ++ pkgname ++-           "-$1.tar.gz|\" \\\n    http://hackage.haskell.org/package/" ++ pkgname ++-           " \\\n    ([\\d\\.]*\\d)/\n"+    pack $ "version=3\nhttp://hackage.haskell.org/package/" ++ pkgname ++ "/distro-monitor .*-([0-9\\.]+)\\.(?:zip|tgz|tbz|txz|(?:tar\\.(?:gz|bz2|xz)))\n"  -- FIXME - use Atoms siteAtoms :: BinPkgName -> T.Site -> Atoms -> Atoms@@ -291,7 +289,7 @@                           , "    service apache2 restart" ]                      else []) ++                     [ -- This gets done by the #DEBHELPER# code below.-                      {- "    service " <> pack (show (pretty b)) <> " start", -}+                      {- "    service " <> pack (show (pPrint b)) <> " start", -}                       "    ;;"                     , "esac"                     , ""@@ -337,7 +335,7 @@ -- FIXME - use Atoms execAtoms :: BinPkgName -> T.InstallFile -> Atoms -> Atoms execAtoms b ifile r =-    modL T.rulesFragments (Set.insert (pack ("build" </> show (pretty b) ++ ":: build-ghc-stamp"))) .+    modL T.rulesFragments (Set.insert (pack ("build" </> ppDisplay b ++ ":: build-ghc-stamp"))) .     fileAtoms b ifile $     r 
src/Debian/Debianize/Output.hs view
@@ -34,7 +34,7 @@ import qualified Debian.Debianize.Types as T import qualified Debian.Debianize.Types.BinaryDebDescription as B (package) import qualified Debian.Debianize.Types.SourceDebDescription as S (source)-import Debian.Pretty (Pretty(pretty))+import Debian.Pretty (ppPrint, ppDisplay) import Prelude hiding (unlines, writeFile, (.)) import System.Directory (createDirectoryIfMissing, doesFileExist, getPermissions, Permissions(executable), setPermissions) --import System.Environment (getEnv)@@ -42,6 +42,7 @@ import System.FilePath ((</>), takeDirectory) import System.IO (hPutStrLn, stderr) import System.Process (readProcessWithExitCode, showCommandForUser)+import Text.PrettyPrint.HughesPJClass (text)  -- | Run the script in @debian/Debianize.hs@ with the given command -- line arguments.  Returns @True@ if the script exists and succeeds.@@ -115,7 +116,7 @@       doFile path (Just o) (Just n) =           if o == n           then Nothing -- Just (path ++ ": Unchanged\n")-          else Just (show (prettyDiff ("old" </> path) ("new" </> path) (contextDiff 2 (split (== '\n') o) (split (== '\n') n))))+          else Just (show (prettyDiff (text ("old" </> path)) (text ("new" </> path)) (text . unpack) (contextDiff 2 (split (== '\n') o) (split (== '\n') n))))       doFile _path Nothing Nothing = error "Internal error in zipMaps"  -- | Make sure the new debianization matches the existing@@ -126,9 +127,9 @@ validateDebianization :: Atoms -> Atoms -> () validateDebianization old new =     case () of-      _ | oldVersion /= newVersion -> throw (userError ("Version mismatch, expected " ++ show (pretty oldVersion) ++ ", found " ++ show (pretty newVersion)))-        | oldSource /= newSource -> throw (userError ("Source mismatch, expected " ++ show (pretty oldSource) ++ ", found " ++ show (pretty newSource)))-        | oldPackages /= newPackages -> throw (userError ("Package mismatch, expected " ++ show (map pretty oldPackages) ++ ", found " ++ show (map pretty newPackages)))+      _ | oldVersion /= newVersion -> throw (userError ("Version mismatch, expected " ++ ppDisplay oldVersion ++ ", found " ++ ppDisplay newVersion))+        | oldSource /= newSource -> throw (userError ("Source mismatch, expected " ++ ppDisplay oldSource ++ ", found " ++ ppDisplay newSource))+        | oldPackages /= newPackages -> throw (userError ("Package mismatch, expected " ++ show (map ppPrint oldPackages) ++ ", found " ++ show (map ppPrint newPackages)))         | True -> ()     where       oldVersion = logVersion (head (unChangeLog (fromMaybe (error "Missing changelog") (getL T.changelog old))))
src/Debian/Debianize/Prelude.hs view
@@ -1,6 +1,6 @@ -- | Functions and instances used by but not related to cabal-debian. -- These could conceivably be moved into more general libraries.-{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE FlexibleContexts, FlexibleInstances, ScopedTypeVariables #-} {-# OPTIONS_GHC -Wall -fno-warn-orphans #-} module Debian.Debianize.Prelude     ( curry3@@ -41,7 +41,6 @@     , maybeLens     , fromEmpty     , fromSingleton-    , Pretty(pretty)     ) where  import Control.Applicative ((<$>))@@ -63,7 +62,8 @@ import Data.Text.IO (hGetContents) import Debian.Control (parseControl, lookupP, Field'(Field), unControl, stripWS) import Debian.Orphans ()-import Debian.Pretty (Pretty(pretty))+import Debian.Pretty (PP(PP))+import Debian.Relation.Common ({- Pretty instances -}) import Debian.Version (DebianVersion, prettyDebianVersion) import Debian.Version.String (parseDebianVersion) import qualified Debian.Relation as D@@ -76,6 +76,7 @@ import System.IO (IOMode (ReadMode), withFile, openFile, hSetBinaryMode) import System.IO.Error (isDoesNotExistError, catchIOError) import System.Process (readProcessWithExitCode, showCommandForUser)+import Text.PrettyPrint.HughesPJClass as PP (Pretty(pPrint), text)  curry3 :: ((a, b, c) -> d) -> a -> b -> c -> d curry3 f a b c = f (a, b, c)@@ -94,7 +95,7 @@     return . Map.fromList . catMaybes  (!) :: DebMap -> D.BinPkgName -> DebianVersion-m ! k = maybe (error ("No version number for " ++ (show . pretty $ k) ++ " in " ++ show (Map.map (maybe Nothing (Just . prettyDebianVersion)) m))) id (Map.findWithDefault Nothing k m)+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@@ -185,15 +186,13 @@ readFileMaybe :: FilePath -> IO (Maybe Text) readFileMaybe path = (Just <$> readFile' path) `catchIOError` (\ _ -> return Nothing) --- Would like to call pretty instead of D.prettyRelations, but the--- Pretty instance for [a] doesn't work for us.-showDeps :: [[D.Relation]] -> String-showDeps = show . pretty+showDeps :: D.Relations -> String+showDeps = show . pPrint . PP  -- The extra space after prefix' is here for historical reasons(?)-showDeps' :: [a] -> [[D.Relation]] -> String+showDeps' :: [a] -> D.Relations -> String showDeps' prefix xss =-    intercalate  ("\n" ++ prefix' ++ " ") . Prelude.lines . show . pretty $ xss+    intercalate  ("\n" ++ prefix' ++ " ") . Prelude.lines . show . pPrint . PP $ xss     where prefix' = List.map (\ _ -> ' ') prefix  -- | From Darcs.Utils - set the working directory and run an IO operation.@@ -242,7 +241,7 @@  zipMaps :: Ord k => (k -> Maybe a -> Maybe b -> Maybe c) -> Map k a -> Map k b -> Map k c zipMaps f m n =-    foldWithKey h (foldWithKey g empty m) n+    foldWithKey h (foldWithKey g Map.empty m) n     where       g k a r = case f k (Just a) (lookup k n) of                   Just c -> Map.insert k c r              -- Both m and n have entries for k@@ -347,8 +346,8 @@       [] -> e       xs -> multiple xs -instance Pretty PackageIdentifier where-    pretty p = pretty (pkgName p) <> pretty "-" <> pretty (pkgVersion p)+instance Pretty (PP PackageIdentifier) where+    pPrint (PP p) = pPrint (PP (pkgName p)) <> text "-" <> pPrint (PP (pkgVersion p)) -instance Pretty PackageName where-    pretty (PackageName s) = pretty s+instance Pretty (PP PackageName) where+    pPrint (PP (PackageName s)) = text s
src/Debian/Debianize/SubstVars.hs view
@@ -26,7 +26,7 @@ import Debian.Debianize.Prelude ((!), buildDebVersionMap, cond, DebMap, debOfFile, diffFile, dpkgFileMap, replaceFile, showDeps, modifyM) import qualified Debian.Debianize.Types.Atoms as T import Debian.Orphans ()-import Debian.Pretty (pretty)+import Debian.Pretty (ppDisplay) import Debian.Relation (BinPkgName(BinPkgName), Relation, Relations) import qualified Debian.Relation as D (BinPkgName(BinPkgName), ParseRelations(parseRelations), Relation(Rel), Relations, VersionReq(GRE)) #if MIN_VERSION_Cabal(1,18,0)@@ -91,7 +91,7 @@       ([], Nothing) -> return ()       (missing, _) ->           liftIO $ die ("These debian packages need to be added to the build dependency list so the required cabal " ++-                        "packages are available:\n  " ++ intercalate "\n  " (map (show . pretty . fst) missing) +++                        "packages are available:\n  " ++ intercalate "\n  " (map (ppDisplay . fst) missing) ++                         "\nIf this is an obsolete package you may need to withdraw the old versions from the\n" ++                         "upstream repository, and uninstall and purge it from your local system.")     where
src/Debian/Orphans.hs view
@@ -9,10 +9,8 @@ import Data.Monoid ((<>)) import Data.Version (Version(..), showVersion) import Debian.Changes (ChangeLog(..), ChangeLogEntry(..))-import Debian.Pretty (Pretty(pretty), text, cat, empty)-import Debian.Relation (Relation(..), VersionReq(..), ArchitectureReq(..),-                        SrcPkgName(..))-import Debian.Version (DebianVersion)+import Debian.Pretty (PP(PP, unPP))+import Debian.Relation (Relation(..), VersionReq(..), ArchitectureReq(..)) import Distribution.Compiler (CompilerId(..)) #if !MIN_VERSION_Cabal(1,18,0) import Distribution.Compiler (CompilerFlavor(..))@@ -23,6 +21,7 @@ import Distribution.Version (VersionRange(..), foldVersionRange') import Language.Haskell.Extension (Extension(..), KnownExtension(..), Language(..)) import Text.ParserCombinators.Parsec.Rfc2822 (NameAddr(..))+import Text.PrettyPrint.HughesPJClass (Pretty(pPrint), text, hcat)  deriving instance Typeable Compiler deriving instance Typeable CompilerId@@ -84,17 +83,17 @@  -- Convert from license to RPM-friendly description.  The strings are -- taken from TagsCheck.py in the rpmlint distribution.-instance Pretty License where-    pretty (GPL _) = text "GPL"-    pretty (LGPL _) = text "LGPL"-    pretty BSD3 = text "BSD"-    pretty BSD4 = text "BSD-like"-    pretty PublicDomain = text "Public Domain"-    pretty AllRightsReserved = text "Proprietary"-    pretty OtherLicense = text "Non-distributable"-    pretty MIT = text "MIT"-    pretty (UnknownLicense _) = text "Unknown"-    pretty x = pretty (show x)+instance Pretty (PP License) where+    pPrint (PP (GPL _)) = text "GPL"+    pPrint (PP (LGPL _)) = text "LGPL"+    pPrint (PP BSD3) = text "BSD"+    pPrint (PP BSD4) = text "BSD-like"+    pPrint (PP PublicDomain) = text "Public Domain"+    pPrint (PP AllRightsReserved) = text "Proprietary"+    pPrint (PP OtherLicense) = text "Non-distributable"+    pPrint (PP MIT) = text "MIT"+    pPrint (PP (UnknownLicense _)) = text "Unknown"+    pPrint (PP x) = text (show x)  deriving instance Data NameAddr deriving instance Typeable NameAddr@@ -103,41 +102,27 @@ -- This Pretty instance gives a string used to create a valid -- changelog entry, it *must* have a name followed by an email address -- in angle brackets.-instance Pretty NameAddr where-    pretty x = pretty (fromMaybe (nameAddr_addr x) (nameAddr_name x) ++ " <" ++ nameAddr_addr x ++ ">")-    -- pretty x = text (maybe (nameAddr_addr x) (\ n -> n ++ " <" ++ nameAddr_addr x ++ ">") (nameAddr_name x))--instance Pretty [NameAddr] where-    pretty = cat . intersperse (text ", ") . map pretty+instance Pretty (PP NameAddr) where+    pPrint (PP x) = text (fromMaybe (nameAddr_addr x) (nameAddr_name x) ++ " <" ++ nameAddr_addr x ++ ">")+    -- pPrint x = text (maybe (nameAddr_addr x) (\ n -> n ++ " <" ++ nameAddr_addr x ++ ">") (nameAddr_name x)) -instance Pretty (Maybe NameAddr) where-    pretty Nothing = empty-    pretty (Just x) = pretty x+instance Pretty (PP [NameAddr]) where+    pPrint = hcat . intersperse (text ", ") . map (pPrint . PP) . unPP -instance Pretty VersionRange where-    pretty range =+instance Pretty (PP VersionRange) where+    pPrint (PP range) =         foldVersionRange'           (text "*")-          (\ v -> text "=" <> pretty v)-          (\ v -> text ">" <> pretty v)-          (\ v -> text "<" <> pretty v)-          (\ v -> text ">=" <> pretty v)-          (\ v -> text "<=" <> pretty v)-          (\ x _ -> text "=" <> pretty x <> text ".*") -- not exactly right+          (\ v -> text "=" <> pPrint (PP v))+          (\ v -> text ">" <> pPrint (PP v))+          (\ v -> text "<" <> pPrint (PP v))+          (\ v -> text ">=" <> pPrint (PP v))+          (\ v -> text "<=" <> pPrint (PP v))+          (\ x _ -> text "=" <> pPrint (PP x) <> text ".*") -- not exactly right           (\ x y -> text "(" <> x <> text " || " <> y <> text ")")           (\ x y -> text "(" <> x <> text " && " <> y <> text ")")           (\ x -> text "(" <> x <> text ")")           range -instance Pretty Version where-    pretty = pretty . showVersion--instance Pretty DebianVersion where-    pretty = pretty . show--instance Pretty (Maybe SrcPkgName) where-    pretty Nothing = empty-    pretty (Just x) = pretty x--instance Pretty Bool where-    pretty = pretty . show+instance Pretty (PP Version) where+    pPrint = text . showVersion . unPP
src/Debian/Policy.hs view
@@ -45,7 +45,7 @@ import Data.Monoid ((<>)) import Data.Text (Text, pack, unpack, strip) import Debian.Debianize.Prelude (read')-import Debian.Pretty (Pretty(pretty), text, empty)+import Debian.Pretty (PP(..)) import Debian.Relation (BinPkgName) import Debian.Version (DebianVersion, parseDebianVersion, version) import System.Environment (getEnvironment)@@ -53,12 +53,13 @@ import System.Process (readProcess) import Text.Parsec (parse) import Text.ParserCombinators.Parsec.Rfc2822 (NameAddr(..), address)+import Text.PrettyPrint.HughesPJClass (Pretty(pPrint), text)  databaseDirectory :: BinPkgName -> String-databaseDirectory x = "/srv" </> show (pretty x)+databaseDirectory x = "/srv" </> show (pPrint . PP $ x)  apacheLogDirectory :: BinPkgName -> String-apacheLogDirectory x =  "/var/log/apache2/" ++ show (pretty x)+apacheLogDirectory x =  "/var/log/apache2/" ++ show (pPrint . PP $ x)  apacheErrorLog :: BinPkgName -> String apacheErrorLog x = apacheLogDirectory x </> errorLogBaseName@@ -67,7 +68,7 @@ apacheAccessLog x = apacheLogDirectory x </> accessLogBaseName  serverLogDirectory :: BinPkgName -> String-serverLogDirectory x = "/var/log/" ++ show (pretty x)+serverLogDirectory x = "/var/log/" ++ show (pPrint . PP $ x)  serverAppLog :: BinPkgName -> String serverAppLog x = serverLogDirectory x </> appLogBaseName@@ -104,9 +105,9 @@  data StandardsVersion = StandardsVersion Int Int Int (Maybe Int) deriving (Eq, Ord, Show, Data, Typeable) -instance Pretty StandardsVersion where-    pretty (StandardsVersion a b c (Just d)) = pretty (show a) <> text "." <> pretty (show b) <> text "." <> pretty (show c) <> text "." <> pretty (show d)-    pretty (StandardsVersion a b c Nothing) = pretty (show a) <> text "." <> pretty (show b) <> text "." <> pretty (show c)+instance Pretty (PP StandardsVersion) where+    pPrint (PP (StandardsVersion a b c (Just d))) = text (show a) <> text "." <> text (show b) <> text "." <> text (show c) <> text "." <> text (show d)+    pPrint (PP (StandardsVersion a b c Nothing)) = text (show a) <> text "." <> text (show b) <> text "." <> text (show c)  -- | Assumes debian-policy is installed getDebianStandardsVersion :: IO (Maybe StandardsVersion)@@ -129,9 +130,9 @@     | Quilt3     deriving (Eq, Ord, Show, Data, Typeable) -instance Pretty SourceFormat where-    pretty Quilt3 = text "3.0 (quilt)\n"-    pretty Native3 = text "3.0 (native)\n"+instance Pretty (PP SourceFormat) where+    pPrint (PP Quilt3) = text "3.0 (quilt)\n"+    pPrint (PP Native3) = text "3.0 (native)\n"  readSourceFormat :: Text -> Either Text SourceFormat readSourceFormat s =@@ -158,8 +159,8 @@       "extra" -> Extra       x -> error $ "Invalid priority string: " ++ show x -instance Pretty PackagePriority where-    pretty = pretty . map toLower . show+instance Pretty (PP PackagePriority) where+    pPrint = text . map toLower . show . unPP  -- | The architectures for which a binary deb can be built. data PackageArchitectures@@ -168,14 +169,10 @@     | Names [String] -- ^ The list of suitable architectures     deriving (Read, Eq, Ord, Show, Data, Typeable) -instance Pretty PackageArchitectures where-    pretty All = text "all"-    pretty Any = text "any"-    pretty (Names xs) = pretty $ intercalate " " xs--instance Pretty (Maybe PackageArchitectures) where-    pretty Nothing = empty-    pretty (Just x) = pretty x+instance Pretty (PP PackageArchitectures) where+    pPrint (PP All) = text "all"+    pPrint (PP Any) = text "any"+    pPrint (PP (Names xs)) = text $ intercalate " " xs  parsePackageArchitectures :: String -> PackageArchitectures parsePackageArchitectures "all" = All@@ -196,9 +193,9 @@       (a, '/' : _) -> error $ "readSection - unknown area: " ++ show a       (a, _) -> MainSection a -instance Pretty Section where-    pretty (MainSection sec) = pretty sec-    pretty (AreaSection area sec) = pretty area <> text "/" <> pretty sec+instance Pretty (PP Section) where+    pPrint (PP (MainSection sec)) = text sec+    pPrint (PP (AreaSection area sec)) = pPrint (PP area) <> text "/" <> text sec  -- Is this really all that is allowed here?  Doesn't Ubuntu have different areas? data Area@@ -207,10 +204,10 @@     | NonFree     deriving (Read, Eq, Ord, Show, Data, Typeable) -instance Pretty Area where-    pretty Main = text "main"-    pretty Contrib = text "contrib"-    pretty NonFree = text "non-free"+instance Pretty (PP Area) where+    pPrint (PP Main) = text "main"+    pPrint (PP Contrib) = text "contrib"+    pPrint (PP NonFree) = text "non-free"  {- Create a debian maintainer field from the environment variables:
test-data/alex/output/debian/control view
@@ -1,5 +1,5 @@ Source: haskell-alex-Priority: optional+Priority: extra Section: haskell Maintainer: Simon Marlow <marlowsd@gmail.com> Build-Depends: debhelper (>= 7.0)
test-data/alex/output/debian/watch view
@@ -1,5 +1,2 @@ version=3-opts="downloadurlmangle=s|archive/([\w\d_-]+)/([\d\.]+)/|archive/$1/$2/$1-$2.tar.gz|,\-filenamemangle=s|(.*)/$|alex-$1.tar.gz|" \-    http://hackage.haskell.org/package/alex \-    ([\d\.]*\d)/+http://hackage.haskell.org/package/alex/distro-monitor .*-([0-9\.]+)\.(?:zip|tgz|tbz|txz|(?:tar\.(?:gz|bz2|xz)))
test-data/archive/output/debian/control view
@@ -1,5 +1,5 @@ Source: seereason-darcs-backups-Priority: optional+Priority: extra Maintainer: David Fox <dsf@seereason.com> Section: haskell Build-Depends: debhelper (>= 7.0)
test-data/archive/output/debian/watch view
@@ -1,5 +1,2 @@ version=3-opts="downloadurlmangle=s|archive/([\w\d_-]+)/([\d\.]+)/|archive/$1/$2/$1-$2.tar.gz|,\-filenamemangle=s|(.*)/$|seereason-darcs-backups-$1.tar.gz|" \-    http://hackage.haskell.org/package/seereason-darcs-backups \-    ([\d\.]*\d)/+http://hackage.haskell.org/package/seereason-darcs-backups/distro-monitor .*-([0-9\.]+)\.(?:zip|tgz|tbz|txz|(?:tar\.(?:gz|bz2|xz)))
test-data/artvaluereport-data/output/debian/control view
@@ -1,5 +1,5 @@ Source: haskell-artvaluereport-data-Priority: optional+Priority: extra Section: haskell Maintainer: David Fox <dsf@seereason.com> Build-Depends: debhelper (>= 7.0)
test-data/artvaluereport-data/output/debian/watch view
@@ -1,5 +1,2 @@ version=3-opts="downloadurlmangle=s|archive/([\w\d_-]+)/([\d\.]+)/|archive/$1/$2/$1-$2.tar.gz|,\-filenamemangle=s|(.*)/$|artvaluereport-data-$1.tar.gz|" \-    http://hackage.haskell.org/package/artvaluereport-data \-    ([\d\.]*\d)/+http://hackage.haskell.org/package/artvaluereport-data/distro-monitor .*-([0-9\.]+)\.(?:zip|tgz|tbz|txz|(?:tar\.(?:gz|bz2|xz)))
test-data/clckwrks-dot-com/output/debian/control view
@@ -1,6 +1,6 @@ Source: haskell-clckwrks-dot-com Maintainer: Jeremy Shaw <jeremy@n-heptane.com>-Priority: optional+Priority: extra Section: haskell Build-Depends: debhelper (>= 7.0)                , haskell-devscripts (>= 0.8)
test-data/clckwrks-dot-com/output/debian/watch view
@@ -1,5 +1,2 @@ version=3-opts="downloadurlmangle=s|archive/([\w\d_-]+)/([\d\.]+)/|archive/$1/$2/$1-$2.tar.gz|,\-filenamemangle=s|(.*)/$|clckwrks-dot-com-$1.tar.gz|" \-    http://hackage.haskell.org/package/clckwrks-dot-com \-    ([\d\.]*\d)/+http://hackage.haskell.org/package/clckwrks-dot-com/distro-monitor .*-([0-9\.]+)\.(?:zip|tgz|tbz|txz|(?:tar\.(?:gz|bz2|xz)))
test-data/creativeprompts/output/debian/control view
@@ -1,6 +1,6 @@ Source: haskell-creativeprompts Maintainer: Jeremy Shaw <jeremy@seereason.com>-Priority: optional+Priority: extra Section: haskell Build-Depends: debhelper (>= 7.0) 	       , haskell-devscripts (>= 0.8)
test-data/creativeprompts/output/debian/watch view
@@ -1,5 +1,2 @@ version=3-opts="downloadurlmangle=s|archive/([\w\d_-]+)/([\d\.]+)/|archive/$1/$2/$1-$2.tar.gz|,\-filenamemangle=s|(.*)/$|creativeprompts-$1.tar.gz|" \-    http://hackage.haskell.org/package/creativeprompts \-    ([\d\.]*\d)/+http://hackage.haskell.org/package/creativeprompts/distro-monitor .*-([0-9\.]+)\.(?:zip|tgz|tbz|txz|(?:tar\.(?:gz|bz2|xz)))