Safe Haskell | None |
---|---|
Language | Haskell98 |
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.
- 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 { }
- | NoBinaryParagraphs { }
- | MissingField { }
- | ParseRelationsError {
- locs :: [Loc]
- parseError :: ParseError
- | ParseControlError {
- locs :: [Loc]
- parseError :: ParseError
- | IOError { }
- class 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
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.)
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.
Class of things that contain one DebianControl value
class HasDebianControl a where Source
Class of things that contain a validated Debian control file.
debianControl :: a -> 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