Module CPM.Repository.Select

Some queries on the repository cache.

Author: Michael Hanus

Version: November 2020

Summary of exported operations:

searchNameSynopsisModules :: Config -> String -> IO [Package]   
Returns the packages of the repository containing a given string in the name, synopsis, or exported modules.
searchExportedModules :: Config -> String -> IO [Package]   
Returns the packages of the repository containing a given module in the list of exported modules.
searchExecutable :: Config -> String -> IO [Package]   
Returns the packages of the repository containing a given string in the name of the executable.
getRepositoryWithNameVersionSynopsis :: Config -> IO Repository   
Returns the complete repository where in each package the name, version, synopsis, and compilerCompatibility is set.
getRepositoryWithNameVersionSynopsisDeps :: Config -> IO Repository   
Returns the complete repository where in each package the name, version, synopsis, dependencies and compilerCompatibility is set.
getRepositoryWithNameVersionCategory :: Config -> IO Repository   
Returns the complete repository where in each package the name, version, category, and compilerCompatibility is set.
getBaseRepository :: Config -> IO Repository   
Returns the complete repository where in each package the name, version, dependencies, and compilerCompatibility is set.
getRepoForPackageSpec :: Config -> Package -> IO Repository   
Returns the repository containing all packages and dependencies (in all versions) mentioned in the given package specification.
getRepoForPackages :: Config -> [String] -> IO Repository   
Returns the repository containing only packages of the second argument and all the packages on which they depend (including all versions).
getAllPackageVersions :: Config -> String -> Bool -> IO [Package]   
Retrieves all versions of a package with a given name from the repository.
getPackageVersion :: Config -> String -> (Int,Int,Int,Maybe String) -> IO (Maybe Package)   
Retrieves a package with a given name and version from the repository.
addPackageToRepositoryCache :: Config -> Package -> IO ([LogEntry],Either LogEntry ())   
Adds a new package to the repository cache.
updatePackageInRepositoryCache :: Config -> Package -> IO ([LogEntry],Either LogEntry ())   
Updates an existing package in the repository cache.

Exported operations:

searchNameSynopsisModules :: Config -> String -> IO [Package]   

Returns the packages of the repository containing a given string in the name, synopsis, or exported modules. In each package, the name, version, synopsis, and compilerCompatibility is set.

searchExportedModules :: Config -> String -> IO [Package]   

Returns the packages of the repository containing a given module in the list of exported modules. In each package, the name, version, synopsis, compilerCompatibility, and exportedModules is set.

searchExecutable :: Config -> String -> IO [Package]   

Returns the packages of the repository containing a given string in the name of the executable. In each package, the name, version, synopsis, compilerCompatibility, and executableSpec is set.

getRepositoryWithNameVersionSynopsis :: Config -> IO Repository   

Returns the complete repository where in each package the name, version, synopsis, and compilerCompatibility is set.

getRepositoryWithNameVersionSynopsisDeps :: Config -> IO Repository   

Returns the complete repository where in each package the name, version, synopsis, dependencies and compilerCompatibility is set.

getRepositoryWithNameVersionCategory :: Config -> IO Repository   

Returns the complete repository where in each package the name, version, category, and compilerCompatibility is set.

getBaseRepository :: Config -> IO Repository   

Returns the complete repository where in each package the name, version, dependencies, and compilerCompatibility is set. The information is read either from the cache DB or from the cache file.

getRepoForPackageSpec :: Config -> Package -> IO Repository   

Returns the repository containing all packages and dependencies (in all versions) mentioned in the given package specification. In each package the name, version, dependencies, and compilerCompatibility is set. The information is read either from the cache DB or from the cache file.

getRepoForPackages :: Config -> [String] -> IO Repository   

Returns the repository containing only packages of the second argument and all the packages on which they depend (including all versions). In each package the name, version, dependencies, and compilerCompatibility is set. The information is read either from the cache DB or from the cache file.

getAllPackageVersions :: Config -> String -> Bool -> IO [Package]   

Retrieves all versions of a package with a given name from the repository.

Example call:
(getAllPackageVersions cfg pkgname pre)
Parameters:
  • cfg : the current CPM configuration
  • pkgname : the package name to be retrieved
  • pre : should pre-release versions be included?

getPackageVersion :: Config -> String -> (Int,Int,Int,Maybe String) -> IO (Maybe Package)   

Retrieves a package with a given name and version from the repository.

Example call:
(getPackageVersion cfg pkgname ver)
Parameters:
  • cfg : the current CPM configuration
  • pkgname : the package name to be retrieved
  • ver : the requested version of the package

addPackageToRepositoryCache :: Config -> Package -> IO ([LogEntry],Either LogEntry ())   

Adds a new package to the repository cache. In the file-based implementation, we simply clean the cache files.

updatePackageInRepositoryCache :: Config -> Package -> IO ([LogEntry],Either LogEntry ())   

Updates an existing package in the repository cache. In the file-based implementation, we simply clean the cache files.