-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A set of modules for working with Debian control files and packages -- -- This version is very out of date and no longer supported. Get latest -- version from darcs for now. Modules for parsing Debian control files, -- resolving dependencies, comparing version numbers, and other useful -- stuff. @package debian @version 1.2.1 -- | A module for parsing, comparing, and (eventually) modifying debian -- version numbers. -- http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Version module Linspire.Debian.Version.Common data DebianVersion class ParseDebianVersion a parseDebianVersion :: (ParseDebianVersion a) => a -> DebianVersion -- | Split a DebianVersion into its three components: epoch, version, -- revision. It is not safe to use the parsed version number for this -- because you will lose information, such as leading zeros. evr :: DebianVersion -> (Maybe Int, String, Maybe String) epoch :: DebianVersion -> Maybe Int version :: DebianVersion -> String revision :: DebianVersion -> Maybe String buildDebianVersion :: Maybe Int -> String -> Maybe String -> DebianVersion -- | Convert a string to a debian version number. May throw an exception if -- the string is unparsable -- but I am not sure if that can currently -- happen. Are there any invalid version strings? Perhaps ones with -- underscore, or something? parseDV :: CharParser () (Found Int, NonNumeric, Found NonNumeric) instance Ord Numeric instance Eq Numeric instance Ord NonNumeric instance Eq NonNumeric instance Ord DebianVersion instance Eq DebianVersion instance Show DebianVersion module Linspire.Debian.Version.String class ParseDebianVersion a parseDebianVersion :: (ParseDebianVersion a) => a -> DebianVersion instance ParseDebianVersion String module Linspire.Debian.Version.ByteString class ParseDebianVersion a parseDebianVersion :: (ParseDebianVersion a) => a -> DebianVersion instance ParseDebianVersion ByteString module Linspire.Debian.SourcesList data DebSource DebSource :: SourceType -> URI -> Either String (String, [String]) -> DebSource data SourceType Deb :: SourceType DebSrc :: SourceType -- | parseSourceLine -- parses a source line the argument must be a -- non-empty, valid source line with comments stripped see: -- sourceLines parseSourceLine :: String -> DebSource parseSourcesList :: String -> [DebSource] -- | quoteWords - similar to words, but with special handling of -- double-quotes and brackets. -- -- The handling double quotes and [] is supposed to match: -- apt-0.6.44.2/apt-pkg/contrib/strutl.cc:ParseQuoteWord() -- -- The behaviour can be defined as: -- -- Break the string into space seperated words ignoring spaces that -- appear between "" or []. Strip trailing and leading white space around -- words. Strip out double quotes, but leave the square brackets intact. quoteWords :: String -> [String] -- | Return the list of files that apt-get update would write into -- /var/lib/apt/lists when it processed the given list of DebSource. -- FIXME: remove the root argument from this and just return the names. archFiles :: FilePath -> Maybe String -> DebSource -> [FilePath] instance Eq DebSource instance Eq SourceType instance Show DebSource instance Show SourceType -- | A module for parsing, comparing, and (eventually) modifying debian -- version numbers. -- http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Version module Linspire.Debian.Version data DebianVersion parseDebianVersion :: (ParseDebianVersion a) => a -> DebianVersion epoch :: DebianVersion -> Maybe Int version :: DebianVersion -> String revision :: DebianVersion -> Maybe String buildDebianVersion :: Maybe Int -> String -> Maybe String -> DebianVersion -- | Split a DebianVersion into its three components: epoch, version, -- revision. It is not safe to use the parsed version number for this -- because you will lose information, such as leading zeros. evr :: DebianVersion -> (Maybe Int, String, Maybe String) module Linspire.Debian.Relation.Common type PkgName = String type Relations = AndRelation type AndRelation = [OrRelation] type OrRelation = [Relation] data Relation Rel :: PkgName -> (Maybe VersionReq) -> (Maybe ArchitectureReq) -> Relation class ParseRelations a parseRelations :: (ParseRelations a) => a -> Either ParseError Relations data ArchitectureReq ArchOnly :: [String] -> ArchitectureReq ArchExcept :: [String] -> ArchitectureReq data VersionReq SLT :: DebianVersion -> VersionReq LTE :: DebianVersion -> VersionReq EEQ :: DebianVersion -> VersionReq GRE :: DebianVersion -> VersionReq SGR :: DebianVersion -> VersionReq -- | Check if a version number satisfies a version requirement. checkVersionReq :: Maybe VersionReq -> Maybe DebianVersion -> Bool instance Eq VersionReq instance Eq ArchitectureReq instance Eq Relation instance Ord VersionReq instance Show VersionReq instance Show ArchitectureReq instance Ord Relation instance Show Relation -- | A module for working with debian relationships -- http://www.debian.org/doc/debian-policy/ch-relationships.html module Linspire.Debian.Relation.String type PkgName = String type AndRelation = [OrRelation] type OrRelation = [Relation] type Relations = AndRelation data Relation Rel :: PkgName -> (Maybe VersionReq) -> (Maybe ArchitectureReq) -> Relation data ArchitectureReq ArchOnly :: [String] -> ArchitectureReq ArchExcept :: [String] -> ArchitectureReq data VersionReq SLT :: DebianVersion -> VersionReq LTE :: DebianVersion -> VersionReq EEQ :: DebianVersion -> VersionReq GRE :: DebianVersion -> VersionReq SGR :: DebianVersion -> VersionReq -- | Check if a version number satisfies a version requirement. checkVersionReq :: Maybe VersionReq -> Maybe DebianVersion -> Bool type RelParser a = CharParser () a class ParseRelations a parseRelations :: (ParseRelations a) => a -> Either ParseError Relations pRelations :: RelParser Relations instance ParseRelations String -- | A module for working with debian relationships -- http://www.debian.org/doc/debian-policy/ch-relationships.html module Linspire.Debian.Relation.ByteString type PkgName = String type AndRelation = [OrRelation] type OrRelation = [Relation] type Relations = AndRelation data Relation Rel :: PkgName -> (Maybe VersionReq) -> (Maybe ArchitectureReq) -> Relation data ArchitectureReq ArchOnly :: [String] -> ArchitectureReq ArchExcept :: [String] -> ArchitectureReq data VersionReq SLT :: DebianVersion -> VersionReq LTE :: DebianVersion -> VersionReq EEQ :: DebianVersion -> VersionReq GRE :: DebianVersion -> VersionReq SGR :: DebianVersion -> VersionReq -- | Check if a version number satisfies a version requirement. checkVersionReq :: Maybe VersionReq -> Maybe DebianVersion -> Bool type RelParser a = CharParser () a class ParseRelations a parseRelations :: (ParseRelations a) => a -> Either ParseError Relations instance ParseRelations ByteString -- | A module for working with debian relationships -- http://www.debian.org/doc/debian-policy/ch-relationships.html module Linspire.Debian.Relation type PkgName = String type AndRelation = [OrRelation] type OrRelation = [Relation] type Relations = AndRelation data Relation Rel :: PkgName -> (Maybe VersionReq) -> (Maybe ArchitectureReq) -> Relation data ArchitectureReq ArchOnly :: [String] -> ArchitectureReq ArchExcept :: [String] -> ArchitectureReq data VersionReq SLT :: DebianVersion -> VersionReq LTE :: DebianVersion -> VersionReq EEQ :: DebianVersion -> VersionReq GRE :: DebianVersion -> VersionReq SGR :: DebianVersion -> VersionReq -- | Check if a version number satisfies a version requirement. checkVersionReq :: Maybe VersionReq -> Maybe DebianVersion -> Bool type RelParser a = CharParser () a class ParseRelations a parseRelations :: (ParseRelations a) => a -> Either ParseError Relations -- | Functions for dealing with source and binary packages in an -- abstract-way module Linspire.Debian.Package type PackageNameMap a = Map String [a] -- | packageNameMap creates a map from a package name to all the -- versions of that package NOTE: Provides are not included in the map -- NOTE: the sort order is random -- this is perhaps a bug see also: -- addProvides packageNameMap :: (a -> String) -> [a] -> PackageNameMap a -- | addProvides finds packages that Provide other packages and adds -- them to the PackageNameMap. They will be adde to the end of the list, -- so that real packages have 'higher priority' than virtual packages. -- NOTE: Does not check for duplication or multiple use addProvides :: (p -> [PkgName]) -> [p] -> PackageNameMap p -> PackageNameMap p -- | findProvides findProvides :: (p -> [PkgName]) -> [p] -> [(PkgName, p)] -- | lookupPackageByRel returns all the packages that satisfy the -- specified relation TODO: Add architecture check lookupPackageByRel :: PackageNameMap a -> (a -> (String, DebianVersion)) -> Relation -> [a] module Linspire.Debian.Control.Common newtype Control' a Control :: [Paragraph' a] -> Control' a unControl :: Control' a -> [Paragraph' a] newtype Paragraph' a Paragraph :: [Field' a] -> Paragraph' a -- | NOTE: we do not strip the leading or trailing whitespace in the name -- or value data Field' a Field :: (a, a) -> Field' a Comment :: a -> Field' a class ControlFunctions a parseControlFromFile :: (ControlFunctions a) => FilePath -> IO (Either ParseError (Control' a)) parseControlFromHandle :: (ControlFunctions a) => String -> Handle -> IO (Either ParseError (Control' a)) lookupP :: (ControlFunctions a) => String -> (Paragraph' a) -> Maybe (Field' a) stripWS :: (ControlFunctions a) => a -> a mergeControls :: [Control' a] -> Control' a fieldValue :: (ControlFunctions a) => String -> Paragraph' a -> Maybe a removeField :: (Eq a) => a -> Paragraph' a -> Paragraph' a prependFields :: [Field' a] -> Paragraph' a -> Paragraph' a appendFields :: [Field' a] -> Paragraph' a -> Paragraph' a renameField :: (Eq a) => a -> a -> Paragraph' a -> Paragraph' a modifyField :: (Eq a) => a -> (a -> a) -> Paragraph' a -> Paragraph' a -- | Move selected fields to the beginning of a paragraph. raiseFields :: (Eq a) => (a -> Bool) -> Paragraph' a -> Paragraph' a instance (Eq a) => Eq (Field' a) module Linspire.Debian.Control.ByteString newtype Control' a Control :: [Paragraph' a] -> Control' a unControl :: Control' a -> [Paragraph' a] newtype Paragraph' a Paragraph :: [Field' a] -> Paragraph' a -- | NOTE: we do not strip the leading or trailing whitespace in the name -- or value data Field' a Field :: (a, a) -> Field' a Comment :: a -> Field' a type Control = Control' ByteString type Paragraph = Paragraph' ByteString type Field = Field' ByteString class ControlFunctions a parseControlFromFile :: (ControlFunctions a) => FilePath -> IO (Either ParseError (Control' a)) parseControlFromHandle :: (ControlFunctions a) => String -> Handle -> IO (Either ParseError (Control' a)) lookupP :: (ControlFunctions a) => String -> (Paragraph' a) -> Maybe (Field' a) stripWS :: (ControlFunctions a) => a -> a mergeControls :: [Control' a] -> Control' a fieldValue :: (ControlFunctions a) => String -> Paragraph' a -> Maybe a removeField :: (Eq a) => a -> Paragraph' a -> Paragraph' a prependFields :: [Field' a] -> Paragraph' a -> Paragraph' a appendFields :: [Field' a] -> Paragraph' a -> Paragraph' a renameField :: (Eq a) => a -> a -> Paragraph' a -> Paragraph' a modifyField :: (Eq a) => a -> (a -> a) -> Paragraph' a -> Paragraph' a -- | Move selected fields to the beginning of a paragraph. raiseFields :: (Eq a) => (a -> Bool) -> Paragraph' a -> Paragraph' a instance (Show a) => Show (Result a) instance MonadPlus (Parser state) instance Monad (Parser state) instance ControlFunctions ByteString module Linspire.Debian.Dependencies data Status Remaining :: AndRelation -> Status MissingDep :: Relation -> Status Complete :: Status type State a = (Status, [a]) complete :: State a -> Bool data CSP a CSP :: PackageNameMap a -> Relations -> (a -> Relations) -> (a -> Relations) -> (a -> (String, DebianVersion)) -> CSP a pnm :: CSP a -> PackageNameMap a relations :: CSP a -> Relations depFunction :: CSP a -> (a -> Relations) conflicts :: CSP a -> a -> Relations packageVersion :: CSP a -> a -> (String, DebianVersion) -- | TODO addProvides -- see DQL.Exec controlCSP :: Control -> Relations -> (Paragraph -> Relations) -> CSP Paragraph testCSP :: FilePath -> (Paragraph -> Relations) -> String -> (CSP Paragraph -> IO a) -> IO a depF :: Paragraph -> Relations sidPackages :: String test :: String -> Labeler Paragraph -> IO () packageVersionParagraph :: Paragraph -> (String, DebianVersion) conflict :: CSP p -> p -> p -> Bool -- | JAS: deal with Provides (can a package provide more than one -- package?) conflict' :: (String, DebianVersion) -> Relation -> Bool mkTree :: a -> [Tree a] -> Tree a label :: Tree a -> a initTree :: (a -> [a]) -> a -> Tree a mapTree :: (a -> b) -> Tree a -> Tree b foldTree :: (a -> [b] -> b) -> Tree a -> b zipTreesWith :: (a -> b -> c) -> Tree a -> Tree b -> Tree c prune :: (a -> Bool) -> Tree a -> Tree a leaves :: Tree a -> [a] inhTree :: (b -> a -> b) -> b -> Tree a -> Tree b distrTree :: (a -> [b]) -> b -> Tree a -> Tree b mkSearchTree :: CSP a -> Tree (State a) -- | earliestInconsistency does what it sounds like the 'reverse as' is -- because the vars are order high to low, but we want to find the lowest -- numbered (aka, earliest) inconsistency ?? earliestInconsistency :: CSP a -> State a -> Maybe ((String, DebianVersion), (String, DebianVersion)) type ConflictSet = ([(String, DebianVersion)], [Relation]) isConflict :: ConflictSet -> Bool solutions :: Tree (State a, ConflictSet) -> [State a] type Labeler a = CSP a -> Tree (State a) -> Tree (State a, ConflictSet) search :: Labeler a -> CSP a -> [State a] bt :: Labeler a -- | bj - backjumping labeler -- -- If the node already has a conflict set, then leave it alone. -- -- Otherwise, the conflictset for the node is the combination of the -- conflict sets of its direct children. bj :: CSP p -> Tree (State p, ConflictSet) -> Tree (State p, ConflictSet) unionCS :: [ConflictSet] -> ConflictSet combine :: CSP p -> [(State p, ConflictSet)] -> [ConflictSet] -> ConflictSet instance Show Status instance Eq Status module Linspire.Debian.Control.PrettyPrint ppControl :: (ToText a) => Control' a -> Doc ppParagraph :: (ToText a) => Paragraph' a -> Doc ppField :: (ToText a) => Field' a -> Doc class ToText a totext :: (ToText a) => a -> Doc instance ToText ByteString instance ToText String module Linspire.Debian.Control.String newtype Control' a Control :: [Paragraph' a] -> Control' a unControl :: Control' a -> [Paragraph' a] newtype Paragraph' a Paragraph :: [Field' a] -> Paragraph' a -- | NOTE: we do not strip the leading or trailing whitespace in the name -- or value data Field' a Field :: (a, a) -> Field' a Comment :: a -> Field' a type Control = Control' String type Paragraph = Paragraph' String type Field = Field' String type ControlParser a = CharParser () a class ControlFunctions a parseControlFromFile :: (ControlFunctions a) => FilePath -> IO (Either ParseError (Control' a)) parseControlFromHandle :: (ControlFunctions a) => String -> Handle -> IO (Either ParseError (Control' a)) lookupP :: (ControlFunctions a) => String -> (Paragraph' a) -> Maybe (Field' a) stripWS :: (ControlFunctions a) => a -> a -- | A parser for debian control file. This parser handles control files -- that end without a newline as well as ones that have several blank -- lines at the end. It is very liberal and does not attempt validate the -- fields in any way. All trailing, leading, and folded whitespace is -- preserved in the field values. See stripWS. pControl :: ControlParser Control mergeControls :: [Control' a] -> Control' a fieldValue :: (ControlFunctions a) => String -> Paragraph' a -> Maybe a removeField :: (Eq a) => a -> Paragraph' a -> Paragraph' a prependFields :: [Field' a] -> Paragraph' a -> Paragraph' a appendFields :: [Field' a] -> Paragraph' a -> Paragraph' a renameField :: (Eq a) => a -> a -> Paragraph' a -> Paragraph' a modifyField :: (Eq a) => a -> (a -> a) -> Paragraph' a -> Paragraph' a -- | Move selected fields to the beginning of a paragraph. raiseFields :: (Eq a) => (a -> Bool) -> Paragraph' a -> Paragraph' a instance ControlFunctions String instance Show (Field' String) instance Show (Paragraph' String) instance Show (Control' String) -- | A module for working with Debian control files -- http://www.debian.org/doc/debian-policy/ch-controlfields.html module Linspire.Debian.Control newtype Control' a Control :: [Paragraph' a] -> Control' a unControl :: Control' a -> [Paragraph' a] newtype Paragraph' a Paragraph :: [Field' a] -> Paragraph' a -- | NOTE: we do not strip the leading or trailing whitespace in the name -- or value data Field' a Field :: (a, a) -> Field' a Comment :: a -> Field' a type Control = Control' String type Paragraph = Paragraph' String type Field = Field' String type ControlParser a = CharParser () a class ControlFunctions a parseControlFromFile :: (ControlFunctions a) => FilePath -> IO (Either ParseError (Control' a)) parseControlFromHandle :: (ControlFunctions a) => String -> Handle -> IO (Either ParseError (Control' a)) lookupP :: (ControlFunctions a) => String -> (Paragraph' a) -> Maybe (Field' a) stripWS :: (ControlFunctions a) => a -> a -- | A parser for debian control file. This parser handles control files -- that end without a newline as well as ones that have several blank -- lines at the end. It is very liberal and does not attempt validate the -- fields in any way. All trailing, leading, and folded whitespace is -- preserved in the field values. See stripWS. pControl :: ControlParser Control mergeControls :: [Control' a] -> Control' a fieldValue :: (ControlFunctions a) => String -> Paragraph' a -> Maybe a removeField :: (Eq a) => a -> Paragraph' a -> Paragraph' a prependFields :: [Field' a] -> Paragraph' a -> Paragraph' a appendFields :: [Field' a] -> Paragraph' a -> Paragraph' a renameField :: (Eq a) => a -> a -> Paragraph' a -> Paragraph' a modifyField :: (Eq a) => a -> (a -> a) -> Paragraph' a -> Paragraph' a -- | Move selected fields to the beginning of a paragraph. raiseFields :: (Eq a) => (a -> Bool) -> Paragraph' a -> Paragraph' a -- | Experimental module for representing a single package , highly likely -- to change in incompatible ways. module Linspire.Debian.PackageDeprecated -- | A package with a name and list of dependencies data Package Package :: String -> Maybe DebianVersion -> Relations -> Relations -> Relations -> Relations -> Relations -> Package pName :: Package -> String pVersion :: Package -> Maybe DebianVersion pDepends :: Package -> Relations pPreDepends :: Package -> Relations pConflicts :: Package -> Relations pReplaces :: Package -> Relations pProvides :: Package -> Relations -- | FIXME: we do not deal with Provides/virtual packages yet paragraphToPackages :: Paragraph -> Package type ProvidesMap = Map String [Package] findProvides :: [Package] -> [(PkgName, Package)] -- | Architecture ? makeVirtualPackages :: ProvidesMap -> [Package] controlToPackageNameMap :: Control -> (Paragraph -> Package) -> PackageNameMap Package packagesToPackageNameMap :: [Package] -> PackageNameMap Package -- | TODO: Add architecture check lookupPackageByRel :: PackageNameMap Package -> Relation -> [Package] tryParseRel :: Maybe Field -> Relations instance Show Package instance Eq Package