Copyright | (c) 2017 Red Hat Inc. |
---|---|
License | LGPL |
Maintainer | https://github.com/weldr |
Stability | alpha |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
Functions for importing individual RPM packages into the database
- consume :: (MonadBaseControl IO m, MonadIO m, MonadThrow m, MonadError CsError m) => ContentStore -> FilePath -> Consumer RPM m Bool
- loadIntoMDDB :: (MonadBaseControl IO m, MonadResource m) => RPM -> [(Text, Maybe ObjectDigest)] -> SqlPersistT m Bool
- loadFromURI :: URI -> ReaderT ImportState IO ()
- rpmExistsInMDDB :: MonadResource m => RPM -> SqlPersistT m Bool
Documentation
consume :: (MonadBaseControl IO m, MonadIO m, MonadThrow m, MonadError CsError m) => ContentStore -> FilePath -> Consumer RPM m Bool Source #
A conduit consumer that takes in RPM data and stores its payload into the content store and its header
information into the mddb. The return value is whether or not an import occurred. This is not the
same as success vs. failure. On failures, a CsError
will be thrown. If the package already exists
in the database, this function will return False.
loadIntoMDDB :: (MonadBaseControl IO m, MonadResource m) => RPM -> [(Text, Maybe ObjectDigest)] -> SqlPersistT m Bool Source #
Load the headers from a parsed RPM into the MDDB. The return value is whether or not an import occurred. This is not the same as success vs. failure. If the package already exists in the database, this function will return False.
loadFromURI :: URI -> ReaderT ImportState IO () Source #
Fetch an RPM from a given URI
and load it into the MDDB. This function must be
run within the ReaderT
monad, which should be given an ImportState
record. This
is how importing knows where to store the results. Errors will be printed to the
screen.
rpmExistsInMDDB :: MonadResource m => RPM -> SqlPersistT m Bool Source #
Query the MDDB to see if the package has already been imported. If so, quit now to prevent it
from being added to the content store a second time. Note that loadIntoMDDB
also performs this
check, but both of these functions are public and therefore both need to prevent duplicate imports.