debian-4.1.2: Modules for working with the Debian package system

Safe Haskell | None
Language | Haskell2010

Debian.Control.Policy

Contents

- Validated debian control file type
- Class of things that contain one DebianControl value
- Pure functions that operate on validated control files

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

- data DebianControl
- validateDebianControl :: MonadCatch m => Control' Text -> m (Either ControlFileError DebianControl)
- unsafeDebianControl :: Control' Text -> DebianControl
- parseDebianControlFromFile :: FilePath -> IO (Either ControlFileError DebianControl)
- parseDebianControl :: MonadCatch m => String -> Text -> m (Either ControlFileError DebianControl)
- data ControlFileError
  - = NoParagraphs {
    - locs :: [Loc]
    }
  - | NoBinaryParagraphs {
    - locs :: [Loc]
    - ctl :: String
    }
  - | MissingField {
    - locs :: [Loc]
    - field :: String
    }
  - | ParseRelationsError {
    - locs :: [Loc]
    - parseError :: ParseError
    }
  - | ParseControlError {
    - locs :: [Loc]
    - parseError :: ParseError
    }
  - | IOError {
    - locs :: [Loc]
    - ioError :: IOError
    }
- class Show a => HasDebianControl a where
  - debianControl :: a -> DebianControl
- debianSourceParagraph :: HasDebianControl a => a -> Paragraph' Text
- debianBinaryParagraphs :: HasDebianControl a => a -> [Paragraph' Text]
- debianPackageParagraphs :: HasDebianControl a => a -> (Paragraph' Text, [Paragraph' Text])
- debianPackageNames :: HasDebianControl a => a -> (SrcPkgName, [BinPkgName])
- debianSourcePackageName :: HasDebianControl a => a -> SrcPkgName
- debianBinaryPackageNames :: HasDebianControl a => a -> [BinPkgName]
- debianRelations :: HasDebianControl a => String -> a -> Either ControlFileError (Maybe Relations)
- debianBuildDeps :: HasDebianControl a => a -> Maybe Relations
- debianBuildDepsIndep :: HasDebianControl a => a -> Maybe Relations

# Validated debian control file type

data DebianControl Source #

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

#### Instances

Instances details

HasDebianControl DebianControl Source # |
Instance details Defined in Debian.Control.Policy Methods debianControl :: DebianControl -> DebianControl Source #
Show DebianControl Source # |
Instance details Defined in Debian.Control.Policy Methods showsPrec :: Int -> DebianControl -> ShowS Source # show :: DebianControl -> String Source # showList :: [DebianControl] -> ShowS Source #

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.)

unsafeDebianControl :: Control' Text -> DebianControl Source #

parseDebianControlFromFile :: FilePath -> IO (Either ControlFileError DebianControl) Source #

parseDebianControl :: MonadCatch m => String -> Text -> m (Either ControlFileError DebianControl) Source #

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]
- ctl :: String

MissingField |

Fields

- locs :: [Loc]
- field :: String

ParseRelationsError |

Fields

- locs :: [Loc]
- parseError :: ParseError

ParseControlError |

Fields

- locs :: [Loc]
- parseError :: ParseError

IOError |

Fields

- locs :: [Loc]
- ioError :: IOError

#### Instances

Instances details

Exception ControlFileError Source # |
Instance details Defined in Debian.Control.Policy Methods toException :: ControlFileError -> SomeException Source # fromException :: SomeException -> Maybe ControlFileError Source # displayException :: ControlFileError -> String Source # backtraceDesired :: ControlFileError -> Bool Source #
Show ControlFileError Source # |
Instance details Defined in Debian.Control.Policy Methods showsPrec :: Int -> ControlFileError -> ShowS Source # show :: ControlFileError -> String Source # showList :: [ControlFileError] -> ShowS Source #
Eq ControlFileError Source # |
Instance details Defined in Debian.Control.Policy Methods (==) :: ControlFileError -> ControlFileError -> Bool Source # (/=) :: ControlFileError -> ControlFileError -> Bool Source #

# Class of things that contain one DebianControl value

class Show a => HasDebianControl a where Source #

Class of things that contain a validated Debian control file.

Methods

debianControl :: a -> DebianControl Source #

#### Instances

Instances details

HasDebianControl DebianControl Source # |
Instance details Defined in Debian.Control.Policy Methods debianControl :: DebianControl -> DebianControl Source #

# Pure functions that operate on validated control files

debianSourceParagraph :: HasDebianControl a => a -> Paragraph' Text Source #

debianBinaryParagraphs :: HasDebianControl a => a -> [Paragraph' Text] Source #

debianPackageParagraphs :: HasDebianControl a => a -> (Paragraph' Text, [Paragraph' Text]) Source #

debianPackageNames :: HasDebianControl a => a -> (SrcPkgName, [BinPkgName]) Source #

debianSourcePackageName :: HasDebianControl a => a -> SrcPkgName Source #

debianBinaryPackageNames :: HasDebianControl a => a -> [BinPkgName] Source #

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.

debianBuildDeps :: HasDebianControl a => a -> Maybe Relations Source #

debianBuildDepsIndep :: HasDebianControl a => a -> Maybe Relations Source #