cabal-debian 4.38.4 → 4.38.5
raw patch · 18 files changed
+197/−175 lines, 18 files
Files
- cabal-debian.cabal +8/−3
- changelog +7/−0
- src/Debian/Debianize/BuildDependencies.hs +9/−8
- src/Debian/Debianize/CabalInfo.hs +1/−1
- src/Debian/Debianize/CopyrightDescription.hs +4/−3
- src/Debian/Debianize/DebianName.hs +4/−3
- src/Debian/Debianize/Files.hs +22/−21
- src/Debian/Debianize/Finalize.hs +31/−31
- src/Debian/Debianize/InputCabal.hs +1/−1
- src/Debian/Debianize/InputDebian.hs +1/−1
- src/Debian/Debianize/Monad.hs +1/−1
- src/Debian/Debianize/Optparse.hs +2/−2
- src/Debian/Debianize/Output.hs +3/−3
- src/Debian/Debianize/Prelude.hs +9/−8
- src/Debian/Debianize/VersionSplits.hs +6/−5
- src/Debian/GHC.hs +8/−7
- src/Debian/Orphans.hs +27/−25
- src/Debian/Policy.hs +53/−52
cabal-debian.cabal view
@@ -1,5 +1,5 @@ Name: cabal-debian-Version: 4.38.4+Version: 4.38.5 Copyright: Copyright (c) 2007-2014, David Fox, Jeremy Shaw License: BSD3 License-File: LICENSE@@ -144,12 +144,17 @@ test-data/artvaluereport2/output/debian/artvaluereport2-backups.install test-data/artvaluereport2/output/debian/copyright test-data/artvaluereport2/output/debian/source/format-tested-with: GHC == 8.0.1, GHC == 8.0.2, GHC == 8.4.3, GHC == 8.6.2+tested-with: GHC == 7.8.4, GHC == 7.10.3, GHC == 7.11.* flag pretty-112 Description: prettyclass was merged into pretty-1.1.2 Default: True +flag local-debian+ Description: Compile the debian package from local source in ../debian-haskell+ Default: False+ Manual: True+ Source-Repository head type: git location: https://github.com/ddssff/cabal-debian@@ -164,7 +169,6 @@ Cabal >= 1.18, containers, data-default,- debian >= 3.91, deepseq, Diff >= 0.3.1, directory,@@ -226,6 +230,7 @@ Build-Depends: pretty >= 1.1.2 else Build-Depends: pretty < 1.1.2, prettyclass+ Build-Depends: debian >= 3.91 Executable cabal-debian Default-Language: Haskell2010
changelog view
@@ -1,3 +1,10 @@+haskell-cabal-debian (4.38.5) unstable; urgency=medium++ * Use Cabal's pretty printer, there is a corresponding change+ to the debian package.++ -- David Fox <dsf@seereason.com> Tue, 12 Feb 2019 16:50:15 -0800+ haskell-cabal-debian (4.38.2) unstable; urgency=medium * Support for Cabal-2.2
src/Debian/Debianize/BuildDependencies.hs view
@@ -11,10 +11,10 @@ #endif import Control.Lens import Control.Monad.State (MonadState(get))-import Control.Monad.Trans (liftIO, MonadIO)+import Control.Monad.Trans (MonadIO) import Data.Char (isSpace, toLower) import Data.Function (on)-import Data.List as List (filter, groupBy, intercalate, map, minimumBy, nub, sortBy)+import Data.List as List (filter, groupBy, map, minimumBy, nub, sortBy) import Data.Map as Map (lookup, Map) import Data.Maybe (catMaybes, fromMaybe, isJust, isNothing, listToMaybe, mapMaybe) import Data.Monoid ((<>))@@ -39,6 +39,7 @@ import Distribution.PackageDescription as Cabal (BuildInfo(..), BuildInfo(buildTools, extraLibs, pkgconfigDepends), Library(..), Executable(..), TestSuite(..)) import Distribution.PackageDescription (PackageDescription) import qualified Distribution.PackageDescription as Cabal (PackageDescription(library, executables, testSuites))+import Distribution.Pretty (prettyShow) #if MIN_VERSION_Cabal(2,0,0) import Distribution.Types.LegacyExeDependency (LegacyExeDependency(..)) import Distribution.Types.PkgconfigDependency (PkgconfigDependency(..))@@ -120,7 +121,7 @@ -- The haskell-cdbs package contains the hlibrary.mk file with -- the rules for building haskell packages.-debianBuildDeps :: (MonadIO m, Functor m) => PackageDescription -> CabalT m D.Relations+debianBuildDeps :: (MonadIO m) => PackageDescription -> CabalT m D.Relations debianBuildDeps pkgDesc = do hflavor <- use (A.debInfo . D.flags . compilerFlavor) prof <- not <$> use (A.debInfo . D.noProfilingLibrary)@@ -200,7 +201,7 @@ -- | Collect the dependencies required to build any packages that have -- architecture "all".-debianBuildDepsIndep :: (MonadIO m, Functor m) => PackageDescription -> CabalT m D.Relations+debianBuildDepsIndep :: (MonadIO m) => PackageDescription -> CabalT m D.Relations debianBuildDepsIndep pkgDesc = do hc <- use (A.debInfo . D.flags . compilerFlavor) let hcs = singleton hc -- vestigial@@ -218,7 +219,7 @@ -- | The documentation dependencies for a package include the -- documentation package for any libraries which are build -- dependencies, so we have use to all the cross references.-docDependencies :: (MonadIO m, Functor m) => Dependency_ -> CabalT m D.Relations+docDependencies :: (MonadIO m) => Dependency_ -> CabalT m D.Relations docDependencies (BuildDepends (Dependency name ranges)) = do hc <- use (A.debInfo . D.flags . compilerFlavor) let hcs = singleton hc -- vestigial@@ -229,7 +230,7 @@ -- | The Debian build dependencies for a package include the profiling -- libraries and the documentation packages, used for creating cross -- references. Also the packages associated with extra libraries.-buildDependencies :: (MonadIO m, Functor m) => Set (CompilerFlavor, B.PackageType) -> Dependency_ -> CabalT m D.Relations+buildDependencies :: (MonadIO m) => Set (CompilerFlavor, B.PackageType) -> Dependency_ -> CabalT m D.Relations buildDependencies hcTypePairs (BuildDepends (Dependency name ranges)) = use (A.debInfo . D.omitProfVersionDeps) >>= \ omitProfDeps -> concat <$> mapM (\ (hc, typ) -> dependencies hc typ name ranges omitProfDeps) (toList hcTypePairs)@@ -431,10 +432,10 @@ debianVersion' :: Monad m => PackageName -> Version -> CabalT m DebianVersion debianVersion' name v = do atoms <- get- return $ parseDebianVersion' (maybe "" (\ n -> show n ++ ":") (Map.lookup name (view A.epochMap atoms)) ++ showVersion v)+ return $ parseDebianVersion' (maybe "" (\ n -> show n ++ ":") (Map.lookup name (view A.epochMap atoms)) ++ prettyShow v) debianVersion'' :: CabalInfo -> PackageIdentifier -> DebianVersion-debianVersion'' atoms i = parseDebianVersion' (maybe "" (\ n -> show n ++ ":") (Map.lookup (pkgName i) (view A.epochMap atoms)) ++ showVersion (pkgVersion i))+debianVersion'' atoms i = parseDebianVersion' (maybe "" (\ n -> show n ++ ":") (Map.lookup (pkgName i) (view A.epochMap atoms)) ++ prettyShow (pkgVersion i)) data Rels a = And {unAnd :: [Rels a]} | Or {unOr :: [Rels a]} | Rel' {unRel :: a} deriving Show
src/Debian/Debianize/CabalInfo.hs view
@@ -75,7 +75,7 @@ -- | Given the 'Flags' value read the cabalization and build a new -- 'CabalInfo' record.-newCabalInfo :: (MonadIO m, MonadMask m, Functor m) => Flags -> m (Either String CabalInfo)+newCabalInfo :: (MonadIO m, MonadMask m{-, Functor m-}) => Flags -> m (Either String CabalInfo) newCabalInfo flags' = withProcAndSys "/" $ inputCabalization flags' >>= either (return . Left) (\p -> Right <$> doPkgDesc p) where
src/Debian/Debianize/CopyrightDescription.hs view
@@ -55,7 +55,8 @@ #endif import Network.URI (URI, parseURI) import Prelude hiding (init, init, log, log, unlines, readFile)-import Text.PrettyPrint.HughesPJClass (Pretty(pPrint), text)+import Text.PrettyPrint.HughesPJClass (text)+import Distribution.Pretty (Pretty(pretty)) unPackageName :: Cabal.PackageName -> String #if MIN_VERSION_Cabal(2,0,0)@@ -98,8 +99,8 @@ instance Pretty CopyrightDescription where -- Special case encodes free format debian/copyright file- pPrint x@(CopyrightDescription {_summaryComment = Just t}) | x {_summaryComment = Nothing} == def = text (List.dropWhileEnd isSpace (unpack t) <> "\n")- pPrint x = pPrint . toControlFile $ x+ pretty x@(CopyrightDescription {_summaryComment = Just t}) | x {_summaryComment = Nothing} == def = text (List.dropWhileEnd isSpace (unpack t) <> "\n")+ pretty x = pretty . toControlFile $ x instance Default CopyrightDescription where def = CopyrightDescription
src/Debian/Debianize/DebianName.hs view
@@ -30,12 +30,13 @@ import Distribution.Compiler (CompilerFlavor(..)) #if MIN_VERSION_Cabal(2,0,0) import Distribution.Package (Dependency(..), PackageIdentifier(..), PackageName, unPackageName)-import Distribution.Version (showVersion, Version)+import Distribution.Version (Version) #else import Data.Version (showVersion, Version) import Distribution.Package (Dependency(..), PackageIdentifier(..), PackageName(PackageName)) #endif import qualified Distribution.PackageDescription as Cabal (PackageDescription(package))+import Distribution.Pretty (prettyShow) import Prelude hiding (unlines) data Dependency_@@ -46,7 +47,7 @@ deriving (Eq, Show) -- | Build the Debian package name for a given package type.-debianName :: (Monad m, Functor m, PkgName name) => PackageType -> CompilerFlavor -> CabalT m name+debianName :: (Monad m, PkgName name) => PackageType -> CompilerFlavor -> CabalT m name debianName typ hc = do base <- case (typ, hc) of@@ -70,7 +71,7 @@ #else let pname@(PackageName _) = pkgName pkgId #endif- version = (Just (D.EEQ (parseDebianVersion' (showVersion (pkgVersion pkgId)))))+ version = (Just (D.EEQ (parseDebianVersion' (prettyShow (pkgVersion pkgId))))) case (nameBase, Map.lookup (pkgName pkgId) nameMap) of (Just base, _) -> return base (Nothing, Nothing) -> return $ debianBaseName pname
src/Debian/Debianize/Files.hs view
@@ -36,12 +36,13 @@ import Distribution.PackageDescription (PackageDescription) import Prelude hiding (dropWhile, init, log, unlines, writeFile) import System.FilePath ((</>))-import Text.PrettyPrint.HughesPJClass (empty, Pretty(pPrint), text)+import Text.PrettyPrint.HughesPJClass (empty, text)+import Distribution.Pretty (Pretty(pretty)) type FilesT m = WriterT [(FilePath, Text)] (DebianT m) instance Pretty (PP Bool) where- pPrint = text . show . unPP+ pretty = text . show . unPP -- | Turn the Debianization into a list of files, making sure the text -- associated with each path is unique. Assumes that@@ -50,7 +51,7 @@ -- the Debianization produced by finalizeDebianization in the unit -- tests.) -debianizationFileMap :: (MonadFail m, Functor m) => DebianT m (Map FilePath Text)+debianizationFileMap :: (MonadFail m) => DebianT m (Map FilePath Text) debianizationFileMap = fmap (Map.fromListWithKey (\ k a b -> error $ "Multiple values for " ++ k ++ ":\n " ++ show a ++ "\n" ++ show b)) $ execWriterT $ do -- here <- liftIO getCurrentDirectory@@ -72,18 +73,18 @@ tell =<< prermFiles tell =<< intermediates -sourceFormatFiles :: (Monad m, Functor m) => FilesT m [(FilePath, Text)]+sourceFormatFiles :: (Monad m) => FilesT m [(FilePath, Text)] sourceFormatFiles = do fmt <- lift $ use D.sourceFormat return $ [("debian/source/format", pack . ppShow $ fmt)] -watchFile :: (Monad m, Functor m) => FilesT m [(FilePath, Text)]+watchFile :: (Monad m) => FilesT m [(FilePath, Text)] watchFile = maybe [] (\ x -> [("debian/watch", x)]) <$> (lift $ use D.watch) -intermediates :: (Monad m, Functor m) => FilesT m [(FilePath, Text)]+intermediates :: (Monad m) => FilesT m [(FilePath, Text)] intermediates = Set.toList <$> (lift $ use D.intermediateFiles) -installs :: (Monad m, Functor m) => FilesT m [(FilePath, Text)]+installs :: (Monad m) => FilesT m [(FilePath, Text)] installs = (Map.toList . Map.map unlines . Set.fold doAtom mempty) <$> (lift $ use (D.atomSet)) where@@ -91,7 +92,7 @@ doAtom _ mp = mp pathf name = "debian" </> show (ppPrint name) ++ ".install" -dirs :: (Monad m, Functor m) => FilesT m [(FilePath, Text)]+dirs :: (Monad m) => FilesT m [(FilePath, Text)] dirs = (Map.toList . Map.map unlines . Set.fold doAtom mempty) <$> (lift $ use D.atomSet) where@@ -99,21 +100,21 @@ doAtom _ mp = mp pathf name = "debian" </> show (ppPrint name) ++ ".dirs" -init :: (Monad m, Functor m) => FilesT m [(FilePath, Text)]+init :: (Monad m) => FilesT m [(FilePath, Text)] init = (Map.toList . mapKeys pathf) <$> (lift $ use D.installInit) where 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 :: (Monad m) => FilesT m [(FilePath, Text)] logrotate = (Map.toList . Map.map (\ stanzas -> Text.unlines (Set.toList stanzas)) . mapKeys pathf) <$> (lift $ use D.logrotateStanza) where 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 :: (Monad m) => FilesT m [(FilePath, Text)] links = (Map.toList . Map.map unlines . Set.fold doAtom mempty) <$> (lift $ use D.atomSet) where@@ -121,31 +122,31 @@ doAtom _ mp = mp pathf name = "debian" </> show (ppPrint name) ++ ".links" -postinstFiles :: (Monad m, Functor m) => FilesT m [(FilePath, Text)]+postinstFiles :: (Monad m) => FilesT m [(FilePath, Text)] postinstFiles = (Map.toList . mapKeys pathf) <$> (lift $ use D.postInst) where pathf (BinPkgName name) = "debian" </> name <> ".postinst" -postrmFiles :: (Monad m, Functor m) => FilesT m [(FilePath, Text)]+postrmFiles :: (Monad m) => FilesT m [(FilePath, Text)] postrmFiles = (Map.toList . mapKeys pathf) <$> (lift $ use D.postRm) where pathf name = "debian" </> show (ppPrint name) ++ ".postrm" -preinstFiles :: (Monad m, Functor m) => FilesT m [(FilePath, Text)]+preinstFiles :: (Monad m) => FilesT m [(FilePath, Text)] preinstFiles = (Map.toList . mapKeys pathf) <$> (lift $ use D.preInst) where pathf name = "debian" </> show (ppPrint name) ++ ".preinst" -prermFiles :: (Monad m, Functor m) => FilesT m [(FilePath, Text)]+prermFiles :: (Monad m) => FilesT m [(FilePath, Text)] prermFiles = (Map.toList . mapKeys pathf) <$> (lift $ use D.preRm) where pathf name = "debian" </> show (ppPrint name) ++ ".prerm" -rules :: (MonadFail m, Functor m) => FilesT m [(FilePath, Text)]+rules :: (MonadFail m) => FilesT m [(FilePath, Text)] rules = do Just rh <- lift (use (D.rulesHead)) rassignments <- lift (use (D.rulesSettings)) >>= return . intercalate "\n"@@ -153,28 +154,28 @@ rl <- (reverse . Set.toList) <$> lift (use (D.rulesFragments)) return [("debian/rules", intercalate "\n\n" (filter (not . Text.null) (List.map strip (rh : rassignments : rincludes : rl))) <> "\n")] -changelog :: (Monad m, Functor m) => FilesT m [(FilePath, Text)]+changelog :: (Monad m) => FilesT m [(FilePath, Text)] changelog = do log <- lift $ use D.changelog return [("debian/changelog", pack (show (ppPrint (fromMaybe (error "No changelog in debianization") log))))] -control :: (Monad m, Functor m) => FilesT m [(FilePath, Text)]+control :: (Monad m) => FilesT m [(FilePath, Text)] control = do d <- lift $ use D.control return [("debian/control", prettyText (controlFile d))] -compat :: (Monad m, Functor m) => FilesT m [(FilePath, Text)]+compat :: (Monad m) => FilesT m [(FilePath, Text)] compat = do t <- lift $ use D.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 :: (Monad m) => FilesT m [(FilePath, Text)] copyright = do copyrt <- lift $ use (D.copyright) return $ maybe [] (\ x -> [("debian/copyright", prettyText x)]) copyrt instance Pretty (PP (PackageDescription -> IO CopyrightDescription)) where- pPrint _ = text "<function>"+ pretty _ = text "<function>" controlFile :: S.SourceDebDescription -> Control' String controlFile src =
src/Debian/Debianize/Finalize.hs view
@@ -1,5 +1,5 @@ -- | Compute the debianization of a cabal package.-{-# LANGUAGE CPP, FlexibleContexts, FlexibleInstances, OverloadedStrings, ScopedTypeVariables #-}+{-# LANGUAGE CPP, FlexibleContexts, FlexibleInstances, OverloadedStrings, ScopedTypeVariables, TemplateHaskell #-} module Debian.Debianize.Finalize ( debianize , debianizeWith@@ -31,6 +31,7 @@ import Data.Set.Extra as Set (mapM_) import Data.Text as Text (intercalate, pack, Text, unlines, unpack) import Debian.Changes (ChangeLog(..), ChangeLogEntry(..))+import Debian.Codename (parseCodename) import Debian.Debianize.BasicInfo (cabalFlagAssignments, compilerFlavor, verbosity) import qualified Debian.Debianize.BinaryDebDescription as B import Debian.Debianize.BuildDependencies (debianBuildDeps, debianBuildDepsIndep)@@ -51,7 +52,6 @@ import Debian.Pretty (PP(..), ppShow) import Debian.Relation (BinPkgName, BinPkgName(BinPkgName), Relation(Rel), Relations, SrcPkgName(SrcPkgName)) import qualified Debian.Relation as D (BinPkgName(BinPkgName), Relation(..))-import Debian.Release (parseReleaseName) import Debian.Time (getCurrentLocalRFC822Time) import qualified Debian.Version as V (buildDebianVersion, DebianVersion, parseDebianVersion', epoch, version, revision) import Distribution.Compiler (CompilerFlavor(GHC))@@ -59,15 +59,15 @@ import Distribution.Compiler (CompilerFlavor(GHCJS)) #endif #if MIN_VERSION_Cabal(2,0,0)-import Distribution.Package (Dependency(..), PackageIdentifier(..), PackageName, mkPackageName, unPackageName)+import Distribution.Package (Dependency(..), PackageIdentifier(..), PackageName, unPackageName) import Distribution.PackageDescription as Cabal (allBuildInfo, author, BuildInfo(buildable, extraLibs), Executable(buildInfo, exeName), FlagName, mkFlagName, unFlagName, maintainer, PackageDescription(testSuites, description)) import Distribution.Types.UnqualComponentName-import Distribution.Utils.ShortText+--import Distribution.Utils.ShortText #else import Distribution.Package (Dependency(..), PackageIdentifier(..), PackageName(PackageName)) import Distribution.PackageDescription as Cabal (allBuildInfo, author, BuildInfo(buildable, extraLibs), Executable(buildInfo, exeName), FlagName(FlagName), maintainer, PackageDescription(testSuites)) #endif-import Distribution.PackageDescription as Cabal (PackageDescription(dataFiles, description, executables, library, package, synopsis))+import Distribution.PackageDescription as Cabal (PackageDescription(dataFiles, {-description,-} executables, library, package, synopsis)) import Prelude hiding (init, log, map, unlines, unlines, writeFile) import System.Directory (doesFileExist) import System.FilePath ((<.>), (</>), makeRelative, splitFileName, takeDirectory, takeFileName)@@ -77,30 +77,30 @@ #else import Text.ParserCombinators.Parsec.Rfc2822 (NameAddr(..)) #endif-import Text.PrettyPrint.HughesPJClass (Pretty(pPrint))+import Distribution.Pretty (Pretty(pretty)) -- | @debianize customize@ initializes the CabalT state from the -- environment and the cabal package description in (and possibly the -- debian/changelog file) from the current directory, then runs -- @customize@ and finalizes the debianization so it is ready to be -- output.-debianize :: (MonadIO m, MonadFail m, Functor m) => CabalT m () -> CabalT m ()+debianize :: (MonadIO m, MonadFail m) => CabalT m () -> CabalT m () debianize = debianizeWith (return ()) -debianizeWebsite :: (MonadIO m, MonadFail m, Functor m) => CabalT m () -> CabalT m ()+debianizeWebsite :: (MonadIO m, MonadFail m) => CabalT m () -> CabalT m () debianizeWebsite = debianizeWith (expandWebsite >> expandServer >> expandBackups) -- | Pass a function with some additional work to do. I don't know -- if this could be done by just summing it with customize - probably. -- But I don't want to untangle this right now.-debianizeWith :: (MonadIO m, MonadFail m, Functor m) => CabalT m () -> CabalT m () -> CabalT m ()+debianizeWith :: (MonadIO m, MonadFail m) => CabalT m () -> CabalT m () -> CabalT m () debianizeWith goodies customize = do liftCabal inputChangeLog customize finalizeDebianization goodies -- | Do some light IO and call finalizeDebianization.-finalizeDebianization :: (MonadIO m, MonadFail m, Functor m) => CabalT m () -> CabalT m ()+finalizeDebianization :: (MonadIO m, MonadFail m) => CabalT m () -> CabalT m () finalizeDebianization goodies = do date <- liftIO getCurrentLocalRFC822Time currentUser <- liftIO getCurrentDebianUser@@ -120,7 +120,7 @@ -- FIXME: we should be able to run this without a PackageDescription, change -- paramter type to Maybe PackageDescription and propagate down thru code finalizeDebianization' ::- (MonadIO m, MonadFail m, Functor m)+ (MonadIO m, MonadFail m) => CabalT m () -> String -> Maybe NameAddr@@ -203,7 +203,7 @@ -- 4. latest version in debian/changelog -- -- The --deb-version argument overrides everything.-debianVersion :: (Monad m, Functor m) => CabalT m V.DebianVersion+debianVersion :: (Monad m) => CabalT m V.DebianVersion debianVersion = do cabalName <- (pkgName . Cabal.package) <$> use A.packageDescription (cabalVersion :: V.DebianVersion) <- (V.parseDebianVersion' . ppShow . pkgVersion . Cabal.package) <$> use A.packageDescription@@ -252,7 +252,7 @@ -- | Compute and return the debian source package name, based on the -- sourcePackageName if it was specified, and constructed from the -- cabal name otherwise.-finalizeSourceName :: (Monad m, Functor m) => B.PackageType -> CabalT m ()+finalizeSourceName :: (Monad m) => B.PackageType -> CabalT m () finalizeSourceName typ = do DebBase debName <- debianNameBase hc <- use (A.debInfo . D.flags . compilerFlavor)@@ -328,7 +328,7 @@ whenEmpty d [] = d whenEmpty _ l = l -finalizeControl :: (MonadFail m, Functor m) => Maybe NameAddr -> CabalT m ()+finalizeControl :: (MonadFail m) => Maybe NameAddr -> CabalT m () finalizeControl currentUser = do finalizeMaintainer currentUser Just src <- use (A.debInfo . D.sourcePackageName)@@ -381,11 +381,11 @@ -- of the debian description, each of which is amended. debianDescriptionBase :: PackageDescription -> Text debianDescriptionBase p =- pack $ List.intercalate "\n " $ (synop' : desc)+ pack $ List.intercalate "\n " $ (synop' : desc') where -- If we have a one line description and no synopsis, use -- the description as the synopsis.- synop' = if List.null synop && length desc /= 1+ synop' = if List.null synop && length desc' /= 1 then "WARNING: No synopsis available for package " ++ ppShow (package p) else synop synop :: String@@ -393,15 +393,15 @@ -- this version goes into production. :-/ Ok, now I know, because sometimes the -- short cabal description has more than one line. synop = List.intercalate " " $ fmap (dropWhileEnd isSpace) $ lines $ synopsis p- desc :: [String]- desc = List.map addDot . stripWith List.null $ fmap (dropWhileEnd isSpace) $ lines $ Cabal.description p+ desc' :: [String]+ desc' = List.map addDot . stripWith List.null $ fmap (dropWhileEnd isSpace) $ lines $ Cabal.description p addDot line = if List.null line then "." else line -- | Make sure there is a changelog entry with the version number and -- source package name implied by the debianization. This means -- either adding an entry or modifying the latest entry (if its -- version number is the exact one in our debianization.)-finalizeChangelog :: (Monad m, Functor m) => String -> Maybe NameAddr -> CabalT m ()+finalizeChangelog :: (Monad m) => String -> Maybe NameAddr -> CabalT m () finalizeChangelog date currentUser = do finalizeMaintainer currentUser ver <- debianVersion@@ -420,16 +420,16 @@ -- Ensure that the package name is correct in the first log entry. fixLog src ver cmts _maint _ (Just (ChangeLog (entry : older))) | logVersion entry == ver =- let entry' = entry { logPackage = show (pPrint (PP src))+ let entry' = entry { logPackage = show (pretty (PP src)) , logComments = logComments entry ++ "\n" ++ (List.unlines $ List.map ((" * " <>) . List.intercalate "\n " . List.map unpack) (fromMaybe [] cmts)) } in Just (ChangeLog (entry' : older)) -- The newest log entry isn't exactly ver, build a new entry. fixLog src ver cmts maint msg log =- let entry = Entry { logPackage = show (pPrint (PP src))+ let entry = Entry { logPackage = show (pretty (PP src)) , logVersion = ver- , logDists = [parseReleaseName "UNRELEASED"]+ , logDists = [parseCodename "UNRELEASED"] , logUrgency = "low" , logComments = List.unlines $ List.map ((" * " <>) . List.intercalate "\n " . List.map unpack) (fromMaybe [[msg]] cmts)@@ -441,7 +441,7 @@ -- | Convert the extraLibs field of the cabal build info into debian -- binary package names and make them dependendencies of the debian -- devel package (if there is one.)-addExtraLibDependencies :: (Monad m, Functor m) => CompilerFlavor -> CabalT m ()+addExtraLibDependencies :: (Monad m) => CompilerFlavor -> CabalT m () addExtraLibDependencies hc = do pkgDesc <- use A.packageDescription devName <- debianName B.Development hc@@ -455,14 +455,14 @@ devDep libMap cab = maybe [[Rel (BinPkgName ("lib" ++ cab ++ "-dev")) Nothing Nothing]] id (Map.lookup cab libMap) -- | Applies a few settings to official packages (unless already set)-checkOfficialSettings :: (Monad m, Functor m) => CompilerFlavor -> CabalT m ()+checkOfficialSettings :: (Monad m) => CompilerFlavor -> CabalT m () checkOfficialSettings flavor = do o <- use (A.debInfo . D.official) when o $ case flavor of GHC -> officialSettings _ -> error $ "There is no official packaging for " ++ show flavor -officialSettings :: (Monad m, Functor m) => CabalT m ()+officialSettings :: (Monad m) => CabalT m () officialSettings = do pkgDesc <- use A.packageDescription #if MIN_VERSION_Cabal(2,0,0)@@ -489,7 +489,7 @@ , S.VCSGit "https://salsa.debian.org/haskell-team/DHG_packages.git" ]) -putBuildDeps :: (MonadIO m, Functor m) => (Relations -> Relations) -> PackageDescription -> CabalT m ()+putBuildDeps :: (MonadIO m) => (Relations -> Relations) -> PackageDescription -> CabalT m () putBuildDeps finalizeRelations pkgDesc = do deps <- debianBuildDeps pkgDesc >>= return . finalizeRelations depsIndep <- debianBuildDepsIndep pkgDesc >>= return . finalizeRelations@@ -534,7 +534,7 @@ B.provides %= (anyrel "${haskell:Provides}" :) -- | Add the library paragraphs for a particular compiler flavor.-librarySpecs :: (Monad m, Functor m) => PackageDescription -> CompilerFlavor -> CabalT m ()+librarySpecs :: (Monad m) => PackageDescription -> CompilerFlavor -> CabalT m () librarySpecs pkgDesc hc = do let dev = isJust (Cabal.library pkgDesc) doc <- get >>= return . not . view (A.debInfo . D.noDocumentationLibrary)@@ -543,7 +543,7 @@ when (dev && prof && hc == GHC) (librarySpec Any B.Profiling hc) when (dev && doc) (docSpecsParagraph hc) -docSpecsParagraph :: (Monad m, Functor m) => CompilerFlavor -> CabalT m ()+docSpecsParagraph :: (Monad m) => CompilerFlavor -> CabalT m () docSpecsParagraph hc = do b <- debianName B.Documentation hc binaryPackageRelations b B.Documentation@@ -553,7 +553,7 @@ (A.debInfo . D.binaryDebDescription b . B.binarySection) .?= Just (MainSection "doc") (A.debInfo . D.binaryDebDescription b . B.description) .?= Just desc -librarySpec :: (Monad m, Functor m) => PackageArchitectures -> B.PackageType -> CompilerFlavor -> CabalT m ()+librarySpec :: (Monad m) => PackageArchitectures -> B.PackageType -> CompilerFlavor -> CabalT m () librarySpec arch typ hc = do b <- debianName typ hc binaryPackageRelations b typ@@ -577,7 +577,7 @@ -- files, assign them to the packages returned by the -- utilsPackageNames lens, and make sure those packages are in the -- source deb description.-makeUtilsPackage :: forall m. (Monad m, Functor m) => PackageDescription -> CompilerFlavor -> CabalT m ()+makeUtilsPackage :: forall m. (Monad m) => PackageDescription -> CompilerFlavor -> CabalT m () makeUtilsPackage pkgDesc hc = do -- Files the cabal package expects to be installed -- Files that are already assigned to any binary deb@@ -770,7 +770,7 @@ List.mapM_ (\ (b, f) -> modify (execAtoms b f)) (Map.toList mp) -- | Add the normal default values to the rules files.-finalizeRules :: (MonadIO m, Functor m) => CabalT m ()+finalizeRules :: (MonadIO m) => CabalT m () finalizeRules = do DebBase b <- debianNameBase hc <- use (A.debInfo . D.flags . compilerFlavor)
src/Debian/Debianize/InputCabal.hs view
@@ -59,7 +59,7 @@ -- in particular, using the dependency environment in the EnvSet, find -- the newest available compiler of the requested compiler flavor and -- use that information load the configured PackageDescription.-inputCabalization :: forall m. (MonadIO m, Functor m) => Flags -> WithProcAndSys m (Either String PackageDescription)+inputCabalization :: forall m. (MonadIO m) => Flags -> WithProcAndSys m (Either String PackageDescription) inputCabalization flags = getCompInfo flags >>= either (return . Left) (\cinfo -> Right <$> doCompInfo cinfo) where
src/Debian/Debianize/InputDebian.hs view
@@ -41,7 +41,7 @@ import Debian.Relation (BinPkgName(..), parseRelations, Relations, SrcPkgName(..)) --import Debug.Trace (trace) #if MIN_VERSION_Cabal(2,0,0)-import Distribution.Package (PackageIdentifier(..), PackageName(..), unPackageName)+import Distribution.Package (PackageIdentifier(..), unPackageName) #else import Distribution.Package (PackageIdentifier(..), PackageName(..)) #endif
src/Debian/Debianize/Monad.hs view
@@ -42,7 +42,7 @@ evalCabalT :: Monad m => CabalT m a -> CabalInfo -> m a evalCabalT action atoms = evalStateT action atoms -runCabalT :: Monad m => CabalT m a -> CabalInfo -> m (a, CabalInfo)+runCabalT :: CabalT m a -> CabalInfo -> m (a, CabalInfo) runCabalT action atoms = runStateT action atoms execCabalM :: CabalM a -> CabalInfo -> CabalInfo
src/Debian/Debianize/Optparse.hs view
@@ -23,7 +23,7 @@ import Control.Lens import Control.Monad.State.Class (MonadState) import Control.Monad.Trans-import "newtype-generics" Control.Newtype+import Control.Newtype.Generics import Data.Bifunctor (first) import Data.Char(toUpper) import Data.Foldable (forM_)@@ -641,7 +641,7 @@ -- of corresponding actions is all great, but now it is pretty easy -- to not handle particular field in `BehaviorAdjustment' field and -- ghc will not complain.-handleBehaviorAdjustment :: (MonadIO m, Functor m) => BehaviorAdjustment -> CabalT m ()+handleBehaviorAdjustment :: (MonadIO m) => BehaviorAdjustment -> CabalT m () handleBehaviorAdjustment (BehaviorAdjustment {..}) = do forM_ _cabalEpochMapping $ \(CabalEpochMapping (pkg, num)) -> A.epochMap %= Map.insert pkg num zoom A.debInfo $ do
src/Debian/Debianize/Output.hs view
@@ -101,7 +101,7 @@ -- | Depending on the options in @atoms@, either validate, describe, -- or write the generated debianization.-finishDebianization :: forall m. (MonadIO m, MonadFail m, Functor m) => StateT CabalInfo m ()+finishDebianization :: forall m. (MonadIO m, MonadFail m) => StateT CabalInfo m () finishDebianization = zoom debInfo $ do new <- get case () of@@ -127,7 +127,7 @@ -- | Write the files of the debianization @d@ to ./debian-writeDebianization :: (MonadIO m, MonadFail m, Functor m) => DebianT m ()+writeDebianization :: (MonadIO m, MonadFail m) => DebianT m () writeDebianization = do files <- debianizationFileMap liftIO $ mapM_ (uncurry doFile) (Map.toList files)@@ -139,7 +139,7 @@ -- | Return a string describing the debianization - a list of file -- names and their contents in a somewhat human readable format.-describeDebianization :: (MonadIO m, MonadFail m, Functor m) => DebianT m String+describeDebianization :: (MonadIO m, MonadFail m) => DebianT m String describeDebianization = debianizationFileMap >>= return . concatMap (\ (path, text) -> path ++ ": " ++ indent " > " (unpack text)) . Map.toList
src/Debian/Debianize/Prelude.hs view
@@ -83,6 +83,7 @@ import Distribution.PackageDescription (FlagName(..)) import Data.Version #endif+import Distribution.Pretty (Pretty(pretty)) import Distribution.Verbosity (intToVerbosity, Verbosity) import GHC.IO.Exception (ExitCode(ExitFailure, ExitSuccess), IOErrorType(InappropriateType, NoSuchThing), IOException(IOError, ioe_description, ioe_type)) import Prelude hiding (lookup, map)@@ -91,7 +92,7 @@ import System.IO (hSetBinaryMode, IOMode(ReadMode), openFile, withFile) import System.IO.Error (catchIOError, isDoesNotExistError) import System.Process (readProcessWithExitCode, showCommandForUser)-import Text.PrettyPrint.HughesPJClass as PP (Pretty(pPrint), text)+import Text.PrettyPrint.HughesPJClass as PP (text) curry3 :: ((a, b, c) -> d) -> a -> b -> c -> d curry3 f a b c = f (a, b, c)@@ -110,7 +111,7 @@ return . Map.fromList . catMaybes (!) :: DebMap -> D.BinPkgName -> DebianVersion-m ! k = maybe (error ("No version number for " ++ (show . pPrint . PP $ k) ++ " in " ++ show (Map.map (maybe Nothing (Just . prettyDebianVersion)) m))) id (Map.findWithDefault Nothing k m)+m ! k = maybe (error ("No version number for " ++ (show . pretty . PP $ k) ++ " in " ++ show (Map.map (maybe Nothing (Just . prettyDebianVersion)) m))) id (Map.findWithDefault Nothing k m) strip :: String -> String strip = stripWith isSpace@@ -205,11 +206,11 @@ readFileMaybe path = (Just <$> readFile' path) `catchIOError` (\ _ -> return Nothing) showDeps :: D.Relations -> String-showDeps = show . pPrint . PP+showDeps = show . pretty . PP showDeps' :: D.Relations -> String showDeps' xss = show $ mconcat $ intersperse (text "\n ") $- [pPrint (PP xs) <> text "," | xs <- xss ]+ [pretty (PP xs) <> text "," | xs <- xss ] -- | From Darcs.Utils - set the working directory and run an IO operation. withCurrentDirectory :: FilePath -> IO a -> IO a@@ -261,7 +262,7 @@ dotFile ".." = True dotFile _ = False -setMapMaybe :: (Ord a, Ord b) => (a -> Maybe b) -> Set a -> Set b+setMapMaybe :: ({-Ord a,-} Ord b) => (a -> Maybe b) -> Set a -> Set b setMapMaybe p = Set.fromList . mapMaybe p . toList zipMaps :: Ord k => (k -> Maybe a -> Maybe b -> Maybe c) -> Map k a -> Map k b -> Map k c@@ -345,13 +346,13 @@ xs -> multiple xs instance Pretty (PP PackageIdentifier) where- pPrint (PP p) = pPrint (PP (pkgName p)) <> text "-" <> pPrint (PP (pkgVersion p))+ pretty (PP p) = pretty (PP (pkgName p)) <> text "-" <> pretty (PP (pkgVersion p)) instance Pretty (PP PackageName) where #if MIN_VERSION_Cabal(2,0,0)- pPrint (PP p) = text (unPackageName p)+ pretty (PP p) = text (unPackageName p) #else- pPrint (PP (PackageName s)) = text s+ pretty (PP (PackageName s)) = text s #endif -- | Set @b@ if it currently isNothing and the argument isJust, that is
src/Debian/Debianize/VersionSplits.hs view
@@ -25,9 +25,10 @@ #if MIN_VERSION_Cabal(2,0,0) import Distribution.Package (PackageIdentifier(..), PackageName) import Distribution.Package (mkPackageName)-import Distribution.Version (showVersion, Version)+import Distribution.Pretty (prettyShow)+import Distribution.Version (Version) #else-import Data.Version (showVersion, Version(Version))+import Data.Version (Version(Version)) import Distribution.Package (PackageIdentifier(..), PackageName(..)) #endif import Distribution.Version (anyVersion, earlierVersion, intersectVersionRanges, orLaterVersion, VersionRange)@@ -102,12 +103,12 @@ debianFromCabal :: VersionSplits -> PackageIdentifier -> DebBase debianFromCabal s p = doSplits s (Just (D.EEQ debVer))- where debVer = parseDebianVersion' (showVersion (pkgVersion p))+ where debVer = parseDebianVersion' (prettyShow (pkgVersion p)) cabalFromDebian' :: Map PackageName VersionSplits -> DebBase -> Version -> PackageIdentifier cabalFromDebian' mp base ver = PackageIdentifier (cabalFromDebian mp base dver) ver- where dver = parseDebianVersion' (showVersion ver)+ where dver = parseDebianVersion' (prettyShow ver) -- | Brute force implementation - I'm assuming this is not a huge map. cabalFromDebian :: Map PackageName VersionSplits -> DebBase -> DebianVersion -> PackageName@@ -136,7 +137,7 @@ doSplits :: VersionSplits -> Maybe D.VersionReq -> DebBase doSplits s version = foldTriples' (\ ltName v geName _ ->- let split = parseDebianVersion' (showVersion v) in+ let split = parseDebianVersion' (prettyShow v) in case version of Nothing -> geName Just (D.SLT v') | v' <= split -> ltName
src/Debian/GHC.hs view
@@ -30,6 +30,7 @@ import Control.Lens (_2, over) import Control.Monad.Trans (MonadIO, liftIO) import Data.Char (isSpace, toLower, toUpper)+import Data.Function.Memoize (deriveMemoizable, Memoizable, memoize, memoize2, memoizeFinite) import Data.List (intercalate, isPrefixOf) import Debian.Debianize.BinaryDebDescription (PackageType(..)) import Debian.Relation (BinPkgName(BinPkgName))@@ -39,8 +40,8 @@ import Distribution.Compiler (CompilerInfo(..), unknownCompilerInfo, AbiTag(NoAbiTag)) #endif #if MIN_VERSION_Cabal(2,0,0)-import Data.Function.Memoize (deriveMemoizable, Memoizable, memoize, memoize2, memoizeFinite)-import Distribution.Version (mkVersion', mkVersion, showVersion, Version, versionNumbers)+import Distribution.Pretty (prettyShow)+import Distribution.Version (mkVersion', mkVersion, Version, versionNumbers) import Data.Version (parseVersion) import Data.Word (Word64) #else@@ -106,10 +107,10 @@ -- suitable for using some version of ghc from hvr's compiler repo. hvrCompilerPATH :: Version -> String -> String hvrCompilerPATH v path0 =- intercalate ":" ["/opt/ghc/" ++ showVersion v ++ "/bin",- "/opt/cabal/" ++ showVersion (hvrCabalVersion v) ++ "/bin",- "/opt/happy/" ++ showVersion (hvrHappyVersion v) ++ "/bin",- "/opt/alex/" ++ showVersion (hvrAlexVersion v) ++ "/bin",+ intercalate ":" ["/opt/ghc/" ++ prettyShow v ++ "/bin",+ "/opt/cabal/" ++ prettyShow (hvrCabalVersion v) ++ "/bin",+ "/opt/happy/" ++ prettyShow (hvrHappyVersion v) ++ "/bin",+ "/opt/alex/" ++ prettyShow (hvrAlexVersion v) ++ "/bin", path0] -- | What version of Cabal goes with this version of GHC?@@ -240,7 +241,7 @@ #endif where greatestLowerBound :: DebianVersion -> [Version] -> Version- greatestLowerBound b xs = last $ takeWhile (\ v -> parseDebianVersion' (showVersion v) < b) xs+ greatestLowerBound b xs = last $ takeWhile (\ v -> parseDebianVersion' (prettyShow v) < b) xs -- | General function to build a command line option that reads most -- of the possible values for CompilerFlavor.
src/Debian/Orphans.hs view
@@ -19,10 +19,11 @@ #endif import Distribution.License (License(..)) import Distribution.PackageDescription (Executable(..), PackageDescription(package))+import Distribution.Pretty (prettyShow) import Distribution.Simple.Compiler (Compiler(..)) import Distribution.Version (foldVersionRange', VersionRange(..)) #if MIN_VERSION_Cabal(2,0,0)-import Distribution.Version (showVersion, Version)+import Distribution.Version (Version) #else import Data.Version (showVersion, Version(..)) #endif@@ -36,7 +37,8 @@ #else import Text.ParserCombinators.Parsec.Rfc2822 (NameAddr(..)) #endif-import Text.PrettyPrint.HughesPJClass (hcat, Pretty(pPrint), text)+import Text.PrettyPrint.HughesPJClass (hcat, text)+import Distribution.Pretty (Pretty(pretty)) deriving instance Typeable Compiler deriving instance Typeable CompilerId@@ -101,16 +103,16 @@ -- Convert from license to RPM-friendly description. The strings are -- taken from TagsCheck.py in the rpmlint distribution. 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)+ pretty (PP (GPL _)) = text "GPL"+ pretty (PP (LGPL _)) = text "LGPL"+ pretty (PP BSD3) = text "BSD"+ pretty (PP BSD4) = text "BSD-like"+ pretty (PP PublicDomain) = text "Public Domain"+ pretty (PP AllRightsReserved) = text "Proprietary"+ pretty (PP OtherLicense) = text "Non-distributable"+ pretty (PP MIT) = text "MIT"+ pretty (PP (UnknownLicense _)) = text "Unknown"+ pretty (PP x) = text (show x) deriving instance Data NameAddr deriving instance Typeable NameAddr@@ -120,24 +122,24 @@ -- changelog entry, it *must* have a name followed by an email address -- in angle brackets. 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))+ pretty (PP x) = text (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 (PP [NameAddr]) where- pPrint = hcat . intersperse (text ", ") . map (pPrint . PP) . unPP+ pretty = hcat . intersperse (text ", ") . map (pretty . PP) . unPP instance Pretty (PP VersionRange) where- pPrint (PP range) =+ pretty (PP range) = foldVersionRange' (text "*")- (\ 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+ (\ v -> text "=" <> pretty (PP v))+ (\ v -> text ">" <> pretty (PP v))+ (\ v -> text "<" <> pretty (PP v))+ (\ v -> text ">=" <> pretty (PP v))+ (\ v -> text "<=" <> pretty (PP v))+ (\ x _ -> text "=" <> pretty (PP x) <> text ".*") -- not exactly right #if MIN_VERSION_Cabal(2,0,0)- (\ v _ -> text " >= " <> pPrint (PP v)) -- maybe this will do?+ (\ v _ -> text " >= " <> pretty (PP v)) -- maybe this will do? #endif (\ x y -> text "(" <> x <> text " || " <> y <> text ")") (\ x y -> text "(" <> x <> text " && " <> y <> text ")")@@ -145,7 +147,7 @@ range instance Pretty (PP Version) where- pPrint = text . showVersion . unPP+ pretty = text . prettyShow . unPP instance Pretty (PP URI) where- pPrint = text . show . unPP+ pretty = text . show . unPP
src/Debian/Policy.hs view
@@ -69,11 +69,12 @@ #else import Text.ParserCombinators.Parsec.Rfc2822 (address, NameAddr(..)) #endif-import Text.PrettyPrint.HughesPJClass (Pretty(pPrint), text)+import Text.PrettyPrint.HughesPJClass (text)+import Distribution.Pretty (Pretty(pretty)) import Text.Read (readMaybe) databaseDirectory :: BinPkgName -> String-databaseDirectory x = "/srv" </> show (pPrint . PP $ x)+databaseDirectory x = "/srv" </> show (pretty . PP $ x) dataDirectory :: PackageDescription -> String dataDirectory pkgDesc = "/usr/share" </> showPkgName (pkgName (package pkgDesc))@@ -84,7 +85,7 @@ fixchar c = c apacheLogDirectory :: BinPkgName -> String-apacheLogDirectory x = "/var/log/apache2/" ++ show (pPrint . PP $ x)+apacheLogDirectory x = "/var/log/apache2/" ++ show (pretty . PP $ x) apacheErrorLog :: BinPkgName -> String apacheErrorLog x = apacheLogDirectory x </> errorLogBaseName@@ -93,7 +94,7 @@ apacheAccessLog x = apacheLogDirectory x </> accessLogBaseName serverLogDirectory :: BinPkgName -> String-serverLogDirectory x = "/var/log/" ++ show (pPrint . PP $ x)+serverLogDirectory x = "/var/log/" ++ show (pretty . PP $ x) serverAppLog :: BinPkgName -> String serverAppLog x = serverLogDirectory x </> appLogBaseName@@ -131,8 +132,8 @@ data StandardsVersion = StandardsVersion Int Int Int (Maybe Int) deriving (Eq, Ord, Show, Data, Typeable) 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)+ pretty (PP (StandardsVersion a b c (Just d))) = text (show a) <> text "." <> text (show b) <> text "." <> text (show c) <> text "." <> text (show d)+ pretty (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)@@ -156,8 +157,8 @@ deriving (Eq, Ord, Show, Data, Typeable) instance Pretty (PP SourceFormat) where- pPrint (PP Quilt3) = text "3.0 (quilt)\n"- pPrint (PP Native3) = text "3.0 (native)\n"+ pretty (PP Quilt3) = text "3.0 (quilt)\n"+ pretty (PP Native3) = text "3.0 (native)\n" readSourceFormat :: Text -> Either Text SourceFormat readSourceFormat s =@@ -185,7 +186,7 @@ x -> error $ "Invalid priority string: " ++ show x instance Pretty (PP PackagePriority) where- pPrint = text . map toLower . show . unPP+ pretty = text . map toLower . show . unPP -- | The architectures for which a binary deb can be built. data PackageArchitectures@@ -195,9 +196,9 @@ deriving (Read, Eq, Ord, Show, Data, Typeable) instance Pretty (PP PackageArchitectures) where- pPrint (PP All) = text "all"- pPrint (PP Any) = text "any"- pPrint (PP (Names xs)) = text $ intercalate " " xs+ pretty (PP All) = text "all"+ pretty (PP Any) = text "any"+ pretty (PP (Names xs)) = text $ intercalate " " xs parsePackageArchitectures :: String -> PackageArchitectures parsePackageArchitectures "all" = All@@ -219,8 +220,8 @@ (a, _) -> MainSection a instance Pretty (PP Section) where- pPrint (PP (MainSection sec)) = text sec- pPrint (PP (AreaSection area sec)) = pPrint (PP area) <> text "/" <> text sec+ pretty (PP (MainSection sec)) = text sec+ pretty (PP (AreaSection area sec)) = pretty (PP area) <> text "/" <> text sec data MultiArch = MANo | MASame | MAForeign | MAAllowed deriving (Read, Eq, Ord, Show, Data, Typeable)@@ -235,10 +236,10 @@ x -> error $ "Invalid Multi-Arch string: " ++ show x instance Pretty (PP MultiArch) where- pPrint (PP MANo) = text "no"- pPrint (PP MASame) = text "same"- pPrint (PP MAForeign) = text "foreign"- pPrint (PP MAAllowed) = text "allowed"+ pretty (PP MANo) = text "no"+ pretty (PP MASame) = text "same"+ pretty (PP MAForeign) = text "foreign"+ pretty (PP MAAllowed) = text "allowed" -- Is this really all that is allowed here? Doesn't Ubuntu have different areas? data Area@@ -248,9 +249,9 @@ deriving (Read, Eq, Ord, Show, Data, Typeable) instance Pretty (PP Area) where- pPrint (PP Main) = text "main"- pPrint (PP Contrib) = text "contrib"- pPrint (PP NonFree) = text "non-free"+ pretty (PP Main) = text "main"+ pretty (PP Contrib) = text "contrib"+ pretty (PP NonFree) = text "non-free" {- Create a debian maintainer field from the environment variables:@@ -363,37 +364,37 @@ -- We need a license parse function that converts these strings back -- into License values. instance Pretty License where- pPrint Public_Domain = text "public-domain"- pPrint Apache = text "Apache"- pPrint Artistic = text "Artistic"- pPrint BSD_2_Clause = text "BSD2"- pPrint BSD_3_Clause = text "BSD3"- pPrint BSD_4_Clause = text "BSD4"- pPrint ISC = text "ISC"- pPrint CC_BY = text "CC-BY"- pPrint CC_BY_SA = text "CC-BY-SA"- pPrint CC_BY_ND = text "CC-BY-ND"- pPrint CC_BY_NC = text "CC-BY-NC"- pPrint CC_BY_NC_SA = text "CC-BY-NC-SA"- pPrint CC_BY_NC_ND = text "CC-BY-NC-ND"- pPrint CC0 = text "CC0"- pPrint CDDL = text "CDDL"- pPrint CPL = text "CPL"- pPrint EFL = text "EFL"- pPrint Expat = text "Expat"- pPrint GPL = text "GPL"- pPrint LGPL = text "LGPL"- pPrint GFDL = text "GFDL"- pPrint GFDL_NIV = text "GFDL-NIV"- pPrint LPPL = text "LPPL"- pPrint MPL = text "MPL"- pPrint Perl = text "Perl"- pPrint Python = text "Python"- pPrint QPL = text "QPL"- pPrint W3C = text "W3C"- pPrint Zlib = text "Zlib"- pPrint Zope = text "Zope"- pPrint (OtherLicense s) = text s+ pretty Public_Domain = text "public-domain"+ pretty Apache = text "Apache"+ pretty Artistic = text "Artistic"+ pretty BSD_2_Clause = text "BSD2"+ pretty BSD_3_Clause = text "BSD3"+ pretty BSD_4_Clause = text "BSD4"+ pretty ISC = text "ISC"+ pretty CC_BY = text "CC-BY"+ pretty CC_BY_SA = text "CC-BY-SA"+ pretty CC_BY_ND = text "CC-BY-ND"+ pretty CC_BY_NC = text "CC-BY-NC"+ pretty CC_BY_NC_SA = text "CC-BY-NC-SA"+ pretty CC_BY_NC_ND = text "CC-BY-NC-ND"+ pretty CC0 = text "CC0"+ pretty CDDL = text "CDDL"+ pretty CPL = text "CPL"+ pretty EFL = text "EFL"+ pretty Expat = text "Expat"+ pretty GPL = text "GPL"+ pretty LGPL = text "LGPL"+ pretty GFDL = text "GFDL"+ pretty GFDL_NIV = text "GFDL-NIV"+ pretty LPPL = text "LPPL"+ pretty MPL = text "MPL"+ pretty Perl = text "Perl"+ pretty Python = text "Python"+ pretty QPL = text "QPL"+ pretty W3C = text "W3C"+ pretty Zlib = text "Zlib"+ pretty Zope = text "Zope"+ pretty (OtherLicense s) = text s -- | Convert the Cabal license to a Debian license. I would welcome input -- on how to make this more correct.