cabal-file-0.1.1: Cabal file access
Safe HaskellNone
LanguageHaskell2010

Hackage.Index

Synopsis

Documentation

getCabal :: PackageIdentifier -> IO ByteString Source #

Get the contents of the .cabal file for package version

getCabals :: PackageIdentifier -> PackageIdentifier -> IO (ByteString, ByteString) Source #

Get two .cabal files at once!

withCabalFile :: PackageIdentifier -> (FilePath -> IO a) -> IO a Source #

Pass a temporary copy of .cabal file to some action

listPackages :: IO [String] Source #

List all packages in the index (unsorted for performance)

packageVersions :: PackageName -> IO [Version] Source #

Get all versions of a package in the index

latestVersion :: PackageName -> IO (Maybe Version) Source #

Get the latest version of package from the index

Note: does not take preferred-versions into account

preferredVersions :: PackageName -> IO (Maybe ByteString) Source #

Get the preferred-versions metadata for package

getTimestamp :: PackageIdentifier -> IO (Maybe UTCTime) Source #

Get the index timestamp for (the latest revision of) pkgid

indexFiles :: IO [String] Source #

List all files in the Hackage index (.cabal files, metadata .json files, preferred-versions files)

getPackageDescription :: PackageIdentifier -> IO (Maybe PackageDescription) Source #

Get and try to parse the PackageDescription of a package version

getPackageDescription' :: PackageIdentifier -> IO PackageDescription Source #

Get and parse PackageDescription of package version

Raises an error on failure.

packageIdOrLatest :: PackageIdentifier -> IO PackageIdentifier Source #

Convert a PackageID if unversioned to latest package version

getFileInfo :: PackageIdentifier -> IO FileInfo Source #

Get FileInfo metadata for package version source

Re-exports from hackage-security

data FileInfo #

File information

This intentionally does not have an Eq instance; see knownFileInfoEqual and verifyFileInfo instead.

NOTE: Throughout we compute file information always over the raw bytes. For example, when timestamp.json lists the hash of snapshot.json, this hash is computed over the actual snapshot.json file (as opposed to the canonical form of the embedded JSON). This brings it in line with the hash computed over target files, where that is the only choice available.

Instances

Instances details
Show FileInfo 
Instance details

Defined in Hackage.Security.TUF.FileInfo

Monad m => ToJSON m FileInfo 
Instance details

Defined in Hackage.Security.TUF.FileInfo

Methods

toJSON :: FileInfo -> m JSValue #

ReportSchemaErrors m => FromJSON m FileInfo 
Instance details

Defined in Hackage.Security.TUF.FileInfo

Methods

fromJSON :: JSValue -> m FileInfo #

newtype FileLength #

File length

Having verified file length information means we can protect against endless data attacks and similar.

Constructors

FileLength 

Fields

fileInfoSHA256 :: FileInfo -> Maybe Hash #

Extract SHA256 hash from FileInfo (if present)