packages feed

debian 3.83.4.2 → 3.84

raw patch · 20 files changed

+208/−186 lines, 20 filesdep +prettyclassPVP ok

version bump matches the API change (PVP)

Dependencies added: prettyclass

API changes (from Hackage documentation)

- Debian.Changes: instance Pretty ChangeLog
- Debian.Changes: instance Pretty ChangeLogEntry
- Debian.Changes: instance Pretty ChangedFileSpec
- Debian.Changes: instance Pretty ChangesFile
- Debian.Control.Common: instance Pretty a => Pretty (Control' a)
- Debian.Control.Common: instance Pretty a => Pretty (Field' a)
- Debian.Control.Common: instance Pretty a => Pretty (Paragraph' a)
- Debian.Pretty: (<>) :: Monoid m => m -> m -> m
- Debian.Pretty: cat :: [Doc] -> Doc
- Debian.Pretty: class Pretty a
- Debian.Pretty: data Doc
- Debian.Pretty: empty :: Doc
- Debian.Pretty: instance Monoid Doc
- Debian.Pretty: instance Pretty String
- Debian.Pretty: instance Pretty Text
- Debian.Pretty: instance Show Doc
- Debian.Pretty: pretty :: Pretty a => a -> Doc
- Debian.Pretty: render :: Doc -> Text
- Debian.Pretty: text :: Text -> Doc
- Debian.Pretty: vcat :: [Doc] -> Doc
- Debian.Relation.Common: instance Pretty ArchitectureReq
- Debian.Relation.Common: instance Pretty BinPkgName
- Debian.Relation.Common: instance Pretty OrRelation
- Debian.Relation.Common: instance Pretty Relation
- Debian.Relation.Common: instance Pretty Relations
- Debian.Relation.Common: instance Pretty SrcPkgName
- Debian.Relation.Common: instance Pretty VersionReq
- Debian.Sources: instance Pretty DebSource
- Debian.Sources: instance Pretty SourceType
+ Debian.Changes: instance Pretty (PP ChangeLog)
+ Debian.Changes: instance Pretty (PP ChangeLogEntry)
+ Debian.Changes: instance Pretty (PP ChangedFileSpec)
+ Debian.Changes: instance Pretty (PP ChangesFile)
+ Debian.Changes: instance Pretty (PP [ChangeLogEntry])
+ Debian.Control.Common: instance Pretty (PP a) => Pretty (PP (Control' a))
+ Debian.Control.Common: instance Pretty (PP a) => Pretty (PP (Field' a))
+ Debian.Control.Common: instance Pretty (PP a) => Pretty (PP (Paragraph' a))
+ Debian.Pretty: PP :: a -> PP a
+ Debian.Pretty: display' :: Pretty a => a -> Text
+ Debian.Pretty: instance Functor PP
+ Debian.Pretty: instance Pretty (PP String)
+ Debian.Pretty: instance Pretty (PP Text)
+ Debian.Pretty: instance Pretty (PP a) => Pretty (PP (Maybe a))
+ Debian.Pretty: newtype PP a
+ Debian.Pretty: ppDisplay :: Pretty (PP a) => a -> String
+ Debian.Pretty: ppDisplay' :: Pretty (PP a) => a -> Text
+ Debian.Pretty: ppPrint :: Pretty (PP a) => a -> Doc
+ Debian.Pretty: unPP :: PP a -> a
+ Debian.Relation.Common: instance Pretty (PP ArchitectureReq)
+ Debian.Relation.Common: instance Pretty (PP BinPkgName)
+ Debian.Relation.Common: instance Pretty (PP OrRelation)
+ Debian.Relation.Common: instance Pretty (PP Relation)
+ Debian.Relation.Common: instance Pretty (PP Relations)
+ Debian.Relation.Common: instance Pretty (PP SrcPkgName)
+ Debian.Relation.Common: instance Pretty (PP VersionReq)
+ Debian.Sources: instance Pretty (PP DebSource)
+ Debian.Sources: instance Pretty (PP SourceType)
+ Debian.Sources: instance Pretty (PP [DebSource])
+ Debian.Version.Common: instance Pretty (PP DebianVersion)
- Debian.Relation: class Pretty a => PkgName a
+ Debian.Relation: class Pretty (PP a) => PkgName a
- Debian.Relation.Common: class Pretty a => PkgName a
+ Debian.Relation.Common: class Pretty (PP a) => PkgName a

Files

Debian/Apt/Dependencies.hs view
@@ -20,10 +20,10 @@ import Debian.Apt.Package(PackageNameMap, packageNameMap, lookupPackageByRel) import Debian.Control.ByteString(ControlFunctions(stripWS, lookupP, parseControlFromFile),                                  Field'(Field, Comment), Control'(Control), Paragraph, Control)-import Debian.Pretty (render) import Debian.Relation (BinPkgName(..)) import Debian.Relation.ByteString(ParseRelations(..), Relation(..), OrRelation, AndRelation, Relations, checkVersionReq) import Debian.Version(DebianVersion, parseDebianVersion, prettyDebianVersion)+import Text.PrettyPrint (render)  -- * Basic CSP Types and Functions 
Debian/Apt/Index.hs view
@@ -32,7 +32,7 @@ import Debian.Control.ByteString import Debian.Control.Common import Debian.Control.Text (decodeControl)-import Debian.Pretty (pretty, render)+import Debian.Pretty (PP(..)) import Debian.Release import Debian.Sources import Debian.URI@@ -42,6 +42,8 @@ import System.FilePath (takeBaseName) --import qualified System.Unix.Misc as Misc import Text.ParserCombinators.Parsec.Error+import Text.PrettyPrint (render)+import Text.PrettyPrint.HughesPJClass (pPrint)  -- |Package indexes on the server are uncompressed or compressed with -- gzip or bzip2. We do not know what will exist on the server until we@@ -123,7 +125,7 @@     where       baseURI = sourceUri debSource       (release, sections) =-          either (error $ "indexURIs: support not implemented for exact path: " ++ unpack (render (pretty debSource))) id (sourceDist debSource)+          either (error $ "indexURIs: support not implemented for exact path: " ++ render (pPrint (PP debSource))) id (sourceDist debSource)  -- |return a tuple for the section  --  - the URI to the uncompressed index file
Debian/Arch.hs view
@@ -10,12 +10,12 @@ import Data.Data (Data) import Data.Monoid ((<>)) import Data.Typeable (Typeable)-import Debian.Pretty (Doc, Pretty(pretty), text)+import Text.PrettyPrint (Doc, text)  data ArchOS = ArchOS String | ArchOSAny deriving (Eq, Ord, Read, Show, Data, Typeable)  prettyOS :: ArchOS -> Doc-prettyOS (ArchOS s) = pretty s+prettyOS (ArchOS s) = text s prettyOS ArchOSAny = text "any"  parseOS :: String -> ArchOS@@ -25,7 +25,7 @@ data ArchCPU = ArchCPU String | ArchCPUAny deriving (Eq, Ord, Read, Show, Data, Typeable)  prettyCPU :: ArchCPU -> Doc-prettyCPU (ArchCPU s) = pretty s+prettyCPU (ArchCPU s) = text s prettyCPU ArchCPUAny = text "any"  parseCPU :: String -> ArchCPU
Debian/Changes.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE FlexibleInstances #-} {-# OPTIONS_GHC -fno-warn-name-shadowing -fno-warn-missing-signatures #-} -- |Changelog and changes file support. module Debian.Changes@@ -18,12 +19,14 @@ import Data.Text (Text, pack, unpack, strip) import Debian.Arch (Arch, prettyArch) import qualified Debian.Control.String as S-import Debian.Pretty (Doc, empty, Pretty(pretty), cat, vcat, render)+import Debian.Pretty (PP(..)) import Debian.Release import Debian.URI() import Debian.Version import System.Posix.Types import Text.Regex.TDFA hiding (empty)+import Text.PrettyPrint (Doc, text, hcat, render)+import Text.PrettyPrint.HughesPJClass (Pretty(pPrint))  -- |A file generated by dpkg-buildpackage describing the result of a -- package build@@ -70,35 +73,41 @@ -}  changesFileName :: ChangesFile -> String-changesFileName = unpack . render . pretty+changesFileName = render . pPrint . PP -instance Pretty ChangesFile where-    pretty changes = pretty (changePackage changes ++ "_") <> prettyDebianVersion (changeVersion changes) <> pretty "_" <> prettyArch (changeArch changes) <> pretty ".changes"+instance Pretty (PP ChangesFile) where+    pPrint (PP changes) = text (changePackage changes ++ "_") <> prettyDebianVersion (changeVersion changes) <> text "_" <> prettyArch (changeArch changes) <> text ".changes" -instance Pretty ChangedFileSpec where-    pretty file =-      pretty (changedFileMD5sum file <> " " <>+instance Pretty (PP ChangedFileSpec) where+    pPrint (PP file) =+        text (changedFileMD5sum file <> " " <>               show (changedFileSize file) <> " " <>               sectionName (changedFileSection file) <> " " <>               changedFilePriority file <> " " <>               changedFileName file) -instance Pretty ChangeLogEntry where-    pretty (Entry package ver dists urgency details who date) =-        cat  [ pretty (package <> " (") <> prettyDebianVersion ver <> pretty (") " <> intercalate " " (map releaseName' dists) ++ "; urgency=" ++ urgency)-             , pretty "\n\n"-             , pretty "  " <> pretty (strip (pack details))-             , pretty "\n\n"-             , pretty (" -- " <> who <> "  " <> date) ]-    pretty (WhiteSpace _) = error "instance Pretty ChangeLogEntry"+instance Pretty (PP ChangeLogEntry) where+    pPrint (PP (Entry package ver dists urgency details who date)) =+        hcat [ text package <> text " (" <> prettyDebianVersion ver <> text (") " <> intercalate " " (map releaseName' dists) ++ "; urgency=" ++ urgency)+             , text "\n\n"+             , text "  " <> text (strip' details)+             , text "\n\n"+             , text (" -- " <> who <> "  " <> date)+             , text "\n" ]+    pPrint (PP (WhiteSpace _)) = error "instance Pretty ChangeLogEntry" -instance Pretty ChangeLog where-    pretty (ChangeLog xs) = vcat (intersperse empty (map pretty xs))+instance Pretty (PP [ChangeLogEntry]) where+    pPrint = hcat . intersperse (text "\n") . map (pPrint . PP) . unPP +strip' = unpack . strip . pack++instance Pretty (PP ChangeLog) where+    pPrint (PP (ChangeLog xs)) = hcat (intersperse (text "\n") (map (pPrint . PP) xs))+ -- |Show just the top line of a changelog entry (for debugging output.) _showHeader :: ChangeLogEntry -> Doc _showHeader (Entry package ver dists urgency _ _ _) =-    pretty (package <> " (") <> prettyDebianVersion ver <> pretty (") " <> intercalate " " (map releaseName' dists) <> "; urgency=" <> urgency <> "...")+    text (package <> " (") <> prettyDebianVersion ver <> text (") " <> intercalate " " (map releaseName' dists) <> "; urgency=" <> urgency <> "...") _showHeader (WhiteSpace _) = error "_showHeader"  {-
Debian/Control/Common.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE FlexibleContexts, FlexibleInstances, OverloadedStrings, UndecidableInstances #-} module Debian.Control.Common     ( -- * Types       Control'(..)@@ -20,11 +20,13 @@  import Data.List (partition, intersperse) import Data.Monoid ((<>))-import Debian.Pretty (Doc, text, Pretty(pretty), cat, vcat)+import Debian.Pretty (PP(..)) import System.Exit (ExitCode(ExitSuccess, ExitFailure)) import System.IO (Handle) import System.Process (runInteractiveCommand, waitForProcess) import Text.ParserCombinators.Parsec (ParseError)+import Text.PrettyPrint (Doc, text, hcat)+import Text.PrettyPrint.HughesPJClass (Pretty(pPrint))  newtype Control' a     = Control { unControl :: [Paragraph' a] } deriving (Eq, Ord, Read, Show)@@ -57,30 +59,27 @@     stripWS :: a -> a     asString :: a -> String --- |This may have bad performance issues (why?)-instance Pretty a => Pretty (Control' a) where-    pretty = ppControl-    -- pretty (Control paragraphs) = vcat (map pretty paragraphs)-instance Pretty a => Pretty (Paragraph' a) where-    pretty = ppParagraph-    -- pretty (Paragraph fields) = vcat (map pretty fields ++ [empty])+-- | This may have bad performance issues (dsf: Whoever wrote this+-- comment should have explained why.)+instance Pretty (PP a) => Pretty (PP (Control' a)) where+    pPrint = ppControl . unPP+instance Pretty (PP a) => Pretty (PP (Paragraph' a)) where+    pPrint = ppParagraph . unPP -instance Pretty a => Pretty (Field' a) where-    pretty = ppField-    -- pretty (Field (name,value)) = pretty name <> text ":" <> pretty value-    -- pretty (Comment s) = pretty s+instance Pretty (PP a) => Pretty (PP (Field' a)) where+    pPrint = ppField . unPP -ppControl :: (Pretty a) => Control' a -> Doc+ppControl :: Pretty (PP a) => Control' a -> Doc ppControl (Control paragraph) =-    cat (intersperse (text "\n") (map ppParagraph paragraph))+    hcat (intersperse (text "\n") (map ppParagraph paragraph)) -ppParagraph :: (Pretty a) => Paragraph' a -> Doc+ppParagraph :: Pretty (PP a) => Paragraph' a -> Doc ppParagraph (Paragraph fields) =-    vcat (map ppField fields)+    hcat (map (\ x -> ppField x <> text "\n") fields) -ppField :: (Pretty a) => Field' a -> Doc-ppField (Field (n,v)) = pretty n <> text ":" <> pretty v-ppField (Comment c) = pretty c+ppField :: Pretty (PP a) => Field' a -> Doc+ppField (Field (n,v)) = pPrint (PP n) <> text ":" <> pPrint (PP v)+ppField (Comment c) = pPrint (PP c)  mergeControls :: [Control' a] -> Control' a mergeControls controls =
Debian/Control/Policy.hs view
@@ -34,13 +34,12 @@ import Data.ListLike (toList) import Debian.Control.Common (Control'(..), Paragraph'(..), Field'(..), fieldValue, ControlFunctions(parseControlFromFile, parseControl)) import Debian.Control.Text ()-import Debian.Loc (mapExn, __LOC__)-import Debian.Pretty (pretty)+import Debian.Loc (__LOC__)+import Debian.Pretty (ppDisplay) import Debian.Relation (SrcPkgName(..), BinPkgName(..), Relations, parseRelations) import Debian.Relation.Text () import Language.Haskell.TH (Loc) -- import qualified Debug.ShowPlease as Please-import GHC.IO.Exception (ioe_location) import Text.Parsec.Error (ParseError)  -- | Opaque (constructor not exported) type to hold a validated Debian@@ -48,10 +47,10 @@ data DebianControl = DebianControl {unDebianControl :: Control' Text}  instance Show DebianControl where-    show c = "(parseDebianControl \"\" " ++ show (show (pretty (unDebianControl c))) ++ ")"+    show c = "(parseDebianControl \"\" " ++ show (ppDisplay (unDebianControl c)) ++ ")"  instance Show (Control' Text) where-    show c = "(parseControl \"\" " ++ show (show (pretty c)) ++ ")"+    show c = "(parseControl \"\" " ++ show (ppDisplay c) ++ ")"  -- | Validate and return a control file in an opaque wrapper.  May -- throw a ControlFileError.  Currently we only verify that it has a
Debian/GenBuildDeps.hs view
@@ -32,7 +32,7 @@ import qualified Data.Set as Set import		 Debian.Control (parseControlFromFile) import		 Debian.Control.Policy (HasDebianControl, ControlFileError(..), validateDebianControl, debianSourcePackageName, debianBinaryPackageNames, debianBuildDeps, debianBuildDepsIndep)-import           Debian.Loc (__LOC__, mapExn)+import           Debian.Loc (__LOC__) import		 Debian.Relation import		 Debian.Relation.Text () import           Language.Haskell.TH (Loc)
Debian/Pretty.hs view
@@ -1,58 +1,42 @@-{-# LANGUAGE FlexibleInstances, OverloadedStrings, TypeSynonymInstances #-}+{-# LANGUAGE DeriveFunctor, FlexibleContexts, FlexibleInstances, OverloadedStrings, TypeSynonymInstances #-} module Debian.Pretty-    ( Doc-    , text-    , empty-    , cat-    , vcat-    , Pretty(pretty)-    , render+    ( PP(PP, unPP)     , display-    , (<>)+    , display'+    , ppPrint+    , ppDisplay+    , ppDisplay'     ) where --- import qualified Data.ByteString.Char8 as C-import Data.List (intersperse)-import Data.Monoid (Monoid(mempty, mappend), (<>))-import Data.Text (Text, pack, unpack)--data Doc = Doc {unDoc :: Text}--instance Monoid Doc where-    mempty = Doc mempty-    mappend (Doc a) (Doc b) = Doc (a <> b)--empty :: Doc-empty = Doc mempty--text :: Text -> Doc-text = Doc+import Data.Text (Text, unpack, pack)+import Text.PrettyPrint.HughesPJClass (Doc, Pretty(pPrint), text, empty) -cat :: [Doc] -> Doc-cat = foldl (<>) empty+-- | This type is wrapped around values before we pretty print them so+-- we can write our own Pretty instances for common types without+-- polluting the name space of clients of this package with instances+-- they don't want.+newtype PP a = PP {unPP :: a} deriving (Functor) -vcat :: [Doc] -> Doc-vcat xs = cat (intersperse (Doc "\n") xs) <> Doc "\n"+instance Pretty (PP Text) where+    pPrint = text . unpack . unPP -class Pretty a where-    pretty :: a -> Doc+instance Pretty (PP String) where+    pPrint = text . unPP -instance Pretty String where-    pretty = text . pack+instance Pretty (PP a) => Pretty (PP (Maybe a)) where+    pPrint = maybe empty ppPrint . unPP -instance Pretty Text where-    pretty = text+display :: Pretty a => a -> String+display = show . pPrint --- instance ToText C.ByteString where---     totext = text . C.unpack+display' :: Pretty a => a -> Text+display' = pack .show . pPrint -render :: Doc -> Text-render = unDoc+ppPrint :: Pretty (PP a) => a -> Doc+ppPrint = pPrint . PP -display :: Pretty a => a -> String-display = unpack . unDoc . pretty+ppDisplay :: Pretty (PP a) => a -> String+ppDisplay = display . PP --- I'm keeping this for backwards compatibility, though it doesn't seem like--- a proper use of the Show class to me.-instance Show Doc where-    show = unpack . render+ppDisplay' :: Pretty (PP a) => a -> Text+ppDisplay' = pack . display . PP
Debian/Relation/Common.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE DeriveDataTypeable, FlexibleInstances, OverloadedStrings, TypeSynonymInstances #-}+{-# LANGUAGE DeriveDataTypeable, FlexibleContexts, FlexibleInstances, OverloadedStrings, TypeSynonymInstances #-} module Debian.Relation.Common where  -- Standard GHC Modules@@ -10,9 +10,11 @@ import Data.Set as Set (Set, toList) import Data.Typeable (Typeable) import Debian.Arch (Arch, prettyArch)-import Debian.Pretty (Pretty(pretty), Doc, text, empty)+import Debian.Pretty (PP(..)) import Prelude hiding (map) import Text.ParserCombinators.Parsec+import Text.PrettyPrint (Doc, text, empty)+import Text.PrettyPrint.HughesPJClass (Pretty(pPrint))  -- Local Modules @@ -29,7 +31,7 @@ newtype SrcPkgName = SrcPkgName {unSrcPkgName :: String} deriving (Read, Show, Eq, Ord, Data, Typeable) newtype BinPkgName = BinPkgName {unBinPkgName :: String} deriving (Read, Show, Eq, Ord, Data, Typeable) -class Pretty a => PkgName a where+class Pretty (PP a) => PkgName a where     pkgNameFromString :: String -> a  instance PkgName BinPkgName where@@ -53,7 +55,7 @@  prettyRelation :: Relation -> Doc prettyRelation (Rel name ver arch) =-    pretty name <> maybe empty prettyVersionReq ver <> maybe empty prettyArchitectureReq arch+    pPrint (PP name) <> maybe empty prettyVersionReq ver <> maybe empty prettyArchitectureReq arch  instance Ord Relation where     compare (Rel pkgName1 mVerReq1 _mArch1) (Rel pkgName2 mVerReq2 _mArch2) =@@ -106,23 +108,25 @@ checkVersionReq (Just (GRE v1)) (Just v2) = v2 >= v1 checkVersionReq (Just (SGR v1)) (Just v2) = v2 > v1 -instance Pretty BinPkgName where-    pretty = pretty . unBinPkgName+instance Pretty (PP BinPkgName) where+    pPrint = text . unBinPkgName . unPP -instance Pretty SrcPkgName where-    pretty = pretty . unSrcPkgName+instance Pretty (PP SrcPkgName) where+    pPrint = text . unSrcPkgName . unPP -instance Pretty Relations where-    pretty = prettyRelations+-- | Wrap `PP` around type synonyms that might overlap with the+-- `Pretty [a]` instance.+instance Pretty (PP Relations) where+    pPrint = prettyRelations . unPP -instance Pretty OrRelation where-    pretty = prettyOrRelation+instance Pretty (PP OrRelation) where+    pPrint = prettyOrRelation . unPP -instance Pretty Relation where-    pretty = prettyRelation+instance Pretty (PP Relation) where+    pPrint = prettyRelation . unPP -instance Pretty VersionReq where-    pretty = prettyVersionReq+instance Pretty (PP VersionReq) where+    pPrint = prettyVersionReq . unPP -instance Pretty ArchitectureReq where-    pretty = prettyArchitectureReq+instance Pretty (PP ArchitectureReq) where+    pPrint = prettyArchitectureReq . unPP
Debian/Report.hs view
@@ -1,16 +1,15 @@ module Debian.Report where +import Data.Maybe+import qualified Data.Map as M+import Data.Text as Text (Text, unpack) import Debian.Apt.Index (Fetcher, Compression(..), update, controlFromIndex') import Debian.Control.Text-import Debian.Pretty (render) import Debian.Sources import Debian.Version--import Data.Maybe-import qualified Data.Map as M-import Data.Text as Text (Text, unpack) import Text.XML.HaXml (CFilter, mkElem, cdata) import Text.XML.HaXml.Posn+import Text.PrettyPrint (render)  -- * General Package Map Builders @@ -83,6 +82,6 @@       mkTrumpedPackage (package, (oldVersion, newVersion)) =           mkElem "trumpedPackage"                      [ mkElem "package" [ cdata (unpack package) ]-                     , mkElem "oldVersion" [ cdata (unpack . render . prettyDebianVersion $ oldVersion) ]-                     , mkElem "newVersion" [ cdata (unpack . render . prettyDebianVersion $ newVersion) ]+                     , mkElem "oldVersion" [ cdata (render . prettyDebianVersion $ oldVersion) ]+                     , mkElem "newVersion" [ cdata (render . prettyDebianVersion $ newVersion) ]                      ]
Debian/Sources.hs view
@@ -1,13 +1,14 @@-{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE FlexibleInstances, OverloadedStrings #-} {-# OPTIONS_GHC -fno-warn-name-shadowing #-} module Debian.Sources where  import Data.List (intercalate) import Data.Monoid ((<>))-import Data.Text (pack)-import Debian.Pretty (Pretty(pretty), text)+import Debian.Pretty (PP(..)) import Debian.Release import Network.URI (URI, uriToString, parseURI, unEscapeString, escapeURIString, isAllowedInURI)+import Text.PrettyPrint (text, hcat)+import Text.PrettyPrint.HughesPJClass (Pretty(pPrint))  data SourceType     = Deb | DebSrc@@ -20,18 +21,21 @@     , sourceDist :: Either String (ReleaseName, [Section])     } deriving (Eq, Ord) -instance Pretty SourceType where-    pretty Deb = text "deb"-    pretty DebSrc = text "deb-src"+instance Pretty (PP SourceType) where+    pPrint (PP Deb) = text "deb"+    pPrint (PP DebSrc) = text "deb-src" -instance Pretty DebSource where-    pretty (DebSource thetype theuri thedist) =-        pretty thetype <>-        text (" " <> pack (uriToString id theuri " ") <>+instance Pretty (PP DebSource) where+    pPrint (PP (DebSource thetype theuri thedist)) =+        pPrint (PP thetype) <>+        text (" " <> uriToString id theuri " " <>               case thedist of                 Left exactPath -> escape exactPath-                Right (dist, sections) -> pack (releaseName' dist <> " " <> intercalate " " (map sectionName' sections)))-            where escape = pack . escapeURIString isAllowedInURI+                Right (dist, sections) -> releaseName' dist <> " " <> intercalate " " (map sectionName' sections))+            where escape = escapeURIString isAllowedInURI++instance Pretty (PP [DebSource]) where+    pPrint = hcat . map (\ x -> pPrint (PP x) <> text "\n") . unPP  -- |This is a name given to a combination of parts of one or more -- releases that can be specified by a sources.list file.
Debian/Util/FakeChanges.hs view
@@ -10,23 +10,18 @@ import Data.Foldable (concat, all, foldr) import Data.List as List (intercalate, nub, partition, isSuffixOf) import Data.Maybe-import Data.Text (unpack)+import Debian.Pretty (ppDisplay) import Data.Traversable+import Debian.Control+import qualified Debian.Deb as Deb+import Debian.Time+import Network.BSD (getHostName)+import Prelude hiding (concat, foldr, all, mapM, sum) import System.Environment import System.FilePath import System.Posix.Files import Text.Regex.TDFA-import Prelude hiding (concat, foldr, all, mapM, sum)-import Network.BSD (getHostName) -import Debian.Control-import qualified Debian.Deb as Deb-import Debian.Pretty (pretty, render)-import Debian.Time--- import System.Unix.FilePath--- import System.Unix.Misc-- data Error     = NoDebs     | TooManyDscs [FilePath]@@ -78,7 +73,7 @@                                              ))                , ("Files", "\n" ++ unlines fileLines)                ]-       return $ (concat [ source, "_", version, "_", binArch, ".changes"], unpack (render (pretty changes)))+       return $ (concat [ source, "_", version, "_", binArch, ".changes"], ppDisplay changes) --       let (invalid, binaries) = unzipEithers $ map debNameSplit debs {-        when (not . null $ invalid) (throwDyn [MalformedDebFilename invalid])@@ -223,13 +218,13 @@              case  res of                (Left e) -> error $ "Error parsing " ++ dsc' ++ "\n" ++ show e                (Right (Control [p])) -> return (dsc', p)-               (Right c) -> error $ dsc' ++ " did not have exactly one paragraph: " ++ unpack (render (pretty c))+               (Right c) -> error $ dsc' ++ " did not have exactly one paragraph: " ++ ppDisplay c       loadDeb :: FilePath -> IO (FilePath, Paragraph)       loadDeb deb =           do res <- Deb.fields deb              case res of                (Control [p]) -> return (deb, p)-               _ -> error $ deb ++ " did not have exactly one paragraph: " ++ unpack (render (pretty res))+               _ -> error $ deb ++ " did not have exactly one paragraph: " ++ ppDisplay res   getUploader :: IO String
Debian/Version/Common.hs view
@@ -1,8 +1,9 @@ -- |A module for parsing, comparing, and (eventually) modifying debian version -- numbers. <http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Version>+{-# LANGUAGE FlexibleInstances #-} {-# OPTIONS -fno-warn-orphans -fno-warn-unused-do-bind #-} module Debian.Version.Common-    (DebianVersion -- |Exported abstract because the internal representation is likely to change +    ( DebianVersion -- |Exported abstract because the internal representation is likely to change      , prettyDebianVersion     , ParseDebianVersion(..)     , evr		-- DebianVersion -> (Maybe Int, String, Maybe String)@@ -11,16 +12,21 @@     , revision     , buildDebianVersion     , parseDV-    ) where +    ) where  import Data.Char (ord, isDigit, isAlpha)-import Debian.Pretty (Doc, pretty, render)+import Debian.Pretty (PP(..)) import Debian.Version.Internal import Text.ParserCombinators.Parsec import Text.Regex+import Text.PrettyPrint (Doc, render)+import Text.PrettyPrint.HughesPJClass (Pretty(pPrint), text)  prettyDebianVersion :: DebianVersion -> Doc-prettyDebianVersion (DebianVersion s _) = pretty s+prettyDebianVersion (DebianVersion s _) = text s++instance Pretty (PP DebianVersion) where+    pPrint = prettyDebianVersion . unPP  instance Eq DebianVersion where     (DebianVersion _ v1) == (DebianVersion _ v2) = v1 == v2
Debian/Version/Internal.hs view
@@ -4,8 +4,7 @@     , Numeric(..)     , NonNumeric(..)     , Found(..)-    )-    where+    ) where  import Data.Data (Data) import Data.Typeable (Typeable)@@ -24,7 +23,6 @@ data Numeric     = Numeric Int (Maybe NonNumeric)       deriving (Show, Data, Typeable)-  data Found a     = Found { unFound :: a }
Test/Changes.hs view
@@ -2,16 +2,13 @@ {-# OPTIONS -fno-warn-missing-signatures -fno-warn-orphans #-} module Test.Changes where -import Test.HUnit-import Data.Text (unpack) import Debian.Changes-import Debian.Pretty (pretty, render)+import Debian.Pretty (PP(..)) import Debian.Release (ReleaseName(ReleaseName, relName)) import Debian.Version (parseDebianVersion)---- deriving instance Show ChangeLogEntry--- instance Show ChangeLog where---     show = unpack . render . pretty+import Test.HUnit+import Text.PrettyPrint (render)+import Text.PrettyPrint.HughesPJClass (pPrint)  s3 = unlines      ["name (version) dist; urgency=urgency",@@ -160,14 +157,14 @@       " -- Marco Túlio Gontijo e Silva <marcot@holoscopio.com>  Wed, 11 Mar 2009 18:58:06 -0300",       ""] -test5 = TestCase (assertEqual "haskell-regex-compat changelog" s1 (unpack . render . pretty . parseChangeLog $ s1))+test5 = TestCase (assertEqual "haskell-regex-compat changelog 1" s1 (render . pPrint . PP . parseChangeLog $ s1))  test3 =-    TestCase (assertEqual "haskell-regex-compat changelog" expected (parseEntries s3))+    TestCase (assertEqual "haskell-regex-compat changelog 2" expected (parseEntries s3))     where expected = [Right (Entry {logPackage = "name", logVersion = parseDebianVersion "version", logDists = [ReleaseName {relName = "dist"}], logUrgency = "urgency", logComments = "  * details\n", logWho = "David Fox <dsf@seereason.com>", logDate = "Wed, 21 Nov 2007 01:26:57 +0000"})]  test4 =-    TestCase (assertEqual "haskell-regex-compat changelog" expected (parseEntries s4))+    TestCase (assertEqual "haskell-regex-compat changelog 3" expected (parseEntries s4))     where expected = [Right (Entry {logPackage = "haskell-regex-compat",                                      logVersion = parseDebianVersion "0.92-3+seereason1~jaunty4",                                      logDists = [ReleaseName {relName = "jaunty-seereason"}],@@ -177,7 +174,7 @@                                      logDate = "Wed, 21 Nov 2007 01:26:57 +0000"})]  test1 =-    TestCase (assertEqual "haskell-regex-compat changelog" expected (parseChangeLog s1))+    TestCase (assertEqual "haskell-regex-compat changelog 4" expected (parseChangeLog s1))     where expected = ChangeLog [(Entry {logPackage = "haskell-regex-compat", logVersion = parseDebianVersion "0.92-3+seereason1~jaunty4", logDists = [ReleaseName {relName = "jaunty-seereason"}], logUrgency = "low", logComments = "  [ Joachim Breitner ]\n  * Adjust priority according to override file\n  * Depend on hscolour (Closes: #550769)\n\n  [ Marco T\250lio Gontijo e Silva ]\n  * debian/control: Use more sintetic name for Vcs-Darcs.\n  * Built from sid apt pool\n  * Build dependency changes:\n     cpphs:                    1.9-1+seereason1~jaunty5     -> 1.9-1+seereason1~jaunty6\n     ghc6:                     6.10.4-1+seereason5~jaunty1  -> 6.12.1-0+seereason1~jaunty1\n     ghc6-doc:                 6.10.4-1+seereason5~jaunty1  -> 6.12.1-0+seereason1~jaunty1\n     ghc6-prof:                6.10.4-1+seereason5~jaunty1  -> 6.12.1-0+seereason1~jaunty1\n     haddock:                  2.4.2-3+seereason3~jaunty1   -> 6.12.1-0+seereason1~jaunty1\n     haskell-devscripts:       0.6.18-21+seereason1~jaunty1 -> 0.6.18-23+seereason1~jaunty1\n     haskell-regex-base-doc:   0.93.1-5+seereason1~jaunty1  -> 0.93.1-5++1+seereason1~jaunty1\n     haskell-regex-posix-doc:  0.93.2-4+seereason1~jaunty1  -> 0.93.2-4+seereason1~jaunty2\n     libghc6-regex-base-dev:   0.93.1-5+seereason1~jaunty1  -> 0.93.1-5++1+seereason1~jaunty1\n     libghc6-regex-base-prof:  0.93.1-5+seereason1~jaunty1  -> 0.93.1-5++1+seereason1~jaunty1\n     libghc6-regex-posix-dev:  0.93.2-4+seereason1~jaunty1  -> 0.93.2-4+seereason1~jaunty2\n     libghc6-regex-posix-prof: 0.93.2-4+seereason1~jaunty1  -> 0.93.2-4+seereason1~jaunty2\n", logWho = "SeeReason Autobuilder <autobuilder@seereason.org>", logDate = "Fri, 25 Dec 2009 01:55:37 -0800"}),                       (Entry {logPackage = "haskell-regex-compat", logVersion = parseDebianVersion "0.92-3", logDists = [ReleaseName {relName = "unstable"}], logUrgency = "low", logComments = "  [ Joachim Breitner ]\n  * Adjust priority according to override file\n  * Depend on hscolour (Closes: #550769)\n\n  [ Marco T\250lio Gontijo e Silva ]\n  * debian/control: Use more sintetic name for Vcs-Darcs.\n", logWho = "Joachim Breitner <nomeata@debian.org>", logDate = "Mon, 20 Jul 2009 13:05:35 +0200"}),                       (Entry {logPackage = "haskell-regex-compat", logVersion = parseDebianVersion "0.92-2", logDists = [ReleaseName {relName = "unstable"}], logUrgency = "low", logComments = "  * Adopt package for the Debian Haskell Group\n  * Fix \"FTBFS with new dpkg-dev\" by adding comma to debian/control\n    (Closes: #536473)\n", logWho = "Joachim Breitner <nomeata@debian.org>", logDate = "Mon, 20 Jul 2009 12:05:40 +0200"}),
Test/Control.hs view
@@ -3,14 +3,19 @@  import Test.HUnit import Data.Monoid ((<>))-import Data.Text as T (Text, intercalate)+import Data.List as L (intercalate)+import Data.Text as T (Text) import Debian.Control import Debian.Control.Policy import Debian.Control.Text ({- Pretty instances -})-import Debian.Pretty (pretty, render)+import Debian.Pretty (ppPrint) import Debian.Relation import Debian.Version (parseDebianVersion)+import Text.PrettyPrint.HughesPJClass (Doc, text) +instance Eq Doc where+    a == b = show a == show b+ instance Eq DebianControl where     a == b = unDebianControl a == unDebianControl b -- deriving instance Show (Control' Text)@@ -21,31 +26,31 @@ -- inter-paragraph newlines, or missing terminating newlines, would be -- good. controlTests =-    [ TestCase (assertEqual "pretty1" (Prelude.show . pretty $ control) (either (error "parser failed") (Prelude.show . pretty) (parseControl "debian/control" sample)))-    , TestCase (assertEqual "pretty2" sample (render (pretty control)))-    , TestCase (assertEqual "pretty3" (head paragraphs <> "\n") (render (pretty (head (unControl control)))))+    [ TestCase (assertEqual "pretty1" (ppPrint control) (either (error "parser failed") ppPrint (parseControl "debian/control" sample)))+    , TestCase (assertEqual "pretty2" (text sample) (ppPrint control))+    , TestCase (assertEqual "pretty3" (text (head paragraphs <> "\n")) (ppPrint (head (unControl control))))     -- The Pretty class instances are distinct implementations from     -- those in Debian.Control.PrettyPrint.  Not sure why, there is a     -- terse note about performance concerns.-    , TestCase (assertEqual "pretty4" sample (render (pretty control)))-    , TestCase (assertEqual "pretty5" (head paragraphs <> "\n") (render (pretty (head (unControl control)))))+    , TestCase (assertEqual "pretty4" (text sample) (ppPrint control))+    , TestCase (assertEqual "pretty5" (text (head paragraphs <> "\n")) (ppPrint (head (unControl control))))     , TestCase (validateDebianControl control >>= \ vc -> assertEqual "policy1" (Right (unsafeDebianControl control)) vc) -- validate control file     , TestCase (validateDebianControl control >>= \ vc -> assertEqual "policy2" (Right (Just builddeps)) (either Left (debianRelations "Build-Depends") vc)) -- parse build deps     , TestCase (validateDebianControl control >>= \ vc -> assertEqual "policy3" (Right Nothing) (either Left (debianRelations "Foo") vc)) -- absent field     , TestCase (parseDebianControlFromFile "Test/Control.hs" >>= \ vc ->                 assertEqual "policy4"                             -- Exceptions have bogus Eq instances, so we need to show then compare.-                            "Left (ParseControlError {locs = [Loc {loc_filename = \"./Debian/Control/Policy.hs\", loc_package = \"main\", loc_module = \"Debian.Control.Policy\", loc_start = (79,54), loc_end = (79,62)}], parseError = \"Test/Control.hs\" (line 0, column 0):\nFailed to parse Test/Control.hs})"+                            "Left (ParseControlError {locs = [Loc {loc_filename = \"./Debian/Control/Policy.hs\", loc_package = \"main\", loc_module = \"Debian.Control.Policy\", loc_start = (78,54), loc_end = (78,62)}], parseError = \"Test/Control.hs\" (line 0, column 0):\nFailed to parse Test/Control.hs})"                             (show (either Left (either Left Right . debianRelations "Foo") vc)))     , TestCase (parseDebianControlFromFile "nonexistant" >>= \ vc ->                 assertEqual "policy5"-                            "Left (IOError {locs = [Loc {loc_filename = \"./Debian/Control/Policy.hs\", loc_package = \"main\", loc_module = \"Debian.Control.Policy\", loc_start = (78,36), loc_end = (78,44)}], ioError = nonexistant: openBinaryFile: does not exist (No such file or directory)})"+                            "Left (IOError {locs = [Loc {loc_filename = \"./Debian/Control/Policy.hs\", loc_package = \"main\", loc_module = \"Debian.Control.Policy\", loc_start = (77,36), loc_end = (77,44)}], ioError = nonexistant: openBinaryFile: does not exist (No such file or directory)})"                             (show (either Left (debianRelations "Foo") (vc :: Either ControlFileError DebianControl))))     ]  -- | These paragraphs have no terminating newlines.  They are added -- where appropriate to the expected test results.-paragraphs :: [Text]+paragraphs :: [String] paragraphs =     [ "Source: haskell-debian\nSection: haskell\nPriority: extra\nMaintainer: Debian Haskell Group <pkg-haskell-maintainers@lists.alioth.debian.org>\nUploaders: Joachim Breitner <nomeata@debian.org>\nBuild-Depends: debhelper (>= 7)\n  , cdbs\n  , haskell-devscripts (>= 0.7)\n  , ghc\n  , ghc-prof\n  , libghc-hunit-dev\n  , libghc-hunit-prof\n  , libghc-mtl-dev\n  , libghc-mtl-prof\n  , libghc-parsec3-dev\n  , libghc-parsec3-prof\n  , libghc-pretty-class-dev\n  , libghc-pretty-class-prof\n  , libghc-process-extras-dev (>= 0.4)\n  , libghc-process-extras-prof (>= 0.4)\n  , libghc-regex-compat-dev\n  , libghc-regex-compat-prof\n  , libghc-regex-tdfa-dev (>= 1.1.3)\n  , libghc-regex-tdfa-prof\n  , libghc-bzlib-dev (>= 0.5.0.0-4)\n  , libghc-bzlib-prof\n  , libghc-haxml-prof (>= 1:1.20)\n  , libghc-unixutils-dev (>= 1.50)\n  , libghc-unixutils-prof (>= 1.50)\n  , libghc-zlib-dev\n  , libghc-zlib-prof\n  , libghc-network-dev (>= 2.4)\n  , libghc-network-prof (>= 2.4)\n  , libghc-utf8-string-dev\n  , libghc-utf8-string-prof,\n  , libcrypto++-dev\nBuild-Depends-Indep: ghc-doc\n  , libghc-hunit-doc\n  , libghc-mtl-doc\n  , libghc-parsec3-doc\n  , libghc-pretty-class-doc\n  , libghc-process-extras-doc (>= 0.4)\n  , libghc-regex-compat-doc\n  , libghc-regex-tdfa-doc\n  , libghc-bzlib-doc\n  , libghc-haxml-doc (>= 1:1.20)\n  , libghc-unixutils-doc (>= 1.50)\n  , libghc-zlib-doc\n  , libghc-network-doc (>= 2.4)\n  , libghc-utf8-string-doc\nStandards-Version: 3.9.2\nHomepage: http://hackage.haskell.org/package/debian\nVcs-Darcs: http://darcs.debian.org/pkg-haskell/haskell-debian\nVcs-Browser: http://darcs.debian.org/cgi-bin/darcsweb.cgi?r=pkg-haskell/haskell-debian",       "Package: libghc-debian-dev\nArchitecture: any\nDepends: ${haskell:Depends}\n  , ${shlibs:Depends}\n  , ${misc:Depends}\nRecommends: ${haskell:Recommends}\nSuggests: ${haskell:Suggests}\nProvides: ${haskell:Provides}\nDescription: Haskell library for working with the Debian package system\n This package provides a library for the Haskell programming language.\n See http://www.haskell.org/ for more information on Haskell.\n .\n This library includes modules covering almost every aspect of the Debian\n packaging system, including low level data types such as version numbers\n and dependency relations, on up to the types necessary for computing and\n installing build dependencies, building source and binary packages,\n and inserting them into a repository.\n .\n This package contains the libraries compiled for GHC 6.",@@ -87,8 +92,8 @@              [Rel (BinPkgName {unBinPkgName = "libghc-utf8-string-prof"}) Nothing Nothing],              [Rel (BinPkgName {unBinPkgName = "libcrypto++-dev"}) Nothing Nothing]] -sample :: Text-sample = T.intercalate "\n\n" paragraphs <> "\n"+sample :: String+sample = intercalate "\n\n" paragraphs <> "\n"  -- | The expecte result of parsing the sample control file. control :: Control' Text
Test/SourcesList.hs view
@@ -1,13 +1,13 @@ {-# LANGUAGE OverloadedStrings #-} module Test.SourcesList where -import Data.Text (Text, unpack)+import Data.Text (Text) import Data.Monoid (mconcat, (<>))-import Debian.Pretty (vcat, pretty, render)-import Test.HUnit-+import Debian.Pretty (PP(PP)) import Debian.Sources---import Data.Maybe+import Test.HUnit+import Text.PrettyPrint (render)+import Text.PrettyPrint.HughesPJClass (pPrint)  -- * Unit Tests @@ -25,7 +25,7 @@  testSourcesList :: Test testSourcesList =-    test [ assertEqual "valid sources.list" validSourcesListExpected (unpack . render . vcat . map pretty . parseSourcesList $ validSourcesListStr) ]+    test [ assertEqual "valid sources.list" validSourcesListExpected (render . pPrint . PP . parseSourcesList $ validSourcesListStr) ]     where       validSourcesListStr =           unlines $ [ " # A comment only line "@@ -48,7 +48,7 @@  testSourcesListParse :: Test testSourcesListParse =-    test [ assertEqual "" gutsy (unpack . mconcat . map (<> "\n") . map (render . pretty) . parseSourcesList $ gutsy) ]+    test [ assertEqual "" gutsy (mconcat . map (<> "\n") . map (render . pPrint . PP) . parseSourcesList $ gutsy) ]     where       gutsy = concat ["deb http://us.archive.ubuntu.com/ubuntu/ gutsy main restricted universe multiverse\n", 	              "deb-src http://us.archive.ubuntu.com/ubuntu/ gutsy main restricted universe multiverse\n",
changelog view
@@ -1,3 +1,12 @@+haskell-debian (3.84) unstable; urgency=low++  * Replace the Debian.Pretty module with a module copied from the+    pretty-class package, Text.PrettyPrint.HughesPJClass.  This is almost+    identical to the module in Lennart's prettyclass package, but has what+    I believe to be a more correct pPrintList method for type Char.++ -- David Fox <dsf@seereason.com>  Sun, 14 Sep 2014 12:37:57 -0700+ haskell-debian (3.83.4.2) unstable; urgency=low    * Require a better version of process-listlike.
debian.cabal view
@@ -1,5 +1,5 @@ Name:           debian-Version:        3.83.4.2+Version:        3.84 License:        BSD3 License-File:   debian/copyright Author:         David Fox <dsf@seereason.com>, Jeremy Shaw <jeremy@seereason.com>, Clifford Beshers <beshers@seereason.com>@@ -25,6 +25,7 @@  Default: True  Library+ Hs-Source-Dirs: .  Build-Depends:    base >= 4 && < 5,    bytestring,@@ -40,6 +41,8 @@    mtl,    old-locale,    parsec >= 2 && <4,+   pretty,+   prettyclass,    process,    pureMD5,    regex-compat,@@ -60,8 +63,8 @@    build-depends: process-listlike >= 0.9  else    build-depends: process-extras+  ghc-options: -Wall -O2- Extensions: ExistentialQuantification CPP  Exposed-modules:         Debian.Apt.Dependencies,         Debian.Apt.Index,@@ -132,7 +135,7 @@ Executable debian-tests  Main-is: Test/Main.hs  ghc-options: -threaded -W -O2- Build-Depends: ansi-wl-pprint, base, bytestring, containers, debian, directory, exceptions, HUnit, ListLike, mtl, parsec, process, regex-compat, regex-tdfa, template-haskell, text, utf8-string+ Build-Depends: ansi-wl-pprint, base, bytestring, containers, debian, directory, exceptions, HUnit, ListLike, mtl, parsec, pretty, prettyclass, process, regex-compat, regex-tdfa, template-haskell, text, utf8-string  if flag(network-uri)    Build-Depends: network >= 2.6, network-uri >= 2.6  else
debian/changelog view
@@ -1,3 +1,12 @@+haskell-debian (3.84) unstable; urgency=low++  * Replace the Debian.Pretty module with a module copied from the+    pretty-class package, Text.PrettyPrint.HughesPJClass.  This is almost+    identical to the module in Lennart's prettyclass package, but has what+    I believe to be a more correct pPrintList method for type Char.++ -- David Fox <dsf@seereason.com>  Sun, 14 Sep 2014 12:37:57 -0700+ haskell-debian (3.83.4.2) unstable; urgency=low    * Require a better version of process-listlike.