Copyright | (c) Duncan Coutts 2008 |
---|---|
License | BSD-like |
Maintainer | duncan@community.haskell.org |
Stability | provisional |
Portability | portable |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Extra utils related to the package indexes.
Synopsis
- getIndexFileAge :: Repo -> IO Double
- getInstalledPackages :: Verbosity -> Compiler -> PackageDBStack -> ProgramDb -> IO InstalledPackageIndex
- indexBaseName :: Repo -> FilePath
- getInstalledPackagesMonitorFiles :: Verbosity -> Compiler -> PackageDBStack -> ProgramDb -> Platform -> IO [FilePath]
- getSourcePackages :: Verbosity -> RepoContext -> IO SourcePackageDb
- getSourcePackagesMonitorFiles :: [Repo] -> [FilePath]
- data TotalIndexState
- getSourcePackagesAtIndexState :: Verbosity -> RepoContext -> Maybe TotalIndexState -> Maybe ActiveRepos -> IO (SourcePackageDb, TotalIndexState, ActiveRepos)
- data ActiveRepos
- filterSkippedActiveRepos :: ActiveRepos -> ActiveRepos
- data Index
- data RepoIndexState
- data PackageEntry
- parsePackageIndex :: Verbosity -> ByteString -> [IO (Maybe PackageOrDep)]
- updateRepoIndexCache :: Verbosity -> Index -> IO ()
- updatePackageIndexCacheFile :: Verbosity -> Index -> IO ()
- writeIndexTimestamp :: Index -> RepoIndexState -> IO ()
- currentIndexTimestamp :: Verbosity -> RepoContext -> Repo -> IO Timestamp
- data BuildTreeRefType
- refTypeFromTypeCode :: TypeCode -> BuildTreeRefType
- typeCodeFromRefType :: BuildTreeRefType -> TypeCode
- preferredVersions :: FilePath
- isPreferredVersions :: FilePath -> Bool
- parsePreferredVersionsWarnings :: ByteString -> [Either PreferredVersionsParseError Dependency]
- data PreferredVersionsParseError = PreferredVersionsParseError {}
Documentation
getIndexFileAge :: Repo -> IO Double Source #
Return the age of the index file in days (as a Double).
getInstalledPackages :: Verbosity -> Compiler -> PackageDBStack -> ProgramDb -> IO InstalledPackageIndex Source #
Reduced-verbosity version of getInstalledPackages
indexBaseName :: Repo -> FilePath Source #
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.
getInstalledPackagesMonitorFiles :: Verbosity -> Compiler -> PackageDBStack -> ProgramDb -> Platform -> IO [FilePath] #
A set of files (or directories) that can be monitored to detect when there might have been a change in the installed packages.
getSourcePackages :: Verbosity -> RepoContext -> IO SourcePackageDb Source #
Read a repository index from disk, from the local files specified by
a list of Repo
s.
All the SourcePackage
s are marked as having come from the appropriate
Repo
.
This is a higher level wrapper used internally in cabal-install.
getSourcePackagesMonitorFiles :: [Repo] -> [FilePath] Source #
A set of files (or directories) that can be monitored to detect when there might have been a change in the source packages.
data TotalIndexState Source #
Index state of multiple repositories
Instances
getSourcePackagesAtIndexState :: Verbosity -> RepoContext -> Maybe TotalIndexState -> Maybe ActiveRepos -> IO (SourcePackageDb, TotalIndexState, ActiveRepos) Source #
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.
data ActiveRepos Source #
Ordered list of active repositories.
Instances
filterSkippedActiveRepos :: ActiveRepos -> ActiveRepos Source #
Note, this does nothing if ActiveRepoRest
is present.
Which index do we mean?
RepoIndex RepoContext Repo | The main index for the specified repository |
SandboxIndex FilePath | A sandbox-local repository Argument is the location of the index file |
data RepoIndexState Source #
Specification of the state of a specific repo package index
IndexStateHead | Use all available entries |
IndexStateTime !Timestamp | Use all entries that existed at the specified time |
Instances
data PackageEntry Source #
An index entry is either a normal package, or a local build tree reference.
NormalPackage PackageId GenericPackageDescription ByteString BlockNo | |
BuildTreeRef BuildTreeRefType PackageId GenericPackageDescription FilePath BlockNo |
Instances
Package PackageEntry Source # | |
Defined in Distribution.Client.IndexUtils |
parsePackageIndex :: Verbosity -> ByteString -> [IO (Maybe PackageOrDep)] Source #
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
PackageOrDep
s. We can use lazySequence
to turn this into a list of
PackageOrDep
s, still maintaining the lazy nature of the original tar read.
updateRepoIndexCache :: Verbosity -> Index -> IO () Source #
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.
writeIndexTimestamp :: Index -> RepoIndexState -> IO () Source #
Write the IndexState
to the filesystem
currentIndexTimestamp :: Verbosity -> RepoContext -> Repo -> IO Timestamp Source #
Read out the "current" index timestamp, i.e., what timestamp you would use to revert to this version
data BuildTreeRefType Source #
A build tree reference is either a link or a snapshot.
Instances
Structured BuildTreeRefType Source # | |
Defined in Distribution.Client.IndexUtils structure :: Proxy BuildTreeRefType -> Structure # structureHash' :: Tagged BuildTreeRefType MD5 | |
Generic BuildTreeRefType Source # | |
Defined in Distribution.Client.IndexUtils type Rep BuildTreeRefType :: Type -> Type # from :: BuildTreeRefType -> Rep BuildTreeRefType x # to :: Rep BuildTreeRefType x -> BuildTreeRefType # | |
Show BuildTreeRefType Source # | |
Defined in Distribution.Client.IndexUtils showsPrec :: Int -> BuildTreeRefType -> ShowS # show :: BuildTreeRefType -> String # showList :: [BuildTreeRefType] -> ShowS # | |
Binary BuildTreeRefType Source # | |
Defined in Distribution.Client.IndexUtils | |
Eq BuildTreeRefType Source # | |
Defined in Distribution.Client.IndexUtils (==) :: BuildTreeRefType -> BuildTreeRefType -> Bool # (/=) :: BuildTreeRefType -> BuildTreeRefType -> Bool # | |
type Rep BuildTreeRefType Source # | |
Defined in Distribution.Client.IndexUtils |
preferred-versions utilities
preferredVersions :: FilePath Source #
Expected 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
isPreferredVersions :: FilePath -> Bool Source #
Does the given filename match with the expected name of 'preferred-versions'?
parsePreferredVersionsWarnings :: ByteString -> [Either PreferredVersionsParseError Dependency] Source #
Parse `preferred-versions` file, collecting parse errors that can be shown in error messages.
data PreferredVersionsParseError Source #
Parser error of the `preferred-versions` file.
PreferredVersionsParseError | |
|