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

Safe Haskell | None
Language | Haskell2010

Debian.Apt.Methods

Description

an interface for using the methods in varlibaptmethods

Synopsis

- withMethodPath :: FilePath -> (MethodHandle -> IO a) -> IO a
- withMethodURI :: URI -> (MethodHandle -> IO a) -> IO a
- whichMethodPath :: URI -> IO (Maybe FilePath)
- openMethod :: FilePath -> IO MethodHandle
- closeMethod :: MethodHandle -> IO ExitCode
- recvStatus :: MethodHandle -> IO Status
- sendCommand :: MethodHandle -> Command -> IO ()
- getLastModified :: FilePath -> IO (Maybe UTCTime)
- simpleFetch :: [ConfigItem] -> URI -> FilePath -> Maybe UTCTime -> IO Bool
- fetch :: FetchCallbacks -> [ConfigItem] -> URI -> FilePath -> Maybe UTCTime -> IO Bool
- data FetchCallbacks = FetchCallbacks {
  - logCB :: Message -> IO ()
  - statusCB :: URI -> Message -> IO ()
  - uriStartCB :: URI -> Maybe Integer -> Maybe UTCTime -> Maybe Integer -> IO ()
  - uriDoneCB :: URI -> Maybe Integer -> Maybe UTCTime -> Maybe Integer -> Maybe FilePath -> Hashes -> Bool -> IO ()
  - uriFailureCB :: URI -> Message -> IO ()
  - generalFailureCB :: Message -> IO ()
  - authorizationRequiredCB :: Site -> IO (Maybe (User, Password))
  - mediaFailureCB :: Media -> Drive -> IO ()
  - debugCB :: String -> IO ()
  }
- emptyFetchCallbacks :: FetchCallbacks
- cliFetchCallbacks :: FetchCallbacks
- data Command
  - = URIAcquire URI FilePath (Maybe UTCTime)
  - | Configuration [ConfigItem]
  - | AuthorizationCredentials Site User Password
  - | MediaChanged Media (Maybe Bool)
- data Status
  - = Capabilities {
    - version :: String
    - singleInstance :: Bool
    - preScan :: Bool
    - pipeline :: Bool
    - sendConfig :: Bool
    - needsCleanup :: Bool
    - localOnly :: Bool
    }
  - | LogMsg Message
  - | Status URI Message
  - | URIStart {
    - uri :: URI
    - size :: Maybe Integer
    - lastModified :: Maybe UTCTime
    - resumePoint :: Maybe Integer
    }
  - | URIDone {
    - uri :: URI
    - size :: Maybe Integer
    - lastModified :: Maybe UTCTime
    - resumePoint :: Maybe Integer
    - filename :: Maybe FilePath
    - hashes :: Hashes
    - imsHit :: Bool
    }
  - | URIFailure {
    - uri :: URI
    - message :: Message
    }
  - | GeneralFailure Message
  - | AuthorizationRequired Site
  - | MediaFailure Media Drive
- type Message = String
- type Site = String
- type User = String
- type Password = String
- type Media = String
- type Drive = String
- type Header = (String, String)
- type ConfigItem = (String, String)

# Documentation

withMethodPath :: FilePath -> (MethodHandle -> IO a) -> IO a Source #

withMethod - run |methodPath| bracketed with openMethod/closeMethod. |f| gets the open handle.

withMethodURI :: URI -> (MethodHandle -> IO a) -> IO a Source #

whichMethodPath :: URI -> IO (Maybe FilePath) Source #

whichMethodBinary - find the method executable associated with a URI throws an exception on failure

openMethod :: FilePath -> IO MethodHandle Source #

closeMethod :: MethodHandle -> IO ExitCode Source #

recvStatus :: MethodHandle -> IO Status Source #

sendCommand :: MethodHandle -> Command -> IO () Source #

getLastModified :: FilePath -> IO (Maybe UTCTime) Source #

simpleFetch :: [ConfigItem] -> URI -> FilePath -> Maybe UTCTime -> IO Bool Source #

fetch :: FetchCallbacks -> [ConfigItem] -> URI -> FilePath -> Maybe UTCTime -> IO Bool Source #

fetch a single item, show console output see also: getLastModified

data FetchCallbacks Source #

Constructors

FetchCallbacks |

Fields

- logCB :: Message -> IO ()
- statusCB :: URI -> Message -> IO ()
- uriStartCB :: URI -> Maybe Integer -> Maybe UTCTime -> Maybe Integer -> IO ()
- uriDoneCB :: URI -> Maybe Integer -> Maybe UTCTime -> Maybe Integer -> Maybe FilePath -> Hashes -> Bool -> IO ()
- uriFailureCB :: URI -> Message -> IO ()
- generalFailureCB :: Message -> IO ()
- authorizationRequiredCB :: Site -> IO (Maybe (User, Password))
- mediaFailureCB :: Media -> Drive -> IO ()
- debugCB :: String -> IO ()

emptyFetchCallbacks :: FetchCallbacks Source #

set of callbacks which do nothing. suitable for non-interactive usage. In the case authorization is required, no credentials will be supplied and the download should abort.

cliFetchCallbacks :: FetchCallbacks Source #

data Command Source #

Constructors

URIAcquire URI FilePath (Maybe UTCTime) |
Configuration [ConfigItem] |
AuthorizationCredentials Site User Password |
MediaChanged Media (Maybe Bool) |

#### Instances

Instances details

Show Command Source # |
Instance details Defined in Debian.Apt.Methods Methods showsPrec :: Int -> Command -> ShowS Source # show :: Command -> String Source # showList :: [Command] -> ShowS Source #
Eq Command Source # |
Instance details Defined in Debian.Apt.Methods Methods (==) :: Command -> Command -> Bool Source # (/=) :: Command -> Command -> Bool Source #

data Status Source #

Constructors

Capabilities |

Fields

- version :: String
- singleInstance :: Bool
- preScan :: Bool
- pipeline :: Bool
- sendConfig :: Bool
- needsCleanup :: Bool
- localOnly :: Bool

LogMsg Message |
Status URI Message |
URIStart |

Fields

- uri :: URI
- size :: Maybe Integer
- lastModified :: Maybe UTCTime
- resumePoint :: Maybe Integer

URIDone |

Fields

- uri :: URI
- size :: Maybe Integer
- lastModified :: Maybe UTCTime
- resumePoint :: Maybe Integer
- filename :: Maybe FilePath
- hashes :: Hashes
- imsHit :: Bool

URIFailure |

Fields

- uri :: URI
- message :: Message

GeneralFailure Message |
AuthorizationRequired Site |
MediaFailure Media Drive |

#### Instances

Instances details

Show Status Source # |
Instance details Defined in Debian.Apt.Methods Methods showsPrec :: Int -> Status -> ShowS Source # show :: Status -> String Source # showList :: [Status] -> ShowS Source #
Eq Status Source # |
Instance details Defined in Debian.Apt.Methods Methods (==) :: Status -> Status -> Bool Source # (/=) :: Status -> Status -> Bool Source #

type Message = String Source #

type Site = String Source #

type User = String Source #

type Password = String Source #

type Media = String Source #

type Drive = String Source #

type Header = (String, String) Source #

type ConfigItem = (String, String) Source #