Return the age of the index file in days (as a Double).
Modulecabal-install-3.12.1.0Haskell2010
Distribution.Client.IndexUtils
Extra utils related to the package indexes.
- 7 types
- 18 values
- Packagecabal-install-3.12.1.0
- Exports25
- LanguageHaskell2010
- LicenceBSD-3-Clause
- SourceIndexUtils.hs
Reduced-verbosity version of getInstalledPackages
Get filename base (i.e. without file extension) for index-related files
Secure cabal repositories use a new extended & incremental
01-index.tar. In order to avoid issues resulting from clobbering
new/old-style index data, we save them locally to different names.
Example: Use indexBaseName repo . "tar.gz" to compute the FilePath of the
00-index.tar.gz/01-index.tar.gz file.
A set of files (or directories) that can be monitored to detect when there might have been a change in the installed packages.
Read a repository index from disk, from the local files specified by a list of Repos.
All the SourcePackages are marked as having come from the appropriate Repo.
This is a higher level wrapper used internally in cabal-install.
A set of files (or directories) that can be monitored to detect when there might have been a change in the source packages.
Index state of multiple repositories
Instances9Eq, Show, Generic, NFData, Binary, Parsec, …
Eq TotalIndexStateDefined in cabal-install-3.12.1.0 · Distribution.Client.IndexUtils.IndexStateShow TotalIndexStateDefined in cabal-install-3.12.1.0 · Distribution.Client.IndexUtils.IndexStateGeneric TotalIndexStateDefined in cabal-install-3.12.1.0 · Distribution.Client.IndexUtils.IndexStateNFData TotalIndexStateDefined in cabal-install-3.12.1.0 · Distribution.Client.IndexUtils.IndexStateBinary TotalIndexStateDefined in cabal-install-3.12.1.0 · Distribution.Client.IndexUtils.IndexStateParsec TotalIndexStateDefined in cabal-install-3.12.1.0 · Distribution.Client.IndexUtils.IndexStateExample1 expression simpleParsec "HEAD" :: Maybe TotalIndexStateJust (TIS IndexStateHead (fromList []))
Example1 expression simpleParsec "" :: Maybe TotalIndexStateNothing
Example1 expression simpleParsec "hackage.haskell.org HEAD" :: Maybe TotalIndexStateJust (TIS IndexStateHead (fromList []))
Example1 expression simpleParsec "2020-02-04T12:34:56Z, hackage.haskell.org HEAD" :: Maybe TotalIndexStateJust (TIS (IndexStateTime (TS 1580819696)) (fromList [(RepoName {unRepoName = "hackage.haskell.org"},IndexStateHead)]))
Example1 expression simpleParsec "hackage.haskell.org 2020-02-04T12:34:56Z" :: Maybe TotalIndexStateJust (TIS IndexStateHead (fromList [(RepoName {unRepoName = "hackage.haskell.org"},IndexStateTime (TS 1580819696))]))
Pretty TotalIndexStateDefined in cabal-install-3.12.1.0 · Distribution.Client.IndexUtils.IndexStateStructured TotalIndexStateDefined in cabal-install-3.12.1.0 · Distribution.Client.IndexUtils.IndexStatetype Rep TotalIndexState = D1 ('MetaDataDefined in cabal-install-3.12.1.0 · Distribution.Client.IndexUtils.IndexState"TotalIndexState"
"Distribution.Client.IndexUtils.IndexState"
"cabal-install-3.12.1.0-1D90DH9PPem9Tqn79I9vRN"
'False) (C1 ('MetaCons"TIS"
'PrefixI 'False) (S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 RepoIndexState) :*: S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map RepoName RepoIndexState))))
Variant of getSourcePackages which allows getting the source
packages at a particular IndexState.
Current choices are either the latest (aka HEAD), or the index as it was at a particular time.
Returns also the total index where repositories' RepoIndexState's are not HEAD. This is used in v2-freeze.
Ordered list of active repositories.
Instances9Eq, Show, Generic, NFData, Binary, Parsec, …
Eq ActiveReposDefined in cabal-install-3.12.1.0 · Distribution.Client.IndexUtils.ActiveReposShow ActiveReposDefined in cabal-install-3.12.1.0 · Distribution.Client.IndexUtils.ActiveReposGeneric ActiveReposDefined in cabal-install-3.12.1.0 · Distribution.Client.IndexUtils.ActiveReposNFData ActiveReposDefined in cabal-install-3.12.1.0 · Distribution.Client.IndexUtils.ActiveReposBinary ActiveReposDefined in cabal-install-3.12.1.0 · Distribution.Client.IndexUtils.ActiveReposParsec ActiveReposDefined in cabal-install-3.12.1.0 · Distribution.Client.IndexUtils.ActiveReposNote: empty string is not valid ActiveRepos.
Example1 expression simpleParsec "" :: Maybe ActiveReposNothing
Example1 expression simpleParsec ":none" :: Maybe ActiveReposJust (ActiveRepos [])
Example1 expression simpleParsec ":rest" :: Maybe ActiveReposJust (ActiveRepos [ActiveRepoRest CombineStrategyMerge])
Example1 expression simpleParsec "hackage.haskell.org, :rest, head.hackage:override" :: Maybe ActiveReposJust (ActiveRepos [ActiveRepo (RepoName {unRepoName = "hackage.haskell.org"}) CombineStrategyMerge,ActiveRepoRest CombineStrategyMerge,ActiveRepo (RepoName {unRepoName = "head.hackage"}) CombineStrategyOverride])
Pretty ActiveReposDefined in cabal-install-3.12.1.0 · Distribution.Client.IndexUtils.ActiveReposStructured ActiveReposDefined in cabal-install-3.12.1.0 · Distribution.Client.IndexUtils.ActiveRepostype Rep ActiveRepos = D1 ('MetaDataDefined in cabal-install-3.12.1.0 · Distribution.Client.IndexUtils.ActiveRepos"ActiveRepos"
"Distribution.Client.IndexUtils.ActiveRepos"
"cabal-install-3.12.1.0-1D90DH9PPem9Tqn79I9vRN"
'True) (C1 ('MetaCons"ActiveRepos"
'PrefixI 'False) (S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [ActiveRepoEntry])))
Note, this does nothing if ActiveRepoRest is present.
Which index do we mean?
Constructors
RepoIndex RepoContext RepoThe main index for the specified repository
Specification of the state of a specific repo package index
Constructors
IndexStateHeadUse all available entries
IndexStateTime !TimestampUse all entries that existed at the specified time
Instances9Eq, Show, Generic, NFData, Binary, Parsec, …
Eq RepoIndexStateDefined in cabal-install-3.12.1.0 · Distribution.Client.IndexUtils.IndexStateShow RepoIndexStateDefined in cabal-install-3.12.1.0 · Distribution.Client.IndexUtils.IndexStateGeneric RepoIndexStateDefined in cabal-install-3.12.1.0 · Distribution.Client.IndexUtils.IndexStateNFData RepoIndexStateDefined in cabal-install-3.12.1.0 · Distribution.Client.IndexUtils.IndexStateBinary RepoIndexStateDefined in cabal-install-3.12.1.0 · Distribution.Client.IndexUtils.IndexStateParsec RepoIndexStateDefined in cabal-install-3.12.1.0 · Distribution.Client.IndexUtils.IndexStatePretty RepoIndexStateDefined in cabal-install-3.12.1.0 · Distribution.Client.IndexUtils.IndexStateStructured RepoIndexStateDefined in cabal-install-3.12.1.0 · Distribution.Client.IndexUtils.IndexStatetype Rep RepoIndexState = D1 ('MetaDataDefined in cabal-install-3.12.1.0 · Distribution.Client.IndexUtils.IndexState"RepoIndexState"
"Distribution.Client.IndexUtils.IndexState"
"cabal-install-3.12.1.0-1D90DH9PPem9Tqn79I9vRN"
'False) (C1 ('MetaCons"IndexStateHead"
'PrefixI 'False) U1 :+: C1 ('MetaCons"IndexStateTime"
'PrefixI 'False) (S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Timestamp)))
An index entry is either a normal package, or a local build tree reference.
Constructors
Instances1Package
Package PackageEntryDefined in cabal-install-3.12.1.0 · Distribution.Client.IndexUtils
Read 00-index.tar.gz and extract .cabal and preferred-versions files
We read the index using read, which gives us a lazily constructed
TarEntries. We translate it to a list of entries using tarEntriesList,
which preserves the lazy nature of TarEntries, and finally concatMap a
function over this to translate it to a list of IO actions returning
PackageOrDeps. We can use lazySequence to turn this into a list of
PackageOrDeps, still maintaining the lazy nature of the original tar read.
It is not necessary to call this, as the cache will be updated when the index is read normally. However you can do the work earlier if you like.
Write the IndexState to the filesystem
Read out the "current" index timestamp, i.e., what timestamp you would use to revert to this version.
Note: this is not the same as readIndexTimestamp!
This resolves HEAD to the index's isiHeadTime, i.e.
the index latest known timestamp.
Return NoTimestamp if the index has never been updated.
A build tree reference is either a link or a snapshot.
Instances6Eq, Show, Generic, Binary, Structured, Rep
Eq BuildTreeRefTypeDefined in cabal-install-3.12.1.0 · Distribution.Client.IndexUtilsShow BuildTreeRefTypeDefined in cabal-install-3.12.1.0 · Distribution.Client.IndexUtilsGeneric BuildTreeRefTypeDefined in cabal-install-3.12.1.0 · Distribution.Client.IndexUtilsBinary BuildTreeRefTypeDefined in cabal-install-3.12.1.0 · Distribution.Client.IndexUtilsStructured BuildTreeRefTypeDefined in cabal-install-3.12.1.0 · Distribution.Client.IndexUtilstype Rep BuildTreeRefType = D1 ('MetaDataDefined in cabal-install-3.12.1.0 · Distribution.Client.IndexUtils"BuildTreeRefType"
"Distribution.Client.IndexUtils"
"cabal-install-3.12.1.0-1D90DH9PPem9Tqn79I9vRN"
'False) (C1 ('MetaCons"SnapshotRef"
'PrefixI 'False) U1 :+: C1 ('MetaCons"LinkRef"
'PrefixI 'False) U1)
preferred-versions utilities
4 declarationsExpected name of the 'preferred-versions' file.
Contains special constraints, such as a preferred version of a package or deprecations of certain package versions.
Expected format:
binary > 0.9.0.0 || < 0.9.0.0
text == 1.2.1.0
Does the given filename match with the expected name of 'preferred-versions'?
Parse `preferred-versions` file, collecting parse errors that can be shown in error messages.
Parser error of the `preferred-versions` file.
Constructors
PreferredVersionsParseErrorpreferredVersionsParsecError :: StringParser error to show to a user.
preferredVersionsOriginalDependency :: StringOriginal input that produced the parser error.
Instances6Eq, Ord, Read, Show, Generic, Rep
Eq PreferredVersionsParseErrorDefined in cabal-install-3.12.1.0 · Distribution.Client.IndexUtilsOrd PreferredVersionsParseErrorDefined in cabal-install-3.12.1.0 · Distribution.Client.IndexUtilsRead PreferredVersionsParseErrorDefined in cabal-install-3.12.1.0 · Distribution.Client.IndexUtilsShow PreferredVersionsParseErrorDefined in cabal-install-3.12.1.0 · Distribution.Client.IndexUtilsGeneric PreferredVersionsParseErrorDefined in cabal-install-3.12.1.0 · Distribution.Client.IndexUtilstype Rep PreferredVersionsParseError = D1 ('MetaDataDefined in cabal-install-3.12.1.0 · Distribution.Client.IndexUtils"PreferredVersionsParseError"
"Distribution.Client.IndexUtils"
"cabal-install-3.12.1.0-1D90DH9PPem9Tqn79I9vRN"
'False) (C1 ('MetaCons"PreferredVersionsParseError"
'PrefixI 'True) (S1 ('MetaSel ('Just"preferredVersionsParsecError"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String) :*: S1 ('MetaSel ('Just"preferredVersionsOriginalDependency"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String)))