Module CPM.Repository

This module implements functionality surrounding the package repository. The repository is the index of all packages known to the package manager. It contains metadata about the packages, such as their names, versions dependencies and where they can be acquired. The repository does not contain the actual packages. For a list of packages that are currently installed locally, you can consult the database.

Summary of exported operations:

emptyRepository :: Repository   
Creates an empty repository.
findAllVersions :: Repository -> String -> Bool -> [Package]   
Finds all versions of a package known to the repository.
searchPackages :: Repository -> Bool -> Bool -> String -> [[Package]]   
Search the names and synopses of all compiler-compatbile packages in the repository for a particular term.
listPackages :: Repository -> [[Package]]   
Get all packages in the repository and group them by versions (newest first).
findLatestVersion :: Config -> Repository -> String -> Bool -> Maybe Package   
Finds the latest compiler-compatbile version of a package.
findVersion :: Repository -> String -> (Int,Int,Int,Maybe String) -> Maybe Package   
Finds a specific version of a package.
allPackages :: Repository -> [Package]   
Get all packages in the central package index.
readRepository :: Config -> Bool -> IO Repository   
Reads all package specifications from the default repository.
useUpdateHelp :: String   
updateRepository :: Config -> IO ([LogEntry],Either LogEntry ())   
Updates the package index from the central Git repository.
cleanRepositoryCache :: Config -> IO ()   
Cleans the repository cache.
readPackageFromRepository :: Config -> Package -> IO ([LogEntry],Either LogEntry Package)   
Reads a given package from the default repository directory.
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.

Exported datatypes:


Repository

Constructors:


Exported operations:

emptyRepository :: Repository   

Creates an empty repository.

Further infos:
  • solution complete, i.e., able to compute all solutions

findAllVersions :: Repository -> String -> Bool -> [Package]   

Finds all versions of a package known to the repository. Returns the packages sorted from newest to oldest.

Example call:
(findAllVersions r p pre)
Parameters:
  • r : the repository
  • p : the name of the package to search for
  • pre : should pre-release versions be included?

searchPackages :: Repository -> Bool -> Bool -> String -> [[Package]]   

Search the names and synopses of all compiler-compatbile packages in the repository for a particular term. Lower/upercase is ignored for the search. Returns all matching versions (newest first) of each package.

Example call:
(searchPackages repo searchmod searchexec searchterm)
Parameters:
  • repo : the repository
  • searchmod : search for some module?
  • searchexec : search for some executable?
  • searchterm : the term to search for

listPackages :: Repository -> [[Package]]   

Get all packages in the repository and group them by versions (newest first).

Example call:
(listPackages cfg repo)
Parameters:
  • cfg : the current CPM configuration
  • repo : the repository

findLatestVersion :: Config -> Repository -> String -> Bool -> Maybe Package   

Finds the latest compiler-compatbile version of a package.

Example call:
(findLatestVersion cfg repo p pre)
Parameters:
  • cfg : the current CPM configuration
  • repo : the central package index
  • p : the package to search for
  • pre : include pre-release versions

findVersion :: Repository -> String -> (Int,Int,Int,Maybe String) -> Maybe Package   

Finds a specific version of a package.

allPackages :: Repository -> [Package]   

Get all packages in the central package index.

Further infos:
  • solution complete, i.e., able to compute all solutions

readRepository :: Config -> Bool -> IO Repository   

Reads all package specifications from the default repository. Uses the cache if it is present or update the cache after reading. If some errors occur, show them and terminate with error exit status.

Example call:
(readRepository cfg large)
Parameters:
  • cfg : the configuration to use
  • large : if true reads the larger cache with more package information (e.g., for searching all packages)

useUpdateHelp :: String   

Further infos:
  • solution complete, i.e., able to compute all solutions

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

Updates the package index from the central Git repository. Cleans also the global package cache in order to support downloading the newest versions.

cleanRepositoryCache :: Config -> IO ()   

Cleans the repository cache.

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

Reads a given package from the default repository directory. This is useful to obtain the complete package specification from a possibly incomplete package specification.

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