Distribution.Client.Types.Repo

cabal-install-3.12.1.0: The command-line interface for Cabal and Hackage.

Safe Haskell | None
Language | Haskell2010

Distribution.Client.Types.Repo

Contents

- Remote repository
- Local repository (no-index)
- Repository

Synopsis

- data RemoteRepo = RemoteRepo {
  - remoteRepoName :: RepoName
  - remoteRepoURI :: URI
  - remoteRepoSecure :: Maybe Bool
  - remoteRepoRootKeys :: [String]
  - remoteRepoKeyThreshold :: Int
  - remoteRepoShouldTryHttps :: Bool
  }
- emptyRemoteRepo :: RepoName -> RemoteRepo
- data LocalRepo = LocalRepo {
  - localRepoName :: RepoName
  - localRepoPath :: FilePath
  - localRepoSharedCache :: Bool
  }
- emptyLocalRepo :: RepoName -> LocalRepo
- localRepoCacheKey :: LocalRepo -> String
- data Repo
  - = RepoLocalNoIndex {
    - repoLocal :: LocalRepo
    - repoLocalDir :: FilePath
    }
  - | RepoRemote {
    - repoRemote :: RemoteRepo
    - repoLocalDir :: FilePath
    }
  - | RepoSecure {
    - repoRemote :: RemoteRepo
    - repoLocalDir :: FilePath
    }
- repoName :: Repo -> RepoName
- isRepoRemote :: Repo -> Bool
- maybeRepoRemote :: Repo -> Maybe RemoteRepo

# Remote repository

data RemoteRepo #

Constructors

RemoteRepo |
Fields remoteRepoName :: RepoName remoteRepoURI :: URI remoteRepoSecure :: Maybe Bool Enable secure access? `Nothing` here represents "whatever the default is"; this is important to allow for a smooth transition from opt-in to opt-out security (once we switch to opt-out, all access to the central Hackage repository should be secure by default) remoteRepoRootKeys :: [String] Root key IDs (for bootstrapping) remoteRepoKeyThreshold :: Int Threshold for verification during bootstrapping remoteRepoShouldTryHttps :: Bool Normally a repo just specifies an HTTP or HTTPS URI, but as a special case we may know a repo supports both and want to try HTTPS if we can, but still allow falling back to HTTP. This field is not currently stored in the config file, but is filled in automagically for known repos.

#### Instances

Instances details

Parsec RemoteRepo # | Note: serialised format represents `RemoteRepo` only partially.
Instance details Defined in Distribution.Client.Types.Repo Methods parsec :: CabalParsing m => m RemoteRepo #
Pretty RemoteRepo # |
Instance details Defined in Distribution.Client.Types.Repo Methods pretty :: RemoteRepo -> Doc # prettyVersioned :: CabalSpecVersion -> RemoteRepo -> Doc #
Structured RemoteRepo # |
Instance details Defined in Distribution.Client.Types.Repo Methods structure :: Proxy RemoteRepo -> Structure # structureHash' :: Tagged RemoteRepo MD5
Binary RemoteRepo # |
Instance details Defined in Distribution.Client.Types.Repo Methods put :: RemoteRepo -> Put # get :: Get RemoteRepo # putList :: [RemoteRepo] -> Put #
Generic RemoteRepo # |
Instance details Defined in Distribution.Client.Types.Repo Associated Types
type Rep RemoteRepo |
Instance details Defined in Distribution.Client.Types.Repo type Rep RemoteRepo = D1 ('MetaData "RemoteRepo" "Distribution.Client.Types.Repo" "cabal-install-3.12.1.0-G554PkJj2SpDqyarXp9tbt" 'False) (C1 ('MetaCons "RemoteRepo" 'PrefixI 'True) ((S1 ('MetaSel ('Just "remoteRepoName") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 RepoName) :*: (S1 ('MetaSel ('Just "remoteRepoURI") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 URI) :*: S1 ('MetaSel ('Just "remoteRepoSecure") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Bool)))) :*: (S1 ('MetaSel ('Just "remoteRepoRootKeys") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [String]) :*: (S1 ('MetaSel ('Just "remoteRepoKeyThreshold") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int) :*: S1 ('MetaSel ('Just "remoteRepoShouldTryHttps") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool)))))
Methods from :: RemoteRepo -> Rep RemoteRepo x # to :: Rep RemoteRepo x -> RemoteRepo #
Show RemoteRepo # |
Instance details Defined in Distribution.Client.Types.Repo Methods showsPrec :: Int -> RemoteRepo -> ShowS # show :: RemoteRepo -> String # showList :: [RemoteRepo] -> ShowS #
Eq RemoteRepo # |
Instance details Defined in Distribution.Client.Types.Repo Methods (==) :: RemoteRepo -> RemoteRepo -> Bool # (/=) :: RemoteRepo -> RemoteRepo -> Bool #
Ord RemoteRepo # |
Instance details Defined in Distribution.Client.Types.Repo Methods compare :: RemoteRepo -> RemoteRepo -> Ordering # (<) :: RemoteRepo -> RemoteRepo -> Bool # (<=) :: RemoteRepo -> RemoteRepo -> Bool # (>) :: RemoteRepo -> RemoteRepo -> Bool # (>=) :: RemoteRepo -> RemoteRepo -> Bool # max :: RemoteRepo -> RemoteRepo -> RemoteRepo # min :: RemoteRepo -> RemoteRepo -> RemoteRepo #
type Rep RemoteRepo # |
Instance details Defined in Distribution.Client.Types.Repo type Rep RemoteRepo = D1 ('MetaData "RemoteRepo" "Distribution.Client.Types.Repo" "cabal-install-3.12.1.0-G554PkJj2SpDqyarXp9tbt" 'False) (C1 ('MetaCons "RemoteRepo" 'PrefixI 'True) ((S1 ('MetaSel ('Just "remoteRepoName") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 RepoName) :*: (S1 ('MetaSel ('Just "remoteRepoURI") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 URI) :*: S1 ('MetaSel ('Just "remoteRepoSecure") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Bool)))) :*: (S1 ('MetaSel ('Just "remoteRepoRootKeys") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [String]) :*: (S1 ('MetaSel ('Just "remoteRepoKeyThreshold") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int) :*: S1 ('MetaSel ('Just "remoteRepoShouldTryHttps") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool)))))

emptyRemoteRepo :: RepoName -> RemoteRepo #

Construct a partial `RemoteRepo` value to fold the field parser list over.

# Local repository (no-index)

data LocalRepo #

no-index style local repositories.

https://github.com/haskell/cabal/issues/6359

Constructors

LocalRepo |
Fields localRepoName :: RepoName localRepoPath :: FilePath localRepoSharedCache :: Bool

#### Instances

Instances details

Parsec LocalRepo # | Note: doesn't parse `localRepoSharedCache` field.
Instance details Defined in Distribution.Client.Types.Repo Methods parsec :: CabalParsing m => m LocalRepo #
Pretty LocalRepo # |
Instance details Defined in Distribution.Client.Types.Repo Methods pretty :: LocalRepo -> Doc # prettyVersioned :: CabalSpecVersion -> LocalRepo -> Doc #
Structured LocalRepo # |
Instance details Defined in Distribution.Client.Types.Repo Methods structure :: Proxy LocalRepo -> Structure # structureHash' :: Tagged LocalRepo MD5
Binary LocalRepo # |
Instance details Defined in Distribution.Client.Types.Repo Methods put :: LocalRepo -> Put # get :: Get LocalRepo # putList :: [LocalRepo] -> Put #
Generic LocalRepo # |
Instance details Defined in Distribution.Client.Types.Repo Associated Types
type Rep LocalRepo |
Instance details Defined in Distribution.Client.Types.Repo type Rep LocalRepo = D1 ('MetaData "LocalRepo" "Distribution.Client.Types.Repo" "cabal-install-3.12.1.0-G554PkJj2SpDqyarXp9tbt" 'False) (C1 ('MetaCons "LocalRepo" 'PrefixI 'True) (S1 ('MetaSel ('Just "localRepoName") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 RepoName) :*: (S1 ('MetaSel ('Just "localRepoPath") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 FilePath) :*: S1 ('MetaSel ('Just "localRepoSharedCache") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool))))
Methods from :: LocalRepo -> Rep LocalRepo x # to :: Rep LocalRepo x -> LocalRepo #
Show LocalRepo # |
Instance details Defined in Distribution.Client.Types.Repo Methods showsPrec :: Int -> LocalRepo -> ShowS # show :: LocalRepo -> String # showList :: [LocalRepo] -> ShowS #
Eq LocalRepo # |
Instance details Defined in Distribution.Client.Types.Repo Methods (==) :: LocalRepo -> LocalRepo -> Bool # (/=) :: LocalRepo -> LocalRepo -> Bool #
Ord LocalRepo # |
Instance details Defined in Distribution.Client.Types.Repo Methods compare :: LocalRepo -> LocalRepo -> Ordering # (<) :: LocalRepo -> LocalRepo -> Bool # (<=) :: LocalRepo -> LocalRepo -> Bool # (>) :: LocalRepo -> LocalRepo -> Bool # (>=) :: LocalRepo -> LocalRepo -> Bool # max :: LocalRepo -> LocalRepo -> LocalRepo # min :: LocalRepo -> LocalRepo -> LocalRepo #
type Rep LocalRepo # |
Instance details Defined in Distribution.Client.Types.Repo type Rep LocalRepo = D1 ('MetaData "LocalRepo" "Distribution.Client.Types.Repo" "cabal-install-3.12.1.0-G554PkJj2SpDqyarXp9tbt" 'False) (C1 ('MetaCons "LocalRepo" 'PrefixI 'True) (S1 ('MetaSel ('Just "localRepoName") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 RepoName) :*: (S1 ('MetaSel ('Just "localRepoPath") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 FilePath) :*: S1 ('MetaSel ('Just "localRepoSharedCache") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool))))

emptyLocalRepo :: RepoName -> LocalRepo #

Construct a partial `LocalRepo` value to fold the field parser list over.

localRepoCacheKey :: LocalRepo -> String #

Calculate a cache key for local-repo.

For remote repositories we just use name, but local repositories may all be named "local", so we add a bit of `localRepoPath` into the mix.

# Repository

data Repo #

Different kinds of repositories

NOTE: It is important that this type remains serializable.

Constructors

RepoLocalNoIndex | Local repository, without index. https://github.com/haskell/cabal/issues/6359
Fields repoLocal :: LocalRepo repoLocalDir :: FilePath
RepoRemote | Standard (unsecured) remote repositories
Fields repoRemote :: RemoteRepo repoLocalDir :: FilePath
RepoSecure | Secure repositories Although this contains the same fields as `RepoRemote`, we use a separate constructor to avoid confusing the two. Not all access to a secure repo goes through the hackage-security library currently; code paths that do not still make use of the `repoRemote` and `repoLocalDir` fields directly.
Fields repoRemote :: RemoteRepo repoLocalDir :: FilePath

#### Instances

Instances details

Structured Repo # |
Instance details Defined in Distribution.Client.Types.Repo Methods structure :: Proxy Repo -> Structure # structureHash' :: Tagged Repo MD5
Binary Repo # |
Instance details Defined in Distribution.Client.Types.Repo Methods put :: Repo -> Put # get :: Get Repo # putList :: [Repo] -> Put #
Generic Repo # |
Instance details Defined in Distribution.Client.Types.Repo Associated Types
type Rep Repo |
Instance details Defined in Distribution.Client.Types.Repo type Rep Repo = D1 ('MetaData "Repo" "Distribution.Client.Types.Repo" "cabal-install-3.12.1.0-G554PkJj2SpDqyarXp9tbt" 'False) (C1 ('MetaCons "RepoLocalNoIndex" 'PrefixI 'True) (S1 ('MetaSel ('Just "repoLocal") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 LocalRepo) :*: S1 ('MetaSel ('Just "repoLocalDir") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 FilePath)) :+: (C1 ('MetaCons "RepoRemote" 'PrefixI 'True) (S1 ('MetaSel ('Just "repoRemote") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 RemoteRepo) :*: S1 ('MetaSel ('Just "repoLocalDir") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 FilePath)) :+: C1 ('MetaCons "RepoSecure" 'PrefixI 'True) (S1 ('MetaSel ('Just "repoRemote") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 RemoteRepo) :*: S1 ('MetaSel ('Just "repoLocalDir") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 FilePath))))
Methods from :: Repo -> Rep Repo x # to :: Rep Repo x -> Repo #
Show Repo # |
Instance details Defined in Distribution.Client.Types.Repo Methods showsPrec :: Int -> Repo -> ShowS # show :: Repo -> String # showList :: [Repo] -> ShowS #
Eq Repo # |
Instance details Defined in Distribution.Client.Types.Repo Methods (==) :: Repo -> Repo -> Bool # (/=) :: Repo -> Repo -> Bool #
Ord Repo # |
Instance details Defined in Distribution.Client.Types.Repo Methods compare :: Repo -> Repo -> Ordering # (<) :: Repo -> Repo -> Bool # (<=) :: Repo -> Repo -> Bool # (>) :: Repo -> Repo -> Bool # (>=) :: Repo -> Repo -> Bool # max :: Repo -> Repo -> Repo # min :: Repo -> Repo -> Repo #
type Rep Repo # |
Instance details Defined in Distribution.Client.Types.Repo type Rep Repo = D1 ('MetaData "Repo" "Distribution.Client.Types.Repo" "cabal-install-3.12.1.0-G554PkJj2SpDqyarXp9tbt" 'False) (C1 ('MetaCons "RepoLocalNoIndex" 'PrefixI 'True) (S1 ('MetaSel ('Just "repoLocal") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 LocalRepo) :*: S1 ('MetaSel ('Just "repoLocalDir") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 FilePath)) :+: (C1 ('MetaCons "RepoRemote" 'PrefixI 'True) (S1 ('MetaSel ('Just "repoRemote") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 RemoteRepo) :*: S1 ('MetaSel ('Just "repoLocalDir") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 FilePath)) :+: C1 ('MetaCons "RepoSecure" 'PrefixI 'True) (S1 ('MetaSel ('Just "repoRemote") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 RemoteRepo) :*: S1 ('MetaSel ('Just "repoLocalDir") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 FilePath))))

repoName :: Repo -> RepoName #

isRepoRemote :: Repo -> Bool #

Check if this is a remote repo

maybeRepoRemote :: Repo -> Maybe RemoteRepo #

Extract `RemoteRepo` from `Repo` if remote.