{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE PackageImports #-}
{-# LANGUAGE Rank2Types #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TupleSections #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
module Debian.Debianize.Optparse (
  CommandLineOptions(..),
  BehaviorAdjustment,
  Flags(..),
  parseProgramArguments,
  parseProgramArguments',
  handleBehaviorAdjustment) where

import Control.Applicative (many, (<|>))
import Control.Lens
import Control.Monad.State.Class (MonadState)
import Control.Monad.Trans
import Data.Bifunctor (first)
import Data.Char(toUpper)
import Data.Foldable (forM_)
import Data.Maybe.Extended (fromMaybe)
import Data.Maybe.Extended (nothingIf)
import Debian.Debianize.BasicInfo (EnvSet(EnvSet), cleanOS, dependOS, buildOS, Flags(..))
import Debian.Debianize.DebInfo (TestsStatus(..))
import Debian.Debianize.Monad
import Debian.Debianize.Prelude (maybeRead)
import Debian.Debianize.VersionSplits
import Debian.GHC ()
import Debian.Policy
import Debian.Relation
import Debian.Version (DebianVersion, parseDebianVersion')
import Distribution.Compiler (CompilerFlavor(..))
import Distribution.Package (PackageName, mkPackageName, unPackageName)
import Distribution.PackageDescription (FlagName, mkFlagName)
import GHC.Generics
import System.Environment (getArgs)
import System.FilePath(splitFileName, (</>))
import System.Process (showCommandForUser)
import Text.Parsec.Rfc2822 (NameAddr(..))
import Text.PrettyPrint.ANSI.Leijen (linebreak, (<+>), string, indent)
import qualified  Debian.Debianize.DebInfo as D
import qualified Data.Map as Map
import qualified Data.Set as Set
import qualified Debian.Debianize.BinaryDebDescription as B
import qualified Debian.Debianize.CabalInfo as A
import qualified Debian.Debianize.SourceDebDescription as S
import qualified Options.Applicative as O

data HaddockStatus = HaddockEnabled | HaddockDisabled deriving HaddockStatus -> HaddockStatus -> Bool
(HaddockStatus -> HaddockStatus -> Bool)
-> (HaddockStatus -> HaddockStatus -> Bool) -> Eq HaddockStatus
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: HaddockStatus -> HaddockStatus -> Bool
== :: HaddockStatus -> HaddockStatus -> Bool
$c/= :: HaddockStatus -> HaddockStatus -> Bool
/= :: HaddockStatus -> HaddockStatus -> Bool
Eq
data ProfilingStatus = ProfilingEnabled | ProfilingDisabled deriving ProfilingStatus -> ProfilingStatus -> Bool
(ProfilingStatus -> ProfilingStatus -> Bool)
-> (ProfilingStatus -> ProfilingStatus -> Bool)
-> Eq ProfilingStatus
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ProfilingStatus -> ProfilingStatus -> Bool
== :: ProfilingStatus -> ProfilingStatus -> Bool
$c/= :: ProfilingStatus -> ProfilingStatus -> Bool
/= :: ProfilingStatus -> ProfilingStatus -> Bool
Eq
data OfficialStatus = Official | NonOfficial deriving OfficialStatus -> OfficialStatus -> Bool
(OfficialStatus -> OfficialStatus -> Bool)
-> (OfficialStatus -> OfficialStatus -> Bool) -> Eq OfficialStatus
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: OfficialStatus -> OfficialStatus -> Bool
== :: OfficialStatus -> OfficialStatus -> Bool
$c/= :: OfficialStatus -> OfficialStatus -> Bool
/= :: OfficialStatus -> OfficialStatus -> Bool
Eq
newtype BuildDep = BuildDep Relations deriving ((forall x. BuildDep -> Rep BuildDep x)
-> (forall x. Rep BuildDep x -> BuildDep) -> Generic BuildDep
forall x. Rep BuildDep x -> BuildDep
forall x. BuildDep -> Rep BuildDep x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. BuildDep -> Rep BuildDep x
from :: forall x. BuildDep -> Rep BuildDep x
$cto :: forall x. Rep BuildDep x -> BuildDep
to :: forall x. Rep BuildDep x -> BuildDep
Generic, Iso' BuildDep (Unwrapped BuildDep) -> Wrapped BuildDep
forall s. Iso' s (Unwrapped s) -> Wrapped s
Iso' BuildDep (Unwrapped BuildDep)
$c_Wrapped' :: Iso' BuildDep (Unwrapped BuildDep)
_Wrapped' :: Iso' BuildDep (Unwrapped BuildDep)
Wrapped, Rewrapped BuildDep)
newtype BuildDepIndep = BuildDepIndep Relations deriving ((forall x. BuildDepIndep -> Rep BuildDepIndep x)
-> (forall x. Rep BuildDepIndep x -> BuildDepIndep)
-> Generic BuildDepIndep
forall x. Rep BuildDepIndep x -> BuildDepIndep
forall x. BuildDepIndep -> Rep BuildDepIndep x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. BuildDepIndep -> Rep BuildDepIndep x
from :: forall x. BuildDepIndep -> Rep BuildDepIndep x
$cto :: forall x. Rep BuildDepIndep x -> BuildDepIndep
to :: forall x. Rep BuildDepIndep x -> BuildDepIndep
Generic, Iso' BuildDepIndep (Unwrapped BuildDepIndep)
-> Wrapped BuildDepIndep
forall s. Iso' s (Unwrapped s) -> Wrapped s
Iso' BuildDepIndep (Unwrapped BuildDepIndep)
$c_Wrapped' :: Iso' BuildDepIndep (Unwrapped BuildDepIndep)
_Wrapped' :: Iso' BuildDepIndep (Unwrapped BuildDepIndep)
Wrapped, Rewrapped BuildDepIndep)
newtype DevDep = DevDep Relations deriving ((forall x. DevDep -> Rep DevDep x)
-> (forall x. Rep DevDep x -> DevDep) -> Generic DevDep
forall x. Rep DevDep x -> DevDep
forall x. DevDep -> Rep DevDep x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. DevDep -> Rep DevDep x
from :: forall x. DevDep -> Rep DevDep x
$cto :: forall x. Rep DevDep x -> DevDep
to :: forall x. Rep DevDep x -> DevDep
Generic, Iso' DevDep (Unwrapped DevDep) -> Wrapped DevDep
forall s. Iso' s (Unwrapped s) -> Wrapped s
Iso' DevDep (Unwrapped DevDep)
$c_Wrapped' :: Iso' DevDep (Unwrapped DevDep)
_Wrapped' :: Iso' DevDep (Unwrapped DevDep)
Wrapped, Rewrapped DevDep)
newtype ExtraDepends = ExtraDepends (BinPkgName, Relations) deriving ((forall x. ExtraDepends -> Rep ExtraDepends x)
-> (forall x. Rep ExtraDepends x -> ExtraDepends)
-> Generic ExtraDepends
forall x. Rep ExtraDepends x -> ExtraDepends
forall x. ExtraDepends -> Rep ExtraDepends x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. ExtraDepends -> Rep ExtraDepends x
from :: forall x. ExtraDepends -> Rep ExtraDepends x
$cto :: forall x. Rep ExtraDepends x -> ExtraDepends
to :: forall x. Rep ExtraDepends x -> ExtraDepends
Generic, Iso' ExtraDepends (Unwrapped ExtraDepends) -> Wrapped ExtraDepends
forall s. Iso' s (Unwrapped s) -> Wrapped s
Iso' ExtraDepends (Unwrapped ExtraDepends)
$c_Wrapped' :: Iso' ExtraDepends (Unwrapped ExtraDepends)
_Wrapped' :: Iso' ExtraDepends (Unwrapped ExtraDepends)
Wrapped, Rewrapped ExtraDepends)
newtype ExtraConflicts = ExtraConflicts (BinPkgName, Relations) deriving ((forall x. ExtraConflicts -> Rep ExtraConflicts x)
-> (forall x. Rep ExtraConflicts x -> ExtraConflicts)
-> Generic ExtraConflicts
forall x. Rep ExtraConflicts x -> ExtraConflicts
forall x. ExtraConflicts -> Rep ExtraConflicts x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. ExtraConflicts -> Rep ExtraConflicts x
from :: forall x. ExtraConflicts -> Rep ExtraConflicts x
$cto :: forall x. Rep ExtraConflicts x -> ExtraConflicts
to :: forall x. Rep ExtraConflicts x -> ExtraConflicts
Generic, Iso' ExtraConflicts (Unwrapped ExtraConflicts)
-> Wrapped ExtraConflicts
forall s. Iso' s (Unwrapped s) -> Wrapped s
Iso' ExtraConflicts (Unwrapped ExtraConflicts)
$c_Wrapped' :: Iso' ExtraConflicts (Unwrapped ExtraConflicts)
_Wrapped' :: Iso' ExtraConflicts (Unwrapped ExtraConflicts)
Wrapped, Rewrapped ExtraConflicts)
newtype ExtraProvides = ExtraProvides (BinPkgName, Relations) deriving ((forall x. ExtraProvides -> Rep ExtraProvides x)
-> (forall x. Rep ExtraProvides x -> ExtraProvides)
-> Generic ExtraProvides
forall x. Rep ExtraProvides x -> ExtraProvides
forall x. ExtraProvides -> Rep ExtraProvides x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. ExtraProvides -> Rep ExtraProvides x
from :: forall x. ExtraProvides -> Rep ExtraProvides x
$cto :: forall x. Rep ExtraProvides x -> ExtraProvides
to :: forall x. Rep ExtraProvides x -> ExtraProvides
Generic, Iso' ExtraProvides (Unwrapped ExtraProvides)
-> Wrapped ExtraProvides
forall s. Iso' s (Unwrapped s) -> Wrapped s
Iso' ExtraProvides (Unwrapped ExtraProvides)
$c_Wrapped' :: Iso' ExtraProvides (Unwrapped ExtraProvides)
_Wrapped' :: Iso' ExtraProvides (Unwrapped ExtraProvides)
Wrapped, Rewrapped ExtraProvides)
newtype ExtraReplaces = ExtraReplaces (BinPkgName, Relations) deriving ((forall x. ExtraReplaces -> Rep ExtraReplaces x)
-> (forall x. Rep ExtraReplaces x -> ExtraReplaces)
-> Generic ExtraReplaces
forall x. Rep ExtraReplaces x -> ExtraReplaces
forall x. ExtraReplaces -> Rep ExtraReplaces x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. ExtraReplaces -> Rep ExtraReplaces x
from :: forall x. ExtraReplaces -> Rep ExtraReplaces x
$cto :: forall x. Rep ExtraReplaces x -> ExtraReplaces
to :: forall x. Rep ExtraReplaces x -> ExtraReplaces
Generic, Iso' ExtraReplaces (Unwrapped ExtraReplaces)
-> Wrapped ExtraReplaces
forall s. Iso' s (Unwrapped s) -> Wrapped s
Iso' ExtraReplaces (Unwrapped ExtraReplaces)
$c_Wrapped' :: Iso' ExtraReplaces (Unwrapped ExtraReplaces)
_Wrapped' :: Iso' ExtraReplaces (Unwrapped ExtraReplaces)
Wrapped, Rewrapped ExtraReplaces)
newtype ExtraRecommends = ExtraRecommends (BinPkgName, Relations) deriving ((forall x. ExtraRecommends -> Rep ExtraRecommends x)
-> (forall x. Rep ExtraRecommends x -> ExtraRecommends)
-> Generic ExtraRecommends
forall x. Rep ExtraRecommends x -> ExtraRecommends
forall x. ExtraRecommends -> Rep ExtraRecommends x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. ExtraRecommends -> Rep ExtraRecommends x
from :: forall x. ExtraRecommends -> Rep ExtraRecommends x
$cto :: forall x. Rep ExtraRecommends x -> ExtraRecommends
to :: forall x. Rep ExtraRecommends x -> ExtraRecommends
Generic, Iso' ExtraRecommends (Unwrapped ExtraRecommends)
-> Wrapped ExtraRecommends
forall s. Iso' s (Unwrapped s) -> Wrapped s
Iso' ExtraRecommends (Unwrapped ExtraRecommends)
$c_Wrapped' :: Iso' ExtraRecommends (Unwrapped ExtraRecommends)
_Wrapped' :: Iso' ExtraRecommends (Unwrapped ExtraRecommends)
Wrapped, Rewrapped ExtraRecommends)
newtype ExtraSuggests = ExtraSuggests (BinPkgName, Relations) deriving ((forall x. ExtraSuggests -> Rep ExtraSuggests x)
-> (forall x. Rep ExtraSuggests x -> ExtraSuggests)
-> Generic ExtraSuggests
forall x. Rep ExtraSuggests x -> ExtraSuggests
forall x. ExtraSuggests -> Rep ExtraSuggests x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. ExtraSuggests -> Rep ExtraSuggests x
from :: forall x. ExtraSuggests -> Rep ExtraSuggests x
$cto :: forall x. Rep ExtraSuggests x -> ExtraSuggests
to :: forall x. Rep ExtraSuggests x -> ExtraSuggests
Generic, Iso' ExtraSuggests (Unwrapped ExtraSuggests)
-> Wrapped ExtraSuggests
forall s. Iso' s (Unwrapped s) -> Wrapped s
Iso' ExtraSuggests (Unwrapped ExtraSuggests)
$c_Wrapped' :: Iso' ExtraSuggests (Unwrapped ExtraSuggests)
_Wrapped' :: Iso' ExtraSuggests (Unwrapped ExtraSuggests)
Wrapped, Rewrapped ExtraSuggests)
newtype CabalDebMapping = CabalDebMapping (PackageName, Relations) deriving ((forall x. CabalDebMapping -> Rep CabalDebMapping x)
-> (forall x. Rep CabalDebMapping x -> CabalDebMapping)
-> Generic CabalDebMapping
forall x. Rep CabalDebMapping x -> CabalDebMapping
forall x. CabalDebMapping -> Rep CabalDebMapping x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. CabalDebMapping -> Rep CabalDebMapping x
from :: forall x. CabalDebMapping -> Rep CabalDebMapping x
$cto :: forall x. Rep CabalDebMapping x -> CabalDebMapping
to :: forall x. Rep CabalDebMapping x -> CabalDebMapping
Generic, Iso' CabalDebMapping (Unwrapped CabalDebMapping)
-> Wrapped CabalDebMapping
forall s. Iso' s (Unwrapped s) -> Wrapped s
Iso' CabalDebMapping (Unwrapped CabalDebMapping)
$c_Wrapped' :: Iso' CabalDebMapping (Unwrapped CabalDebMapping)
_Wrapped' :: Iso' CabalDebMapping (Unwrapped CabalDebMapping)
Wrapped)
newtype ExecDebMapping = ExecDebMapping (String, Relations) deriving ((forall x. ExecDebMapping -> Rep ExecDebMapping x)
-> (forall x. Rep ExecDebMapping x -> ExecDebMapping)
-> Generic ExecDebMapping
forall x. Rep ExecDebMapping x -> ExecDebMapping
forall x. ExecDebMapping -> Rep ExecDebMapping x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. ExecDebMapping -> Rep ExecDebMapping x
from :: forall x. ExecDebMapping -> Rep ExecDebMapping x
$cto :: forall x. Rep ExecDebMapping x -> ExecDebMapping
to :: forall x. Rep ExecDebMapping x -> ExecDebMapping
Generic, Iso' ExecDebMapping (Unwrapped ExecDebMapping)
-> Wrapped ExecDebMapping
forall s. Iso' s (Unwrapped s) -> Wrapped s
Iso' ExecDebMapping (Unwrapped ExecDebMapping)
$c_Wrapped' :: Iso' ExecDebMapping (Unwrapped ExecDebMapping)
_Wrapped' :: Iso' ExecDebMapping (Unwrapped ExecDebMapping)
Wrapped, Rewrapped ExecDebMapping)
newtype Revision = Revision String deriving ((forall x. Revision -> Rep Revision x)
-> (forall x. Rep Revision x -> Revision) -> Generic Revision
forall x. Rep Revision x -> Revision
forall x. Revision -> Rep Revision x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. Revision -> Rep Revision x
from :: forall x. Revision -> Rep Revision x
$cto :: forall x. Rep Revision x -> Revision
to :: forall x. Rep Revision x -> Revision
Generic, Iso' Revision (Unwrapped Revision) -> Wrapped Revision
forall s. Iso' s (Unwrapped s) -> Wrapped s
Iso' Revision (Unwrapped Revision)
$c_Wrapped' :: Iso' Revision (Unwrapped Revision)
_Wrapped' :: Iso' Revision (Unwrapped Revision)
Wrapped, Rewrapped Revision)
newtype CabalEpochMapping = CabalEpochMapping (PackageName, Int) deriving ((forall x. CabalEpochMapping -> Rep CabalEpochMapping x)
-> (forall x. Rep CabalEpochMapping x -> CabalEpochMapping)
-> Generic CabalEpochMapping
forall x. Rep CabalEpochMapping x -> CabalEpochMapping
forall x. CabalEpochMapping -> Rep CabalEpochMapping x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. CabalEpochMapping -> Rep CabalEpochMapping x
from :: forall x. CabalEpochMapping -> Rep CabalEpochMapping x
$cto :: forall x. Rep CabalEpochMapping x -> CabalEpochMapping
to :: forall x. Rep CabalEpochMapping x -> CabalEpochMapping
Generic, Iso' CabalEpochMapping (Unwrapped CabalEpochMapping)
-> Wrapped CabalEpochMapping
forall s. Iso' s (Unwrapped s) -> Wrapped s
Iso' CabalEpochMapping (Unwrapped CabalEpochMapping)
$c_Wrapped' :: Iso' CabalEpochMapping (Unwrapped CabalEpochMapping)
_Wrapped' :: Iso' CabalEpochMapping (Unwrapped CabalEpochMapping)
Wrapped)
newtype CabalFlagMapping = CabalFlagMapping (FlagName, Bool) deriving ((forall x. CabalFlagMapping -> Rep CabalFlagMapping x)
-> (forall x. Rep CabalFlagMapping x -> CabalFlagMapping)
-> Generic CabalFlagMapping
forall x. Rep CabalFlagMapping x -> CabalFlagMapping
forall x. CabalFlagMapping -> Rep CabalFlagMapping x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. CabalFlagMapping -> Rep CabalFlagMapping x
from :: forall x. CabalFlagMapping -> Rep CabalFlagMapping x
$cto :: forall x. Rep CabalFlagMapping x -> CabalFlagMapping
to :: forall x. Rep CabalFlagMapping x -> CabalFlagMapping
Generic, Iso' CabalFlagMapping (Unwrapped CabalFlagMapping)
-> Wrapped CabalFlagMapping
forall s. Iso' s (Unwrapped s) -> Wrapped s
Iso' CabalFlagMapping (Unwrapped CabalFlagMapping)
$c_Wrapped' :: Iso' CabalFlagMapping (Unwrapped CabalFlagMapping)
_Wrapped' :: Iso' CabalFlagMapping (Unwrapped CabalFlagMapping)
Wrapped)

-- | This data type is an abomination. It represent information,
-- provided on command line. Part of such information provides
-- means to create initial 'CabalT' state and is stored in
-- '_flags' field. See 'newCabalInfo'.
--
-- Other, much greater part represent changes to already created
-- state. They are stored in '_adjustment' field.
--
-- All this can be understood from (simplified) types:
--
-- > type CabalT m a = StateT CabalInfo m a
-- > newCabalInfo :: Flags -> IO CabalInfo
-- > handleBehaviorAdjustment :: BehaviorAdjustment -> CabalT IO ()

data CommandLineOptions = CommandLineOptions {
  CommandLineOptions -> Flags
_flags :: Flags,
  CommandLineOptions -> BehaviorAdjustment
_adjustment :: BehaviorAdjustment
}
-- | This data type represents changes to 'CabalT' state,
-- requested at command line.
data BehaviorAdjustment = BehaviorAdjustment {
  BehaviorAdjustment -> NameAddr
_maintainer        :: NameAddr,
  BehaviorAdjustment -> [NameAddr]
_uploaders         :: [NameAddr],
  BehaviorAdjustment -> [(BinPkgName, InstallFile)]
_executable        :: [(BinPkgName, D.InstallFile)],
  BehaviorAdjustment -> Maybe FilePath
_defaultPackage    :: Maybe String,
  BehaviorAdjustment -> [BinPkgName]
_missingDependency :: [BinPkgName],
  BehaviorAdjustment -> Maybe DebBase
_debianNameBase    :: Maybe DebBase,
  BehaviorAdjustment -> Maybe DebianVersion
_debianVersion     :: Maybe DebianVersion,
  BehaviorAdjustment -> Maybe Revision
_revision          :: Maybe Revision,
  BehaviorAdjustment -> Maybe SrcPkgName
_sourcePackageName :: Maybe SrcPkgName,
  BehaviorAdjustment -> Section
_sourceSection     :: Section,
  BehaviorAdjustment -> StandardsVersion
_standardsVersion  :: StandardsVersion,
  BehaviorAdjustment -> [BuildDep]
_buildDep          :: [BuildDep],
  BehaviorAdjustment -> [BuildDepIndep]
_buildDepIndep     :: [BuildDepIndep],
  BehaviorAdjustment -> [DevDep]
_devDep            :: [DevDep],
  BehaviorAdjustment -> [ExtraDepends]
_extraDepends      :: [ExtraDepends],
  BehaviorAdjustment -> [ExtraConflicts]
_extraConflicts    :: [ExtraConflicts],
  BehaviorAdjustment -> [ExtraProvides]
_extraProvides     :: [ExtraProvides],
  BehaviorAdjustment -> [ExtraReplaces]
_extraReplaces     :: [ExtraReplaces],
  BehaviorAdjustment -> [ExtraRecommends]
_extraRecommends   :: [ExtraRecommends],
  BehaviorAdjustment -> [ExtraSuggests]
_extraSuggests     :: [ExtraSuggests],
  BehaviorAdjustment -> [CabalDebMapping]
_cabalDebMapping   :: [CabalDebMapping],
  BehaviorAdjustment -> [CabalEpochMapping]
_cabalEpochMapping :: [CabalEpochMapping],
  BehaviorAdjustment -> [ExecDebMapping]
_execDebMapping    :: [ExecDebMapping],
  BehaviorAdjustment -> ProfilingStatus
_profiling         :: ProfilingStatus,
  BehaviorAdjustment -> [HaddockStatus]
_haddock           :: [HaddockStatus],
  BehaviorAdjustment -> OfficialStatus
_official          :: OfficialStatus,
  BehaviorAdjustment -> SourceFormat
_sourceFormat      :: SourceFormat,
  BehaviorAdjustment -> TestsStatus
_tests             :: TestsStatus
}

-- Brief instruction to save you, dear developer from scrutinizing
-- `optparse-applicative` documentation.
--
-- There is two main types in command line parsing.
--
-- 'ReadM' is description how make object from string.
-- For every object of type 'a' with some parsing logic
-- we define auxiliary function with 'R' suffix and
-- type 'ReadM a'.
--
-- 'Parser' is type, containing information about
-- which string in command line should be converted
-- to object. Every field in 'BehaviorAdjustment'
-- and 'Flags' type of type 'b' have corresponding function
-- of type 'Parser' with suffix 'P'.


-- Here are all 'ReadM' values.

executableR :: O.ReadM (BinPkgName, D.InstallFile)
executableR :: ReadM (BinPkgName, InstallFile)
executableR = (FilePath, FilePath) -> (BinPkgName, InstallFile)
parsePair ((FilePath, FilePath) -> (BinPkgName, InstallFile))
-> (FilePath -> (FilePath, FilePath))
-> FilePath
-> (BinPkgName, InstallFile)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Char -> Bool) -> FilePath -> (FilePath, FilePath)
forall a. (a -> Bool) -> [a] -> ([a], [a])
span (Char -> Char -> Bool
forall a. Eq a => a -> a -> Bool
/= Char
':') (FilePath -> (BinPkgName, InstallFile))
-> ReadM FilePath -> ReadM (BinPkgName, InstallFile)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ReadM FilePath
forall s. IsString s => ReadM s
O.str where
  parsePair :: (String, String) -> (BinPkgName, D.InstallFile)
  parsePair :: (FilePath, FilePath) -> (BinPkgName, InstallFile)
parsePair (FilePath
sp, FilePath
md) = let (FilePath
sd, FilePath
name) = FilePath -> (FilePath, FilePath)
splitFileName FilePath
sp in
    (FilePath -> BinPkgName
BinPkgName FilePath
name, D.InstallFile { execName :: FilePath
D.execName  = FilePath
name,
                                      destName :: FilePath
D.destName  = FilePath
name,
                                      sourceDir :: Maybe FilePath
D.sourceDir = (FilePath -> Bool) -> FilePath -> Maybe FilePath
forall a. (a -> Bool) -> a -> Maybe a
nothingIf ( FilePath -> FilePath -> Bool
forall a. Eq a => a -> a -> Bool
== FilePath
"./") FilePath
sd,
                                      destDir :: Maybe FilePath
D.destDir   = case FilePath
md of
                                                      (Char
':' : FilePath
dd) -> FilePath -> Maybe FilePath
forall a. a -> Maybe a
Just FilePath
dd
                                                      FilePath
_          -> Maybe FilePath
forall a. Maybe a
Nothing })

binPkgNameR :: O.ReadM BinPkgName
binPkgNameR :: ReadM BinPkgName
binPkgNameR = FilePath -> BinPkgName
BinPkgName (FilePath -> BinPkgName) -> ReadM FilePath -> ReadM BinPkgName
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ReadM FilePath
forall s. IsString s => ReadM s
O.str

nameAddrR :: O.ReadM NameAddr
nameAddrR :: ReadM NameAddr
nameAddrR = (FilePath -> ReadM NameAddr)
-> (NameAddr -> ReadM NameAddr)
-> Either FilePath NameAddr
-> ReadM NameAddr
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
either FilePath -> ReadM NameAddr
forall a. FilePath -> ReadM a
forall (m :: * -> *) a. MonadFail m => FilePath -> m a
fail NameAddr -> ReadM NameAddr
forall a. a -> ReadM a
forall (m :: * -> *) a. Monad m => a -> m a
return (Either FilePath NameAddr -> ReadM NameAddr)
-> ReadM (Either FilePath NameAddr) -> ReadM NameAddr
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< FilePath -> Either FilePath NameAddr
parseMaintainer (FilePath -> Either FilePath NameAddr)
-> ReadM FilePath -> ReadM (Either FilePath NameAddr)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ReadM FilePath
forall s. IsString s => ReadM s
O.str

relationsR :: O.ReadM Relations
relationsR :: ReadM Relations
relationsR = (ParseError -> ReadM Relations)
-> (Relations -> ReadM Relations)
-> Either ParseError Relations
-> ReadM Relations
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
either (FilePath -> ReadM Relations
forall a. FilePath -> ReadM a
forall (m :: * -> *) a. MonadFail m => FilePath -> m a
fail (FilePath -> ReadM Relations)
-> (ParseError -> FilePath) -> ParseError -> ReadM Relations
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ParseError -> FilePath
forall a. Show a => a -> FilePath
show) Relations -> ReadM Relations
forall a. a -> ReadM a
forall (m :: * -> *) a. Monad m => a -> m a
return (Either ParseError Relations -> ReadM Relations)
-> ReadM (Either ParseError Relations) -> ReadM Relations
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< FilePath -> Either ParseError Relations
forall a. ParseRelations a => a -> Either ParseError Relations
parseRelations (FilePath -> Either ParseError Relations)
-> ReadM FilePath -> ReadM (Either ParseError Relations)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (ReadM FilePath
forall s. IsString s => ReadM s
O.str :: O.ReadM String)

mappingR :: O.ReadM (String, Relations)
mappingR :: ReadM (FilePath, Relations)
mappingR = (Char -> Bool) -> FilePath -> (FilePath, FilePath)
forall a. (a -> Bool) -> [a] -> ([a], [a])
span (Char -> Char -> Bool
forall a. Eq a => a -> a -> Bool
/= Char
':') (FilePath -> (FilePath, FilePath))
-> ReadM FilePath -> ReadM (FilePath, FilePath)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ReadM FilePath
forall s. IsString s => ReadM s
O.str ReadM (FilePath, FilePath)
-> ((FilePath, FilePath) -> ReadM (FilePath, Relations))
-> ReadM (FilePath, Relations)
forall a b. ReadM a -> (a -> ReadM b) -> ReadM b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \case
  (FilePath
str, FilePath
"") -> FilePath -> ReadM (FilePath, Relations)
forall a. FilePath -> ReadM a
forall (m :: * -> *) a. MonadFail m => FilePath -> m a
fail (FilePath -> ReadM (FilePath, Relations))
-> FilePath -> ReadM (FilePath, Relations)
forall a b. (a -> b) -> a -> b
$ FilePath
"Does not contains colon: `" FilePath -> FilePath -> FilePath
forall a. [a] -> [a] -> [a]
++ FilePath
str FilePath -> FilePath -> FilePath
forall a. [a] -> [a] -> [a]
++ FilePath
"'"
  (FilePath
pkgstr, Char
_ : FilePath
relstr) -> do
    Relations
rels <- (ParseError -> ReadM Relations)
-> (Relations -> ReadM Relations)
-> Either ParseError Relations
-> ReadM Relations
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
either (FilePath -> ReadM Relations
forall a. FilePath -> ReadM a
forall (m :: * -> *) a. MonadFail m => FilePath -> m a
fail (FilePath -> ReadM Relations)
-> (ParseError -> FilePath) -> ParseError -> ReadM Relations
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ParseError -> FilePath
forall a. Show a => a -> FilePath
show) Relations -> ReadM Relations
forall a. a -> ReadM a
forall (m :: * -> *) a. Monad m => a -> m a
return (Either ParseError Relations -> ReadM Relations)
-> Either ParseError Relations -> ReadM Relations
forall a b. (a -> b) -> a -> b
$ FilePath -> Either ParseError Relations
forall a. ParseRelations a => a -> Either ParseError Relations
parseRelations FilePath
relstr
    (FilePath, Relations) -> ReadM (FilePath, Relations)
forall a. a -> ReadM a
forall (m :: * -> *) a. Monad m => a -> m a
return (FilePath
pkgstr, Relations
rels)

epochMappingR :: O.ReadM (String, Int)
epochMappingR :: ReadM (FilePath, Int)
epochMappingR = (Char -> Bool) -> FilePath -> (FilePath, FilePath)
forall a. (a -> Bool) -> [a] -> ([a], [a])
span (Char -> Char -> Bool
forall a. Eq a => a -> a -> Bool
/= Char
'=') (FilePath -> (FilePath, FilePath))
-> ReadM FilePath -> ReadM (FilePath, FilePath)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ReadM FilePath
forall s. IsString s => ReadM s
O.str ReadM (FilePath, FilePath)
-> ((FilePath, FilePath) -> ReadM (FilePath, Int))
-> ReadM (FilePath, Int)
forall a b. ReadM a -> (a -> ReadM b) -> ReadM b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \case
  (FilePath
pkgstr, Char
'=' : FilePath
numstr) -> do
    let epoch :: Int
epoch = Int -> Maybe Int -> Int
forall a. a -> Maybe a -> a
fromMaybe (FilePath -> Int
forall a. HasCallStack => FilePath -> a
error (FilePath
"Invalid epoch: " FilePath -> FilePath -> FilePath
forall a. [a] -> [a] -> [a]
++ FilePath
numstr)) (FilePath -> Maybe Int
forall a. Read a => FilePath -> Maybe a
maybeRead FilePath
numstr :: Maybe Int)
    (FilePath, Int) -> ReadM (FilePath, Int)
forall a. a -> ReadM a
forall (m :: * -> *) a. Monad m => a -> m a
return (FilePath
pkgstr, Int
epoch)
  (FilePath
str, FilePath
_) -> FilePath -> ReadM (FilePath, Int)
forall a. FilePath -> ReadM a
forall (m :: * -> *) a. MonadFail m => FilePath -> m a
fail (FilePath -> ReadM (FilePath, Int))
-> FilePath -> ReadM (FilePath, Int)
forall a b. (a -> b) -> a -> b
$ FilePath
"Does not contains equals: `" FilePath -> FilePath -> FilePath
forall a. [a] -> [a] -> [a]
++ FilePath
str FilePath -> FilePath -> FilePath
forall a. [a] -> [a] -> [a]
++ FilePath
"'"

extraRelationsR :: O.ReadM (BinPkgName, Relations)
extraRelationsR :: ReadM (BinPkgName, Relations)
extraRelationsR = (FilePath -> BinPkgName)
-> (FilePath, Relations) -> (BinPkgName, Relations)
forall a b c. (a -> b) -> (a, c) -> (b, c)
forall (p :: * -> * -> *) a b c.
Bifunctor p =>
(a -> b) -> p a c -> p b c
first FilePath -> BinPkgName
BinPkgName ((FilePath, Relations) -> (BinPkgName, Relations))
-> ReadM (FilePath, Relations) -> ReadM (BinPkgName, Relations)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ReadM (FilePath, Relations)
mappingR

cabalDebMappingR :: O.ReadM CabalDebMapping
cabalDebMappingR :: ReadM CabalDebMapping
cabalDebMappingR = (PackageName, Relations) -> CabalDebMapping
CabalDebMapping ((PackageName, Relations) -> CabalDebMapping)
-> ((FilePath, Relations) -> (PackageName, Relations))
-> (FilePath, Relations)
-> CabalDebMapping
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (FilePath -> PackageName)
-> (FilePath, Relations) -> (PackageName, Relations)
forall a b c. (a -> b) -> (a, c) -> (b, c)
forall (p :: * -> * -> *) a b c.
Bifunctor p =>
(a -> b) -> p a c -> p b c
first FilePath -> PackageName
mkPackageName ((FilePath, Relations) -> CabalDebMapping)
-> ReadM (FilePath, Relations) -> ReadM CabalDebMapping
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ReadM (FilePath, Relations)
mappingR

cabalEpochMappingR :: O.ReadM CabalEpochMapping
cabalEpochMappingR :: ReadM CabalEpochMapping
cabalEpochMappingR = (PackageName, Int) -> CabalEpochMapping
CabalEpochMapping ((PackageName, Int) -> CabalEpochMapping)
-> ((FilePath, Int) -> (PackageName, Int))
-> (FilePath, Int)
-> CabalEpochMapping
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (FilePath -> PackageName) -> (FilePath, Int) -> (PackageName, Int)
forall a b c. (a -> b) -> (a, c) -> (b, c)
forall (p :: * -> * -> *) a b c.
Bifunctor p =>
(a -> b) -> p a c -> p b c
first FilePath -> PackageName
mkPackageName ((FilePath, Int) -> CabalEpochMapping)
-> ReadM (FilePath, Int) -> ReadM CabalEpochMapping
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ReadM (FilePath, Int)
epochMappingR

cabalFlagMappingR :: O.ReadM CabalFlagMapping
cabalFlagMappingR :: ReadM CabalFlagMapping
cabalFlagMappingR = ReadM FilePath
forall s. IsString s => ReadM s
O.str ReadM FilePath
-> (FilePath -> ReadM CabalFlagMapping) -> ReadM CabalFlagMapping
forall a b. ReadM a -> (a -> ReadM b) -> ReadM b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \case
  (Char
'-' : FilePath
str) -> CabalFlagMapping -> ReadM CabalFlagMapping
forall a. a -> ReadM a
forall (m :: * -> *) a. Monad m => a -> m a
return (CabalFlagMapping -> ReadM CabalFlagMapping)
-> CabalFlagMapping -> ReadM CabalFlagMapping
forall a b. (a -> b) -> a -> b
$ (FlagName, Bool) -> CabalFlagMapping
CabalFlagMapping (FilePath -> FlagName
mkFlagName FilePath
str, Bool
False)
  FilePath
str -> CabalFlagMapping -> ReadM CabalFlagMapping
forall a. a -> ReadM a
forall (m :: * -> *) a. Monad m => a -> m a
return (CabalFlagMapping -> ReadM CabalFlagMapping)
-> CabalFlagMapping -> ReadM CabalFlagMapping
forall a b. (a -> b) -> a -> b
$ (FlagName, Bool) -> CabalFlagMapping
CabalFlagMapping (FilePath -> FlagName
mkFlagName FilePath
str, Bool
True)

-- Here are parser for BehaviorAdjustment and next are parsers for
-- every field of this data.  Please, keep parsers declarations in
-- same order, as are fields.

behaviorAdjustmentP :: O.Parser BehaviorAdjustment
behaviorAdjustmentP :: Parser BehaviorAdjustment
behaviorAdjustmentP = NameAddr
-> [NameAddr]
-> [(BinPkgName, InstallFile)]
-> Maybe FilePath
-> [BinPkgName]
-> Maybe DebBase
-> Maybe DebianVersion
-> Maybe Revision
-> Maybe SrcPkgName
-> Section
-> StandardsVersion
-> [BuildDep]
-> [BuildDepIndep]
-> [DevDep]
-> [ExtraDepends]
-> [ExtraConflicts]
-> [ExtraProvides]
-> [ExtraReplaces]
-> [ExtraRecommends]
-> [ExtraSuggests]
-> [CabalDebMapping]
-> [CabalEpochMapping]
-> [ExecDebMapping]
-> ProfilingStatus
-> [HaddockStatus]
-> OfficialStatus
-> SourceFormat
-> TestsStatus
-> BehaviorAdjustment
BehaviorAdjustment (NameAddr
 -> [NameAddr]
 -> [(BinPkgName, InstallFile)]
 -> Maybe FilePath
 -> [BinPkgName]
 -> Maybe DebBase
 -> Maybe DebianVersion
 -> Maybe Revision
 -> Maybe SrcPkgName
 -> Section
 -> StandardsVersion
 -> [BuildDep]
 -> [BuildDepIndep]
 -> [DevDep]
 -> [ExtraDepends]
 -> [ExtraConflicts]
 -> [ExtraProvides]
 -> [ExtraReplaces]
 -> [ExtraRecommends]
 -> [ExtraSuggests]
 -> [CabalDebMapping]
 -> [CabalEpochMapping]
 -> [ExecDebMapping]
 -> ProfilingStatus
 -> [HaddockStatus]
 -> OfficialStatus
 -> SourceFormat
 -> TestsStatus
 -> BehaviorAdjustment)
-> Parser NameAddr
-> Parser
     ([NameAddr]
      -> [(BinPkgName, InstallFile)]
      -> Maybe FilePath
      -> [BinPkgName]
      -> Maybe DebBase
      -> Maybe DebianVersion
      -> Maybe Revision
      -> Maybe SrcPkgName
      -> Section
      -> StandardsVersion
      -> [BuildDep]
      -> [BuildDepIndep]
      -> [DevDep]
      -> [ExtraDepends]
      -> [ExtraConflicts]
      -> [ExtraProvides]
      -> [ExtraReplaces]
      -> [ExtraRecommends]
      -> [ExtraSuggests]
      -> [CabalDebMapping]
      -> [CabalEpochMapping]
      -> [ExecDebMapping]
      -> ProfilingStatus
      -> [HaddockStatus]
      -> OfficialStatus
      -> SourceFormat
      -> TestsStatus
      -> BehaviorAdjustment)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser NameAddr
maintainerP
                                         Parser
  ([NameAddr]
   -> [(BinPkgName, InstallFile)]
   -> Maybe FilePath
   -> [BinPkgName]
   -> Maybe DebBase
   -> Maybe DebianVersion
   -> Maybe Revision
   -> Maybe SrcPkgName
   -> Section
   -> StandardsVersion
   -> [BuildDep]
   -> [BuildDepIndep]
   -> [DevDep]
   -> [ExtraDepends]
   -> [ExtraConflicts]
   -> [ExtraProvides]
   -> [ExtraReplaces]
   -> [ExtraRecommends]
   -> [ExtraSuggests]
   -> [CabalDebMapping]
   -> [CabalEpochMapping]
   -> [ExecDebMapping]
   -> ProfilingStatus
   -> [HaddockStatus]
   -> OfficialStatus
   -> SourceFormat
   -> TestsStatus
   -> BehaviorAdjustment)
-> Parser [NameAddr]
-> Parser
     ([(BinPkgName, InstallFile)]
      -> Maybe FilePath
      -> [BinPkgName]
      -> Maybe DebBase
      -> Maybe DebianVersion
      -> Maybe Revision
      -> Maybe SrcPkgName
      -> Section
      -> StandardsVersion
      -> [BuildDep]
      -> [BuildDepIndep]
      -> [DevDep]
      -> [ExtraDepends]
      -> [ExtraConflicts]
      -> [ExtraProvides]
      -> [ExtraReplaces]
      -> [ExtraRecommends]
      -> [ExtraSuggests]
      -> [CabalDebMapping]
      -> [CabalEpochMapping]
      -> [ExecDebMapping]
      -> ProfilingStatus
      -> [HaddockStatus]
      -> OfficialStatus
      -> SourceFormat
      -> TestsStatus
      -> BehaviorAdjustment)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser [NameAddr]
uploadersP
                                         Parser
  ([(BinPkgName, InstallFile)]
   -> Maybe FilePath
   -> [BinPkgName]
   -> Maybe DebBase
   -> Maybe DebianVersion
   -> Maybe Revision
   -> Maybe SrcPkgName
   -> Section
   -> StandardsVersion
   -> [BuildDep]
   -> [BuildDepIndep]
   -> [DevDep]
   -> [ExtraDepends]
   -> [ExtraConflicts]
   -> [ExtraProvides]
   -> [ExtraReplaces]
   -> [ExtraRecommends]
   -> [ExtraSuggests]
   -> [CabalDebMapping]
   -> [CabalEpochMapping]
   -> [ExecDebMapping]
   -> ProfilingStatus
   -> [HaddockStatus]
   -> OfficialStatus
   -> SourceFormat
   -> TestsStatus
   -> BehaviorAdjustment)
-> Parser [(BinPkgName, InstallFile)]
-> Parser
     (Maybe FilePath
      -> [BinPkgName]
      -> Maybe DebBase
      -> Maybe DebianVersion
      -> Maybe Revision
      -> Maybe SrcPkgName
      -> Section
      -> StandardsVersion
      -> [BuildDep]
      -> [BuildDepIndep]
      -> [DevDep]
      -> [ExtraDepends]
      -> [ExtraConflicts]
      -> [ExtraProvides]
      -> [ExtraReplaces]
      -> [ExtraRecommends]
      -> [ExtraSuggests]
      -> [CabalDebMapping]
      -> [CabalEpochMapping]
      -> [ExecDebMapping]
      -> ProfilingStatus
      -> [HaddockStatus]
      -> OfficialStatus
      -> SourceFormat
      -> TestsStatus
      -> BehaviorAdjustment)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser [(BinPkgName, InstallFile)]
executableP
                                         Parser
  (Maybe FilePath
   -> [BinPkgName]
   -> Maybe DebBase
   -> Maybe DebianVersion
   -> Maybe Revision
   -> Maybe SrcPkgName
   -> Section
   -> StandardsVersion
   -> [BuildDep]
   -> [BuildDepIndep]
   -> [DevDep]
   -> [ExtraDepends]
   -> [ExtraConflicts]
   -> [ExtraProvides]
   -> [ExtraReplaces]
   -> [ExtraRecommends]
   -> [ExtraSuggests]
   -> [CabalDebMapping]
   -> [CabalEpochMapping]
   -> [ExecDebMapping]
   -> ProfilingStatus
   -> [HaddockStatus]
   -> OfficialStatus
   -> SourceFormat
   -> TestsStatus
   -> BehaviorAdjustment)
-> Parser (Maybe FilePath)
-> Parser
     ([BinPkgName]
      -> Maybe DebBase
      -> Maybe DebianVersion
      -> Maybe Revision
      -> Maybe SrcPkgName
      -> Section
      -> StandardsVersion
      -> [BuildDep]
      -> [BuildDepIndep]
      -> [DevDep]
      -> [ExtraDepends]
      -> [ExtraConflicts]
      -> [ExtraProvides]
      -> [ExtraReplaces]
      -> [ExtraRecommends]
      -> [ExtraSuggests]
      -> [CabalDebMapping]
      -> [CabalEpochMapping]
      -> [ExecDebMapping]
      -> ProfilingStatus
      -> [HaddockStatus]
      -> OfficialStatus
      -> SourceFormat
      -> TestsStatus
      -> BehaviorAdjustment)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (Maybe FilePath)
defaultPackageP
                                         Parser
  ([BinPkgName]
   -> Maybe DebBase
   -> Maybe DebianVersion
   -> Maybe Revision
   -> Maybe SrcPkgName
   -> Section
   -> StandardsVersion
   -> [BuildDep]
   -> [BuildDepIndep]
   -> [DevDep]
   -> [ExtraDepends]
   -> [ExtraConflicts]
   -> [ExtraProvides]
   -> [ExtraReplaces]
   -> [ExtraRecommends]
   -> [ExtraSuggests]
   -> [CabalDebMapping]
   -> [CabalEpochMapping]
   -> [ExecDebMapping]
   -> ProfilingStatus
   -> [HaddockStatus]
   -> OfficialStatus
   -> SourceFormat
   -> TestsStatus
   -> BehaviorAdjustment)
-> Parser [BinPkgName]
-> Parser
     (Maybe DebBase
      -> Maybe DebianVersion
      -> Maybe Revision
      -> Maybe SrcPkgName
      -> Section
      -> StandardsVersion
      -> [BuildDep]
      -> [BuildDepIndep]
      -> [DevDep]
      -> [ExtraDepends]
      -> [ExtraConflicts]
      -> [ExtraProvides]
      -> [ExtraReplaces]
      -> [ExtraRecommends]
      -> [ExtraSuggests]
      -> [CabalDebMapping]
      -> [CabalEpochMapping]
      -> [ExecDebMapping]
      -> ProfilingStatus
      -> [HaddockStatus]
      -> OfficialStatus
      -> SourceFormat
      -> TestsStatus
      -> BehaviorAdjustment)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser [BinPkgName]
missingDependencyP
                                         Parser
  (Maybe DebBase
   -> Maybe DebianVersion
   -> Maybe Revision
   -> Maybe SrcPkgName
   -> Section
   -> StandardsVersion
   -> [BuildDep]
   -> [BuildDepIndep]
   -> [DevDep]
   -> [ExtraDepends]
   -> [ExtraConflicts]
   -> [ExtraProvides]
   -> [ExtraReplaces]
   -> [ExtraRecommends]
   -> [ExtraSuggests]
   -> [CabalDebMapping]
   -> [CabalEpochMapping]
   -> [ExecDebMapping]
   -> ProfilingStatus
   -> [HaddockStatus]
   -> OfficialStatus
   -> SourceFormat
   -> TestsStatus
   -> BehaviorAdjustment)
-> Parser (Maybe DebBase)
-> Parser
     (Maybe DebianVersion
      -> Maybe Revision
      -> Maybe SrcPkgName
      -> Section
      -> StandardsVersion
      -> [BuildDep]
      -> [BuildDepIndep]
      -> [DevDep]
      -> [ExtraDepends]
      -> [ExtraConflicts]
      -> [ExtraProvides]
      -> [ExtraReplaces]
      -> [ExtraRecommends]
      -> [ExtraSuggests]
      -> [CabalDebMapping]
      -> [CabalEpochMapping]
      -> [ExecDebMapping]
      -> ProfilingStatus
      -> [HaddockStatus]
      -> OfficialStatus
      -> SourceFormat
      -> TestsStatus
      -> BehaviorAdjustment)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (Maybe DebBase)
debianNameBaseP
                                         Parser
  (Maybe DebianVersion
   -> Maybe Revision
   -> Maybe SrcPkgName
   -> Section
   -> StandardsVersion
   -> [BuildDep]
   -> [BuildDepIndep]
   -> [DevDep]
   -> [ExtraDepends]
   -> [ExtraConflicts]
   -> [ExtraProvides]
   -> [ExtraReplaces]
   -> [ExtraRecommends]
   -> [ExtraSuggests]
   -> [CabalDebMapping]
   -> [CabalEpochMapping]
   -> [ExecDebMapping]
   -> ProfilingStatus
   -> [HaddockStatus]
   -> OfficialStatus
   -> SourceFormat
   -> TestsStatus
   -> BehaviorAdjustment)
-> Parser (Maybe DebianVersion)
-> Parser
     (Maybe Revision
      -> Maybe SrcPkgName
      -> Section
      -> StandardsVersion
      -> [BuildDep]
      -> [BuildDepIndep]
      -> [DevDep]
      -> [ExtraDepends]
      -> [ExtraConflicts]
      -> [ExtraProvides]
      -> [ExtraReplaces]
      -> [ExtraRecommends]
      -> [ExtraSuggests]
      -> [CabalDebMapping]
      -> [CabalEpochMapping]
      -> [ExecDebMapping]
      -> ProfilingStatus
      -> [HaddockStatus]
      -> OfficialStatus
      -> SourceFormat
      -> TestsStatus
      -> BehaviorAdjustment)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (Maybe DebianVersion)
debianVersionP
                                         Parser
  (Maybe Revision
   -> Maybe SrcPkgName
   -> Section
   -> StandardsVersion
   -> [BuildDep]
   -> [BuildDepIndep]
   -> [DevDep]
   -> [ExtraDepends]
   -> [ExtraConflicts]
   -> [ExtraProvides]
   -> [ExtraReplaces]
   -> [ExtraRecommends]
   -> [ExtraSuggests]
   -> [CabalDebMapping]
   -> [CabalEpochMapping]
   -> [ExecDebMapping]
   -> ProfilingStatus
   -> [HaddockStatus]
   -> OfficialStatus
   -> SourceFormat
   -> TestsStatus
   -> BehaviorAdjustment)
-> Parser (Maybe Revision)
-> Parser
     (Maybe SrcPkgName
      -> Section
      -> StandardsVersion
      -> [BuildDep]
      -> [BuildDepIndep]
      -> [DevDep]
      -> [ExtraDepends]
      -> [ExtraConflicts]
      -> [ExtraProvides]
      -> [ExtraReplaces]
      -> [ExtraRecommends]
      -> [ExtraSuggests]
      -> [CabalDebMapping]
      -> [CabalEpochMapping]
      -> [ExecDebMapping]
      -> ProfilingStatus
      -> [HaddockStatus]
      -> OfficialStatus
      -> SourceFormat
      -> TestsStatus
      -> BehaviorAdjustment)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (Maybe Revision)
debianRevisionP
                                         Parser
  (Maybe SrcPkgName
   -> Section
   -> StandardsVersion
   -> [BuildDep]
   -> [BuildDepIndep]
   -> [DevDep]
   -> [ExtraDepends]
   -> [ExtraConflicts]
   -> [ExtraProvides]
   -> [ExtraReplaces]
   -> [ExtraRecommends]
   -> [ExtraSuggests]
   -> [CabalDebMapping]
   -> [CabalEpochMapping]
   -> [ExecDebMapping]
   -> ProfilingStatus
   -> [HaddockStatus]
   -> OfficialStatus
   -> SourceFormat
   -> TestsStatus
   -> BehaviorAdjustment)
-> Parser (Maybe SrcPkgName)
-> Parser
     (Section
      -> StandardsVersion
      -> [BuildDep]
      -> [BuildDepIndep]
      -> [DevDep]
      -> [ExtraDepends]
      -> [ExtraConflicts]
      -> [ExtraProvides]
      -> [ExtraReplaces]
      -> [ExtraRecommends]
      -> [ExtraSuggests]
      -> [CabalDebMapping]
      -> [CabalEpochMapping]
      -> [ExecDebMapping]
      -> ProfilingStatus
      -> [HaddockStatus]
      -> OfficialStatus
      -> SourceFormat
      -> TestsStatus
      -> BehaviorAdjustment)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser (Maybe SrcPkgName)
sourcePackageNameP
                                         Parser
  (Section
   -> StandardsVersion
   -> [BuildDep]
   -> [BuildDepIndep]
   -> [DevDep]
   -> [ExtraDepends]
   -> [ExtraConflicts]
   -> [ExtraProvides]
   -> [ExtraReplaces]
   -> [ExtraRecommends]
   -> [ExtraSuggests]
   -> [CabalDebMapping]
   -> [CabalEpochMapping]
   -> [ExecDebMapping]
   -> ProfilingStatus
   -> [HaddockStatus]
   -> OfficialStatus
   -> SourceFormat
   -> TestsStatus
   -> BehaviorAdjustment)
-> Parser Section
-> Parser
     (StandardsVersion
      -> [BuildDep]
      -> [BuildDepIndep]
      -> [DevDep]
      -> [ExtraDepends]
      -> [ExtraConflicts]
      -> [ExtraProvides]
      -> [ExtraReplaces]
      -> [ExtraRecommends]
      -> [ExtraSuggests]
      -> [CabalDebMapping]
      -> [CabalEpochMapping]
      -> [ExecDebMapping]
      -> ProfilingStatus
      -> [HaddockStatus]
      -> OfficialStatus
      -> SourceFormat
      -> TestsStatus
      -> BehaviorAdjustment)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser Section
sourceSectionP
                                         Parser
  (StandardsVersion
   -> [BuildDep]
   -> [BuildDepIndep]
   -> [DevDep]
   -> [ExtraDepends]
   -> [ExtraConflicts]
   -> [ExtraProvides]
   -> [ExtraReplaces]
   -> [ExtraRecommends]
   -> [ExtraSuggests]
   -> [CabalDebMapping]
   -> [CabalEpochMapping]
   -> [ExecDebMapping]
   -> ProfilingStatus
   -> [HaddockStatus]
   -> OfficialStatus
   -> SourceFormat
   -> TestsStatus
   -> BehaviorAdjustment)
-> Parser StandardsVersion
-> Parser
     ([BuildDep]
      -> [BuildDepIndep]
      -> [DevDep]
      -> [ExtraDepends]
      -> [ExtraConflicts]
      -> [ExtraProvides]
      -> [ExtraReplaces]
      -> [ExtraRecommends]
      -> [ExtraSuggests]
      -> [CabalDebMapping]
      -> [CabalEpochMapping]
      -> [ExecDebMapping]
      -> ProfilingStatus
      -> [HaddockStatus]
      -> OfficialStatus
      -> SourceFormat
      -> TestsStatus
      -> BehaviorAdjustment)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser StandardsVersion
standardsVersionP
                                         Parser
  ([BuildDep]
   -> [BuildDepIndep]
   -> [DevDep]
   -> [ExtraDepends]
   -> [ExtraConflicts]
   -> [ExtraProvides]
   -> [ExtraReplaces]
   -> [ExtraRecommends]
   -> [ExtraSuggests]
   -> [CabalDebMapping]
   -> [CabalEpochMapping]
   -> [ExecDebMapping]
   -> ProfilingStatus
   -> [HaddockStatus]
   -> OfficialStatus
   -> SourceFormat
   -> TestsStatus
   -> BehaviorAdjustment)
-> Parser [BuildDep]
-> Parser
     ([BuildDepIndep]
      -> [DevDep]
      -> [ExtraDepends]
      -> [ExtraConflicts]
      -> [ExtraProvides]
      -> [ExtraReplaces]
      -> [ExtraRecommends]
      -> [ExtraSuggests]
      -> [CabalDebMapping]
      -> [CabalEpochMapping]
      -> [ExecDebMapping]
      -> ProfilingStatus
      -> [HaddockStatus]
      -> OfficialStatus
      -> SourceFormat
      -> TestsStatus
      -> BehaviorAdjustment)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser [BuildDep]
buildDepP
                                         Parser
  ([BuildDepIndep]
   -> [DevDep]
   -> [ExtraDepends]
   -> [ExtraConflicts]
   -> [ExtraProvides]
   -> [ExtraReplaces]
   -> [ExtraRecommends]
   -> [ExtraSuggests]
   -> [CabalDebMapping]
   -> [CabalEpochMapping]
   -> [ExecDebMapping]
   -> ProfilingStatus
   -> [HaddockStatus]
   -> OfficialStatus
   -> SourceFormat
   -> TestsStatus
   -> BehaviorAdjustment)
-> Parser [BuildDepIndep]
-> Parser
     ([DevDep]
      -> [ExtraDepends]
      -> [ExtraConflicts]
      -> [ExtraProvides]
      -> [ExtraReplaces]
      -> [ExtraRecommends]
      -> [ExtraSuggests]
      -> [CabalDebMapping]
      -> [CabalEpochMapping]
      -> [ExecDebMapping]
      -> ProfilingStatus
      -> [HaddockStatus]
      -> OfficialStatus
      -> SourceFormat
      -> TestsStatus
      -> BehaviorAdjustment)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser [BuildDepIndep]
buildDepIndepP
                                         Parser
  ([DevDep]
   -> [ExtraDepends]
   -> [ExtraConflicts]
   -> [ExtraProvides]
   -> [ExtraReplaces]
   -> [ExtraRecommends]
   -> [ExtraSuggests]
   -> [CabalDebMapping]
   -> [CabalEpochMapping]
   -> [ExecDebMapping]
   -> ProfilingStatus
   -> [HaddockStatus]
   -> OfficialStatus
   -> SourceFormat
   -> TestsStatus
   -> BehaviorAdjustment)
-> Parser [DevDep]
-> Parser
     ([ExtraDepends]
      -> [ExtraConflicts]
      -> [ExtraProvides]
      -> [ExtraReplaces]
      -> [ExtraRecommends]
      -> [ExtraSuggests]
      -> [CabalDebMapping]
      -> [CabalEpochMapping]
      -> [ExecDebMapping]
      -> ProfilingStatus
      -> [HaddockStatus]
      -> OfficialStatus
      -> SourceFormat
      -> TestsStatus
      -> BehaviorAdjustment)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser [DevDep]
devDepP
                                         Parser
  ([ExtraDepends]
   -> [ExtraConflicts]
   -> [ExtraProvides]
   -> [ExtraReplaces]
   -> [ExtraRecommends]
   -> [ExtraSuggests]
   -> [CabalDebMapping]
   -> [CabalEpochMapping]
   -> [ExecDebMapping]
   -> ProfilingStatus
   -> [HaddockStatus]
   -> OfficialStatus
   -> SourceFormat
   -> TestsStatus
   -> BehaviorAdjustment)
-> Parser [ExtraDepends]
-> Parser
     ([ExtraConflicts]
      -> [ExtraProvides]
      -> [ExtraReplaces]
      -> [ExtraRecommends]
      -> [ExtraSuggests]
      -> [CabalDebMapping]
      -> [CabalEpochMapping]
      -> [ExecDebMapping]
      -> ProfilingStatus
      -> [HaddockStatus]
      -> OfficialStatus
      -> SourceFormat
      -> TestsStatus
      -> BehaviorAdjustment)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser [ExtraDepends]
extraDependsP
                                         Parser
  ([ExtraConflicts]
   -> [ExtraProvides]
   -> [ExtraReplaces]
   -> [ExtraRecommends]
   -> [ExtraSuggests]
   -> [CabalDebMapping]
   -> [CabalEpochMapping]
   -> [ExecDebMapping]
   -> ProfilingStatus
   -> [HaddockStatus]
   -> OfficialStatus
   -> SourceFormat
   -> TestsStatus
   -> BehaviorAdjustment)
-> Parser [ExtraConflicts]
-> Parser
     ([ExtraProvides]
      -> [ExtraReplaces]
      -> [ExtraRecommends]
      -> [ExtraSuggests]
      -> [CabalDebMapping]
      -> [CabalEpochMapping]
      -> [ExecDebMapping]
      -> ProfilingStatus
      -> [HaddockStatus]
      -> OfficialStatus
      -> SourceFormat
      -> TestsStatus
      -> BehaviorAdjustment)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser [ExtraConflicts]
extraConflictsP
                                         Parser
  ([ExtraProvides]
   -> [ExtraReplaces]
   -> [ExtraRecommends]
   -> [ExtraSuggests]
   -> [CabalDebMapping]
   -> [CabalEpochMapping]
   -> [ExecDebMapping]
   -> ProfilingStatus
   -> [HaddockStatus]
   -> OfficialStatus
   -> SourceFormat
   -> TestsStatus
   -> BehaviorAdjustment)
-> Parser [ExtraProvides]
-> Parser
     ([ExtraReplaces]
      -> [ExtraRecommends]
      -> [ExtraSuggests]
      -> [CabalDebMapping]
      -> [CabalEpochMapping]
      -> [ExecDebMapping]
      -> ProfilingStatus
      -> [HaddockStatus]
      -> OfficialStatus
      -> SourceFormat
      -> TestsStatus
      -> BehaviorAdjustment)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser [ExtraProvides]
extraProvidesP
                                         Parser
  ([ExtraReplaces]
   -> [ExtraRecommends]
   -> [ExtraSuggests]
   -> [CabalDebMapping]
   -> [CabalEpochMapping]
   -> [ExecDebMapping]
   -> ProfilingStatus
   -> [HaddockStatus]
   -> OfficialStatus
   -> SourceFormat
   -> TestsStatus
   -> BehaviorAdjustment)
-> Parser [ExtraReplaces]
-> Parser
     ([ExtraRecommends]
      -> [ExtraSuggests]
      -> [CabalDebMapping]
      -> [CabalEpochMapping]
      -> [ExecDebMapping]
      -> ProfilingStatus
      -> [HaddockStatus]
      -> OfficialStatus
      -> SourceFormat
      -> TestsStatus
      -> BehaviorAdjustment)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser [ExtraReplaces]
extraReplacesP
                                         Parser
  ([ExtraRecommends]
   -> [ExtraSuggests]
   -> [CabalDebMapping]
   -> [CabalEpochMapping]
   -> [ExecDebMapping]
   -> ProfilingStatus
   -> [HaddockStatus]
   -> OfficialStatus
   -> SourceFormat
   -> TestsStatus
   -> BehaviorAdjustment)
-> Parser [ExtraRecommends]
-> Parser
     ([ExtraSuggests]
      -> [CabalDebMapping]
      -> [CabalEpochMapping]
      -> [ExecDebMapping]
      -> ProfilingStatus
      -> [HaddockStatus]
      -> OfficialStatus
      -> SourceFormat
      -> TestsStatus
      -> BehaviorAdjustment)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser [ExtraRecommends]
extraRecommendsP
                                         Parser
  ([ExtraSuggests]
   -> [CabalDebMapping]
   -> [CabalEpochMapping]
   -> [ExecDebMapping]
   -> ProfilingStatus
   -> [HaddockStatus]
   -> OfficialStatus
   -> SourceFormat
   -> TestsStatus
   -> BehaviorAdjustment)
-> Parser [ExtraSuggests]
-> Parser
     ([CabalDebMapping]
      -> [CabalEpochMapping]
      -> [ExecDebMapping]
      -> ProfilingStatus
      -> [HaddockStatus]
      -> OfficialStatus
      -> SourceFormat
      -> TestsStatus
      -> BehaviorAdjustment)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser [ExtraSuggests]
extraSuggestsP
                                         Parser
  ([CabalDebMapping]
   -> [CabalEpochMapping]
   -> [ExecDebMapping]
   -> ProfilingStatus
   -> [HaddockStatus]
   -> OfficialStatus
   -> SourceFormat
   -> TestsStatus
   -> BehaviorAdjustment)
-> Parser [CabalDebMapping]
-> Parser
     ([CabalEpochMapping]
      -> [ExecDebMapping]
      -> ProfilingStatus
      -> [HaddockStatus]
      -> OfficialStatus
      -> SourceFormat
      -> TestsStatus
      -> BehaviorAdjustment)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser [CabalDebMapping]
cabalDebMappingP
                                         Parser
  ([CabalEpochMapping]
   -> [ExecDebMapping]
   -> ProfilingStatus
   -> [HaddockStatus]
   -> OfficialStatus
   -> SourceFormat
   -> TestsStatus
   -> BehaviorAdjustment)
-> Parser [CabalEpochMapping]
-> Parser
     ([ExecDebMapping]
      -> ProfilingStatus
      -> [HaddockStatus]
      -> OfficialStatus
      -> SourceFormat
      -> TestsStatus
      -> BehaviorAdjustment)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser [CabalEpochMapping]
cabalEpochMappingP
                                         Parser
  ([ExecDebMapping]
   -> ProfilingStatus
   -> [HaddockStatus]
   -> OfficialStatus
   -> SourceFormat
   -> TestsStatus
   -> BehaviorAdjustment)
-> Parser [ExecDebMapping]
-> Parser
     (ProfilingStatus
      -> [HaddockStatus]
      -> OfficialStatus
      -> SourceFormat
      -> TestsStatus
      -> BehaviorAdjustment)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser [ExecDebMapping]
execDebMappingP
                                         Parser
  (ProfilingStatus
   -> [HaddockStatus]
   -> OfficialStatus
   -> SourceFormat
   -> TestsStatus
   -> BehaviorAdjustment)
-> Parser ProfilingStatus
-> Parser
     ([HaddockStatus]
      -> OfficialStatus
      -> SourceFormat
      -> TestsStatus
      -> BehaviorAdjustment)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser ProfilingStatus
profilingP
                                         Parser
  ([HaddockStatus]
   -> OfficialStatus
   -> SourceFormat
   -> TestsStatus
   -> BehaviorAdjustment)
-> Parser [HaddockStatus]
-> Parser
     (OfficialStatus
      -> SourceFormat -> TestsStatus -> BehaviorAdjustment)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser [HaddockStatus]
haddockP
                                         Parser
  (OfficialStatus
   -> SourceFormat -> TestsStatus -> BehaviorAdjustment)
-> Parser OfficialStatus
-> Parser (SourceFormat -> TestsStatus -> BehaviorAdjustment)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser OfficialStatus
officialP
                                         Parser (SourceFormat -> TestsStatus -> BehaviorAdjustment)
-> Parser SourceFormat
-> Parser (TestsStatus -> BehaviorAdjustment)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser SourceFormat
sourceFormatP
                                         Parser (TestsStatus -> BehaviorAdjustment)
-> Parser TestsStatus -> Parser BehaviorAdjustment
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser TestsStatus
testsP

maintainerP :: O.Parser NameAddr
maintainerP :: Parser NameAddr
maintainerP = ReadM NameAddr -> Mod OptionFields NameAddr -> Parser NameAddr
forall a. ReadM a -> Mod OptionFields a -> Parser a
O.option ReadM NameAddr
nameAddrR Mod OptionFields NameAddr
m where
  m :: Mod OptionFields NameAddr
m = FilePath -> Mod OptionFields NameAddr
forall (f :: * -> *) a. FilePath -> Mod f a
O.help FilePath
helpMsg
      Mod OptionFields NameAddr
-> Mod OptionFields NameAddr -> Mod OptionFields NameAddr
forall a. Semigroup a => a -> a -> a
<> FilePath -> Mod OptionFields NameAddr
forall (f :: * -> *) a. HasName f => FilePath -> Mod f a
O.long FilePath
"maintainer"
      Mod OptionFields NameAddr
-> Mod OptionFields NameAddr -> Mod OptionFields NameAddr
forall a. Semigroup a => a -> a -> a
<> Char -> Mod OptionFields NameAddr
forall (f :: * -> *) a. HasName f => Char -> Mod f a
O.short Char
'm'
      Mod OptionFields NameAddr
-> Mod OptionFields NameAddr -> Mod OptionFields NameAddr
forall a. Semigroup a => a -> a -> a
<> NameAddr -> Mod OptionFields NameAddr
forall (f :: * -> *) a. HasValue f => a -> Mod f a
O.value (Maybe FilePath -> FilePath -> NameAddr
NameAddr (FilePath -> Maybe FilePath
forall a. a -> Maybe a
Just FilePath
"Debian Haskell Group")
                           FilePath
"pkg-haskell-maintainers@lists.alioth.debian.org")
      Mod OptionFields NameAddr
-> Mod OptionFields NameAddr -> Mod OptionFields NameAddr
forall a. Semigroup a => a -> a -> a
<> FilePath -> Mod OptionFields NameAddr
forall (f :: * -> *) a. HasMetavar f => FilePath -> Mod f a
O.metavar FilePath
"'NAME <EMAIL>'"
  helpMsg :: FilePath
helpMsg = FilePath
"Set the `Maintainer' field in debian/control file."

uploadersP :: O.Parser [NameAddr]
uploadersP :: Parser [NameAddr]
uploadersP = Parser NameAddr -> Parser [NameAddr]
forall a. Parser a -> Parser [a]
forall (f :: * -> *) a. Alternative f => f a -> f [a]
many (Parser NameAddr -> Parser [NameAddr])
-> Parser NameAddr -> Parser [NameAddr]
forall a b. (a -> b) -> a -> b
$ ReadM NameAddr -> Mod OptionFields NameAddr -> Parser NameAddr
forall a. ReadM a -> Mod OptionFields a -> Parser a
O.option ReadM NameAddr
nameAddrR Mod OptionFields NameAddr
m where
  m :: Mod OptionFields NameAddr
m = FilePath -> Mod OptionFields NameAddr
forall (f :: * -> *) a. FilePath -> Mod f a
O.help FilePath
helpMsg
      Mod OptionFields NameAddr
-> Mod OptionFields NameAddr -> Mod OptionFields NameAddr
forall a. Semigroup a => a -> a -> a
<> FilePath -> Mod OptionFields NameAddr
forall (f :: * -> *) a. HasName f => FilePath -> Mod f a
O.long FilePath
"uploader"
      Mod OptionFields NameAddr
-> Mod OptionFields NameAddr -> Mod OptionFields NameAddr
forall a. Semigroup a => a -> a -> a
<> Char -> Mod OptionFields NameAddr
forall (f :: * -> *) a. HasName f => Char -> Mod f a
O.short Char
'u'
      Mod OptionFields NameAddr
-> Mod OptionFields NameAddr -> Mod OptionFields NameAddr
forall a. Semigroup a => a -> a -> a
<> FilePath -> Mod OptionFields NameAddr
forall (f :: * -> *) a. HasMetavar f => FilePath -> Mod f a
O.metavar FilePath
"'NAME <EMAIL>'"
  helpMsg :: FilePath
helpMsg = FilePath
"Add entry to `Uploaders' field in debian/control file."

executableP :: O.Parser [(BinPkgName, D.InstallFile)]
executableP :: Parser [(BinPkgName, InstallFile)]
executableP = Parser (BinPkgName, InstallFile)
-> Parser [(BinPkgName, InstallFile)]
forall a. Parser a -> Parser [a]
forall (f :: * -> *) a. Alternative f => f a -> f [a]
many (Parser (BinPkgName, InstallFile)
 -> Parser [(BinPkgName, InstallFile)])
-> Parser (BinPkgName, InstallFile)
-> Parser [(BinPkgName, InstallFile)]
forall a b. (a -> b) -> a -> b
$ ReadM (BinPkgName, InstallFile)
-> Mod OptionFields (BinPkgName, InstallFile)
-> Parser (BinPkgName, InstallFile)
forall a. ReadM a -> Mod OptionFields a -> Parser a
O.option ReadM (BinPkgName, InstallFile)
executableR Mod OptionFields (BinPkgName, InstallFile)
forall {a}. Mod OptionFields a
m where
  m :: Mod OptionFields a
m = FilePath -> Mod OptionFields a
forall (f :: * -> *) a. FilePath -> Mod f a
O.help FilePath
helpMsg
      Mod OptionFields a -> Mod OptionFields a -> Mod OptionFields a
forall a. Semigroup a => a -> a -> a
<> FilePath -> Mod OptionFields a
forall (f :: * -> *) a. HasName f => FilePath -> Mod f a
O.long FilePath
"executable"
      Mod OptionFields a -> Mod OptionFields a -> Mod OptionFields a
forall a. Semigroup a => a -> a -> a
<> Char -> Mod OptionFields a
forall (f :: * -> *) a. HasName f => Char -> Mod f a
O.short Char
'e'
      Mod OptionFields a -> Mod OptionFields a -> Mod OptionFields a
forall a. Semigroup a => a -> a -> a
<> FilePath -> Mod OptionFields a
forall (f :: * -> *) a. HasMetavar f => FilePath -> Mod f a
O.metavar FilePath
"SOURCEPATH[:DESTDIR]"
  helpMsg :: FilePath
helpMsg = [FilePath] -> FilePath
unlines [
   FilePath
"Create an individual binary package to hold this executable.",
   FilePath
"Other executables and data files are gathered into a single package",
   FilePath
"named `haskell-PACKAGENAME-utils'"
   ]

defaultPackageP :: O.Parser (Maybe String)
defaultPackageP :: Parser (Maybe FilePath)
defaultPackageP = ReadM (Maybe FilePath)
-> Mod OptionFields (Maybe FilePath) -> Parser (Maybe FilePath)
forall a. ReadM a -> Mod OptionFields a -> Parser a
O.option (FilePath -> Maybe FilePath
forall a. a -> Maybe a
Just (FilePath -> Maybe FilePath)
-> ReadM FilePath -> ReadM (Maybe FilePath)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ReadM FilePath
forall s. IsString s => ReadM s
O.str) Mod OptionFields (Maybe FilePath)
forall {a}. Mod OptionFields (Maybe a)
m where
  m :: Mod OptionFields (Maybe a)
m = FilePath -> Mod OptionFields (Maybe a)
forall (f :: * -> *) a. FilePath -> Mod f a
O.help FilePath
helpMsg
      Mod OptionFields (Maybe a)
-> Mod OptionFields (Maybe a) -> Mod OptionFields (Maybe a)
forall a. Semigroup a => a -> a -> a
<> FilePath -> Mod OptionFields (Maybe a)
forall (f :: * -> *) a. HasName f => FilePath -> Mod f a
O.long FilePath
"default-package"
      Mod OptionFields (Maybe a)
-> Mod OptionFields (Maybe a) -> Mod OptionFields (Maybe a)
forall a. Semigroup a => a -> a -> a
<> Char -> Mod OptionFields (Maybe a)
forall (f :: * -> *) a. HasName f => Char -> Mod f a
O.short Char
'd'
      Mod OptionFields (Maybe a)
-> Mod OptionFields (Maybe a) -> Mod OptionFields (Maybe a)
forall a. Semigroup a => a -> a -> a
<> Maybe a -> Mod OptionFields (Maybe a)
forall (f :: * -> *) a. HasValue f => a -> Mod f a
O.value Maybe a
forall a. Maybe a
Nothing
      Mod OptionFields (Maybe a)
-> Mod OptionFields (Maybe a) -> Mod OptionFields (Maybe a)
forall a. Semigroup a => a -> a -> a
<> FilePath -> Mod OptionFields (Maybe a)
forall (f :: * -> *) a. HasMetavar f => FilePath -> Mod f a
O.metavar FilePath
"PKGNAME"
  helpMsg :: FilePath
helpMsg = [FilePath] -> FilePath
unlines [
    FilePath
"Set the name of the catch-all package that receives",
    FilePath
"all the files not included in a library package or some",
    FilePath
"other executable package. By default this is `haskell-PACKAGENAME-utils'"
    ]

missingDependencyP :: O.Parser [BinPkgName]
missingDependencyP :: Parser [BinPkgName]
missingDependencyP = Parser BinPkgName -> Parser [BinPkgName]
forall a. Parser a -> Parser [a]
forall (f :: * -> *) a. Alternative f => f a -> f [a]
many (Parser BinPkgName -> Parser [BinPkgName])
-> Parser BinPkgName -> Parser [BinPkgName]
forall a b. (a -> b) -> a -> b
$ ReadM BinPkgName
-> Mod OptionFields BinPkgName -> Parser BinPkgName
forall a. ReadM a -> Mod OptionFields a -> Parser a
O.option ReadM BinPkgName
binPkgNameR Mod OptionFields BinPkgName
forall {a}. Mod OptionFields a
m where
  m :: Mod OptionFields a
m = FilePath -> Mod OptionFields a
forall (f :: * -> *) a. FilePath -> Mod f a
O.help FilePath
helpMsg
      Mod OptionFields a -> Mod OptionFields a -> Mod OptionFields a
forall a. Semigroup a => a -> a -> a
<> FilePath -> Mod OptionFields a
forall (f :: * -> *) a. HasName f => FilePath -> Mod f a
O.long FilePath
"missing-dependency"
      Mod OptionFields a -> Mod OptionFields a -> Mod OptionFields a
forall a. Semigroup a => a -> a -> a
<> FilePath -> Mod OptionFields a
forall (f :: * -> *) a. HasMetavar f => FilePath -> Mod f a
O.metavar FilePath
"DEB"
  helpMsg :: FilePath
helpMsg = [FilePath] -> FilePath
unlines [
    FilePath
"This is the counterpart to --disable-haddock.  It prevents a package",
    FilePath
"from being added to the build dependencies.  This is necessary,",
    FilePath
"for example, when a dependency package was built with the",
    FilePath
"--disable-haddock option, because normally cabal-debian assumes",
    FilePath
"that the -doc package exists and adds it as a build dependency."
    ]

debianNameBaseP :: O.Parser (Maybe DebBase)
debianNameBaseP :: Parser (Maybe DebBase)
debianNameBaseP = ReadM (Maybe DebBase)
-> Mod OptionFields (Maybe DebBase) -> Parser (Maybe DebBase)
forall a. ReadM a -> Mod OptionFields a -> Parser a
O.option (DebBase -> Maybe DebBase
forall a. a -> Maybe a
Just (DebBase -> Maybe DebBase)
-> (FilePath -> DebBase) -> FilePath -> Maybe DebBase
forall b c a. (b -> c) -> (a -> b) -> a -> c
. FilePath -> DebBase
DebBase (FilePath -> Maybe DebBase)
-> ReadM FilePath -> ReadM (Maybe DebBase)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ReadM FilePath
forall s. IsString s => ReadM s
O.str) Mod OptionFields (Maybe DebBase)
forall {a}. Mod OptionFields (Maybe a)
m where
  m :: Mod OptionFields (Maybe a)
m = FilePath -> Mod OptionFields (Maybe a)
forall (f :: * -> *) a. FilePath -> Mod f a
O.help FilePath
helpMsg
      Mod OptionFields (Maybe a)
-> Mod OptionFields (Maybe a) -> Mod OptionFields (Maybe a)
forall a. Semigroup a => a -> a -> a
<> FilePath -> Mod OptionFields (Maybe a)
forall (f :: * -> *) a. HasName f => FilePath -> Mod f a
O.long FilePath
"debian-name-base"
      Mod OptionFields (Maybe a)
-> Mod OptionFields (Maybe a) -> Mod OptionFields (Maybe a)
forall a. Semigroup a => a -> a -> a
<> Char -> Mod OptionFields (Maybe a)
forall (f :: * -> *) a. HasName f => Char -> Mod f a
O.short Char
'b'
      Mod OptionFields (Maybe a)
-> Mod OptionFields (Maybe a) -> Mod OptionFields (Maybe a)
forall a. Semigroup a => a -> a -> a
<> Maybe a -> Mod OptionFields (Maybe a)
forall (f :: * -> *) a. HasValue f => a -> Mod f a
O.value Maybe a
forall a. Maybe a
Nothing
      Mod OptionFields (Maybe a)
-> Mod OptionFields (Maybe a) -> Mod OptionFields (Maybe a)
forall a. Semigroup a => a -> a -> a
<> FilePath -> Mod OptionFields (Maybe a)
forall (f :: * -> *) a. HasMetavar f => FilePath -> Mod f a
O.metavar FilePath
"NAME"
  helpMsg :: FilePath
helpMsg = [FilePath] -> FilePath
unlines [
    FilePath
"Use this name for the base of the debian binary packages - the string between",
    FilePath
"'libghc-' and '-dev'. Normally this is derived from the hackage package name."
    ]

debianVersionP :: O.Parser (Maybe DebianVersion)
debianVersionP :: Parser (Maybe DebianVersion)
debianVersionP = ReadM (Maybe DebianVersion)
-> Mod OptionFields (Maybe DebianVersion)
-> Parser (Maybe DebianVersion)
forall a. ReadM a -> Mod OptionFields a -> Parser a
O.option (DebianVersion -> Maybe DebianVersion
forall a. a -> Maybe a
Just (DebianVersion -> Maybe DebianVersion)
-> (FilePath -> DebianVersion) -> FilePath -> Maybe DebianVersion
forall b c a. (b -> c) -> (a -> b) -> a -> c
. FilePath -> DebianVersion
forall string. ParseDebianVersion string => string -> DebianVersion
parseDebianVersion' (FilePath -> Maybe DebianVersion)
-> ReadM FilePath -> ReadM (Maybe DebianVersion)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (ReadM FilePath
forall s. IsString s => ReadM s
O.str :: O.ReadM String)) Mod OptionFields (Maybe DebianVersion)
forall {a}. Mod OptionFields (Maybe a)
m where
  m :: Mod OptionFields (Maybe a)
m = FilePath -> Mod OptionFields (Maybe a)
forall (f :: * -> *) a. FilePath -> Mod f a
O.help FilePath
helpMsg
      Mod OptionFields (Maybe a)
-> Mod OptionFields (Maybe a) -> Mod OptionFields (Maybe a)
forall a. Semigroup a => a -> a -> a
<> FilePath -> Mod OptionFields (Maybe a)
forall (f :: * -> *) a. HasName f => FilePath -> Mod f a
O.long FilePath
"deb-version"
      Mod OptionFields (Maybe a)
-> Mod OptionFields (Maybe a) -> Mod OptionFields (Maybe a)
forall a. Semigroup a => a -> a -> a
<> FilePath -> Mod OptionFields (Maybe a)
forall (f :: * -> *) a. HasMetavar f => FilePath -> Mod f a
O.metavar FilePath
"DEBIANVERSION"
      Mod OptionFields (Maybe a)
-> Mod OptionFields (Maybe a) -> Mod OptionFields (Maybe a)
forall a. Semigroup a => a -> a -> a
<> Maybe a -> Mod OptionFields (Maybe a)
forall (f :: * -> *) a. HasValue f => a -> Mod f a
O.value Maybe a
forall a. Maybe a
Nothing
  helpMsg :: FilePath
helpMsg = [FilePath] -> FilePath
unlines [
    FilePath
"Specify the version number for the debian package.",
    FilePath
"This will pin the version and should be considered dangerous."
    ]

debianRevisionP :: O.Parser (Maybe Revision)
debianRevisionP :: Parser (Maybe Revision)
debianRevisionP = ReadM (Maybe Revision)
-> Mod OptionFields (Maybe Revision) -> Parser (Maybe Revision)
forall a. ReadM a -> Mod OptionFields a -> Parser a
O.option (Revision -> Maybe Revision
forall a. a -> Maybe a
Just (Revision -> Maybe Revision)
-> (FilePath -> Revision) -> FilePath -> Maybe Revision
forall b c a. (b -> c) -> (a -> b) -> a -> c
. FilePath -> Revision
Revision (FilePath -> Maybe Revision)
-> ReadM FilePath -> ReadM (Maybe Revision)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ReadM FilePath
forall s. IsString s => ReadM s
O.str) Mod OptionFields (Maybe Revision)
forall {a}. Mod OptionFields (Maybe a)
m where
  m :: Mod OptionFields (Maybe a)
m = FilePath -> Mod OptionFields (Maybe a)
forall (f :: * -> *) a. FilePath -> Mod f a
O.help FilePath
helpMsg
      Mod OptionFields (Maybe a)
-> Mod OptionFields (Maybe a) -> Mod OptionFields (Maybe a)
forall a. Semigroup a => a -> a -> a
<> FilePath -> Mod OptionFields (Maybe a)
forall (f :: * -> *) a. HasName f => FilePath -> Mod f a
O.long FilePath
"revision"
      Mod OptionFields (Maybe a)
-> Mod OptionFields (Maybe a) -> Mod OptionFields (Maybe a)
forall a. Semigroup a => a -> a -> a
<> Maybe a -> Mod OptionFields (Maybe a)
forall (f :: * -> *) a. HasValue f => a -> Mod f a
O.value Maybe a
forall a. Maybe a
Nothing
      Mod OptionFields (Maybe a)
-> Mod OptionFields (Maybe a) -> Mod OptionFields (Maybe a)
forall a. Semigroup a => a -> a -> a
<> FilePath -> Mod OptionFields (Maybe a)
forall (f :: * -> *) a. HasMetavar f => FilePath -> Mod f a
O.metavar FilePath
"DEBIANREVISION"
  helpMsg :: FilePath
helpMsg = [FilePath] -> FilePath
unlines [
    FilePath
"Add this string to the cabal version to get the debian version number.",
    FilePath
"Debian policy says this must either be empty (--revision '')",
    FilePath
"or begin with a dash."
    ]

sourcePackageNameP :: O.Parser (Maybe SrcPkgName)
sourcePackageNameP :: Parser (Maybe SrcPkgName)
sourcePackageNameP = ReadM (Maybe SrcPkgName)
-> Mod OptionFields (Maybe SrcPkgName) -> Parser (Maybe SrcPkgName)
forall a. ReadM a -> Mod OptionFields a -> Parser a
O.option (SrcPkgName -> Maybe SrcPkgName
forall a. a -> Maybe a
Just (SrcPkgName -> Maybe SrcPkgName)
-> (FilePath -> SrcPkgName) -> FilePath -> Maybe SrcPkgName
forall b c a. (b -> c) -> (a -> b) -> a -> c
. FilePath -> SrcPkgName
SrcPkgName (FilePath -> Maybe SrcPkgName)
-> ReadM FilePath -> ReadM (Maybe SrcPkgName)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ReadM FilePath
forall s. IsString s => ReadM s
O.str) Mod OptionFields (Maybe SrcPkgName)
forall {a}. Mod OptionFields (Maybe a)
m where
  m :: Mod OptionFields (Maybe a)
m = FilePath -> Mod OptionFields (Maybe a)
forall (f :: * -> *) a. FilePath -> Mod f a
O.help FilePath
helpMsg
      Mod OptionFields (Maybe a)
-> Mod OptionFields (Maybe a) -> Mod OptionFields (Maybe a)
forall a. Semigroup a => a -> a -> a
<> FilePath -> Mod OptionFields (Maybe a)
forall (f :: * -> *) a. HasName f => FilePath -> Mod f a
O.long FilePath
"source-package-name"
      Mod OptionFields (Maybe a)
-> Mod OptionFields (Maybe a) -> Mod OptionFields (Maybe a)
forall a. Semigroup a => a -> a -> a
<> Char -> Mod OptionFields (Maybe a)
forall (f :: * -> *) a. HasName f => Char -> Mod f a
O.short Char
's'
      Mod OptionFields (Maybe a)
-> Mod OptionFields (Maybe a) -> Mod OptionFields (Maybe a)
forall a. Semigroup a => a -> a -> a
<> Maybe a -> Mod OptionFields (Maybe a)
forall (f :: * -> *) a. HasValue f => a -> Mod f a
O.value Maybe a
forall a. Maybe a
Nothing
      Mod OptionFields (Maybe a)
-> Mod OptionFields (Maybe a) -> Mod OptionFields (Maybe a)
forall a. Semigroup a => a -> a -> a
<> FilePath -> Mod OptionFields (Maybe a)
forall (f :: * -> *) a. HasMetavar f => FilePath -> Mod f a
O.metavar FilePath
"DEBIANNAME"
  helpMsg :: FilePath
helpMsg = [FilePath] -> FilePath
unlines [
    FilePath
"Use this name for the debian source package, the name in the Source field",
    FilePath
"at the top of the debian/control file, and also at the very beginning",
    FilePath
"of the debian/changelog file.  By default it is haskell-<cabalname>,",
    FilePath
"where the cabal package name is downcased."
    ]

sourceSectionP :: O.Parser Section
sourceSectionP :: Parser Section
sourceSectionP = ReadM Section -> Mod OptionFields Section -> Parser Section
forall a. ReadM a -> Mod OptionFields a -> Parser a
O.option (FilePath -> Section
MainSection (FilePath -> Section) -> ReadM FilePath -> ReadM Section
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ReadM FilePath
forall s. IsString s => ReadM s
O.str) Mod OptionFields Section
m where
  m :: Mod OptionFields Section
m = FilePath -> Mod OptionFields Section
forall (f :: * -> *) a. FilePath -> Mod f a
O.help FilePath
helpMsg
      Mod OptionFields Section
-> Mod OptionFields Section -> Mod OptionFields Section
forall a. Semigroup a => a -> a -> a
<> FilePath -> Mod OptionFields Section
forall (f :: * -> *) a. HasName f => FilePath -> Mod f a
O.long FilePath
"source-section"
      Mod OptionFields Section
-> Mod OptionFields Section -> Mod OptionFields Section
forall a. Semigroup a => a -> a -> a
<> Char -> Mod OptionFields Section
forall (f :: * -> *) a. HasName f => Char -> Mod f a
O.short Char
'S'
      Mod OptionFields Section
-> Mod OptionFields Section -> Mod OptionFields Section
forall a. Semigroup a => a -> a -> a
<> Section -> Mod OptionFields Section
forall (f :: * -> *) a. HasValue f => a -> Mod f a
O.value (FilePath -> Section
MainSection FilePath
"haskell")
      Mod OptionFields Section
-> Mod OptionFields Section -> Mod OptionFields Section
forall a. Semigroup a => a -> a -> a
<> FilePath -> Mod OptionFields Section
forall (f :: * -> *) a. HasMetavar f => FilePath -> Mod f a
O.metavar FilePath
"SECTION"
  helpMsg :: FilePath
helpMsg = FilePath
"Set the `Section' field in debian/control file."

standardsVersionP :: O.Parser StandardsVersion
standardsVersionP :: Parser StandardsVersion
standardsVersionP = ReadM StandardsVersion
-> Mod OptionFields StandardsVersion -> Parser StandardsVersion
forall a. ReadM a -> Mod OptionFields a -> Parser a
O.option (FilePath -> StandardsVersion
parseStandardsVersion (FilePath -> StandardsVersion)
-> ReadM FilePath -> ReadM StandardsVersion
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ReadM FilePath
forall s. IsString s => ReadM s
O.str) Mod OptionFields StandardsVersion
m where
  m :: Mod OptionFields StandardsVersion
m = FilePath -> Mod OptionFields StandardsVersion
forall (f :: * -> *) a. FilePath -> Mod f a
O.help FilePath
helpMsg
      Mod OptionFields StandardsVersion
-> Mod OptionFields StandardsVersion
-> Mod OptionFields StandardsVersion
forall a. Semigroup a => a -> a -> a
<> FilePath -> Mod OptionFields StandardsVersion
forall (f :: * -> *) a. HasName f => FilePath -> Mod f a
O.long FilePath
"standards-version"
      Mod OptionFields StandardsVersion
-> Mod OptionFields StandardsVersion
-> Mod OptionFields StandardsVersion
forall a. Semigroup a => a -> a -> a
<> StandardsVersion -> Mod OptionFields StandardsVersion
forall (f :: * -> *) a. HasValue f => a -> Mod f a
O.value (FilePath -> StandardsVersion
parseStandardsVersion FilePath
"4.6.2")
      Mod OptionFields StandardsVersion
-> Mod OptionFields StandardsVersion
-> Mod OptionFields StandardsVersion
forall a. Semigroup a => a -> a -> a
<> FilePath -> Mod OptionFields StandardsVersion
forall (f :: * -> *) a. HasMetavar f => FilePath -> Mod f a
O.metavar FilePath
"CABALVERSION"
  helpMsg :: FilePath
helpMsg = [FilePath] -> FilePath
unlines [
    FilePath
"Claim compatibility to this version of the Debian policy",
    FilePath
"(i.e. the value of the Standards-Version field)"
    ]

buildDepP :: O.Parser [BuildDep]
buildDepP :: Parser [BuildDep]
buildDepP = Parser BuildDep -> Parser [BuildDep]
forall a. Parser a -> Parser [a]
forall (f :: * -> *) a. Alternative f => f a -> f [a]
many (Parser BuildDep -> Parser [BuildDep])
-> Parser BuildDep -> Parser [BuildDep]
forall a b. (a -> b) -> a -> b
$ ReadM BuildDep -> Mod OptionFields BuildDep -> Parser BuildDep
forall a. ReadM a -> Mod OptionFields a -> Parser a
O.option (Relations -> BuildDep
BuildDep (Relations -> BuildDep) -> ReadM Relations -> ReadM BuildDep
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ReadM Relations
relationsR) Mod OptionFields BuildDep
forall {a}. Mod OptionFields a
m where
  m :: Mod OptionFields a
m = FilePath -> Mod OptionFields a
forall (f :: * -> *) a. FilePath -> Mod f a
O.help FilePath
helpMsg
      Mod OptionFields a -> Mod OptionFields a -> Mod OptionFields a
forall a. Semigroup a => a -> a -> a
<> FilePath -> Mod OptionFields a
forall (f :: * -> *) a. HasName f => FilePath -> Mod f a
O.long FilePath
"build-dep"
      Mod OptionFields a -> Mod OptionFields a -> Mod OptionFields a
forall a. Semigroup a => a -> a -> a
<> FilePath -> Mod OptionFields a
forall (f :: * -> *) a. HasMetavar f => FilePath -> Mod f a
O.metavar FilePath
"DEBIANRELATIONS"
  helpMsg :: FilePath
helpMsg = [FilePath] -> FilePath
unlines [
    FilePath
"Add a dependency relation to the `Build-Depends'",
    FilePath
"field for this source package."
    ]

buildDepIndepP :: O.Parser [BuildDepIndep]
buildDepIndepP :: Parser [BuildDepIndep]
buildDepIndepP = Parser BuildDepIndep -> Parser [BuildDepIndep]
forall a. Parser a -> Parser [a]
forall (f :: * -> *) a. Alternative f => f a -> f [a]
many (Parser BuildDepIndep -> Parser [BuildDepIndep])
-> Parser BuildDepIndep -> Parser [BuildDepIndep]
forall a b. (a -> b) -> a -> b
$ ReadM BuildDepIndep
-> Mod OptionFields BuildDepIndep -> Parser BuildDepIndep
forall a. ReadM a -> Mod OptionFields a -> Parser a
O.option (Relations -> BuildDepIndep
BuildDepIndep (Relations -> BuildDepIndep)
-> ReadM Relations -> ReadM BuildDepIndep
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ReadM Relations
relationsR) Mod OptionFields BuildDepIndep
forall {a}. Mod OptionFields a
m where
  m :: Mod OptionFields a
m = FilePath -> Mod OptionFields a
forall (f :: * -> *) a. FilePath -> Mod f a
O.help FilePath
helpMsg
      Mod OptionFields a -> Mod OptionFields a -> Mod OptionFields a
forall a. Semigroup a => a -> a -> a
<> FilePath -> Mod OptionFields a
forall (f :: * -> *) a. HasName f => FilePath -> Mod f a
O.long FilePath
"build-dep-indep"
      Mod OptionFields a -> Mod OptionFields a -> Mod OptionFields a
forall a. Semigroup a => a -> a -> a
<> FilePath -> Mod OptionFields a
forall (f :: * -> *) a. HasMetavar f => FilePath -> Mod f a
O.metavar FilePath
"DEBIANRELATIONS"
  helpMsg :: FilePath
helpMsg = [FilePath] -> FilePath
unlines [
    FilePath
"Add a dependency relation to the `Build-Depends-Indep'",
    FilePath
"field for this source package."
    ]

devDepP :: O.Parser [DevDep]
devDepP :: Parser [DevDep]
devDepP = Parser DevDep -> Parser [DevDep]
forall a. Parser a -> Parser [a]
forall (f :: * -> *) a. Alternative f => f a -> f [a]
many (Parser DevDep -> Parser [DevDep])
-> Parser DevDep -> Parser [DevDep]
forall a b. (a -> b) -> a -> b
$ ReadM DevDep -> Mod OptionFields DevDep -> Parser DevDep
forall a. ReadM a -> Mod OptionFields a -> Parser a
O.option (Relations -> DevDep
DevDep (Relations -> DevDep) -> ReadM Relations -> ReadM DevDep
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ReadM Relations
relationsR) Mod OptionFields DevDep
m where
  m :: Mod OptionFields DevDep
m = FilePath -> Mod OptionFields DevDep
forall (f :: * -> *) a. FilePath -> Mod f a
O.help FilePath
helpMsg
      Mod OptionFields DevDep
-> Mod OptionFields DevDep -> Mod OptionFields DevDep
forall a. Semigroup a => a -> a -> a
<> FilePath -> Mod OptionFields DevDep
forall (f :: * -> *) a. HasName f => FilePath -> Mod f a
O.long FilePath
"dev-dep"
      Mod OptionFields DevDep
-> Mod OptionFields DevDep -> Mod OptionFields DevDep
forall a. Semigroup a => a -> a -> a
<> FilePath -> Mod OptionFields DevDep
forall (f :: * -> *) a. HasMetavar f => FilePath -> Mod f a
O.metavar FilePath
"RELATION"
  helpMsg :: FilePath
helpMsg = FilePath
"Add an entry to the `Depends' field of the -dev package"


-- Since `depends', `conflicts' and so on options are totally same,
-- we can avoid code via this function, which, given long option name
-- makes correct O.Parser. Newtype around (BinPkgName, Relations)
-- is inferred, but there is still some duplication.
--
-- Long option name can also be inferred from Typeable instance of
-- mentioned newtype, but this would introduce some amount of
-- low-level string manipulations.
--
-- Nice to know, but now, to me, it would introduce more complexity,
-- than eliminate.
mkExtraP :: (Wrapped s, Rewrapped s s, Unwrapped s ~ (BinPkgName, Relations))
             => String -> O.Parser [s]
mkExtraP :: forall s.
(Wrapped s, Rewrapped s s,
 Unwrapped s ~ (BinPkgName, Relations)) =>
FilePath -> Parser [s]
mkExtraP long :: FilePath
long@(Char
c:FilePath
cr) = Parser s -> Parser [s]
forall a. Parser a -> Parser [a]
forall (f :: * -> *) a. Alternative f => f a -> f [a]
many (Parser s -> Parser [s]) -> Parser s -> Parser [s]
forall a b. (a -> b) -> a -> b
$ ReadM s -> Mod OptionFields s -> Parser s
forall a. ReadM a -> Mod OptionFields a -> Parser a
O.option (Getting s (BinPkgName, Relations) s -> (BinPkgName, Relations) -> s
forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view Getting s (BinPkgName, Relations) s
(s -> Const s s) -> Unwrapped s -> Const s (Unwrapped s)
forall s t. Rewrapping s t => Iso (Unwrapped t) (Unwrapped s) t s
Iso (Unwrapped s) (Unwrapped s) s s
_Unwrapped ((BinPkgName, Relations) -> s)
-> ReadM (BinPkgName, Relations) -> ReadM s
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ReadM (BinPkgName, Relations)
extraRelationsR) Mod OptionFields s
m where
    fieldName :: FilePath
fieldName = Char -> Char
toUpper Char
c Char -> FilePath -> FilePath
forall a. a -> [a] -> [a]
: FilePath
cr
    m :: Mod OptionFields s
m = FilePath -> Mod OptionFields s
forall (f :: * -> *) a. FilePath -> Mod f a
O.help FilePath
helpMsg
        Mod OptionFields s -> Mod OptionFields s -> Mod OptionFields s
forall a. Semigroup a => a -> a -> a
<> FilePath -> Mod OptionFields s
forall (f :: * -> *) a. HasName f => FilePath -> Mod f a
O.long FilePath
long
        Mod OptionFields s -> Mod OptionFields s -> Mod OptionFields s
forall a. Semigroup a => a -> a -> a
<> FilePath -> Mod OptionFields s
forall (f :: * -> *) a. HasMetavar f => FilePath -> Mod f a
O.metavar FilePath
"DEB:RELATION"
    helpMsg :: FilePath
helpMsg = FilePath
"Add extry to '" FilePath -> FilePath -> FilePath
forall a. [a] -> [a] -> [a]
++ FilePath
fieldName FilePath -> FilePath -> FilePath
forall a. [a] -> [a] -> [a]
++ FilePath
" 'field of DEB binary package"
mkExtraP FilePath
"" = FilePath -> Parser [s]
forall a. HasCallStack => FilePath -> a
error FilePath
"mkExtraP: empty long option"

extraDependsP :: O.Parser [ExtraDepends]
extraDependsP :: Parser [ExtraDepends]
extraDependsP = FilePath -> Parser [ExtraDepends]
forall s.
(Wrapped s, Rewrapped s s,
 Unwrapped s ~ (BinPkgName, Relations)) =>
FilePath -> Parser [s]
mkExtraP FilePath
"depends"

extraConflictsP :: O.Parser [ExtraConflicts]
extraConflictsP :: Parser [ExtraConflicts]
extraConflictsP = FilePath -> Parser [ExtraConflicts]
forall s.
(Wrapped s, Rewrapped s s,
 Unwrapped s ~ (BinPkgName, Relations)) =>
FilePath -> Parser [s]
mkExtraP FilePath
"conflicts"

extraProvidesP :: O.Parser [ExtraProvides]
extraProvidesP :: Parser [ExtraProvides]
extraProvidesP = FilePath -> Parser [ExtraProvides]
forall s.
(Wrapped s, Rewrapped s s,
 Unwrapped s ~ (BinPkgName, Relations)) =>
FilePath -> Parser [s]
mkExtraP FilePath
"provides"

extraReplacesP :: O.Parser [ExtraReplaces]
extraReplacesP :: Parser [ExtraReplaces]
extraReplacesP = FilePath -> Parser [ExtraReplaces]
forall s.
(Wrapped s, Rewrapped s s,
 Unwrapped s ~ (BinPkgName, Relations)) =>
FilePath -> Parser [s]
mkExtraP FilePath
"replaces"

extraRecommendsP :: O.Parser [ExtraRecommends]
extraRecommendsP :: Parser [ExtraRecommends]
extraRecommendsP = FilePath -> Parser [ExtraRecommends]
forall s.
(Wrapped s, Rewrapped s s,
 Unwrapped s ~ (BinPkgName, Relations)) =>
FilePath -> Parser [s]
mkExtraP FilePath
"recommends"

extraSuggestsP :: O.Parser [ExtraSuggests]
extraSuggestsP :: Parser [ExtraSuggests]
extraSuggestsP = FilePath -> Parser [ExtraSuggests]
forall s.
(Wrapped s, Rewrapped s s,
 Unwrapped s ~ (BinPkgName, Relations)) =>
FilePath -> Parser [s]
mkExtraP FilePath
"suggests"

cabalDebMappingP :: O.Parser [CabalDebMapping]
cabalDebMappingP :: Parser [CabalDebMapping]
cabalDebMappingP = Parser CabalDebMapping -> Parser [CabalDebMapping]
forall a. Parser a -> Parser [a]
forall (f :: * -> *) a. Alternative f => f a -> f [a]
many (Parser CabalDebMapping -> Parser [CabalDebMapping])
-> Parser CabalDebMapping -> Parser [CabalDebMapping]
forall a b. (a -> b) -> a -> b
$ ReadM CabalDebMapping
-> Mod OptionFields CabalDebMapping -> Parser CabalDebMapping
forall a. ReadM a -> Mod OptionFields a -> Parser a
O.option ReadM CabalDebMapping
cabalDebMappingR Mod OptionFields CabalDebMapping
forall {a}. Mod OptionFields a
m where
  m :: Mod OptionFields a
m = FilePath -> Mod OptionFields a
forall (f :: * -> *) a. FilePath -> Mod f a
O.help FilePath
helpMsg
      Mod OptionFields a -> Mod OptionFields a -> Mod OptionFields a
forall a. Semigroup a => a -> a -> a
<> FilePath -> Mod OptionFields a
forall (f :: * -> *) a. HasName f => FilePath -> Mod f a
O.long FilePath
"dep-map"
      Mod OptionFields a -> Mod OptionFields a -> Mod OptionFields a
forall a. Semigroup a => a -> a -> a
<> FilePath -> Mod OptionFields a
forall (f :: * -> *) a. HasMetavar f => FilePath -> Mod f a
O.metavar FilePath
"CABAL:DEBIANBINARYPACKAGE"
  helpMsg :: FilePath
helpMsg = [FilePath] -> FilePath
unlines [
    FilePath
"Specify what debian package name corresponds with a name that appears",
    FilePath
"in the Extra-Library field of a cabal file,",
    FilePath
"e.g. --map-dep cryptopp:libcrypto-dev."
    ]

execDebMappingP :: O.Parser [ExecDebMapping]
execDebMappingP :: Parser [ExecDebMapping]
execDebMappingP = Parser ExecDebMapping -> Parser [ExecDebMapping]
forall a. Parser a -> Parser [a]
forall (f :: * -> *) a. Alternative f => f a -> f [a]
many (Parser ExecDebMapping -> Parser [ExecDebMapping])
-> Parser ExecDebMapping -> Parser [ExecDebMapping]
forall a b. (a -> b) -> a -> b
$ ReadM ExecDebMapping
-> Mod OptionFields ExecDebMapping -> Parser ExecDebMapping
forall a. ReadM a -> Mod OptionFields a -> Parser a
O.option ((FilePath, Relations) -> ExecDebMapping
ExecDebMapping ((FilePath, Relations) -> ExecDebMapping)
-> ReadM (FilePath, Relations) -> ReadM ExecDebMapping
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ReadM (FilePath, Relations)
mappingR) Mod OptionFields ExecDebMapping
forall {a}. Mod OptionFields a
m where
  m :: Mod OptionFields a
m = FilePath -> Mod OptionFields a
forall (f :: * -> *) a. FilePath -> Mod f a
O.help FilePath
helpMsg
      Mod OptionFields a -> Mod OptionFields a -> Mod OptionFields a
forall a. Semigroup a => a -> a -> a
<> FilePath -> Mod OptionFields a
forall (f :: * -> *) a. HasName f => FilePath -> Mod f a
O.long FilePath
"exec-map"
      Mod OptionFields a -> Mod OptionFields a -> Mod OptionFields a
forall a. Semigroup a => a -> a -> a
<> FilePath -> Mod OptionFields a
forall (f :: * -> *) a. HasMetavar f => FilePath -> Mod f a
O.metavar FilePath
"CABAL:DEBIANBINARYPACKAGE"
  helpMsg :: FilePath
helpMsg = [FilePath] -> FilePath
unlines [
    FilePath
"Specify a mapping from the name appearing in the Build-Tool",
    FilePath
"field of the cabal file to a debian binary package name,",
    FilePath
"e.g. --exec-map trhsx:haskell-hsx-utils"
    ]

cabalEpochMappingP :: O.Parser [CabalEpochMapping]
cabalEpochMappingP :: Parser [CabalEpochMapping]
cabalEpochMappingP = Parser CabalEpochMapping -> Parser [CabalEpochMapping]
forall a. Parser a -> Parser [a]
forall (f :: * -> *) a. Alternative f => f a -> f [a]
many (Parser CabalEpochMapping -> Parser [CabalEpochMapping])
-> Parser CabalEpochMapping -> Parser [CabalEpochMapping]
forall a b. (a -> b) -> a -> b
$ ReadM CabalEpochMapping
-> Mod OptionFields CabalEpochMapping -> Parser CabalEpochMapping
forall a. ReadM a -> Mod OptionFields a -> Parser a
O.option (ReadM CabalEpochMapping
cabalEpochMappingR) Mod OptionFields CabalEpochMapping
forall {a}. Mod OptionFields a
m where
  m :: Mod OptionFields a
m = FilePath -> Mod OptionFields a
forall (f :: * -> *) a. FilePath -> Mod f a
O.help FilePath
helpMsg
      Mod OptionFields a -> Mod OptionFields a -> Mod OptionFields a
forall a. Semigroup a => a -> a -> a
<> FilePath -> Mod OptionFields a
forall (f :: * -> *) a. HasName f => FilePath -> Mod f a
O.long FilePath
"epoch-map"
      Mod OptionFields a -> Mod OptionFields a -> Mod OptionFields a
forall a. Semigroup a => a -> a -> a
<> FilePath -> Mod OptionFields a
forall (f :: * -> *) a. HasMetavar f => FilePath -> Mod f a
O.metavar FilePath
"CABALPACKAGE=DIGIT"
  helpMsg :: FilePath
helpMsg = [FilePath] -> FilePath
unlines [
    FilePath
"Specify a mapping from the cabal package name to a digit to use",
    FilePath
"as the debian package epoch number, e.g. --epoch-map HTTP=1"
    ]

cabalFlagsP :: O.Parser [CabalFlagMapping]
cabalFlagsP :: Parser [CabalFlagMapping]
cabalFlagsP = Parser CabalFlagMapping -> Parser [CabalFlagMapping]
forall a. Parser a -> Parser [a]
forall (f :: * -> *) a. Alternative f => f a -> f [a]
many (Parser CabalFlagMapping -> Parser [CabalFlagMapping])
-> Parser CabalFlagMapping -> Parser [CabalFlagMapping]
forall a b. (a -> b) -> a -> b
$ ReadM CabalFlagMapping
-> Mod OptionFields CabalFlagMapping -> Parser CabalFlagMapping
forall a. ReadM a -> Mod OptionFields a -> Parser a
O.option (ReadM CabalFlagMapping
cabalFlagMappingR) Mod OptionFields CabalFlagMapping
m where
  m :: Mod OptionFields CabalFlagMapping
m = FilePath -> Mod OptionFields CabalFlagMapping
forall (f :: * -> *) a. FilePath -> Mod f a
O.help FilePath
helpMsg
      Mod OptionFields CabalFlagMapping
-> Mod OptionFields CabalFlagMapping
-> Mod OptionFields CabalFlagMapping
forall a. Semigroup a => a -> a -> a
<> FilePath -> Mod OptionFields CabalFlagMapping
forall (f :: * -> *) a. HasName f => FilePath -> Mod f a
O.long FilePath
"cabal-flags"
      Mod OptionFields CabalFlagMapping
-> Mod OptionFields CabalFlagMapping
-> Mod OptionFields CabalFlagMapping
forall a. Semigroup a => a -> a -> a
<> FilePath -> Mod OptionFields CabalFlagMapping
forall (f :: * -> *) a. HasName f => FilePath -> Mod f a
O.long FilePath
"cabal-flag"
      Mod OptionFields CabalFlagMapping
-> Mod OptionFields CabalFlagMapping
-> Mod OptionFields CabalFlagMapping
forall a. Semigroup a => a -> a -> a
<> FilePath -> Mod OptionFields CabalFlagMapping
forall (f :: * -> *) a. HasMetavar f => FilePath -> Mod f a
O.metavar FilePath
"CABALFLAG or -CABALFLAG"
  helpMsg :: FilePath
helpMsg = FilePath
"Flags to pass to cabal configure with the --flags= option"


profilingP :: O.Parser ProfilingStatus
profilingP :: Parser ProfilingStatus
profilingP = ProfilingStatus
-> ProfilingStatus
-> Mod FlagFields ProfilingStatus
-> Parser ProfilingStatus
forall a. a -> a -> Mod FlagFields a -> Parser a
O.flag ProfilingStatus
ProfilingEnabled ProfilingStatus
ProfilingDisabled Mod FlagFields ProfilingStatus
forall {a}. Mod FlagFields a
m where
  m :: Mod FlagFields a
m = FilePath -> Mod FlagFields a
forall (f :: * -> *) a. FilePath -> Mod f a
O.help FilePath
helpMsg
      Mod FlagFields a -> Mod FlagFields a -> Mod FlagFields a
forall a. Semigroup a => a -> a -> a
<> FilePath -> Mod FlagFields a
forall (f :: * -> *) a. HasName f => FilePath -> Mod f a
O.long FilePath
"disable-profiling"
  helpMsg :: FilePath
helpMsg = [FilePath] -> FilePath
unlines [
    FilePath
"Do not generate profiling (-prof) library package, do not",
    FilePath
"add -prof packages to the build dependency list."
     ]

haddockP :: O.Parser [HaddockStatus]
haddockP :: Parser [HaddockStatus]
haddockP = (HaddockStatus -> [HaddockStatus] -> [HaddockStatus]
forall a. a -> [a] -> [a]
: []) (HaddockStatus -> [HaddockStatus])
-> Parser HaddockStatus -> Parser [HaddockStatus]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (HaddockStatus
-> HaddockStatus
-> Mod FlagFields HaddockStatus
-> Parser HaddockStatus
forall a. a -> a -> Mod FlagFields a -> Parser a
O.flag HaddockStatus
HaddockEnabled HaddockStatus
HaddockDisabled Mod FlagFields HaddockStatus
m) where
  m :: Mod FlagFields HaddockStatus
m = FilePath -> Mod FlagFields HaddockStatus
forall (f :: * -> *) a. FilePath -> Mod f a
O.help FilePath
helpMsg
      Mod FlagFields HaddockStatus
-> Mod FlagFields HaddockStatus -> Mod FlagFields HaddockStatus
forall a. Semigroup a => a -> a -> a
<> FilePath -> Mod FlagFields HaddockStatus
forall (f :: * -> *) a. HasName f => FilePath -> Mod f a
O.long FilePath
"disable-haddock"
  helpMsg :: FilePath
helpMsg = FilePath
"Do not create a -doc package"

officialP :: O.Parser OfficialStatus
officialP :: Parser OfficialStatus
officialP = OfficialStatus
-> OfficialStatus
-> Mod FlagFields OfficialStatus
-> Parser OfficialStatus
forall a. a -> a -> Mod FlagFields a -> Parser a
O.flag OfficialStatus
NonOfficial OfficialStatus
Official Mod FlagFields OfficialStatus
m where
  m :: Mod FlagFields OfficialStatus
m = FilePath -> Mod FlagFields OfficialStatus
forall (f :: * -> *) a. FilePath -> Mod f a
O.help FilePath
helpMsg
      Mod FlagFields OfficialStatus
-> Mod FlagFields OfficialStatus -> Mod FlagFields OfficialStatus
forall a. Semigroup a => a -> a -> a
<> FilePath -> Mod FlagFields OfficialStatus
forall (f :: * -> *) a. HasName f => FilePath -> Mod f a
O.long FilePath
"official"
  helpMsg :: FilePath
helpMsg = FilePath
"Follow guidelines of Debian Haskell Group"

sourceFormatP :: O.Parser SourceFormat
sourceFormatP :: Parser SourceFormat
sourceFormatP = SourceFormat
-> SourceFormat
-> Mod FlagFields SourceFormat
-> Parser SourceFormat
forall a. a -> a -> Mod FlagFields a -> Parser a
O.flag SourceFormat
Quilt3 SourceFormat
Native3 Mod FlagFields SourceFormat
forall {a}. Mod FlagFields a
m where
  m :: Mod FlagFields a
m = FilePath -> Mod FlagFields a
forall (f :: * -> *) a. FilePath -> Mod f a
O.help FilePath
helpMsg
      Mod FlagFields a -> Mod FlagFields a -> Mod FlagFields a
forall a. Semigroup a => a -> a -> a
<> FilePath -> Mod FlagFields a
forall (f :: * -> *) a. HasName f => FilePath -> Mod f a
O.long FilePath
"native"
  helpMsg :: FilePath
helpMsg = [FilePath] -> FilePath
unlines [
    FilePath
"Package has an no upstream tarball,",
    FilePath
"write '3.0 (native)' into source/format."
    ]

testsP :: O.Parser TestsStatus
testsP :: Parser TestsStatus
testsP = Parser TestsStatus
buildOnlyTestsP Parser TestsStatus -> Parser TestsStatus -> Parser TestsStatus
forall a. Parser a -> Parser a -> Parser a
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Parser TestsStatus
disableTestsP

disableTestsP :: O.Parser TestsStatus
disableTestsP :: Parser TestsStatus
disableTestsP = TestsStatus
-> TestsStatus -> Mod FlagFields TestsStatus -> Parser TestsStatus
forall a. a -> a -> Mod FlagFields a -> Parser a
O.flag TestsStatus
TestsRun TestsStatus
TestsDisable Mod FlagFields TestsStatus
forall {a}. Mod FlagFields a
m where
  m :: Mod FlagFields a
m = FilePath -> Mod FlagFields a
forall (f :: * -> *) a. FilePath -> Mod f a
O.help FilePath
"disable test suite"
      Mod FlagFields a -> Mod FlagFields a -> Mod FlagFields a
forall a. Semigroup a => a -> a -> a
<> FilePath -> Mod FlagFields a
forall (f :: * -> *) a. HasName f => FilePath -> Mod f a
O.long FilePath
"disable-tests"
      Mod FlagFields a -> Mod FlagFields a -> Mod FlagFields a
forall a. Semigroup a => a -> a -> a
<> FilePath -> Mod FlagFields a
forall (f :: * -> *) a. HasName f => FilePath -> Mod f a
O.long FilePath
"no-tests"

buildOnlyTestsP :: O.Parser TestsStatus
buildOnlyTestsP :: Parser TestsStatus
buildOnlyTestsP = TestsStatus
-> TestsStatus -> Mod FlagFields TestsStatus -> Parser TestsStatus
forall a. a -> a -> Mod FlagFields a -> Parser a
O.flag TestsStatus
TestsRun TestsStatus
TestsBuild Mod FlagFields TestsStatus
forall {a}. Mod FlagFields a
m where
  m :: Mod FlagFields a
m = FilePath -> Mod FlagFields a
forall (f :: * -> *) a. FilePath -> Mod f a
O.help FilePath
"build, but do not run test suite"
      Mod FlagFields a -> Mod FlagFields a -> Mod FlagFields a
forall a. Semigroup a => a -> a -> a
<> FilePath -> Mod FlagFields a
forall (f :: * -> *) a. HasName f => FilePath -> Mod f a
O.long FilePath
"no-run-tests"
      Mod FlagFields a -> Mod FlagFields a -> Mod FlagFields a
forall a. Semigroup a => a -> a -> a
<> FilePath -> Mod FlagFields a
forall (f :: * -> *) a. HasName f => FilePath -> Mod f a
O.long FilePath
"disable-running-tests"

-- Here is 'Flags' parser and parsers for every it's field.

flagsP :: O.Parser Flags
flagsP :: Parser Flags
flagsP = Int
-> Bool
-> Bool
-> Bool
-> Bool
-> CompilerFlavor
-> Set (FlagName, Bool)
-> EnvSet
-> Flags
Flags (Int
 -> Bool
 -> Bool
 -> Bool
 -> Bool
 -> CompilerFlavor
 -> Set (FlagName, Bool)
 -> EnvSet
 -> Flags)
-> Parser Int
-> Parser
     (Bool
      -> Bool
      -> Bool
      -> Bool
      -> CompilerFlavor
      -> Set (FlagName, Bool)
      -> EnvSet
      -> Flags)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser Int
verbosityP
               Parser
  (Bool
   -> Bool
   -> Bool
   -> Bool
   -> CompilerFlavor
   -> Set (FlagName, Bool)
   -> EnvSet
   -> Flags)
-> Parser Bool
-> Parser
     (Bool
      -> Bool
      -> Bool
      -> CompilerFlavor
      -> Set (FlagName, Bool)
      -> EnvSet
      -> Flags)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser Bool
dryRunP
               Parser
  (Bool
   -> Bool
   -> Bool
   -> CompilerFlavor
   -> Set (FlagName, Bool)
   -> EnvSet
   -> Flags)
-> Parser Bool
-> Parser
     (Bool
      -> Bool
      -> CompilerFlavor
      -> Set (FlagName, Bool)
      -> EnvSet
      -> Flags)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser Bool
upgradeP
               Parser
  (Bool
   -> Bool
   -> CompilerFlavor
   -> Set (FlagName, Bool)
   -> EnvSet
   -> Flags)
-> Parser Bool
-> Parser
     (Bool -> CompilerFlavor -> Set (FlagName, Bool) -> EnvSet -> Flags)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser Bool
roundtripP
               Parser
  (Bool -> CompilerFlavor -> Set (FlagName, Bool) -> EnvSet -> Flags)
-> Parser Bool
-> Parser
     (CompilerFlavor -> Set (FlagName, Bool) -> EnvSet -> Flags)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Bool -> Parser Bool
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Bool
False     -- validate
               Parser (CompilerFlavor -> Set (FlagName, Bool) -> EnvSet -> Flags)
-> Parser CompilerFlavor
-> Parser (Set (FlagName, Bool) -> EnvSet -> Flags)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser CompilerFlavor
hcFlavorP         -- CompilerFlavor
               Parser (Set (FlagName, Bool) -> EnvSet -> Flags)
-> Parser (Set (FlagName, Bool)) -> Parser (EnvSet -> Flags)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> ([CabalFlagMapping] -> Set (FlagName, Bool)
flagSet ([CabalFlagMapping] -> Set (FlagName, Bool))
-> Parser [CabalFlagMapping] -> Parser (Set (FlagName, Bool))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser [CabalFlagMapping]
cabalFlagsP)    -- cabalFlagAssignments
               Parser (EnvSet -> Flags) -> Parser EnvSet -> Parser Flags
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser EnvSet
buildEnvDirP
    where
      flagSet :: [CabalFlagMapping] -> Set (FlagName, Bool)
flagSet [CabalFlagMapping]
cfms = [(FlagName, Bool)] -> Set (FlagName, Bool)
forall a. Ord a => [a] -> Set a
Set.fromList ((CabalFlagMapping -> (FlagName, Bool))
-> [CabalFlagMapping] -> [(FlagName, Bool)]
forall a b. (a -> b) -> [a] -> [b]
map (\ (CabalFlagMapping (FlagName
name, Bool
bool)) -> (FlagName
name, Bool
bool)) [CabalFlagMapping]
cfms)

verbosityP :: O.Parser Int
verbosityP :: Parser Int
verbosityP = [()] -> Int
forall a. [a] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length ([()] -> Int) -> Parser [()] -> Parser Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser () -> Parser [()]
forall a. Parser a -> Parser [a]
forall (f :: * -> *) a. Alternative f => f a -> f [a]
many (() -> Mod FlagFields () -> Parser ()
forall a. a -> Mod FlagFields a -> Parser a
O.flag' () Mod FlagFields ()
forall {a}. Mod FlagFields a
m) where
  m :: Mod FlagFields a
m = FilePath -> Mod FlagFields a
forall (f :: * -> *) a. FilePath -> Mod f a
O.help FilePath
helpMsg
      Mod FlagFields a -> Mod FlagFields a -> Mod FlagFields a
forall a. Semigroup a => a -> a -> a
<> Char -> Mod FlagFields a
forall (f :: * -> *) a. HasName f => Char -> Mod f a
O.short Char
'v'
      Mod FlagFields a -> Mod FlagFields a -> Mod FlagFields a
forall a. Semigroup a => a -> a -> a
<> FilePath -> Mod FlagFields a
forall (f :: * -> *) a. HasName f => FilePath -> Mod f a
O.long FilePath
"verbose"
  helpMsg :: FilePath
helpMsg = [FilePath] -> FilePath
unlines [
    FilePath
"Every instance of this flag increases amount",
    FilePath
"of progress messages generated"
    ]

dryRunP :: O.Parser Bool
dryRunP :: Parser Bool
dryRunP = Mod FlagFields Bool -> Parser Bool
O.switch Mod FlagFields Bool
forall {a}. Mod FlagFields a
m where
  m :: Mod FlagFields a
m = FilePath -> Mod FlagFields a
forall (f :: * -> *) a. FilePath -> Mod f a
O.help FilePath
helpMsg
      Mod FlagFields a -> Mod FlagFields a -> Mod FlagFields a
forall a. Semigroup a => a -> a -> a
<> Char -> Mod FlagFields a
forall (f :: * -> *) a. HasName f => Char -> Mod f a
O.short Char
'n'
      Mod FlagFields a -> Mod FlagFields a -> Mod FlagFields a
forall a. Semigroup a => a -> a -> a
<> FilePath -> Mod FlagFields a
forall (f :: * -> *) a. HasName f => FilePath -> Mod f a
O.long FilePath
"dry-run"
  helpMsg :: FilePath
helpMsg = [FilePath] -> FilePath
unlines [
    FilePath
"Just compare the existing debianization",
    FilePath
"to the one we would generate."
    ]

upgradeP :: O.Parser Bool
upgradeP :: Parser Bool
upgradeP = Mod FlagFields Bool -> Parser Bool
O.switch Mod FlagFields Bool
forall {a}. Mod FlagFields a
m where
  m :: Mod FlagFields a
m = FilePath -> Mod FlagFields a
forall (f :: * -> *) a. FilePath -> Mod f a
O.help FilePath
helpMsg
      Mod FlagFields a -> Mod FlagFields a -> Mod FlagFields a
forall a. Semigroup a => a -> a -> a
<> FilePath -> Mod FlagFields a
forall (f :: * -> *) a. HasName f => FilePath -> Mod f a
O.long FilePath
"upgrade"
  helpMsg :: FilePath
helpMsg = [FilePath] -> FilePath
unlines [
    FilePath
"Upgrade an existing debianization carefully",
    FilePath
"preserving fields that are commonly hand-edited."
    ]

roundtripP :: O.Parser Bool
roundtripP :: Parser Bool
roundtripP = Mod FlagFields Bool -> Parser Bool
O.switch Mod FlagFields Bool
forall {a}. Mod FlagFields a
m where
  m :: Mod FlagFields a
m = FilePath -> Mod FlagFields a
forall (f :: * -> *) a. FilePath -> Mod f a
O.help FilePath
helpMsg
      Mod FlagFields a -> Mod FlagFields a -> Mod FlagFields a
forall a. Semigroup a => a -> a -> a
<> FilePath -> Mod FlagFields a
forall (f :: * -> *) a. HasName f => FilePath -> Mod f a
O.long FilePath
"roundtrip"
  helpMsg :: FilePath
helpMsg = [FilePath] -> FilePath
unlines [
    FilePath
"Roundtrip a debianization to normalize it."
    ]

-- versionR :: O.ReadM Version
-- versionR = (maybe (error "Invalid compiler version") id . parseVersion') <$> O.str

hcFlavorP :: O.Parser CompilerFlavor
hcFlavorP :: Parser CompilerFlavor
hcFlavorP = CompilerFlavor
-> CompilerFlavor
-> Mod FlagFields CompilerFlavor
-> Parser CompilerFlavor
forall a. a -> a -> Mod FlagFields a -> Parser a
O.flag CompilerFlavor
GHC
                    CompilerFlavor
GHCJS
                          Mod FlagFields CompilerFlavor
m where
  m :: Mod FlagFields CompilerFlavor
m = FilePath -> Mod FlagFields CompilerFlavor
forall (f :: * -> *) a. FilePath -> Mod f a
O.help FilePath
helpMsg
      Mod FlagFields CompilerFlavor
-> Mod FlagFields CompilerFlavor -> Mod FlagFields CompilerFlavor
forall a. Semigroup a => a -> a -> a
<> FilePath -> Mod FlagFields CompilerFlavor
forall (f :: * -> *) a. HasName f => FilePath -> Mod f a
O.long FilePath
"ghcjs"
  helpMsg :: FilePath
helpMsg = FilePath
"Set compiler flavor to GHCJS."

buildEnvDirP :: O.Parser EnvSet
buildEnvDirP :: Parser EnvSet
buildEnvDirP = ReadM EnvSet -> Mod OptionFields EnvSet -> Parser EnvSet
forall a. ReadM a -> Mod OptionFields a -> Parser a
O.option ((\FilePath
s -> EnvSet {cleanOS :: FilePath
cleanOS = FilePath
s FilePath -> FilePath -> FilePath
</> FilePath
"clean", dependOS :: FilePath
dependOS = FilePath
s FilePath -> FilePath -> FilePath
</> FilePath
"depend", buildOS :: FilePath
buildOS = FilePath
s FilePath -> FilePath -> FilePath
</> FilePath
"build"}) (FilePath -> EnvSet) -> ReadM FilePath -> ReadM EnvSet
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ReadM FilePath
forall s. IsString s => ReadM s
O.str) Mod OptionFields EnvSet
m where
  m :: Mod OptionFields EnvSet
m = FilePath -> Mod OptionFields EnvSet
forall (f :: * -> *) a. FilePath -> Mod f a
O.help FilePath
"Directory containing the three build environments, clean, depend, and build."
      Mod OptionFields EnvSet
-> Mod OptionFields EnvSet -> Mod OptionFields EnvSet
forall a. Semigroup a => a -> a -> a
<> FilePath -> Mod OptionFields EnvSet
forall (f :: * -> *) a. HasName f => FilePath -> Mod f a
O.long FilePath
"buildenvdir"
      Mod OptionFields EnvSet
-> Mod OptionFields EnvSet -> Mod OptionFields EnvSet
forall a. Semigroup a => a -> a -> a
<> EnvSet -> Mod OptionFields EnvSet
forall (f :: * -> *) a. HasValue f => a -> Mod f a
O.value (EnvSet {cleanOS :: FilePath
cleanOS = FilePath
"/", dependOS :: FilePath
dependOS = FilePath
"/", buildOS :: FilePath
buildOS = FilePath
"/"})
      Mod OptionFields EnvSet
-> Mod OptionFields EnvSet -> Mod OptionFields EnvSet
forall a. Semigroup a => a -> a -> a
<> FilePath -> Mod OptionFields EnvSet
forall (f :: * -> *) a. HasMetavar f => FilePath -> Mod f a
O.metavar FilePath
"DIR"

commandLineOptionsP :: O.Parser CommandLineOptions
commandLineOptionsP :: Parser CommandLineOptions
commandLineOptionsP = Flags -> BehaviorAdjustment -> CommandLineOptions
CommandLineOptions (Flags -> BehaviorAdjustment -> CommandLineOptions)
-> Parser Flags
-> Parser (BehaviorAdjustment -> CommandLineOptions)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser Flags
flagsP Parser (BehaviorAdjustment -> CommandLineOptions)
-> Parser BehaviorAdjustment -> Parser CommandLineOptions
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser BehaviorAdjustment
behaviorAdjustmentP

commandLineOptionsParserInfo :: [String] -> O.ParserInfo CommandLineOptions
commandLineOptionsParserInfo :: [FilePath] -> ParserInfo CommandLineOptions
commandLineOptionsParserInfo [FilePath]
args = Parser CommandLineOptions
-> InfoMod CommandLineOptions -> ParserInfo CommandLineOptions
forall a. Parser a -> InfoMod a -> ParserInfo a
O.info (Parser (CommandLineOptions -> CommandLineOptions)
forall a. Parser (a -> a)
O.helper Parser (CommandLineOptions -> CommandLineOptions)
-> Parser CommandLineOptions -> Parser CommandLineOptions
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser CommandLineOptions
commandLineOptionsP) InfoMod CommandLineOptions
im where
  im :: InfoMod CommandLineOptions
im = FilePath -> InfoMod CommandLineOptions
forall a. FilePath -> InfoMod a
O.header FilePath
"cabal-debian -- create debianization of cabal package"
       InfoMod CommandLineOptions
-> InfoMod CommandLineOptions -> InfoMod CommandLineOptions
forall a. Semigroup a => a -> a -> a
<> InfoMod CommandLineOptions
forall a. InfoMod a
O.fullDesc
       InfoMod CommandLineOptions
-> InfoMod CommandLineOptions -> InfoMod CommandLineOptions
forall a. Semigroup a => a -> a -> a
<> Maybe Doc -> InfoMod CommandLineOptions
forall a. Maybe Doc -> InfoMod a
O.progDescDoc (Doc -> Maybe Doc
forall a. a -> Maybe a
Just Doc
descDoc)
  descDoc :: Doc
descDoc =
    Doc
"Typical usage is run in unpacked source root directory"
    Doc -> Doc -> Doc
<+> Doc
linebreak Doc -> Doc -> Doc
<+> Doc
linebreak
    Doc -> Doc -> Doc
<+> Int -> Doc -> Doc
indent Int
2 Doc
"% cabal-debian  --maintainer 'Maintainer Name <maintainer@email>'"
    Doc -> Doc -> Doc
<+> Doc
linebreak Doc -> Doc -> Doc
<+> Doc
linebreak
    Doc -> Doc -> Doc
<+> (FilePath -> Doc
string (FilePath -> Doc) -> ([FilePath] -> FilePath) -> [FilePath] -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [FilePath] -> FilePath
unlines ([FilePath] -> Doc) -> [FilePath] -> Doc
forall a b. (a -> b) -> a -> b
$ [
     FilePath
"This will read the package's cabal file and any existing debian/changelog file and",
     FilePath
"deduce what it can about the debianization, then it will create or modify files in",
     FilePath
"the debian subdirectory.  Note that it will not remove any files in debian, and",
     FilePath
"these could affect the operation of the debianization in unknown ways.  For this",
     FilePath
"reason it is recommended either using a pristine unpacked directory each time, or else",
     FilePath
"using a revision control system to revert the package to a known state before running.",
     FilePath
"",
     FilePath
"Arguments: " FilePath -> FilePath -> FilePath
forall a. [a] -> [a] -> [a]
++ FilePath -> [FilePath] -> FilePath
showCommandForUser FilePath
"cabal-debian" [FilePath]
args
     ])

-- FIXME: Separation of parsing of `BehaviorAdjustment' and performing
-- 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) => BehaviorAdjustment -> CabalT m ()
handleBehaviorAdjustment :: forall (m :: * -> *).
MonadIO m =>
BehaviorAdjustment -> CabalT m ()
handleBehaviorAdjustment (BehaviorAdjustment {[(BinPkgName, InstallFile)]
[BinPkgName]
[NameAddr]
[CabalEpochMapping]
[ExecDebMapping]
[CabalDebMapping]
[ExtraSuggests]
[ExtraRecommends]
[ExtraReplaces]
[ExtraProvides]
[ExtraConflicts]
[ExtraDepends]
[DevDep]
[BuildDepIndep]
[BuildDep]
[HaddockStatus]
Maybe FilePath
Maybe DebianVersion
Maybe SrcPkgName
Maybe DebBase
Maybe Revision
NameAddr
Section
SourceFormat
StandardsVersion
TestsStatus
OfficialStatus
ProfilingStatus
_maintainer :: BehaviorAdjustment -> NameAddr
_uploaders :: BehaviorAdjustment -> [NameAddr]
_executable :: BehaviorAdjustment -> [(BinPkgName, InstallFile)]
_defaultPackage :: BehaviorAdjustment -> Maybe FilePath
_missingDependency :: BehaviorAdjustment -> [BinPkgName]
_debianNameBase :: BehaviorAdjustment -> Maybe DebBase
_debianVersion :: BehaviorAdjustment -> Maybe DebianVersion
_revision :: BehaviorAdjustment -> Maybe Revision
_sourcePackageName :: BehaviorAdjustment -> Maybe SrcPkgName
_sourceSection :: BehaviorAdjustment -> Section
_standardsVersion :: BehaviorAdjustment -> StandardsVersion
_buildDep :: BehaviorAdjustment -> [BuildDep]
_buildDepIndep :: BehaviorAdjustment -> [BuildDepIndep]
_devDep :: BehaviorAdjustment -> [DevDep]
_extraDepends :: BehaviorAdjustment -> [ExtraDepends]
_extraConflicts :: BehaviorAdjustment -> [ExtraConflicts]
_extraProvides :: BehaviorAdjustment -> [ExtraProvides]
_extraReplaces :: BehaviorAdjustment -> [ExtraReplaces]
_extraRecommends :: BehaviorAdjustment -> [ExtraRecommends]
_extraSuggests :: BehaviorAdjustment -> [ExtraSuggests]
_cabalDebMapping :: BehaviorAdjustment -> [CabalDebMapping]
_cabalEpochMapping :: BehaviorAdjustment -> [CabalEpochMapping]
_execDebMapping :: BehaviorAdjustment -> [ExecDebMapping]
_profiling :: BehaviorAdjustment -> ProfilingStatus
_haddock :: BehaviorAdjustment -> [HaddockStatus]
_official :: BehaviorAdjustment -> OfficialStatus
_sourceFormat :: BehaviorAdjustment -> SourceFormat
_tests :: BehaviorAdjustment -> TestsStatus
_maintainer :: NameAddr
_uploaders :: [NameAddr]
_executable :: [(BinPkgName, InstallFile)]
_defaultPackage :: Maybe FilePath
_missingDependency :: [BinPkgName]
_debianNameBase :: Maybe DebBase
_debianVersion :: Maybe DebianVersion
_revision :: Maybe Revision
_sourcePackageName :: Maybe SrcPkgName
_sourceSection :: Section
_standardsVersion :: StandardsVersion
_buildDep :: [BuildDep]
_buildDepIndep :: [BuildDepIndep]
_devDep :: [DevDep]
_extraDepends :: [ExtraDepends]
_extraConflicts :: [ExtraConflicts]
_extraProvides :: [ExtraProvides]
_extraReplaces :: [ExtraReplaces]
_extraRecommends :: [ExtraRecommends]
_extraSuggests :: [ExtraSuggests]
_cabalDebMapping :: [CabalDebMapping]
_cabalEpochMapping :: [CabalEpochMapping]
_execDebMapping :: [ExecDebMapping]
_profiling :: ProfilingStatus
_haddock :: [HaddockStatus]
_official :: OfficialStatus
_sourceFormat :: SourceFormat
_tests :: TestsStatus
..}) = do
 [CabalEpochMapping]
-> (CabalEpochMapping -> CabalT m ()) -> CabalT m ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
t a -> (a -> m b) -> m ()
forM_ [CabalEpochMapping]
_cabalEpochMapping ((CabalEpochMapping -> CabalT m ()) -> CabalT m ())
-> (CabalEpochMapping -> CabalT m ()) -> CabalT m ()
forall a b. (a -> b) -> a -> b
$ \(CabalEpochMapping (PackageName
pkg, Int
num)) -> (Map PackageName Int -> Identity (Map PackageName Int))
-> CabalInfo -> Identity CabalInfo
Lens' CabalInfo (Map PackageName Int)
A.epochMap ((Map PackageName Int -> Identity (Map PackageName Int))
 -> CabalInfo -> Identity CabalInfo)
-> (Map PackageName Int -> Map PackageName Int) -> CabalT m ()
forall s (m :: * -> *) a b.
MonadState s m =>
ASetter s s a b -> (a -> b) -> m ()
%= PackageName -> Int -> Map PackageName Int -> Map PackageName Int
forall k a. Ord k => k -> a -> Map k a -> Map k a
Map.insert PackageName
pkg Int
num
 LensLike' (Zoomed (StateT DebInfo m) ()) CabalInfo DebInfo
-> StateT DebInfo m () -> CabalT m ()
forall c.
LensLike' (Zoomed (StateT DebInfo m) c) CabalInfo DebInfo
-> StateT DebInfo m c -> StateT CabalInfo m c
forall (m :: * -> *) (n :: * -> *) s t c.
Zoom m n s t =>
LensLike' (Zoomed m c) t s -> m c -> n c
zoom LensLike' (Zoomed (StateT DebInfo m) ()) CabalInfo DebInfo
Lens' CabalInfo DebInfo
A.debInfo (StateT DebInfo m () -> CabalT m ())
-> StateT DebInfo m () -> CabalT m ()
forall a b. (a -> b) -> a -> b
$ do
  [(BinPkgName, InstallFile)]
-> ((BinPkgName, InstallFile) -> StateT DebInfo m ())
-> StateT DebInfo m ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
t a -> (a -> m b) -> m ()
forM_ [(BinPkgName, InstallFile)]
_executable (((BinPkgName, InstallFile) -> StateT DebInfo m ())
 -> StateT DebInfo m ())
-> ((BinPkgName, InstallFile) -> StateT DebInfo m ())
-> StateT DebInfo m ()
forall a b. (a -> b) -> a -> b
$ ((Map BinPkgName InstallFile
 -> Identity (Map BinPkgName InstallFile))
-> DebInfo -> Identity DebInfo
Lens' DebInfo (Map BinPkgName InstallFile)
D.executable ((Map BinPkgName InstallFile
  -> Identity (Map BinPkgName InstallFile))
 -> DebInfo -> Identity DebInfo)
-> (Map BinPkgName InstallFile -> Map BinPkgName InstallFile)
-> StateT DebInfo m ()
forall s (m :: * -> *) a b.
MonadState s m =>
ASetter s s a b -> (a -> b) -> m ()
%=) ((Map BinPkgName InstallFile -> Map BinPkgName InstallFile)
 -> StateT DebInfo m ())
-> ((BinPkgName, InstallFile)
    -> Map BinPkgName InstallFile -> Map BinPkgName InstallFile)
-> (BinPkgName, InstallFile)
-> StateT DebInfo m ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (BinPkgName
 -> InstallFile
 -> Map BinPkgName InstallFile
 -> Map BinPkgName InstallFile)
-> (BinPkgName, InstallFile)
-> Map BinPkgName InstallFile
-> Map BinPkgName InstallFile
forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry BinPkgName
-> InstallFile
-> Map BinPkgName InstallFile
-> Map BinPkgName InstallFile
forall k a. Ord k => k -> a -> Map k a -> Map k a
Map.insert
  [ExecDebMapping]
-> (ExecDebMapping -> StateT DebInfo m ()) -> StateT DebInfo m ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
t a -> (a -> m b) -> m ()
forM_ [ExecDebMapping]
_execDebMapping ((ExecDebMapping -> StateT DebInfo m ()) -> StateT DebInfo m ())
-> (ExecDebMapping -> StateT DebInfo m ()) -> StateT DebInfo m ()
forall a b. (a -> b) -> a -> b
$ ((Map FilePath Relations -> Identity (Map FilePath Relations))
-> DebInfo -> Identity DebInfo
Lens' DebInfo (Map FilePath Relations)
D.execMap ((Map FilePath Relations -> Identity (Map FilePath Relations))
 -> DebInfo -> Identity DebInfo)
-> (Map FilePath Relations -> Map FilePath Relations)
-> StateT DebInfo m ()
forall s (m :: * -> *) a b.
MonadState s m =>
ASetter s s a b -> (a -> b) -> m ()
%=) ((Map FilePath Relations -> Map FilePath Relations)
 -> StateT DebInfo m ())
-> (ExecDebMapping
    -> Map FilePath Relations -> Map FilePath Relations)
-> ExecDebMapping
-> StateT DebInfo m ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (FilePath
 -> Relations -> Map FilePath Relations -> Map FilePath Relations)
-> (FilePath, Relations)
-> Map FilePath Relations
-> Map FilePath Relations
forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry FilePath
-> Relations -> Map FilePath Relations -> Map FilePath Relations
forall k a. Ord k => k -> a -> Map k a -> Map k a
Map.insert ((FilePath, Relations)
 -> Map FilePath Relations -> Map FilePath Relations)
-> (ExecDebMapping -> (FilePath, Relations))
-> ExecDebMapping
-> Map FilePath Relations
-> Map FilePath Relations
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Getting (FilePath, Relations) ExecDebMapping (FilePath, Relations)
-> ExecDebMapping -> (FilePath, Relations)
forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view Getting (FilePath, Relations) ExecDebMapping (FilePath, Relations)
(Unwrapped ExecDebMapping
 -> Const (FilePath, Relations) (Unwrapped ExecDebMapping))
-> ExecDebMapping -> Const (FilePath, Relations) ExecDebMapping
forall s t. Rewrapping s t => Iso s t (Unwrapped s) (Unwrapped t)
Iso' ExecDebMapping (Unwrapped ExecDebMapping)
_Wrapped
  [BinPkgName]
-> (BinPkgName -> StateT DebInfo m ()) -> StateT DebInfo m ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
t a -> (a -> m b) -> m ()
forM_ [BinPkgName]
_missingDependency ((BinPkgName -> StateT DebInfo m ()) -> StateT DebInfo m ())
-> (BinPkgName -> StateT DebInfo m ()) -> StateT DebInfo m ()
forall a b. (a -> b) -> a -> b
$ ((Set BinPkgName -> Identity (Set BinPkgName))
-> DebInfo -> Identity DebInfo
Lens' DebInfo (Set BinPkgName)
D.missingDependencies ((Set BinPkgName -> Identity (Set BinPkgName))
 -> DebInfo -> Identity DebInfo)
-> (Set BinPkgName -> Set BinPkgName) -> StateT DebInfo m ()
forall s (m :: * -> *) a b.
MonadState s m =>
ASetter s s a b -> (a -> b) -> m ()
%=) ((Set BinPkgName -> Set BinPkgName) -> StateT DebInfo m ())
-> (BinPkgName -> Set BinPkgName -> Set BinPkgName)
-> BinPkgName
-> StateT DebInfo m ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BinPkgName -> Set BinPkgName -> Set BinPkgName
forall a. Ord a => a -> Set a -> Set a
Set.insert
  (Maybe FilePath -> Identity (Maybe FilePath))
-> DebInfo -> Identity DebInfo
Lens' DebInfo (Maybe FilePath)
D.utilsPackageNameBase ((Maybe FilePath -> Identity (Maybe FilePath))
 -> DebInfo -> Identity DebInfo)
-> Maybe FilePath -> StateT DebInfo m ()
forall s (m :: * -> *) a b.
MonadState s m =>
ASetter s s a b -> b -> m ()
.= Maybe FilePath
_defaultPackage
  (Bool -> Identity Bool) -> DebInfo -> Identity DebInfo
Lens' DebInfo Bool
D.noDocumentationLibrary ((Bool -> Identity Bool) -> DebInfo -> Identity DebInfo)
-> Bool -> StateT DebInfo m ()
forall s (m :: * -> *) a b.
MonadState s m =>
ASetter s s a b -> b -> m ()
.= (HaddockStatus
HaddockDisabled HaddockStatus -> [HaddockStatus] -> Bool
forall a. Eq a => a -> [a] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem` [HaddockStatus]
_haddock)
  (Bool -> Identity Bool) -> DebInfo -> Identity DebInfo
Lens' DebInfo Bool
D.noProfilingLibrary ((Bool -> Identity Bool) -> DebInfo -> Identity DebInfo)
-> Bool -> StateT DebInfo m ()
forall s (m :: * -> *) a b.
MonadState s m =>
ASetter s s a b -> b -> m ()
.= (ProfilingStatus
_profiling ProfilingStatus -> ProfilingStatus -> Bool
forall a. Eq a => a -> a -> Bool
== ProfilingStatus
ProfilingDisabled)
  (Maybe DebBase -> Identity (Maybe DebBase))
-> DebInfo -> Identity DebInfo
Lens' DebInfo (Maybe DebBase)
D.overrideDebianNameBase ((Maybe DebBase -> Identity (Maybe DebBase))
 -> DebInfo -> Identity DebInfo)
-> Maybe DebBase -> StateT DebInfo m ()
forall s (m :: * -> *) a b.
MonadState s m =>
ASetter s s a b -> b -> m ()
.= Maybe DebBase
_debianNameBase
  (Maybe SrcPkgName -> Identity (Maybe SrcPkgName))
-> DebInfo -> Identity DebInfo
Lens' DebInfo (Maybe SrcPkgName)
D.sourcePackageName ((Maybe SrcPkgName -> Identity (Maybe SrcPkgName))
 -> DebInfo -> Identity DebInfo)
-> Maybe SrcPkgName -> StateT DebInfo m ()
forall s (m :: * -> *) a b.
MonadState s m =>
ASetter s s a b -> b -> m ()
.= Maybe SrcPkgName
_sourcePackageName
  (Maybe NameAddr -> Identity (Maybe NameAddr))
-> DebInfo -> Identity DebInfo
Lens' DebInfo (Maybe NameAddr)
D.maintainerOption ((Maybe NameAddr -> Identity (Maybe NameAddr))
 -> DebInfo -> Identity DebInfo)
-> Maybe NameAddr -> StateT DebInfo m ()
forall s (m :: * -> *) a b.
MonadState s m =>
ASetter s s a b -> b -> m ()
.= NameAddr -> Maybe NameAddr
forall a. a -> Maybe a
Just NameAddr
_maintainer
  (SourceFormat -> Identity SourceFormat)
-> DebInfo -> Identity DebInfo
Lens' DebInfo SourceFormat
D.sourceFormat ((SourceFormat -> Identity SourceFormat)
 -> DebInfo -> Identity DebInfo)
-> SourceFormat -> StateT DebInfo m ()
forall s (m :: * -> *) a b.
MonadState s m =>
ASetter s s a b -> b -> m ()
.= SourceFormat
_sourceFormat
  (Maybe FilePath -> Identity (Maybe FilePath))
-> DebInfo -> Identity DebInfo
Lens' DebInfo (Maybe FilePath)
D.revision ((Maybe FilePath -> Identity (Maybe FilePath))
 -> DebInfo -> Identity DebInfo)
-> Maybe FilePath -> StateT DebInfo m ()
forall s (m :: * -> *) a b.
MonadState s m =>
ASetter s s a b -> b -> m ()
.= Getting FilePath Revision FilePath -> Revision -> FilePath
forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view Getting FilePath Revision FilePath
(Unwrapped Revision -> Const FilePath (Unwrapped Revision))
-> Revision -> Const FilePath Revision
forall s t. Rewrapping s t => Iso s t (Unwrapped s) (Unwrapped t)
Iso' Revision (Unwrapped Revision)
_Wrapped (Revision -> FilePath) -> Maybe Revision -> Maybe FilePath
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
`fmap` Maybe Revision
_revision
  (Maybe DebianVersion -> Identity (Maybe DebianVersion))
-> DebInfo -> Identity DebInfo
Lens' DebInfo (Maybe DebianVersion)
D.debVersion ((Maybe DebianVersion -> Identity (Maybe DebianVersion))
 -> DebInfo -> Identity DebInfo)
-> Maybe DebianVersion -> StateT DebInfo m ()
forall s (m :: * -> *) a b.
MonadState s m =>
ASetter s s a b -> b -> m ()
.= Maybe DebianVersion
_debianVersion
  ([NameAddr] -> Identity [NameAddr]) -> DebInfo -> Identity DebInfo
Lens' DebInfo [NameAddr]
D.uploadersOption (([NameAddr] -> Identity [NameAddr])
 -> DebInfo -> Identity DebInfo)
-> ([NameAddr] -> [NameAddr]) -> StateT DebInfo m ()
forall s (m :: * -> *) a b.
MonadState s m =>
ASetter s s a b -> (a -> b) -> m ()
%= ([NameAddr] -> [NameAddr] -> [NameAddr]
forall a. [a] -> [a] -> [a]
++ [NameAddr]
_uploaders)
  (Relations -> Identity Relations) -> DebInfo -> Identity DebInfo
Lens' DebInfo Relations
D.extraDevDeps ((Relations -> Identity Relations) -> DebInfo -> Identity DebInfo)
-> (Relations -> Relations) -> StateT DebInfo m ()
forall s (m :: * -> *) a b.
MonadState s m =>
ASetter s s a b -> (a -> b) -> m ()
%= (Relations -> Relations -> Relations
forall a. [a] -> [a] -> [a]
++ (DevDep -> Relations) -> [DevDep] -> Relations
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (Getting Relations DevDep Relations -> DevDep -> Relations
forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view Getting Relations DevDep Relations
(Unwrapped DevDep -> Const Relations (Unwrapped DevDep))
-> DevDep -> Const Relations DevDep
forall s t. Rewrapping s t => Iso s t (Unwrapped s) (Unwrapped t)
Iso' DevDep (Unwrapped DevDep)
_Wrapped) [DevDep]
_devDep)
  [CabalDebMapping]
-> (CabalDebMapping -> StateT DebInfo m ()) -> StateT DebInfo m ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
t a -> (a -> m b) -> m ()
forM_ [CabalDebMapping]
_cabalDebMapping ((CabalDebMapping -> StateT DebInfo m ()) -> StateT DebInfo m ())
-> (CabalDebMapping -> StateT DebInfo m ()) -> StateT DebInfo m ()
forall a b. (a -> b) -> a -> b
$ \(CabalDebMapping (PackageName
pkg, Relations
rels)) -> do
    (Map FilePath Relations -> Identity (Map FilePath Relations))
-> DebInfo -> Identity DebInfo
Lens' DebInfo (Map FilePath Relations)
D.extraLibMap ((Map FilePath Relations -> Identity (Map FilePath Relations))
 -> DebInfo -> Identity DebInfo)
-> (Map FilePath Relations -> Map FilePath Relations)
-> StateT DebInfo m ()
forall s (m :: * -> *) a b.
MonadState s m =>
ASetter s s a b -> (a -> b) -> m ()
%= FilePath
-> Relations -> Map FilePath Relations -> Map FilePath Relations
forall k a. Ord k => k -> a -> Map k a -> Map k a
Map.insert (PackageName -> FilePath
unPackageName PackageName
pkg) Relations
rels
  [ExtraDepends]
-> Lens' PackageRelations Relations -> StateT DebInfo m ()
forall (m :: * -> *) n.
(MonadState DebInfo m, Wrapped n, Rewrapped n n,
 Unwrapped n ~ (BinPkgName, Relations)) =>
[n] -> Lens' PackageRelations Relations -> m ()
addExtra [ExtraDepends]
_extraDepends (Relations -> f Relations)
-> PackageRelations -> f PackageRelations
Lens' PackageRelations Relations
B.depends
  [ExtraConflicts]
-> Lens' PackageRelations Relations -> StateT DebInfo m ()
forall (m :: * -> *) n.
(MonadState DebInfo m, Wrapped n, Rewrapped n n,
 Unwrapped n ~ (BinPkgName, Relations)) =>
[n] -> Lens' PackageRelations Relations -> m ()
addExtra [ExtraConflicts]
_extraConflicts (Relations -> f Relations)
-> PackageRelations -> f PackageRelations
Lens' PackageRelations Relations
B.conflicts
  [ExtraProvides]
-> Lens' PackageRelations Relations -> StateT DebInfo m ()
forall (m :: * -> *) n.
(MonadState DebInfo m, Wrapped n, Rewrapped n n,
 Unwrapped n ~ (BinPkgName, Relations)) =>
[n] -> Lens' PackageRelations Relations -> m ()
addExtra [ExtraProvides]
_extraProvides (Relations -> f Relations)
-> PackageRelations -> f PackageRelations
Lens' PackageRelations Relations
B.provides
  [ExtraReplaces]
-> Lens' PackageRelations Relations -> StateT DebInfo m ()
forall (m :: * -> *) n.
(MonadState DebInfo m, Wrapped n, Rewrapped n n,
 Unwrapped n ~ (BinPkgName, Relations)) =>
[n] -> Lens' PackageRelations Relations -> m ()
addExtra [ExtraReplaces]
_extraReplaces (Relations -> f Relations)
-> PackageRelations -> f PackageRelations
Lens' PackageRelations Relations
B.replaces
  [ExtraRecommends]
-> Lens' PackageRelations Relations -> StateT DebInfo m ()
forall (m :: * -> *) n.
(MonadState DebInfo m, Wrapped n, Rewrapped n n,
 Unwrapped n ~ (BinPkgName, Relations)) =>
[n] -> Lens' PackageRelations Relations -> m ()
addExtra [ExtraRecommends]
_extraRecommends (Relations -> f Relations)
-> PackageRelations -> f PackageRelations
Lens' PackageRelations Relations
B.recommends
  [ExtraSuggests]
-> Lens' PackageRelations Relations -> StateT DebInfo m ()
forall (m :: * -> *) n.
(MonadState DebInfo m, Wrapped n, Rewrapped n n,
 Unwrapped n ~ (BinPkgName, Relations)) =>
[n] -> Lens' PackageRelations Relations -> m ()
addExtra [ExtraSuggests]
_extraSuggests (Relations -> f Relations)
-> PackageRelations -> f PackageRelations
Lens' PackageRelations Relations
B.suggests
  (TestsStatus -> Identity TestsStatus)
-> DebInfo -> Identity DebInfo
Lens' DebInfo TestsStatus
D.testsStatus ((TestsStatus -> Identity TestsStatus)
 -> DebInfo -> Identity DebInfo)
-> TestsStatus -> StateT DebInfo m ()
forall s (m :: * -> *) a b.
MonadState s m =>
ASetter s s a b -> b -> m ()
.= TestsStatus
_tests
  (Bool -> Identity Bool) -> DebInfo -> Identity DebInfo
Lens' DebInfo Bool
D.official ((Bool -> Identity Bool) -> DebInfo -> Identity DebInfo)
-> Bool -> StateT DebInfo m ()
forall s (m :: * -> *) a b.
MonadState s m =>
ASetter s s a b -> b -> m ()
.= (OfficialStatus
_official OfficialStatus -> OfficialStatus -> Bool
forall a. Eq a => a -> a -> Bool
== OfficialStatus
Official)
  LensLike'
  (Zoomed (StateT SourceDebDescription m) ())
  DebInfo
  SourceDebDescription
-> StateT SourceDebDescription m () -> StateT DebInfo m ()
forall c.
LensLike'
  (Zoomed (StateT SourceDebDescription m) c)
  DebInfo
  SourceDebDescription
-> StateT SourceDebDescription m c -> StateT DebInfo m c
forall (m :: * -> *) (n :: * -> *) s t c.
Zoom m n s t =>
LensLike' (Zoomed m c) t s -> m c -> n c
zoom LensLike'
  (Zoomed (StateT SourceDebDescription m) ())
  DebInfo
  SourceDebDescription
Lens' DebInfo SourceDebDescription
D.control (StateT SourceDebDescription m () -> StateT DebInfo m ())
-> StateT SourceDebDescription m () -> StateT DebInfo m ()
forall a b. (a -> b) -> a -> b
$ do
    (Maybe Section -> Identity (Maybe Section))
-> SourceDebDescription -> Identity SourceDebDescription
Lens' SourceDebDescription (Maybe Section)
S.section ((Maybe Section -> Identity (Maybe Section))
 -> SourceDebDescription -> Identity SourceDebDescription)
-> Maybe Section -> StateT SourceDebDescription m ()
forall s (m :: * -> *) a b.
MonadState s m =>
ASetter s s a b -> b -> m ()
.= Section -> Maybe Section
forall a. a -> Maybe a
Just Section
_sourceSection
    (Maybe StandardsVersion -> Identity (Maybe StandardsVersion))
-> SourceDebDescription -> Identity SourceDebDescription
Lens' SourceDebDescription (Maybe StandardsVersion)
S.standardsVersion ((Maybe StandardsVersion -> Identity (Maybe StandardsVersion))
 -> SourceDebDescription -> Identity SourceDebDescription)
-> Maybe StandardsVersion -> StateT SourceDebDescription m ()
forall s (m :: * -> *) a b.
MonadState s m =>
ASetter s s a b -> b -> m ()
.= StandardsVersion -> Maybe StandardsVersion
forall a. a -> Maybe a
Just StandardsVersion
_standardsVersion
    (Relations -> Identity Relations)
-> SourceDebDescription -> Identity SourceDebDescription
Lens' SourceDebDescription Relations
S.buildDepends ((Relations -> Identity Relations)
 -> SourceDebDescription -> Identity SourceDebDescription)
-> (Relations -> Relations) -> StateT SourceDebDescription m ()
forall s (m :: * -> *) a b.
MonadState s m =>
ASetter s s a b -> (a -> b) -> m ()
%= (Relations -> Relations -> Relations
forall a. [a] -> [a] -> [a]
++ (BuildDep -> Relations) -> [BuildDep] -> Relations
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (Getting Relations BuildDep Relations -> BuildDep -> Relations
forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view Getting Relations BuildDep Relations
(Unwrapped BuildDep -> Const Relations (Unwrapped BuildDep))
-> BuildDep -> Const Relations BuildDep
forall s t. Rewrapping s t => Iso s t (Unwrapped s) (Unwrapped t)
Iso' BuildDep (Unwrapped BuildDep)
_Wrapped) [BuildDep]
_buildDep)
    (Relations -> Identity Relations)
-> SourceDebDescription -> Identity SourceDebDescription
Lens' SourceDebDescription Relations
S.buildDepends ((Relations -> Identity Relations)
 -> SourceDebDescription -> Identity SourceDebDescription)
-> (Relations -> Relations) -> StateT SourceDebDescription m ()
forall s (m :: * -> *) a b.
MonadState s m =>
ASetter s s a b -> (a -> b) -> m ()
%= (Relations -> Relations -> Relations
forall a. [a] -> [a] -> [a]
++ (DevDep -> Relations) -> [DevDep] -> Relations
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (Getting Relations DevDep Relations -> DevDep -> Relations
forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view Getting Relations DevDep Relations
(Unwrapped DevDep -> Const Relations (Unwrapped DevDep))
-> DevDep -> Const Relations DevDep
forall s t. Rewrapping s t => Iso s t (Unwrapped s) (Unwrapped t)
Iso' DevDep (Unwrapped DevDep)
_Wrapped) [DevDep]
_devDep)
    (Relations -> Identity Relations)
-> SourceDebDescription -> Identity SourceDebDescription
Lens' SourceDebDescription Relations
S.buildDependsIndep ((Relations -> Identity Relations)
 -> SourceDebDescription -> Identity SourceDebDescription)
-> (Relations -> Relations) -> StateT SourceDebDescription m ()
forall s (m :: * -> *) a b.
MonadState s m =>
ASetter s s a b -> (a -> b) -> m ()
%= (Relations -> Relations -> Relations
forall a. [a] -> [a] -> [a]
++ (BuildDepIndep -> Relations) -> [BuildDepIndep] -> Relations
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (Getting Relations BuildDepIndep Relations
-> BuildDepIndep -> Relations
forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view Getting Relations BuildDepIndep Relations
(Unwrapped BuildDepIndep
 -> Const Relations (Unwrapped BuildDepIndep))
-> BuildDepIndep -> Const Relations BuildDepIndep
forall s t. Rewrapping s t => Iso s t (Unwrapped s) (Unwrapped t)
Iso' BuildDepIndep (Unwrapped BuildDepIndep)
_Wrapped) [BuildDepIndep]
_buildDepIndep)

addExtra :: (MonadState D.DebInfo m, Wrapped n, Rewrapped n n,
             Unwrapped n ~ (BinPkgName, Relations)) =>
            [n] -> Lens' B.PackageRelations Relations -> m ()
addExtra :: forall (m :: * -> *) n.
(MonadState DebInfo m, Wrapped n, Rewrapped n n,
 Unwrapped n ~ (BinPkgName, Relations)) =>
[n] -> Lens' PackageRelations Relations -> m ()
addExtra [n]
extra Lens' PackageRelations Relations
lens' = [n] -> (n -> m ()) -> m ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
t a -> (a -> m b) -> m ()
forM_ [n]
extra ((n -> m ()) -> m ()) -> (n -> m ()) -> m ()
forall a b. (a -> b) -> a -> b
$ \n
arg -> do
  let (BinPkgName
pkg, Relations
rel) = Getting (BinPkgName, Relations) n (BinPkgName, Relations)
-> n -> (BinPkgName, Relations)
forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view Getting (BinPkgName, Relations) n (BinPkgName, Relations)
(Unwrapped n -> Const (BinPkgName, Relations) (Unwrapped n))
-> n -> Const (BinPkgName, Relations) n
forall s t. Rewrapping s t => Iso s t (Unwrapped s) (Unwrapped t)
Iso n n (Unwrapped n) (Unwrapped n)
_Wrapped n
arg
  BinPkgName -> Lens' DebInfo BinaryDebDescription
D.binaryDebDescription BinPkgName
pkg ((BinaryDebDescription -> Identity BinaryDebDescription)
 -> DebInfo -> Identity DebInfo)
-> ((Relations -> Identity Relations)
    -> BinaryDebDescription -> Identity BinaryDebDescription)
-> (Relations -> Identity Relations)
-> DebInfo
-> Identity DebInfo
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (PackageRelations -> Identity PackageRelations)
-> BinaryDebDescription -> Identity BinaryDebDescription
Lens' BinaryDebDescription PackageRelations
B.relations ((PackageRelations -> Identity PackageRelations)
 -> BinaryDebDescription -> Identity BinaryDebDescription)
-> ((Relations -> Identity Relations)
    -> PackageRelations -> Identity PackageRelations)
-> (Relations -> Identity Relations)
-> BinaryDebDescription
-> Identity BinaryDebDescription
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Relations -> Identity Relations)
-> PackageRelations -> Identity PackageRelations
Lens' PackageRelations Relations
lens' ((Relations -> Identity Relations) -> DebInfo -> Identity DebInfo)
-> (Relations -> Relations) -> m ()
forall s (m :: * -> *) a b.
MonadState s m =>
ASetter s s a b -> (a -> b) -> m ()
%= (Relations -> Relations -> Relations
forall a. [a] -> [a] -> [a]
++ Relations
rel)

parseProgramArguments' :: [String] -> IO CommandLineOptions
parseProgramArguments' :: [FilePath] -> IO CommandLineOptions
parseProgramArguments' [FilePath]
args =  ParserResult CommandLineOptions -> IO CommandLineOptions
forall a. ParserResult a -> IO a
O.handleParseResult ParserResult CommandLineOptions
result where
  prefs :: ParserPrefs
prefs = PrefsMod -> ParserPrefs
O.prefs PrefsMod
forall m. Monoid m => m
O.idm
  result :: ParserResult CommandLineOptions
result = ParserPrefs
-> ParserInfo CommandLineOptions
-> [FilePath]
-> ParserResult CommandLineOptions
forall a.
ParserPrefs -> ParserInfo a -> [FilePath] -> ParserResult a
O.execParserPure ParserPrefs
prefs ([FilePath] -> ParserInfo CommandLineOptions
commandLineOptionsParserInfo [FilePath]
args) [FilePath]
args

parseProgramArguments :: IO CommandLineOptions
parseProgramArguments :: IO CommandLineOptions
parseProgramArguments = IO [FilePath]
getArgs IO [FilePath]
-> ([FilePath] -> IO CommandLineOptions) -> IO CommandLineOptions
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= [FilePath] -> IO CommandLineOptions
parseProgramArguments' ([FilePath] -> IO CommandLineOptions)
-> ([FilePath] -> [FilePath])
-> [FilePath]
-> IO CommandLineOptions
forall b c a. (b -> c) -> (a -> b) -> a -> c
. FilePath -> [FilePath] -> [FilePath]
leaveOne FilePath
"--disable-haddock"
    where
      leaveOne :: String -> [String] -> [String]
      leaveOne :: FilePath -> [FilePath] -> [FilePath]
leaveOne FilePath
s [FilePath]
xs = Bool -> [FilePath] -> [FilePath]
go Bool
False [FilePath]
xs
          where
            go :: Bool -> [FilePath] -> [FilePath]
go Bool
_ [] = []
            go Bool
False (FilePath
x : [FilePath]
xs') | FilePath
x FilePath -> FilePath -> Bool
forall a. Eq a => a -> a -> Bool
== FilePath
s = FilePath
x FilePath -> [FilePath] -> [FilePath]
forall a. a -> [a] -> [a]
: Bool -> [FilePath] -> [FilePath]
go Bool
True [FilePath]
xs'
            go Bool
True (FilePath
x : [FilePath]
xs') | FilePath
x FilePath -> FilePath -> Bool
forall a. Eq a => a -> a -> Bool
== FilePath
s = Bool -> [FilePath] -> [FilePath]
go Bool
True [FilePath]
xs'
            go Bool
flag (FilePath
x : [FilePath]
xs') = FilePath
x FilePath -> [FilePath] -> [FilePath]
forall a. a -> [a] -> [a]
: Bool -> [FilePath] -> [FilePath]
go Bool
flag [FilePath]
xs'