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

Safe Haskell | None
Language | Haskell2010

Debian.Apt.Dependencies

Contents

- Basic CSP Types and Functions
- Test CSP
- Tree Helper Functions
- mkSearchTree
- Conflict Set
- Backtracking Labeler
- BackJumping Solver

Synopsis

- data Status
  - = Remaining AndRelation
  - | MissingDep Relation
  - | Complete
- type State a = (Status, [a])
- complete :: State a -> Bool
- data CSP a = CSP {
  - pnm :: PackageNameMap a
  - relations :: Relations
  - depFunction :: a -> Relations
  - conflicts :: a -> Relations
  - packageVersion :: a -> (BinPkgName, DebianVersion)
  }
- controlCSP :: Control -> Relations -> (Paragraph -> Relations) -> CSP Paragraph
- testCSP :: FilePath -> (Paragraph -> Relations) -> String -> (CSP Paragraph -> IO a) -> IO a
- depF :: Paragraph -> Relations
- test :: FilePath -> String -> Labeler Paragraph -> IO ()
- packageVersionParagraph :: Paragraph -> (BinPkgName, DebianVersion)
- conflict :: CSP p -> p -> p -> Bool
- conflict' :: (BinPkgName, 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 :: CSP a -> State a -> Maybe ((BinPkgName, DebianVersion), (BinPkgName, DebianVersion))
- type ConflictSet = ([(BinPkgName, 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 :: CSP p -> Tree (State p, ConflictSet) -> Tree (State p, ConflictSet)
- unionCS :: [ConflictSet] -> ConflictSet
- combine :: CSP p -> [(State p, ConflictSet)] -> [ConflictSet] -> ConflictSet

# Basic CSP Types and Functions

data Status Source #

Constructors

Remaining AndRelation |
MissingDep Relation |
Complete |

#### Instances

Instances details

Eq Status Source # |
Instance details Defined in Debian.Apt.Dependencies Methods (==) :: Status -> Status -> Bool Source # (/=) :: Status -> Status -> Bool Source #

type State a = (Status, [a]) Source #

complete :: State a -> Bool Source #

data CSP a Source #

Constructors

CSP |

Fields

- pnm :: PackageNameMap a
- relations :: Relations
- depFunction :: a -> Relations
- conflicts :: a -> Relations
- packageVersion :: a -> (BinPkgName, DebianVersion)

# Test CSP

controlCSP :: Control -> Relations -> (Paragraph -> Relations) -> CSP Paragraph Source #

TODO addProvides -- see DQL.Exec

testCSP :: FilePath -> (Paragraph -> Relations) -> String -> (CSP Paragraph -> IO a) -> IO a Source #

depF :: Paragraph -> Relations Source #

test :: FilePath -> String -> Labeler Paragraph -> IO () Source #

packageVersionParagraph :: Paragraph -> (BinPkgName, DebianVersion) Source #

conflict :: CSP p -> p -> p -> Bool Source #

conflict' :: (BinPkgName, DebianVersion) -> Relation -> Bool Source #

JAS: deal with `Provides` (can a package provide more than one package?)

# Tree Helper Functions

mkTree :: a -> [Tree a] -> Tree a Source #

label :: Tree a -> a Source #

initTree :: (a -> [a]) -> a -> Tree a Source #

mapTree :: (a -> b) -> Tree a -> Tree b Source #

foldTree :: (a -> [b] -> b) -> Tree a -> b Source #

zipTreesWith :: (a -> b -> c) -> Tree a -> Tree b -> Tree c Source #

prune :: (a -> Bool) -> Tree a -> Tree a Source #

leaves :: Tree a -> [a] Source #

inhTree :: (b -> a -> b) -> b -> Tree a -> Tree b Source #

distrTree :: (a -> [b]) -> b -> Tree a -> Tree b Source #

# mkSearchTree

mkSearchTree :: CSP a -> Tree (State a) Source #

earliestInconsistency :: CSP a -> State a -> Maybe ((BinPkgName, DebianVersion), (BinPkgName, DebianVersion)) Source #

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, eariest) inconsistency ??

# Conflict Set

type ConflictSet = ([(BinPkgName, DebianVersion)], [Relation]) Source #

conflicting packages and relations that require non-existant packages

isConflict :: ConflictSet -> Bool Source #

solutions :: Tree (State a, ConflictSet) -> [State a] Source #

type Labeler a = CSP a -> Tree (State a) -> Tree (State a, ConflictSet) Source #

search :: Labeler a -> CSP a -> [State a] Source #

# Backtracking Labeler

bt :: Labeler a Source #

# BackJumping Solver

bj :: CSP p -> Tree (State p, ConflictSet) -> Tree (State p, ConflictSet) Source #

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.

unionCS :: [ConflictSet] -> ConflictSet Source #

combine :: CSP p -> [(State p, ConflictSet)] -> [ConflictSet] -> ConflictSet Source #