spago-0.21.0

Safe Haskell | None
Language | Haskell2010

Spago.FetchPackage

Synopsis

- fetchPackages :: (HasLogFunc env, HasJobs env, HasGlobalCache env, HasPackageSet env) => [(PackageName, Package)] -> RIO env ()
- getLocalCacheDir :: (PackageName, Package) -> FilePath
- getCacheVersionDir :: Text -> Text
- localCacheDir :: FilePath

# Documentation

fetchPackages :: (HasLogFunc env, HasJobs env, HasGlobalCache env, HasPackageSet env) => [(PackageName, Package)] -> RIO env () #

Algorithm for fetching dependencies: * get in input a list of Packages to possibly fetch * if a Package is local or in the local cache, skip it * Start processing the remaining packages in parallel: * if a Package is in the global cache, copy it to the local cache * then check if the Package is on GitHub and an "immutable" ref: * if yes, download the tar archive and copy it to global and then local cache * if not, run a series of git commands to get the code, and copy to local cache

getLocalCacheDir :: (PackageName, Package) -> FilePath #

Returns the path in the local cache for a given package If the package is from a remote git repo, return the folder inside the local cache Otherwise return the local folder

getCacheVersionDir :: Text -> Text #

Returns the name of the cache dir based on the ref, escaped if necessary. This function must be injective and must always produce valid directory names, which means that problematic characters like / or : will be escaped using a scheme similar to URL-encoding. Note in particular that the function must be injective in a case-insensitive manner if we want this to work reliably on case-insensitive filesystems, in the sense that two different inputs must map to two different outputs _and_ those outputs must differ by more than just casing.

The characters which are most commonly used in version and branch names are those which we allow through as they are (without escaping).

localCacheDir :: FilePath #

Directory in which spago will put its local cache