Module CPM.PackageCache.Local

This module implements the local package cache. The local package cache is located in the .cpm/package_cache of the current package. It contains symlinks to all dependencies used by the current package. Package files are copied from the local cache to the runtime cache when they need to be used. The package manager usually creates symlinks to the global package cache. Symlinks to other locations can be used to include modified versions of packages that are not yet published to the package repository or installed in the global cache.

Summary of exported operations:

cacheDir :: String -> String  Deterministic 
The cache directory of the local package cache.
allPackages :: String -> ErrorLogger [Package]  Deterministic 
Reads all packages specifications from the local package cache.
createLinkToGlobalCache :: Config -> String -> Package -> ErrorLogger ()  Deterministic 
Creates a link to a package from the global cache in the local cache.
linkPackages :: Config -> String -> [Package] -> ErrorLogger ()  Deterministic 
Links a list of packages from the global cache into the local cache.
doesLinkPointToGlobalCache :: Config -> String -> String -> IO Bool  Deterministic 
Tests whether a link in the local package cache points to a package in the global package cache.
packageDir :: String -> Package -> String  Deterministic 
Calculates the local package path of the given package
isPackageInCache :: String -> Package -> IO Bool  Deterministic 
Checks whether a package is in the local cache.
clearCache :: String -> ErrorLogger ()  Deterministic 
Clear the local package cache.
createLink :: String -> String -> String -> Bool -> ErrorLogger ()  Deterministic 
Create a link from a directory into the local package cache.

Exported operations:

cacheDir :: String -> String  Deterministic 

The cache directory of the local package cache.

Example call:
(cacheDir dir)
Parameters:
  • dir : the package directory

allPackages :: String -> ErrorLogger [Package]  Deterministic 

Reads all packages specifications from the local package cache.

Example call:
(allPackages dir)
Parameters:
  • dir : the package directory

createLinkToGlobalCache :: Config -> String -> Package -> ErrorLogger ()  Deterministic 

Creates a link to a package from the global cache in the local cache. Does not overwrite existing links.

Example call:
(createLinkToGlobalCache cfg dir gc pkg)
Parameters:
  • cfg : the current configuration
  • dir : the package directory
  • gc : the global package cache
  • pkg : the package to copy

linkPackages :: Config -> String -> [Package] -> ErrorLogger ()  Deterministic 

Links a list of packages from the global cache into the local cache. Does not overwrite existing links.

Example call:
(linkPackages cfg dir gc pkgs)
Parameters:
  • cfg : the current configuration
  • dir : the package directory
  • gc : the global package cache
  • pkgs : the list of packages

doesLinkPointToGlobalCache :: Config -> String -> String -> IO Bool  Deterministic 

Tests whether a link in the local package cache points to a package in the global package cache.

Example call:
(doesLinkPointToGlobalCache cfg gc dir name)
Parameters:
  • cfg : the current configuration
  • gc : the global package cache
  • dir : the package directory
  • name : the name of the link

packageDir :: String -> Package -> String  Deterministic 

Calculates the local package path of the given package

Example call:
(packageDir dir pkg)
Parameters:
  • dir : the package directory
  • pkg : the package

isPackageInCache :: String -> Package -> IO Bool  Deterministic 

Checks whether a package is in the local cache.

Example call:
(isPackageInCache dir pkg)
Parameters:
  • dir : the package directory
  • pkg : the package

clearCache :: String -> ErrorLogger ()  Deterministic 

Clear the local package cache.

Example call:
(clearCache dir)
Parameters:
  • dir : the package directory