-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Create a debianization for a cabal package -- -- This package provides two methods for generating the debianization -- (i.e. the contents of the debian subdirectory) for a cabal -- package. An executable named cabal-debian, and a library API to handle -- more complex packaging issues. For documentation of the executable run -- cabal-debian --help, for documentation of the library API -- follow the link to the Debian.Debianize module below. @package cabal-debian @version 4.15 -- | A class used while converting Cabal dependencies into Debian -- dependencies. module Debian.Debianize.Interspersed -- | A class of Bs insterspersed with Cs. It is used when converting the -- cabal dependencies to debian, where the around type is the -- binary package name and the between type is the version number. -- -- Minimum implementation is a method to return the leftmost B, and -- another to return the following (C,B) pairs. Its unfortunate to -- require lists in the implementation, a fold function would be better -- (though I find implementing such folds to be a pain in the -- you-know-what.) -- -- The class provides implementations of three folds, each of which -- exposes slightly different views of the data. class Interspersed t around between | t -> around, t -> between where foldTriples f r0 x = snd $ foldl (\ (b1, r) (c, b2) -> (b1, f b1 c b2 r)) (leftmost x, r0) (pairs x) foldInverted f r0 x = (\ (bn, an, r) -> f bn an Nothing r) $ foldl g (Nothing, leftmost x, r0) (pairs x) where g (b1, a1, r) (b2, a2) = (Just b2, a2, f b1 a1 (Just b2) r) foldArounds f r0 x = snd $ foldl (\ (a1, r) (_, a2) -> (a2, f a1 a2 r)) (leftmost x, r0) (pairs x) foldBetweens f r0 x = foldl (\ r (b, _) -> (f b r)) r0 (pairs x) leftmost :: Interspersed t around between => t -> around pairs :: Interspersed t around between => t -> [(between, around)] foldTriples :: Interspersed t around between => (around -> between -> around -> r -> r) -> r -> t -> r foldInverted :: Interspersed t around between => (Maybe between -> around -> Maybe between -> r -> r) -> r -> t -> r foldArounds :: Interspersed t around between => (around -> around -> r -> r) -> r -> t -> r foldBetweens :: Interspersed t around between => (between -> r -> r) -> r -> t -> r instance Show Splits instance Interspersed Splits Double String module Debian.Debianize.Changelog -- | Apply a filter to the version numbers of the changelog entries. filterEntries :: (DebianVersion -> Bool) -> ChangeLog -> ChangeLog -- | Filter out versions newer than the given one. dropFutureEntries :: DebianVersion -> ChangeLog -> ChangeLog -- | Find the log entry with the given version. findChangelogEntry :: DebianVersion -> ChangeLog -> Maybe ChangeLogEntry mergeChangelogEntries :: ChangeLogEntry -> ChangeLogEntry -> ChangeLogEntry -- | Convert between cabal and debian package names based on version number -- ranges. module Debian.Debianize.VersionSplits -- | The base of a debian binary package name, the string that appears -- between libghc- and -dev. newtype DebBase DebBase :: String -> DebBase -- | Describes a mapping from cabal package name and version to debian -- package names. For example, versions of the cabal QuickCheck package -- less than 2 are mapped to quickcheck1, while version 2 or -- greater is mapped to quickcheck2. data VersionSplits -- | Create a version split database that assigns a single debian package -- name base to all cabal versions. makePackage :: DebBase -> VersionSplits -- | Split the version range and give the older packages a new name. insertSplit :: Version -> DebBase -> VersionSplits -> VersionSplits -- | Brute force implementation - I'm assuming this is not a huge map. cabalFromDebian :: Map PackageName VersionSplits -> DebBase -> DebianVersion -> PackageName cabalFromDebian' :: Map PackageName VersionSplits -> DebBase -> Version -> PackageIdentifier debianFromCabal :: VersionSplits -> PackageIdentifier -> DebBase packageRangesFromVersionSplits :: VersionSplits -> [(DebBase, VersionRange)] -- | Given a version split database, turn the debian version requirements -- into a debian package name base that ought to satisfy them. doSplits :: VersionSplits -> Maybe VersionReq -> DebBase instance Eq DebBase instance Ord DebBase instance Read DebBase instance Show DebBase instance Eq VersionSplits instance Ord VersionSplits instance Interspersed VersionSplits DebBase Version instance Show VersionSplits module Distribution.Version.Invert -- | This function belongs in Cabal, see -- http:hackage.haskell.orgtrachackageticket935. invertVersionRange :: VersionRange -> VersionRange invertVersionIntervals :: [(LowerBound, UpperBound)] -> [(LowerBound, UpperBound)] module Debian.GHC withCompilerVersion :: CompilerFlavor -> FilePath -> (DebianVersion -> a) -> a -- | Memoized version of newestAvailable' newestAvailable :: BinPkgName -> FilePath -> Maybe DebianVersion compilerIdFromDebianVersion :: CompilerFlavor -> DebianVersion -> CompilerId -- | General function to build a command line option that reads most of the -- possible values for CompilerFlavor. compilerFlavorOption :: (CompilerFlavor -> a -> a) -> OptDescr (a -> a) newestAvailableCompilerId :: CompilerFlavor -> FilePath -> CompilerId instance Memoizable BinPkgName instance Memoizable CompilerFlavor -- | Determine whether a specific version of a Haskell package is bundled -- with into this particular version of the given compiler. module Debian.Debianize.Bundled -- | Find out what version, if any, of a cabal library is built into the -- newest version of haskell compiler hc in environment root. For GHC -- this is done by looking at what virtual packages debian package -- provides. I have modified the ghcjs packaging to generate the required -- virtual packages in the Provides line. For other compilers it maybe be -- unimplemented. builtIn :: Map PackageName VersionSplits -> CompilerFlavor -> FilePath -> PackageName -> Maybe Version aptCacheShowPkg :: FilePath -> String -> Either SomeException String aptCacheProvides :: FilePath -> String -> [(DebianVersion, [BinPkgName])] aptCacheDepends :: FilePath -> String -> String -> Either SomeException String aptCacheConflicts :: FilePath -> String -> DebianVersion -> [BinPkgName] aptVersions :: FilePath -> String -> [DebianVersion] -- | Functions and instances used by but not related to cabal-debian. These -- could conceivably be moved into more general libraries. module Debian.Debianize.Prelude curry3 :: ((a, b, c) -> d) -> a -> b -> c -> d type DebMap = Map BinPkgName (Maybe DebianVersion) -- | Read and parse the status file for installed debian packages: -- varlibdpkgstatus buildDebVersionMap :: IO DebMap (!) :: DebMap -> BinPkgName -> DebianVersion trim :: String -> String strictReadF :: (Text -> r) -> FilePath -> IO r -- | Write a file which we might still be reading from in order to compute -- the text argument. replaceFile :: FilePath -> String -> IO () -- | Compute the new file contents from the old. If f returns Nothing do -- not write. modifyFile :: FilePath -> (String -> IO (Maybe String)) -> IO () diffFile :: FilePath -> Text -> IO (Maybe String) removeIfExists :: FilePath -> IO () -- | Create a map from pathname to the names of the packages that contains -- that pathname using the contents of the debian package info directory -- varlibdpkginfo. dpkgFileMap :: IO (Map FilePath (Set BinPkgName)) -- | Given a path, return the name of the package that owns it. debOfFile :: FilePath -> ReaderT (Map FilePath (Set BinPkgName)) IO (Maybe BinPkgName) cond :: t -> t -> Bool -> t readFile' :: FilePath -> IO Text readFileMaybe :: FilePath -> IO (Maybe Text) showDeps :: [[Relation]] -> String showDeps' :: [a] -> [[Relation]] -> String -- | From Darcs.Utils - set the working directory and run an IO operation. withCurrentDirectory :: FilePath -> IO a -> IO a -- | Get directory contents minus dot files. getDirectoryContents' :: FilePath -> IO [FilePath] setMapMaybe :: (Ord a, Ord b) => (a -> Maybe b) -> Set a -> Set b zipMaps :: Ord k => (k -> Maybe a -> Maybe b -> Maybe c) -> Map k a -> Map k b -> Map k c foldEmpty :: r -> ([a] -> r) -> [a] -> r -- | If the current value of getL x is Nothing, replace it with f. maybeL :: Lens a (Maybe b) -> Maybe b -> a -> a indent :: [Char] -> String -> String maybeRead :: Read a => String -> Maybe a read' :: Read a => (String -> a) -> String -> a modifyM :: MonadState a m => (a -> m a) -> m () -- | Version of intToVerbosity that first clamps its argument to the -- acceptable range (0-3). intToVerbosity' :: Int -> Verbosity -- | Set a lens value. (This is a version of Data.Lens.Lazy.~= that returns -- () instead of b.) (~=) :: Monad m => Lens a b -> b -> StateT a m () -- | Set b if it currently isNothing and the argument isJust, that -- is 1. Nothing happens if the argument isNothing 2. Nothing happens if -- the current value isJust (~?=) :: Monad m => Lens a (Maybe b) -> Maybe b -> StateT a m () -- | Modify a value. (This is a version of Data.Lens.Lazy.%= that returns -- () instead of a.) (%=) :: Monad m => Lens a b -> (b -> b) -> StateT a m () -- | Insert an element into a (Set b) (+=) :: (Monad m, Ord b) => Lens a (Set b) -> b -> StateT a m () -- | Insert an element into a (Map b c) (++=) :: (Monad m, Ord b) => Lens a (Map b c) -> (b, c) -> StateT a m () -- | Insert an element into a (Map b (Set c)) (+++=) :: (Monad m, Ord b, Monoid c) => Lens a (Map b c) -> (b, c) -> StateT a m () listElemLens :: (a -> Bool) -> Lens [a] (Maybe a) maybeLens :: a -> Lens a b -> Lens (Maybe a) b fromEmpty :: Set a -> Set a -> Set a fromSingleton :: a -> ([a] -> a) -> Set a -> a class Pretty a pretty :: Pretty a => a -> Doc instance Pretty PackageName instance Pretty PackageIdentifier -- | Code pulled out of cabal-debian that straightforwardly implements -- parts of the Debian policy manual, or other bits of Linux standards. module Debian.Policy databaseDirectory :: BinPkgName -> String apacheLogDirectory :: BinPkgName -> String apacheErrorLog :: BinPkgName -> String apacheAccessLog :: BinPkgName -> String serverLogDirectory :: BinPkgName -> String serverAppLog :: BinPkgName -> String serverAccessLog :: BinPkgName -> String errorLogBaseName :: String appLogBaseName :: String accessLogBaseName :: String debianPackageVersion :: String -> IO (Maybe DebianVersion) -- | The version number of the installed debhelper package is the highest -- acceptable value for compat in a debian/control file. If the package -- doesn't explicitly set an (acceptable) compat value we can use the -- value returned by this function, assuming debhelper is installed. getDebhelperCompatLevel :: IO (Maybe Int) data StandardsVersion StandardsVersion :: Int -> Int -> Int -> (Maybe Int) -> StandardsVersion -- | Assumes debian-policy is installed getDebianStandardsVersion :: IO (Maybe StandardsVersion) parseStandardsVersion :: String -> StandardsVersion data SourceFormat Native3 :: SourceFormat Quilt3 :: SourceFormat readSourceFormat :: Text -> Either Text SourceFormat data PackagePriority Required :: PackagePriority Important :: PackagePriority Standard :: PackagePriority Optional :: PackagePriority Extra :: PackagePriority readPriority :: String -> PackagePriority -- | The architectures for which a binary deb can be built. data PackageArchitectures -- | The package is architecture independenct All :: PackageArchitectures -- | The package can be built for any architecture Any :: PackageArchitectures -- | The list of suitable architectures Names :: [String] -> PackageArchitectures parsePackageArchitectures :: String -> PackageArchitectures data Section MainSection :: String -> Section AreaSection :: Area -> String -> Section readSection :: String -> Section data Area Main :: Area Contrib :: Area NonFree :: Area -- | Turn the uploaders field of a cabal package into a list of RFC2822 -- NameAddr values. parseUploaders :: String -> Either String [NameAddr] -- | Parse a string containing a single NameAddr value. parseMaintainer :: String -> Either String NameAddr getDebianMaintainer :: IO (Maybe NameAddr) haskellMaintainer :: NameAddr instance Typeable StandardsVersion instance Typeable SourceFormat instance Typeable PackagePriority instance Typeable PackageArchitectures instance Typeable Area instance Typeable Section instance Eq StandardsVersion instance Ord StandardsVersion instance Show StandardsVersion instance Data StandardsVersion instance Eq SourceFormat instance Ord SourceFormat instance Show SourceFormat instance Data SourceFormat instance Eq PackagePriority instance Ord PackagePriority instance Read PackagePriority instance Show PackagePriority instance Data PackagePriority instance Read PackageArchitectures instance Eq PackageArchitectures instance Ord PackageArchitectures instance Show PackageArchitectures instance Data PackageArchitectures instance Read Area instance Eq Area instance Ord Area instance Show Area instance Data Area instance Read Section instance Eq Section instance Ord Section instance Show Section instance Data Section instance Pretty Area instance Pretty Section instance Pretty (Maybe PackageArchitectures) instance Pretty PackageArchitectures instance Pretty PackagePriority instance Pretty SourceFormat instance Pretty StandardsVersion module Debian.Debianize.Types.BinaryDebDescription -- | This type represents a section of the control file other than the -- first, which in turn represent one of the binary packages or debs -- produced by this debianization. -- -- The different types of binary debs we can produce from a haskell -- package data BinaryDebDescription newBinaryDebDescription :: BinPkgName -> BinaryDebDescription package :: Lens BinaryDebDescription BinPkgName description :: Lens BinaryDebDescription (Maybe Text) packageType :: Lens BinaryDebDescription (Maybe PackageType) architecture :: Lens BinaryDebDescription (Maybe PackageArchitectures) binarySection :: Lens BinaryDebDescription (Maybe Section) binaryPriority :: Lens BinaryDebDescription (Maybe PackagePriority) essential :: Lens BinaryDebDescription (Maybe Bool) relations :: Lens BinaryDebDescription PackageRelations -- | Package interrelationship information. data PackageType -- | The libghc-foo-dev package. Development :: PackageType -- | The libghc-foo-prof package. Profiling :: PackageType -- | The libghc-foo-doc package. Documentation :: PackageType -- | A package related to a particular executable, perhaps but not -- necessarily a server. Exec :: PackageType -- | A package that holds the package's data files and any executables not -- assigned to other packages. Utilities :: PackageType -- | The source package (not a binary deb actually.) Source' :: PackageType -- | This is used to construct the value for DEB_CABAL_PACKAGE in the rules -- file Cabal :: PackageType data PackageRelations newPackageRelations :: PackageRelations depends :: Lens PackageRelations Relations recommends :: Lens PackageRelations Relations suggests :: Lens PackageRelations Relations preDepends :: Lens PackageRelations Relations breaks :: Lens PackageRelations Relations conflicts :: Lens PackageRelations Relations provides :: Lens PackageRelations Relations replaces :: Lens PackageRelations Relations builtUsing :: Lens PackageRelations Relations instance Typeable PackageType instance Typeable PackageRelations instance Typeable BinaryDebDescription instance Eq PackageType instance Ord PackageType instance Show PackageType instance Read PackageType instance Data PackageType instance Eq PackageRelations instance Ord PackageRelations instance Read PackageRelations instance Show PackageRelations instance Data PackageRelations instance Eq BinaryDebDescription instance Ord BinaryDebDescription instance Read BinaryDebDescription instance Show BinaryDebDescription instance Data BinaryDebDescription module Debian.Debianize.Types.SourceDebDescription -- | This type represents the debian/control file, which is the core of the -- source package debianization. It includes the information that goes in -- the first, or source, section, and then a list of the succeeding -- binary package sections. data SourceDebDescription newSourceDebDescription :: SourceDebDescription newSourceDebDescription' :: SrcPkgName -> NameAddr -> SourceDebDescription source :: Lens SourceDebDescription (Maybe SrcPkgName) maintainer :: Lens SourceDebDescription (Maybe NameAddr) changedBy :: Lens SourceDebDescription (Maybe NameAddr) uploaders :: Lens SourceDebDescription [NameAddr] dmUploadAllowed :: Lens SourceDebDescription Bool priority :: Lens SourceDebDescription (Maybe PackagePriority) section :: Lens SourceDebDescription (Maybe Section) buildDepends :: Lens SourceDebDescription Relations buildConflicts :: Lens SourceDebDescription Relations buildDependsIndep :: Lens SourceDebDescription Relations buildConflictsIndep :: Lens SourceDebDescription Relations standardsVersion :: Lens SourceDebDescription (Maybe StandardsVersion) homepage :: Lens SourceDebDescription (Maybe Text) vcsFields :: Lens SourceDebDescription (Set VersionControlSpec) xFields :: Lens SourceDebDescription (Set XField) binaryPackages :: Lens SourceDebDescription [BinaryDebDescription] data VersionControlSpec VCSBrowser :: Text -> VersionControlSpec VCSArch :: Text -> VersionControlSpec VCSBzr :: Text -> VersionControlSpec VCSCvs :: Text -> VersionControlSpec VCSDarcs :: Text -> VersionControlSpec VCSGit :: Text -> VersionControlSpec VCSHg :: Text -> VersionControlSpec VCSMtn :: Text -> VersionControlSpec VCSSvn :: Text -> VersionControlSpec -- | User defined fields. Parse the line XBS-Comment: I stand between -- the candle and the star. to get XField (fromList BS) -- Comment I stand between the candle and the star. data XField XField :: (Set XFieldDest) -> Text -> Text -> XField data XFieldDest -- | Field will be copied to the binary packgae control files B :: XFieldDest -- | Field will be copied to the source packgae control files S :: XFieldDest -- | Field will be copied to the upload control (.changes) file C :: XFieldDest instance Typeable VersionControlSpec instance Typeable XFieldDest instance Typeable XField instance Typeable SourceDebDescription instance Eq VersionControlSpec instance Ord VersionControlSpec instance Show VersionControlSpec instance Data VersionControlSpec instance Eq XFieldDest instance Ord XFieldDest instance Read XFieldDest instance Show XFieldDest instance Data XFieldDest instance Eq XField instance Ord XField instance Show XField instance Data XField instance Eq SourceDebDescription instance Ord SourceDebDescription instance Show SourceDebDescription instance Data SourceDebDescription -- | This module holds a long list of lenses that access the Atoms record, -- the record that holds the input data from which the debianization is -- to be constructed. module Debian.Debianize.Types.Atoms -- | Bits and pieces of information about the mapping from cabal package -- names and versions to debian package names and versions. In essence, -- an Atoms value represents a package's debianization. The lenses -- in this module are used to get and set the values hidden in this Atoms -- value. Many of the values should be left alone to be set when the -- debianization is finalized. data Atoms Atoms :: Bool -> Bool -> Bool -> Bool -> Set FilePath -> EnvSet -> Flags -> Map PackageName VersionSplits -> SourceDebDescription -> Maybe SrcPkgName -> Maybe String -> Maybe DebianVersion -> Maybe NameAddr -> Set (FlagName, Bool) -> Maybe SourceFormat -> Maybe Text -> Set (FilePath, Text) -> Maybe Text -> Set Text -> Set Text -> Set BinPkgName -> Maybe ChangeLog -> Maybe [[Text]] -> Set BinPkgName -> Map String Relations -> Map String Relations -> Map PackageName Int -> Map PackageName PackageInfo -> Maybe Int -> Maybe Text -> Maybe License -> Maybe Text -> Map BinPkgName (String, FilePath, Text) -> Map BinPkgName (Set Text) -> Map BinPkgName (Set (FilePath, FilePath)) -> Map BinPkgName Text -> Map BinPkgName Text -> Map BinPkgName Text -> Map BinPkgName Text -> Maybe PackageArchitectures -> Map BinPkgName PackageArchitectures -> Maybe PackagePriority -> Map BinPkgName PackagePriority -> Maybe Section -> Map BinPkgName Section -> Map BinPkgName (Set (FilePath, FilePath)) -> Map BinPkgName (Set (FilePath, FilePath)) -> Map BinPkgName (Set (FilePath, FilePath)) -> Map BinPkgName (Set (FilePath, Text)) -> Map BinPkgName (Set (String, FilePath)) -> Map BinPkgName (Set (String, FilePath)) -> Map BinPkgName (Set FilePath) -> Map BinPkgName Text -> Map BinPkgName InstallFile -> Map BinPkgName Server -> Map BinPkgName Site -> Map BinPkgName String -> Relations -> Maybe PackageDescription -> CompilerFlavor -> Atoms -- | Do not produce a libghc-foo-doc package. noDocumentationLibrary_ :: Atoms -> Bool -- | Do not produce a libghc-foo-prof package. noProfilingLibrary_ :: Atoms -> Bool -- | Don't link the documentation for hoogle. noHoogle_ :: Atoms -> Bool -- | If present, don't generate the << dependency when we see a cabal -- equals dependency. (The implementation of this was somehow lost.) omitLTDeps_ :: Atoms -> Bool -- | The build directory used by cabal, typically dist/build when building -- manually or dist-ghc/build when building using GHC and -- haskell-devscripts. This value is used to locate files produced by -- cabal so we can move them into the deb. Note that the --builddir -- option of runhaskell Setup appends the /build to the value it -- receives, so, yes, try not to get confused. FIXME: make this FilePath -- or Maybe FilePath buildDir_ :: Atoms -> Set FilePath -- | Directory containing the build environment for which the debianization -- will be generated. This determines which compiler will be available, -- which in turn determines which basic libraries can be provided by the -- compiler. By default all the paths in EnvSet are /. buildEnv_ :: Atoms -> EnvSet -- | Information regarding mode of operation - verbosity, dry-run, usage, -- etc flags_ :: Atoms -> Flags -- | Mapping from cabal package name and version to debian source package -- name. This allows different ranges of cabal versions to map to -- different debian source package names. debianNameMap_ :: Atoms -> Map PackageName VersionSplits -- | The parsed contents of the control file control_ :: Atoms -> SourceDebDescription -- | Name to give to the debian source package. If not supplied the name is -- constructed from the cabal package name. Note that DebianNameMap could -- encode this information if we already knew the cabal package name, but -- we can't assume that. sourcePackageName_ :: Atoms -> Maybe SrcPkgName -- | Specify the revision string to use when converting the cabal version -- to debian. revision_ :: Atoms -> Maybe String -- | Specify the exact debian version of the resulting package, including -- epoch. One use case is to work around the the buildN versions -- that are often uploaded to the debian and ubuntu repositories. Say the -- latest cabal version of transformers is 0.3.0.0, but the debian -- repository contains version 0.3.0.0-1build3, we need to specify -- debVersion=0.3.0.0-1build3 or the version we produce will look -- older than the one already available upstream. debVersion_ :: Atoms -> Maybe DebianVersion -- | Value for the maintainer field in the control file. Note that the -- cabal maintainer field can have multiple addresses, but debian only -- one. If this is not explicitly set, it is obtained from the cabal -- file, and if it is not there then from the environment. As a last -- resort, there is a hard coded string in here somewhere. maintainerOld_ :: Atoms -> Maybe NameAddr -- | Flags to pass to Cabal function finalizePackageDescription, this can -- be used to control the flags in the cabal file. It can be supplied to -- the cabal-debian binary using the --flags option. cabalFlagAssignments_ :: Atoms -> Set (FlagName, Bool) -- | Write debiansourceformat sourceFormat_ :: Atoms -> Maybe SourceFormat -- | Write debian/watch watch_ :: Atoms -> Maybe Text -- | Put this text into a file with the given name in the debianization. intermediateFiles_ :: Atoms -> Set (FilePath, Text) -- | The header of the debian/rules file. The remainder is assembled from -- DebRulesFragment values in the atom list. rulesHead_ :: Atoms -> Maybe Text -- | A Fragment of debian/rules rulesFragments_ :: Atoms -> Set Text -- | A warning to be reported later warning_ :: Atoms -> Set Text -- | Name of a package that will get left-over data files and executables. -- If there are more than one, each package will get those files. utilsPackageNames_ :: Atoms -> Set BinPkgName -- | The changelog, first entry contains the source package name and -- version changelog_ :: Atoms -> Maybe ChangeLog -- | Each element is a comment to be added to the changelog, where the -- element's text elements are the lines of the comment. comments_ :: Atoms -> Maybe [[Text]] -- | Lets cabal-debian know that a package it might expect to exist -- actually does not, so omit all uses in resulting debianization. missingDependencies_ :: Atoms -> Set BinPkgName -- | Map a cabal Extra-Library name to a debian binary package name, e.g. -- ExtraLibMapping extraLibMap cryptopp -- libcrypto-dev adds a build dependency *and* a regular -- dependency on libcrypto-dev to any package that has -- cryptopp in its cabal Extra-Library list. extraLibMap_ :: Atoms -> Map String Relations -- | Map a cabal Build-Tool name to a debian binary package name, e.g. -- ExecMapping trhsx haskell-hsx-utils adds a -- build dependency on haskell-hsx-utils to any package that has -- trhsx in its cabal build-tool list. execMap_ :: Atoms -> Map String Relations -- | Specify epoch numbers for the debian package generated from a cabal -- package. Example: EpochMapping (PackageName HTTP) 1. epochMap_ :: Atoms -> Map PackageName Int -- | Supply some info about a cabal package. packageInfo_ :: Atoms -> Map PackageName PackageInfo -- | The debhelper compatibility level, from debian/compat. compat_ :: Atoms -> Maybe Int -- | Copyright information copyright_ :: Atoms -> Maybe Text -- | License information Cabal License value license_ :: Atoms -> Maybe License -- | The contents of the file specified in the cabal license-file: field licenseFile_ :: Atoms -> Maybe Text -- | Have Apache configure a site using PACKAGE, DOMAIN, LOGDIR, and -- APACHECONFIGFILE apacheSite_ :: Atoms -> Map BinPkgName (String, FilePath, Text) -- | Add a stanza of a logrotate file to the binary package logrotateStanza_ :: Atoms -> Map BinPkgName (Set Text) -- | Create a symbolic link in the binary package link_ :: Atoms -> Map BinPkgName (Set (FilePath, FilePath)) -- | Script to run after install, should contain line before exit 0 postInst_ :: Atoms -> Map BinPkgName Text -- | Script to run after remove, should contain line before exit 0 postRm_ :: Atoms -> Map BinPkgName Text -- | Script to run before install, should contain line before exit 0 preInst_ :: Atoms -> Map BinPkgName Text -- | Script to run before remove, should contain line before exit 0 preRm_ :: Atoms -> Map BinPkgName Text -- | Set the Architecture field of the source package sourceArchitecture_ :: Atoms -> Maybe PackageArchitectures -- | Set the Architecture field of a binary package binaryArchitectures_ :: Atoms -> Map BinPkgName PackageArchitectures -- | Set the Priority field of the source package sourcePriority_ :: Atoms -> Maybe PackagePriority -- | Set the Priority field of a binary package binaryPriorities_ :: Atoms -> Map BinPkgName PackagePriority -- | Set the Section field of the source package sourceSection_ :: Atoms -> Maybe Section -- | Set the Section field of a binary package binarySections_ :: Atoms -> Map BinPkgName Section -- | Install a build file into the binary package install_ :: Atoms -> Map BinPkgName (Set (FilePath, FilePath)) -- | Install a build file into the binary package at an exact location installTo_ :: Atoms -> Map BinPkgName (Set (FilePath, FilePath)) -- | DHInstallTo somewhere relative to DataDir (see above) installData_ :: Atoms -> Map BinPkgName (Set (FilePath, FilePath)) -- | Create a file with the given text at the given path file_ :: Atoms -> Map BinPkgName (Set (FilePath, Text)) -- | Install a cabal executable into the binary package installCabalExec_ :: Atoms -> Map BinPkgName (Set (String, FilePath)) -- | Install a cabal executable into the binary package at an exact -- location installCabalExecTo_ :: Atoms -> Map BinPkgName (Set (String, FilePath)) -- | Create a directory in the binary package installDir_ :: Atoms -> Map BinPkgName (Set FilePath) -- | Add an init.d file to the binary package installInit_ :: Atoms -> Map BinPkgName Text -- | Create a binary package to hold a cabal executable executable_ :: Atoms -> Map BinPkgName InstallFile -- | Like DHExecutable, but configure the executable as a server process serverInfo_ :: Atoms -> Map BinPkgName Server -- | Like DHServer, but configure the server as a web server website_ :: Atoms -> Map BinPkgName Site -- | Configure the executable to do incremental backups backups_ :: Atoms -> Map BinPkgName String -- | Limited version of Depends, put a dependency on the dev library -- package. The only reason to use this is because we don't yet know the -- name of the dev library package. extraDevDeps_ :: Atoms -> Relations -- | The result of reading a cabal configuration file. packageDescription_ :: Atoms -> Maybe PackageDescription -- | The newest available version of GHC in the build repository. We don't -- support base repositories with no version of GHC, it has been standard -- in Debian and Ubuntu for quite some time. compilerFlavor_ :: Atoms -> CompilerFlavor data EnvSet EnvSet :: FilePath -> FilePath -> FilePath -> EnvSet -- | The output of the debootstrap command cleanOS :: EnvSet -> FilePath -- | An environment with build dependencies installed dependOS :: EnvSet -> FilePath -- | An environment where we have built a package buildOS :: EnvSet -> FilePath -- | Look for --buildenvdir in the command line arguments to get the -- changeroot path, use / if not present. newAtoms :: MonadIO m => CompilerFlavor -> m Atoms makeAtoms :: CompilerFlavor -> EnvSet -> Atoms -- | This record supplies information about the task we want done - -- debianization, validataion, help message, etc. data Flags Flags :: Int -> Bool -> Bool -> DebAction -> Flags -- | Run with progress messages at the given level of verboseness. verbosity_ :: Flags -> Int -- | Don't write any files or create any directories, just explain what -- would have been done. dryRun_ :: Flags -> Bool -- | Fail if the debianization already present doesn't match the one we are -- going to generate closely enough that it is safe to debianize during -- the run of dpkg-buildpackage, when Setup configure is run. -- Specifically, the version number in the top changelog entry must -- match, and the sets of package names in the control file must match. validate_ :: Flags -> Bool -- | What to do - Usage, Debianize or Substvar debAction_ :: Flags -> DebAction data DebAction Usage :: DebAction Debianize :: DebAction SubstVar :: DebType -> DebAction -- | A redundant data type, too lazy to expunge. data DebType Dev :: DebType Prof :: DebType Doc :: DebType data PackageInfo PackageInfo :: PackageName -> Maybe (BinPkgName, DebianVersion) -> Maybe (BinPkgName, DebianVersion) -> Maybe (BinPkgName, DebianVersion) -> PackageInfo cabalName :: PackageInfo -> PackageName devDeb :: PackageInfo -> Maybe (BinPkgName, DebianVersion) profDeb :: PackageInfo -> Maybe (BinPkgName, DebianVersion) docDeb :: PackageInfo -> Maybe (BinPkgName, DebianVersion) -- | Information about the web site we are packaging. data Site Site :: String -> String -> Server -> Site -- | The domain name assigned to the server. An apache configuration will -- be generated to redirect requests from this domain to hostname:port domain :: Site -> String -- | Apache ServerAdmin parameter serverAdmin :: Site -> String -- | The hint to install the server job server :: Site -> Server -- | Information about the server we are packaging. data Server Server :: String -> Int -> String -> String -> [String] -> InstallFile -> Server -- | Host on which the server will run hostname :: Server -> String -- | Port on which the server will run. Obviously, this must assign each -- and every server package to a different port. port :: Server -> Int -- | A comment that will be inserted to explain how the file was generated headerMessage :: Server -> String -- | start-stop-daemon --retry argument retry :: Server -> String -- | Extra flags to pass to the server via the init script serverFlags :: Server -> [String] -- | The hint to install the server executable installFile :: Server -> InstallFile data InstallFile InstallFile :: String -> Maybe FilePath -> Maybe FilePath -> String -> InstallFile -- | The name of the executable file execName :: InstallFile -> String -- | where to find it, default is distbuildexecName/ sourceDir :: InstallFile -> Maybe FilePath -- | where to put it, default is usrbinexecName destDir :: InstallFile -> Maybe FilePath -- | name to give installed executable destName :: InstallFile -> String defaultFlags :: Flags showAtoms :: Atoms -> IO () -- | Set how much progress messages get generated. verbosity :: Lens Atoms Int -- | Don't write anything, just output a description of what would have -- happened dryRun :: Lens Atoms Bool -- | Make sure the version number and package names of the supplied and -- generated debianizations match. validate :: Lens Atoms Bool -- | Debianize, SubstVars, or Usage. I'm no longer sure what SubstVars -- does, but someone may still be using it. debAction :: Lens Atoms DebAction -- | Obsolete record containing verbosity, dryRun, validate, and debAction. flags :: Lens Atoms Flags -- | Unused warning :: Lens Atoms (Set Text) -- | The build directory. This can be set by an argument to the -- Setup script. When Setup is run manually it is just -- dist, when it is run by dpkg-buildpackage the -- compiler name is appended, so it is typically dist-ghc. -- Cabal-debian needs the correct value of buildDir to find the build -- results. buildDir :: Lens Atoms (Set FilePath) buildEnv :: Lens Atoms EnvSet setBuildEnv :: MonadIO m => EnvSet -> Atoms -> m Atoms -- | Map from cabal Extra-Lib names to debian binary package names. extraLibMap :: Lens Atoms (Map String Relations) -- | Map from cabal Build-Tool names to debian binary package names. execMap :: Lens Atoms (Map String Relations) -- | Cabal flag assignments to use when loading the cabal file. cabalFlagAssignments :: Lens Atoms (Set (FlagName, Bool)) -- | The result of loading a .cabal file packageDescription :: Lens Atoms (Maybe PackageDescription) -- | Map from cabal version number ranges to debian package names. This is -- a result of the fact that only one version of a debian package can be -- installed at a given time, while multiple versions of a cabal package -- can. debianNameMap :: Lens Atoms (Map PackageName VersionSplits) -- | Map of Debian epoch numbers assigned to cabal packages. epochMap :: Lens Atoms (Map PackageName Int) -- | Create a package to hold a cabal executable executable :: Lens Atoms (Map BinPkgName InstallFile) -- | Create a package for a server serverInfo :: Lens Atoms (Map BinPkgName Server) -- | Create a package for a website website :: Lens Atoms (Map BinPkgName Site) -- | Create a package for a timed backup script backups :: Lens Atoms (Map BinPkgName String) -- | Create an apache configuration file with the given (domain, logdir, -- filetext). This is called when expanding the result of the website -- lens above. apacheSite :: Lens Atoms (Map BinPkgName (String, FilePath, Text)) -- | List if packages that should be omitted from any dependency list - -- e.g. a profiling package missing due to use of noProfilingPackage lens -- elsewhere. missingDependencies :: Lens Atoms (Set BinPkgName) -- | Override the package name used to hold left over data files and -- executables. Usually only one package is specified, but if more then -- one are they will each receive the same list of files. utilsPackageNames :: Lens Atoms (Set BinPkgName) -- | Override the debian source package name constructed from the cabal -- name sourcePackageName :: Lens Atoms (Maybe SrcPkgName) -- | Revision string used in constructing the debian verison number from -- the cabal version revision :: Lens Atoms (Maybe String) -- | Exact debian version number, overrides the version generated from the -- cabal version debVersion :: Lens Atoms (Maybe DebianVersion) -- | No longer sure what the purpose of this lens is. packageInfo :: Lens Atoms (Map PackageName PackageInfo) -- | Set this to filter any less-than dependencies out of the generated -- debian dependencies. (Not sure if this is implemented.) omitLTDeps :: Lens Atoms Bool -- | Set this to omit the prof library deb. noProfilingLibrary :: Lens Atoms Bool -- | Set this to omit the hoogle documentation link noHoogle :: Lens Atoms Bool -- | Set this to omit the doc library deb. noDocumentationLibrary :: Lens Atoms Bool -- | The copyright information from the cabal file copyright :: Lens Atoms (Maybe Text) -- | The license information from the cabal file license :: Lens Atoms (Maybe License) -- | The value in the cabal file's license-file field licenseFile :: Lens Atoms (Maybe Text) -- | The architectures supported by this source package - Any, -- All, or some list of specific architectures. sourceArchitectures :: Lens Atoms (Maybe PackageArchitectures) -- | Extra install dependencies for the devel library. Redundant with -- depends, but kept for backwards compatibility. Also, I think maybe -- this is or was needed because it can be set before the exact name of -- the library package is known. extraDevDeps :: Lens Atoms Relations -- | The beginning of the rules file rulesHead :: Lens Atoms (Maybe Text) -- | Additional fragments of the rules file rulesFragments :: Lens Atoms (Set Text) -- | Map of debian/postinst scripts postInst :: Lens Atoms (Map BinPkgName Text) -- | Map of debian/postrm scripts postRm :: Lens Atoms (Map BinPkgName Text) -- | Map of debian/preinst scripts preInst :: Lens Atoms (Map BinPkgName Text) -- | Map of debian/prerm scripts preRm :: Lens Atoms (Map BinPkgName Text) -- | The debian/compat file, contains the minimum compatible -- version of the debhelper package. If not given the version -- number of the installed debhelper package is used. compat :: Lens Atoms (Maybe Int) -- | The debian/source/format file. sourceFormat :: Lens Atoms (Maybe SourceFormat) -- | the debian/watch file watch :: Lens Atoms (Maybe Text) -- | the debian/changelog file changelog :: Lens Atoms (Maybe ChangeLog) -- | Comment entries for the latest changelog entry (DebLogComments -- [[Text]]) comments :: Lens Atoms (Maybe [[Text]]) -- | The debian/control file. Many of the following lenses access -- parts of the SourceDebDescription. control :: Lens Atoms SourceDebDescription -- | Add a stanza to the binary package's logrotate script. logrotateStanza :: Lens Atoms (Map BinPkgName (Set Text)) -- | Add entries to a binary deb's debian/foo.links file. link :: Lens Atoms (Map BinPkgName (Set (FilePath, FilePath))) -- | Install files into directories by adding entries to the binary deb's -- debian/foo.install file. install :: Lens Atoms (Map BinPkgName (Set (FilePath, FilePath))) -- | Rename and install files. This is done by adding rules to -- debian/rules. installTo :: Lens Atoms (Map BinPkgName (Set (FilePath, FilePath))) -- | Install files into the a binary deb's data directory, -- usrshare/packagename-version. This expands to either an install -- or an installTo. installData :: Lens Atoms (Map BinPkgName (Set (FilePath, FilePath))) -- | Create a file in the binary deb with the given text. This is done by -- writing the file into the cabalInstall directory and adding an entry -- to the binary deb's .install file. file :: Lens Atoms (Map BinPkgName (Set (FilePath, Text))) -- | Install a cabal executable into a binary deb. FIXME: change signature -- to BinPkgName -> Lens Atoms (Set (String, FilePath)) installCabalExec :: Lens Atoms (Map BinPkgName (Set (String, FilePath))) -- | Rename and install a cabal executable FIXME: change signature to -- BinPkgName -> Lens Atoms (Set (String, FilePath)) installCabalExecTo :: Lens Atoms (Map BinPkgName (Set (String, FilePath))) -- | Create directories in the package FIXME: change signature to -- BinPkgName -> Lens Atoms (Set FilePath) installDir :: Lens Atoms (Map BinPkgName (Set FilePath)) -- | Create an etcinit.d file in the package FIXME: change signature -- to BinPkgName -> Lens Atoms Text installInit :: Lens Atoms (Map BinPkgName Text) -- | Create a file in the debianization. This is used to implement the file -- lens above. FIXME: change signature to BinPkgName -> Lens Atoms -- (Set (FilePath, Text)) intermediateFiles :: Lens Atoms (Set (FilePath, Text)) compilerFlavor :: Lens Atoms CompilerFlavor instance Eq EnvSet instance Show EnvSet instance Eq DebType instance Ord DebType instance Read DebType instance Show DebType instance Read DebAction instance Show DebAction instance Eq DebAction instance Ord DebAction instance Eq Flags instance Ord Flags instance Show Flags instance Eq PackageInfo instance Ord PackageInfo instance Show PackageInfo instance Read InstallFile instance Show InstallFile instance Eq InstallFile instance Ord InstallFile instance Read Server instance Show Server instance Eq Server instance Ord Server instance Read Site instance Show Site instance Eq Site instance Ord Site instance Eq Atoms instance Show Atoms module Debian.Debianize.Monad -- | Bits and pieces of information about the mapping from cabal package -- names and versions to debian package names and versions. In essence, -- an Atoms value represents a package's debianization. The lenses -- in this module are used to get and set the values hidden in this Atoms -- value. Many of the values should be left alone to be set when the -- debianization is finalized. data Atoms type DebT m = StateT Atoms m runDebT :: Monad m => DebT m a -> Atoms -> m (a, Atoms) evalDebT :: Monad m => DebT m a -> Atoms -> m a execDebT :: Monad m => DebT m a -> Atoms -> m Atoms type DebM = State Atoms runDebM :: DebM a -> Atoms -> (a, Atoms) evalDebM :: DebM a -> Atoms -> a execDebM :: DebM a -> Atoms -> Atoms module Debian.Debianize.DebianName -- | Build the Debian package name for a given package type. debianName :: (Monad m, PkgName name) => PackageType -> DebT m name -- | Build a debian package name from a cabal package name and a debian -- package type. Unfortunately, this does not enforce the correspondence -- between the PackageType value and the name type, so it can return -- nonsense like (SrcPkgName libghc-debian-dev). mkPkgName :: PkgName name => CompilerFlavor -> PackageName -> PackageType -> name mkPkgName' :: PkgName name => CompilerFlavor -> DebBase -> PackageType -> name -- | Map all versions of Cabal package pname to Debian package dname. Not -- really a debian package name, but the name of a cabal package that -- maps to the debian package name we want. (Should this be a -- SrcPkgName?) mapCabal :: Monad m => PackageName -> DebBase -> DebT m () -- | Map versions less than ver of Cabal Package pname to Debian package -- ltname splitCabal :: Monad m => PackageName -> DebBase -> Version -> DebT m () instance Eq Dependency_ instance Show Dependency_ module Debian.Debianize.Details -- | Some details about the debian repository - special cases for how some -- cabal packages are mapped to debian package names. debianDefaultAtoms :: Monad m => DebT m () -- | These are the instances of debian names changing that I know about. I -- know they really shouldn't be hard coded. Send a patch. Note that this -- inherits the lack of type safety of the mkPkgName function. (FIXME: -- Use combinators to construct this.) debianVersionSplits :: Map PackageName VersionSplits module Debian.Debianize.Types -- | Set how much progress messages get generated. verbosity :: Lens Atoms Int -- | Don't write anything, just output a description of what would have -- happened dryRun :: Lens Atoms Bool -- | Debianize, SubstVars, or Usage. I'm no longer sure what SubstVars -- does, but someone may still be using it. debAction :: Lens Atoms DebAction -- | Cabal flag assignments to use when loading the cabal file. cabalFlagAssignments :: Lens Atoms (Set (FlagName, Bool)) -- | The result of loading a .cabal file packageDescription :: Lens Atoms (Maybe PackageDescription) -- | Map from cabal Build-Tool names to debian binary package names. execMap :: Lens Atoms (Map String Relations) -- | Map of Debian epoch numbers assigned to cabal packages. epochMap :: Lens Atoms (Map PackageName Int) -- | List if packages that should be omitted from any dependency list - -- e.g. a profiling package missing due to use of noProfilingPackage lens -- elsewhere. missingDependencies :: Lens Atoms (Set BinPkgName) -- | Map from cabal Extra-Lib names to debian binary package names. extraLibMap :: Lens Atoms (Map String Relations) -- | Map from cabal version number ranges to debian package names. This is -- a result of the fact that only one version of a debian package can be -- installed at a given time, while multiple versions of a cabal package -- can. debianNameMap :: Lens Atoms (Map PackageName VersionSplits) -- | Override the debian source package name constructed from the cabal -- name sourcePackageName :: Lens Atoms (Maybe SrcPkgName) -- | Revision string used in constructing the debian verison number from -- the cabal version revision :: Lens Atoms (Maybe String) -- | Exact debian version number, overrides the version generated from the -- cabal version debVersion :: Lens Atoms (Maybe DebianVersion) -- | Maintainer field. Overrides any value found in the cabal file, or in -- the DEBIANMAINTAINER environment variable. -- http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Maintainer maintainer :: Lens Atoms (Maybe NameAddr) -- | The copyright information from the cabal file copyright :: Lens Atoms (Maybe Text) -- | The license information from the cabal file license :: Lens Atoms (Maybe License) -- | The value in the cabal file's license-file field licenseFile :: Lens Atoms (Maybe Text) -- | The architectures supported by this source package - Any, -- All, or some list of specific architectures. sourceArchitectures :: Lens Atoms (Maybe PackageArchitectures) -- | The source package priority - -- http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Priority sourcePriority :: Lens Atoms (Maybe PackagePriority) -- | The source package's section assignment - -- http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Section sourceSection :: Lens Atoms (Maybe Section) -- | The debian/compat file, contains the minimum compatible -- version of the debhelper package. If not given the version -- number of the installed debhelper package is used. compat :: Lens Atoms (Maybe Int) -- | The debian/source/format file. sourceFormat :: Lens Atoms (Maybe SourceFormat) -- | the debian/changelog file changelog :: Lens Atoms (Maybe ChangeLog) -- | Comment entries for the latest changelog entry (DebLogComments -- [[Text]]) comments :: Lens Atoms (Maybe [[Text]]) standardsVersion :: Lens Atoms (Maybe StandardsVersion) -- | The beginning of the rules file rulesHead :: Lens Atoms (Maybe Text) -- | Additional fragments of the rules file rulesFragments :: Lens Atoms (Set Text) -- | Set this to omit the prof library deb. noProfilingLibrary :: Lens Atoms Bool -- | Set this to omit the hoogle documentation link noHoogle :: Lens Atoms Bool -- | Set this to omit the doc library deb. noDocumentationLibrary :: Lens Atoms Bool -- | Override the package name used to hold left over data files and -- executables. Usually only one package is specified, but if more then -- one are they will each receive the same list of files. utilsPackageNames :: Lens Atoms (Set BinPkgName) -- | The build directory. This can be set by an argument to the -- Setup script. When Setup is run manually it is just -- dist, when it is run by dpkg-buildpackage the -- compiler name is appended, so it is typically dist-ghc. -- Cabal-debian needs the correct value of buildDir to find the build -- results. buildDir :: Lens Atoms (Set FilePath) -- | the debian/watch file watch :: Lens Atoms (Maybe Text) -- | Set this to filter any less-than dependencies out of the generated -- debian dependencies. (Not sure if this is implemented.) omitLTDeps :: Lens Atoms Bool -- | The architectures supported by a binary package binaryArchitectures :: BinPkgName -> Lens Atoms (Maybe PackageArchitectures) -- | Create a package to hold a cabal executable executable :: Lens Atoms (Map BinPkgName InstallFile) -- | Create a package for a server serverInfo :: Lens Atoms (Map BinPkgName Server) -- | Create a package for a website website :: Lens Atoms (Map BinPkgName Site) -- | Create a package for a timed backup script backups :: Lens Atoms (Map BinPkgName String) -- | Create an apache configuration file with the given (domain, logdir, -- filetext). This is called when expanding the result of the website -- lens above. apacheSite :: Lens Atoms (Map BinPkgName (String, FilePath, Text)) -- | Extra install dependencies for the devel library. Redundant with -- depends, but kept for backwards compatibility. Also, I think maybe -- this is or was needed because it can be set before the exact name of -- the library package is known. extraDevDeps :: Lens Atoms Relations -- | Map of debian/postinst scripts postInst :: Lens Atoms (Map BinPkgName Text) -- | Map of debian/postrm scripts postRm :: Lens Atoms (Map BinPkgName Text) -- | Map of debian/preinst scripts preInst :: Lens Atoms (Map BinPkgName Text) -- | Map of debian/prerm scripts preRm :: Lens Atoms (Map BinPkgName Text) -- | Map of the binary package priorities (FIXME: redundant with -- BinaryDebDescription) binaryPriority :: BinPkgName -> Lens Atoms (Maybe PackagePriority) -- | Map of the binary deb section assignments (FIXME: redundant with -- BinaryDebDescription) binarySection :: BinPkgName -> Lens Atoms (Maybe Section) -- | Create an etcinit.d file in the package FIXME: change signature -- to BinPkgName -> Lens Atoms Text installInit :: Lens Atoms (Map BinPkgName Text) -- | Lens onto one of several PackageType values of which we have -- specific knowledge how to package. packageType :: BinPkgName -> Lens Atoms (Maybe PackageType) -- | Lens into the description field of a BinaryDebDescription. debianDescription :: BinPkgName -> Lens Atoms (Maybe Text) -- | -- http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Essential essential :: BinPkgName -> Lens Atoms (Maybe Bool) -- | -- http://www.debian.org/doc/debian-policy/ch-controlfields.html#s5.6.10 -- relations :: BinPkgName -> Lens Atoms B.PackageRelations relations -- b = B.relations . binaryDebDescription b -- -- The Depends: relations for each binary deb - -- http://www.debian.org/doc/debian-policy/ch-controlfields.html#s5.6.10 depends :: BinPkgName -> Lens Atoms Relations -- | The Recommends: relations for each binary deb - -- http://www.debian.org/doc/debian-policy/ch-controlfields.html#s5.6.10 recommends :: BinPkgName -> Lens Atoms Relations -- | The Suggests: relations for each binary deb - -- http://www.debian.org/doc/debian-policy/ch-controlfields.html#s5.6.10 suggests :: BinPkgName -> Lens Atoms Relations -- | The Pre-Depends: relations for each binary deb - -- http://www.debian.org/doc/debian-policy/ch-controlfields.html#s5.6.10 preDepends :: BinPkgName -> Lens Atoms Relations -- | The Breaks: relations for each binary deb - -- http://www.debian.org/doc/debian-policy/ch-controlfields.html#s5.6.10 breaks :: BinPkgName -> Lens Atoms Relations -- | The Conflicts: relations for each binary deb - -- http://www.debian.org/doc/debian-policy/ch-controlfields.html#s5.6.10 conflicts :: BinPkgName -> Lens Atoms Relations -- | The Provides: relations for each binary deb - -- http://www.debian.org/doc/debian-policy/ch-controlfields.html#s5.6.10 provides :: BinPkgName -> Lens Atoms Relations -- | The Replaces: relations for each binary deb - -- http://www.debian.org/doc/debian-policy/ch-controlfields.html#s5.6.10 replaces :: BinPkgName -> Lens Atoms Relations -- | THe Built-Using: relations for each binary deb - -- http://www.debian.org/doc/debian-policy/ch-controlfields.html#s5.6.10 builtUsing :: BinPkgName -> Lens Atoms Relations -- | Add entries to a binary deb's debian/foo.links file. link :: Lens Atoms (Map BinPkgName (Set (FilePath, FilePath))) -- | Install files into directories by adding entries to the binary deb's -- debian/foo.install file. install :: Lens Atoms (Map BinPkgName (Set (FilePath, FilePath))) -- | Rename and install files. This is done by adding rules to -- debian/rules. installTo :: Lens Atoms (Map BinPkgName (Set (FilePath, FilePath))) -- | Install files into the a binary deb's data directory, -- usrshare/packagename-version. This expands to either an install -- or an installTo. installData :: Lens Atoms (Map BinPkgName (Set (FilePath, FilePath))) -- | Create a file in the binary deb with the given text. This is done by -- writing the file into the cabalInstall directory and adding an entry -- to the binary deb's .install file. file :: Lens Atoms (Map BinPkgName (Set (FilePath, Text))) -- | Create directories in the package FIXME: change signature to -- BinPkgName -> Lens Atoms (Set FilePath) installDir :: Lens Atoms (Map BinPkgName (Set FilePath)) -- | Add a stanza to the binary package's logrotate script. logrotateStanza :: Lens Atoms (Map BinPkgName (Set Text)) -- | Install a cabal executable into a binary deb. FIXME: change signature -- to BinPkgName -> Lens Atoms (Set (String, FilePath)) installCabalExec :: Lens Atoms (Map BinPkgName (Set (String, FilePath))) -- | Rename and install a cabal executable FIXME: change signature to -- BinPkgName -> Lens Atoms (Set (String, FilePath)) installCabalExecTo :: Lens Atoms (Map BinPkgName (Set (String, FilePath))) -- | Obsolete record containing verbosity, dryRun, validate, and debAction. flags :: Lens Atoms Flags -- | Make sure the version number and package names of the supplied and -- generated debianizations match. validate :: Lens Atoms Bool -- | Unused warning :: Lens Atoms (Set Text) -- | Create a file in the debianization. This is used to implement the file -- lens above. FIXME: change signature to BinPkgName -> Lens Atoms -- (Set (FilePath, Text)) intermediateFiles :: Lens Atoms (Set (FilePath, Text)) -- | No longer sure what the purpose of this lens is. packageInfo :: Lens Atoms (Map PackageName PackageInfo) -- | The debian/control file. Many of the following lenses access -- parts of the SourceDebDescription. control :: Lens Atoms SourceDebDescription -- | -- http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Source source :: Lens Atoms (Maybe SrcPkgName) -- | -- http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Changed-By changedBy :: Lens Atoms (Maybe NameAddr) -- | -- http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Uploaders uploaders :: Lens Atoms ([NameAddr]) -- | Obsolete - -- http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-DM-Upload-Allowed dmUploadAllowed :: Lens Atoms (Bool) -- | -- http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Homepage homepage :: Lens Atoms (Maybe Text) -- | Version control system field - -- http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-VCS-fields vcsFields :: Lens Atoms (Set VersionControlSpec) -- | User defined fields - -- http://www.debian.org/doc/debian-policy/ch-controlfields.html#s5.7 xFields :: Lens Atoms (Set XField) -- | -- http://www.debian.org/doc/debian-policy/ch-relationships.html#s-sourcebinarydeps buildDepends :: Lens Atoms Relations -- | -- http://www.debian.org/doc/debian-policy/ch-relationships.html#s-sourcebinarydeps buildConflicts :: Lens Atoms Relations -- | -- http://www.debian.org/doc/debian-policy/ch-relationships.html#s-sourcebinarydeps buildDependsIndep :: Lens Atoms Relations -- | -- http://www.debian.org/doc/debian-policy/ch-relationships.html#s-sourcebinarydeps buildConflictsIndep :: Lens Atoms Relations binaryPackages :: Lens Atoms [BinaryDebDescription] -- | Things that seem like they could be clients of this library, but are -- instead included as part of the library. module Debian.Debianize.Goodies -- | Create equals dependencies. For each pair (A, B), use dpkg-query to -- find out B's version number, version B. Then write a rule into P's -- .substvar that makes P require that that exact version of A, and -- another that makes P conflict with any older version of A. tightDependencyFixup :: Monad m => [(BinPkgName, BinPkgName)] -> BinPkgName -> DebT m () -- | Add a debian binary package to the debianization containing a cabal -- executable file set up to be a server. doServer :: Monad m => BinPkgName -> Server -> DebT m () -- | Add a debian binary package to the debianization containing a cabal -- executable file set up to be a web site. doWebsite :: Monad m => BinPkgName -> Site -> DebT m () -- | Add a debian binary package to the debianization containing a cabal -- executable file set up to be a backup script. doBackups :: Monad m => BinPkgName -> String -> DebT m () -- | Add a debian binary package to the debianization containing a cabal -- executable file. doExecutable :: Monad m => BinPkgName -> InstallFile -> DebT m () describe :: Monad m => BinPkgName -> DebT m Text watchAtom :: PackageName -> Text oldClckwrksSiteFlags :: Site -> [String] oldClckwrksServerFlags :: Server -> [String] siteAtoms :: BinPkgName -> Site -> Atoms -> Atoms serverAtoms :: BinPkgName -> Server -> Bool -> Atoms -> Atoms backupAtoms :: BinPkgName -> String -> Atoms -> Atoms execAtoms :: BinPkgName -> InstallFile -> Atoms -> Atoms -- | Build a suitable value for the head of the rules file. makeRulesHead :: Monad m => DebT m Text -- | Convert a Debianization into a list of files that can then be written -- out. module Debian.Debianize.Files -- | 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 considering -- building one into the other, but it is handy to look at the -- Debianization produced by finalizeDebianization in the unit tests.) debianizationFileMap :: (Monad m, Functor m) => DebT m (Map FilePath Text) -- | Read an existing Debianization from a directory file. module Debian.Debianize.Input inputDebianization :: MonadIO m => EnvSet -> DebT m () -- | Try to input a file and if successful add it to the debianization. inputDebianizationFile :: MonadIO m => FilePath -> DebT m () inputChangeLog :: MonadIO m => DebT m () inputCabalization :: (MonadIO m, Functor m) => DebT m () inputCabalization' :: Verbosity -> Set (FlagName, Bool) -> CompilerId -> IO (Either [Dependency] PackageDescription) -- | Try to compute a string for the the debian Maintainer: field -- using, in this order 1. the maintainer explicitly specified using -- Debian.Debianize.Monad.maintainer 2. the maintainer field of -- the cabal package, 3. the value returned by getDebianMaintainer, which -- looks in several environment variables, 4. the signature from the -- latest entry in debian/changelog, 5. the Debian Haskell Group, -- pkg-haskell-maintainers@lists.alioth.debian.org inputMaintainer :: MonadIO m => DebT m () -- | Compute the Cabal data directory for a Linux install from a Cabal -- package description. This needs to match the path cabal assigns to -- datadir in the distbuildautogen/Paths_packagename.hs module, or -- perhaps the path in the cabal_debian_datadir environment variable. dataDir :: PackageDescription -> FilePath -- | Support for generating Debianization from Cabal data. module Debian.Debianize.SubstVars -- | Expand the contents of the .substvars file for a library package. Each -- cabal package corresponds to a directory name-version, -- either in usrlib or in -- usrlibhaskell-packagesghc/lib. In that directory is a -- compiler subdirectory such as ghc-6.8.2. In the ghc subdirectory is -- one or two library files of the form libHSname-version.a -- and libHSname-version_p.a. We can determine the debian -- package names by running dpkg -S on these names, or examining the -- varlibdpkginfo/*.list files. From these we can determine -- the source package name, and from that the documentation package name. substvars :: (MonadIO m, Functor m) => DebType -> DebT m () instance Eq Dependency_ instance Show Dependency_ module Debian.Debianize.Options -- | Options that modify other atoms. options :: MonadIO m => [OptDescr (DebT m ())] compileArgs :: MonadIO m => [String] -> DebT m () compileEnvironmentArgs :: MonadIO m => DebT m () compileCommandlineArgs :: MonadIO m => DebT m () -- | Insert a value for CABALDEBIAN into the environment that the -- withEnvironment* functions above will find and use. E.g. -- putEnvironmentFlags [--dry-run, --validate] (debianize -- defaultFlags) putEnvironmentArgs :: [String] -> IO () -- | Read a value out of the CABALDEBIAN environment variable which is the -- result of applying show to a [String]. withEnvironmentArgs :: MonadIO m => ([String] -> DebT m a) -> DebT m a -- | Compute the debianization of a cabal package. module Debian.Debianize.BuildDependencies debianBuildDeps :: MonadIO m => PackageDescription -> DebT m Relations debianBuildDepsIndep :: MonadIO m => PackageDescription -> DebT m Relations instance Eq Dependency_ instance Show Dependency_ instance Show a => Show (Rels a) -- | Compute the debianization of a cabal package. module Debian.Debianize.Finalize -- | Given an Atoms value, get any additional configuration information -- from the environment, read the cabal package description and possibly -- the debian/changelog file, then generate and return the new -- debianization (along with the data directory computed from the cabal -- package description.) debianization :: (MonadIO m, Functor m) => DebT m () -> DebT m () -> DebT m () -- | Do some light IO and call finalizeDebianization. finalizeDebianization' :: (MonadIO m, Functor m) => DebT m () instance Eq Dependency_ instance Show Dependency_ module Data.Algorithm.Diff.Pretty -- | 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 module Data.Algorithm.Diff.Context -- | Do a grouped diff and then turn it into a list of hunks, where each -- hunk is a grouped diff with at most N elements of common context -- around each one. contextDiff :: Eq a => Int -> [a] -> [a] -> [[Diff [a]]] -- | Group the elements whose adjacent pairs satisfy the predicate. Differs -- from groupBy because the predicate does not have to define a total -- ordering. groups :: Eq a => (a -> a -> Bool) -> [a] -> [[a]] -- | Wrappers around the debianization function to perform various tasks - -- output, describe, validate a debianization, run an external script to -- produce a debianization. module Debian.Debianize.Output -- | Depending on the options in atoms, either validate, describe, -- or write the generated debianization. doDebianizeAction :: (MonadIO m, Functor m) => EnvSet -> DebT m () -- | Run the script in debian/Debianize.hs with the given command -- line arguments. Returns True if the script exists and -- succeeds. In this case it may be assumed that a debianization was -- created (or updated) in the debian subdirectory of the current -- directory. In this way we can include a script in a package to produce -- a customized debianization more sophisticated than the one that would -- be produced by the cabal-debian executable. An example is included in -- the debian subdirectory of this library. runDebianizeScript :: [String] -> IO Bool -- | Write the files of the debianization d to ./debian writeDebianization :: (MonadIO m, Functor m) => DebT m () -- | Return a string describing the debianization - a list of file names -- and their contents in a somewhat human readable format. describeDebianization :: (MonadIO m, Functor m) => DebT m String -- | Compare the old and new debianizations, returning a string describing -- the differences. compareDebianization :: Atoms -> Atoms -> IO String -- | Make sure the new debianization matches the existing debianization in -- several ways - specifically, version number, and the names of the -- source and binary packages. Some debian packages come with a skeleton -- debianization that needs to be filled in, this can be used to make -- sure the debianization we produce is usable. validateDebianization :: Atoms -> Atoms -> () -- | -- -- You can either run the cabal-debian --debianize, or for more -- power and flexibility you can put a Debianize.hs script in -- the package's debian subdirectory. Atoms value and -- pass it to the debianize function. The callDebianize -- function retrieves extra arguments from the CABALDEBIAN -- environment variable and calls debianize with the build -- directory set as it would be when the packages is built by -- dpkg-buildpackage. -- -- To see what your debianization would produce, or how it differs from -- the debianization already present: -- --
--   % cabal-debian --debianize -n
--   
-- -- This is equivalent to the library call -- --
--   % ghc -e 'Debian.Debianize.callDebianize ["-n"]'
--   
-- -- To actually create the debianization and then build the debs, -- --
--   % ghc -e 'Debian.Debianize.callDebianize []'
--   % sudo dpkg-buildpackage
--   
-- -- At this point you may need to modify Cabal.defaultFlags to achieve -- specific packaging goals. Create a module for this in -- debian/Debianize.hs: -- --
--   import Data.Lens.Lazy
--   import Data.Map as Map (insertWith)
--   import Data.Set as Set (union, singleton)
--   import Debian.Relation (BinPkgName(BinPkgName), Relation(Rel))
--   import Debian.Debianize (defaultAtoms, depends, debianization, writeDebianization)
--   main = debianization "." defaultAtoms >>=
--          return . modL depends (insertWith union (BinPkgName "cabal-debian") (singleton (Rel (BinPkgName "debian-policy") Nothing Nothing))) >>=
--          writeDebianization "."
--   
-- -- Then to test it, -- --
--   % CABALDEBIAN='["-n"]' runhaskell debian/Debianize.hs
--   
-- -- or equivalently -- --
--   % ghc -e 'Debian.Debianize.runDebianize ["-n"]'
--   
-- -- and to run it for real: -- --
--   % runhaskell debian/Debianize.hs
--   
-- -- -- -- The three phases of the operation of the system are Input -> -- Finalization -> Output. -- -- -- -- There is also a high level function to run a script that runs this -- entire pipeline when it finds from a script found in a -- debian/Debianize.hs file. module Debian.Debianize -- | Given an Atoms value, get any additional configuration information -- from the environment, read the cabal package description and possibly -- the debian/changelog file, then generate and return the new -- debianization (along with the data directory computed from the cabal -- package description.) debianization :: (MonadIO m, Functor m) => DebT m () -> DebT m () -> DebT m () -- | Depending on the options in atoms, either validate, describe, -- or write the generated debianization. doDebianizeAction :: (MonadIO m, Functor m) => EnvSet -> DebT m () -- | Run the script in debian/Debianize.hs with the given command -- line arguments. Returns True if the script exists and -- succeeds. In this case it may be assumed that a debianization was -- created (or updated) in the debian subdirectory of the current -- directory. In this way we can include a script in a package to produce -- a customized debianization more sophisticated than the one that would -- be produced by the cabal-debian executable. An example is included in -- the debian subdirectory of this library. runDebianizeScript :: [String] -> IO Bool -- | Write the files of the debianization d to ./debian writeDebianization :: (MonadIO m, Functor m) => DebT m () -- | Return a string describing the debianization - a list of file names -- and their contents in a somewhat human readable format. describeDebianization :: (MonadIO m, Functor m) => DebT m String -- | Compare the old and new debianizations, returning a string describing -- the differences. compareDebianization :: Atoms -> Atoms -> IO String -- | Make sure the new debianization matches the existing debianization in -- several ways - specifically, version number, and the names of the -- source and binary packages. Some debian packages come with a skeleton -- debianization that needs to be filled in, this can be used to make -- sure the debianization we produce is usable. validateDebianization :: Atoms -> Atoms -> () -- | Some details about the debian repository - special cases for how some -- cabal packages are mapped to debian package names. debianDefaultAtoms :: Monad m => DebT m () -- | Create equals dependencies. For each pair (A, B), use dpkg-query to -- find out B's version number, version B. Then write a rule into P's -- .substvar that makes P require that that exact version of A, and -- another that makes P conflict with any older version of A. tightDependencyFixup :: Monad m => [(BinPkgName, BinPkgName)] -> BinPkgName -> DebT m () -- | Add a debian binary package to the debianization containing a cabal -- executable file. doExecutable :: Monad m => BinPkgName -> InstallFile -> DebT m () -- | Add a debian binary package to the debianization containing a cabal -- executable file set up to be a server. doServer :: Monad m => BinPkgName -> Server -> DebT m () -- | Add a debian binary package to the debianization containing a cabal -- executable file set up to be a web site. doWebsite :: Monad m => BinPkgName -> Site -> DebT m () -- | Add a debian binary package to the debianization containing a cabal -- executable file set up to be a backup script. doBackups :: Monad m => BinPkgName -> String -> DebT m () inputDebianization :: MonadIO m => EnvSet -> DebT m () -- | Try to input a file and if successful add it to the debianization. inputDebianizationFile :: MonadIO m => FilePath -> DebT m () inputChangeLog :: MonadIO m => DebT m () -- | Try to compute a string for the the debian Maintainer: field -- using, in this order 1. the maintainer explicitly specified using -- Debian.Debianize.Monad.maintainer 2. the maintainer field of -- the cabal package, 3. the value returned by getDebianMaintainer, which -- looks in several environment variables, 4. the signature from the -- latest entry in debian/changelog, 5. the Debian Haskell Group, -- pkg-haskell-maintainers@lists.alioth.debian.org inputMaintainer :: MonadIO m => DebT m () type DebT m = StateT Atoms m runDebT :: Monad m => DebT m a -> Atoms -> m (a, Atoms) execDebT :: Monad m => DebT m a -> Atoms -> m Atoms evalDebT :: Monad m => DebT m a -> Atoms -> m a type DebM = State Atoms runDebM :: DebM a -> Atoms -> (a, Atoms) execDebM :: DebM a -> Atoms -> Atoms evalDebM :: DebM a -> Atoms -> a -- | Map all versions of Cabal package pname to Debian package dname. Not -- really a debian package name, but the name of a cabal package that -- maps to the debian package name we want. (Should this be a -- SrcPkgName?) mapCabal :: Monad m => PackageName -> DebBase -> DebT m () -- | Map versions less than ver of Cabal Package pname to Debian package -- ltname splitCabal :: Monad m => PackageName -> DebBase -> Version -> DebT m () compileArgs :: MonadIO m => [String] -> DebT m () -- | Expand the contents of the .substvars file for a library package. Each -- cabal package corresponds to a directory name-version, -- either in usrlib or in -- usrlibhaskell-packagesghc/lib. In that directory is a -- compiler subdirectory such as ghc-6.8.2. In the ghc subdirectory is -- one or two library files of the form libHSname-version.a -- and libHSname-version_p.a. We can determine the debian -- package names by running dpkg -S on these names, or examining the -- varlibdpkginfo/*.list files. From these we can determine -- the source package name, and from that the documentation package name. substvars :: (MonadIO m, Functor m) => DebType -> DebT m () -- | From Darcs.Utils - set the working directory and run an IO operation. withCurrentDirectory :: FilePath -> IO a -> IO a -- | Read and parse the status file for installed debian packages: -- varlibdpkgstatus buildDebVersionMap :: IO DebMap -- | Create a map from pathname to the names of the packages that contains -- that pathname using the contents of the debian package info directory -- varlibdpkginfo. dpkgFileMap :: IO (Map FilePath (Set BinPkgName)) -- | Given a path, return the name of the package that owns it. debOfFile :: FilePath -> ReaderT (Map FilePath (Set BinPkgName)) IO (Maybe BinPkgName) -- | Set a lens value. (This is a version of Data.Lens.Lazy.~= that returns -- () instead of b.) (~=) :: Monad m => Lens a b -> b -> StateT a m () -- | Set b if it currently isNothing and the argument isJust, that -- is 1. Nothing happens if the argument isNothing 2. Nothing happens if -- the current value isJust (~?=) :: Monad m => Lens a (Maybe b) -> Maybe b -> StateT a m () -- | Modify a value. (This is a version of Data.Lens.Lazy.%= that returns -- () instead of a.) (%=) :: Monad m => Lens a b -> (b -> b) -> StateT a m () -- | Insert an element into a (Set b) (+=) :: (Monad m, Ord b) => Lens a (Set b) -> b -> StateT a m () -- | Insert an element into a (Map b c) (++=) :: (Monad m, Ord b) => Lens a (Map b c) -> (b, c) -> StateT a m () -- | Insert an element into a (Map b (Set c)) (+++=) :: (Monad m, Ord b, Monoid c) => Lens a (Map b c) -> (b, c) -> StateT a m ()