cabal-debian-4.31.6: Create a Debianization for a Cabal package

Safe HaskellNone
LanguageHaskell98

Debian.Control.Policy

Contents

Description

Access to things that Debian policy says should be in a valid control file. The pure functions will not throw ControlFileError if they are operating on a DebianControl value returned by validateDebianControl. However, they might if they are created using unsafeDebianControl.

Synopsis

Validated debian control file type

data DebianControl Source

Opaque (constructor not exported) type to hold a validated Debian Control File

validateDebianControl :: MonadCatch m => Control' Text -> m (Either ControlFileError DebianControl) Source

Validate and return a control file in an opaque wrapper. May throw a ControlFileError. Currently we only verify that it has a Source field in the first paragraph and one or more subsequent paragraphs each with a Package field, and no syntax errors in the build dependencies (though they may be absent.)

data ControlFileError Source

Errors that control files might throw, with source file name and line number generated by template haskell.

Constructors

NoParagraphs 

Fields

locs :: [Loc]
 
NoBinaryParagraphs 

Fields

locs :: [Loc]
 
MissingField 

Fields

locs :: [Loc]
 
field :: String
 
ParseRelationsError 

Fields

locs :: [Loc]
 
parseError :: ParseError
 
ParseControlError 

Fields

locs :: [Loc]
 
parseError :: ParseError
 
IOError 

Fields

locs :: [Loc]
 
ioError :: IOError
 

Class of things that contain one DebianControl value

class HasDebianControl a where Source

Class of things that contain a validated Debian control file.

Pure functions that operate on validated control files

debianRelations :: HasDebianControl a => String -> a -> Either ControlFileError (Maybe Relations) Source

This could access fields we haven't validated, so it can return an error. Additionally, the field might be absent, in which case it returns Nothing.