spago-0.21.0
Safe HaskellSafe-Inferred
LanguageHaskell2010

Spago.GlobalCache

Synopsis

Documentation

newtype CommitHash #

Constructors

CommitHash Text 

Instances

Instances details
FromJSON CommitHash # 
Instance details

Defined in Spago.GlobalCache

ToJSON CommitHash # 
Instance details

Defined in Spago.GlobalCache

Data CommitHash # 
Instance details

Defined in Spago.GlobalCache

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> CommitHash -> c CommitHash #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c CommitHash #

toConstr :: CommitHash -> Constr #

dataTypeOf :: CommitHash -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c CommitHash) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CommitHash) #

gmapT :: (forall b. Data b => b -> b) -> CommitHash -> CommitHash #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> CommitHash -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> CommitHash -> r #

gmapQ :: (forall d. Data d => d -> u) -> CommitHash -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> CommitHash -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> CommitHash -> m CommitHash #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> CommitHash -> m CommitHash #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> CommitHash -> m CommitHash #

Generic CommitHash # 
Instance details

Defined in Spago.GlobalCache

Associated Types

type Rep CommitHash :: Type -> Type #

Read CommitHash # 
Instance details

Defined in Spago.GlobalCache

Show CommitHash # 
Instance details

Defined in Spago.GlobalCache

Eq CommitHash # 
Instance details

Defined in Spago.GlobalCache

Ord CommitHash # 
Instance details

Defined in Spago.GlobalCache

type Rep CommitHash # 
Instance details

Defined in Spago.GlobalCache

type Rep CommitHash = D1 ('MetaData "CommitHash" "Spago.GlobalCache" "spago-0.21.0-wuq2Fsi0665WDIPyS8qRJ" 'True) (C1 ('MetaCons "CommitHash" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)))

newtype Tag #

Constructors

Tag Text 

Instances

Instances details
FromJSON Tag # 
Instance details

Defined in Spago.GlobalCache

FromJSONKey Tag # 
Instance details

Defined in Spago.GlobalCache

ToJSON Tag # 
Instance details

Defined in Spago.GlobalCache

ToJSONKey Tag # 
Instance details

Defined in Spago.GlobalCache

Data Tag # 
Instance details

Defined in Spago.GlobalCache

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Tag -> c Tag #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Tag #

toConstr :: Tag -> Constr #

dataTypeOf :: Tag -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Tag) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Tag) #

gmapT :: (forall b. Data b => b -> b) -> Tag -> Tag #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Tag -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Tag -> r #

gmapQ :: (forall d. Data d => d -> u) -> Tag -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Tag -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Tag -> m Tag #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Tag -> m Tag #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Tag -> m Tag #

Generic Tag # 
Instance details

Defined in Spago.GlobalCache

Associated Types

type Rep Tag :: Type -> Type #

Methods

from :: Tag -> Rep Tag x #

to :: Rep Tag x -> Tag #

Read Tag # 
Instance details

Defined in Spago.GlobalCache

Methods

readsPrec :: Int -> ReadS Tag #

readList :: ReadS [Tag] #

readPrec :: ReadPrec Tag #

readListPrec :: ReadPrec [Tag] #

Show Tag # 
Instance details

Defined in Spago.GlobalCache

Methods

showsPrec :: Int -> Tag -> ShowS #

show :: Tag -> String #

showList :: [Tag] -> ShowS #

Eq Tag # 
Instance details

Defined in Spago.GlobalCache

Methods

(==) :: Tag -> Tag -> Bool #

(/=) :: Tag -> Tag -> Bool #

Ord Tag # 
Instance details

Defined in Spago.GlobalCache

Methods

compare :: Tag -> Tag -> Ordering #

(<) :: Tag -> Tag -> Bool #

(<=) :: Tag -> Tag -> Bool #

(>) :: Tag -> Tag -> Bool #

(>=) :: Tag -> Tag -> Bool #

max :: Tag -> Tag -> Tag #

min :: Tag -> Tag -> Tag #

type Rep Tag # 
Instance details

Defined in Spago.GlobalCache

type Rep Tag = D1 ('MetaData "Tag" "Spago.GlobalCache" "spago-0.21.0-wuq2Fsi0665WDIPyS8qRJ" 'True) (C1 ('MetaCons "Tag" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)))

data RepoMetadataV1 #

Instances

Instances details
FromJSON RepoMetadataV1 # 
Instance details

Defined in Spago.GlobalCache

ToJSON RepoMetadataV1 # 
Instance details

Defined in Spago.GlobalCache

Generic RepoMetadataV1 # 
Instance details

Defined in Spago.GlobalCache

Associated Types

type Rep RepoMetadataV1 :: Type -> Type #

Show RepoMetadataV1 # 
Instance details

Defined in Spago.GlobalCache

type Rep RepoMetadataV1 # 
Instance details

Defined in Spago.GlobalCache

type Rep RepoMetadataV1 = D1 ('MetaData "RepoMetadataV1" "Spago.GlobalCache" "spago-0.21.0-wuq2Fsi0665WDIPyS8qRJ" 'False) (C1 ('MetaCons "RepoMetadataV1" 'PrefixI 'True) ((S1 ('MetaSel ('Just "commits") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [CommitHash]) :*: S1 ('MetaSel ('Just "latest") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Tag))) :*: (S1 ('MetaSel ('Just "owner") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: S1 ('MetaSel ('Just "tags") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map Tag CommitHash)))))

globallyCache :: HasLogFunc env => (PackageName, Repo, Text) -> FilePath -> ReposMetadataV1 -> (FilePath -> RIO env ()) -> RIO env () -> RIO env () #

A package is "globally cacheable" if: * it's a GitHub repo * the ref we have is a commit or a tag -- i.e. "immutable enough", so e.g. not a branch

So here we check that one of the two is true, and if so we run the callback with the URL of the .tar.gz archive on GitHub, otherwise another callback for when it's not

getMetadata :: (HasLogFunc env, HasGlobalCache env) => RIO env ReposMetadataV1 #

Download the GitHub Index cache from the `package-sets-metadata` repo

getGlobalCacheDir :: (MonadUnliftIO m, HasLogFunc env, MonadReader env m) => m FilePath #

Directory in which spago will put its global cache `getXdgDirectory XdgCache` tries to find the folder pointed by `$XDG_CACHE_HOME`, otherwise it uses: - (on LinuxMacOS) the folder pointed by `$HOME.cache`, or - (on Windows) the folder pointed by LocalAppData

fetchTarball :: HasLogFunc env => FilePath -> Text -> RIO env () #

Fetch the tarball at archiveUrl and unpack it into destination