Cabal
CopyrightDuncan Coutts 2009 2013
Maintainercabal-devel@haskell.org
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

Distribution.Simple.Program.HcPkg

Description

This module provides an library interface to the hc-pkg program. Currently only GHC and GHCJS have hc-pkg programs.

Synopsis

Types

data ConfiguredProgram Source #

Represents a program which has been configured and is thus ready to be run.

These are usually made by configuring a Program, but if you have to construct one directly then start with simpleConfiguredProgram and override any extra fields.

Constructors

ConfiguredProgram 

Fields

  • programId :: String

    Just the name again

  • programVersion :: Maybe Version

    The version of this program, if it is known.

  • programDefaultArgs :: [String]

    Default command-line args for this program. These flags will appear first on the command line, so they can be overridden by subsequent flags.

  • programOverrideArgs :: [String]

    Override command-line args for this program. These flags will appear last on the command line, so they override all earlier flags.

  • programOverrideEnv :: [(String, Maybe String)]

    Override environment variables for this program. These env vars will extend/override the prevailing environment of the current to form the environment for the new process.

  • programProperties :: Map String String

    A key-value map listing various properties of the program, useful for feature detection. Populated during the configuration step, key names depend on the specific program.

  • programLocation :: ProgramLocation

    Location of the program. eg. /usr/bin/ghc-6.4

  • programMonitorFiles :: [FilePath]

    In addition to the programLocation where the program was found, these are additional locations that were looked at. The combination of this found location and these not-found locations can be used to monitor to detect when the re-configuring the program might give a different result (e.g. found in a different location).

Instances

Instances details
Structured ConfiguredProgram Source # 
Instance details

Defined in Distribution.Simple.Program.Types

Binary ConfiguredProgram Source # 
Instance details

Defined in Distribution.Simple.Program.Types

Generic ConfiguredProgram Source # 
Instance details

Defined in Distribution.Simple.Program.Types

Associated Types

type Rep ConfiguredProgram 
Instance details

Defined in Distribution.Simple.Program.Types

type Rep ConfiguredProgram = D1 ('MetaData "ConfiguredProgram" "Distribution.Simple.Program.Types" "Cabal-3.18.1.0-inplace" 'False) (C1 ('MetaCons "ConfiguredProgram" 'PrefixI 'True) (((S1 ('MetaSel ('Just "programId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String) :*: S1 ('MetaSel ('Just "programVersion") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Version))) :*: (S1 ('MetaSel ('Just "programDefaultArgs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [String]) :*: S1 ('MetaSel ('Just "programOverrideArgs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [String]))) :*: ((S1 ('MetaSel ('Just "programOverrideEnv") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [(String, Maybe String)]) :*: S1 ('MetaSel ('Just "programProperties") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map String String))) :*: (S1 ('MetaSel ('Just "programLocation") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ProgramLocation) :*: S1 ('MetaSel ('Just "programMonitorFiles") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [FilePath])))))
Read ConfiguredProgram Source # 
Instance details

Defined in Distribution.Simple.Program.Types

Show ConfiguredProgram Source # 
Instance details

Defined in Distribution.Simple.Program.Types

Eq ConfiguredProgram Source # 
Instance details

Defined in Distribution.Simple.Program.Types

type Rep ConfiguredProgram Source # 
Instance details

Defined in Distribution.Simple.Program.Types

type Rep ConfiguredProgram = D1 ('MetaData "ConfiguredProgram" "Distribution.Simple.Program.Types" "Cabal-3.18.1.0-inplace" 'False) (C1 ('MetaCons "ConfiguredProgram" 'PrefixI 'True) (((S1 ('MetaSel ('Just "programId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String) :*: S1 ('MetaSel ('Just "programVersion") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Version))) :*: (S1 ('MetaSel ('Just "programDefaultArgs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [String]) :*: S1 ('MetaSel ('Just "programOverrideArgs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [String]))) :*: ((S1 ('MetaSel ('Just "programOverrideEnv") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [(String, Maybe String)]) :*: S1 ('MetaSel ('Just "programProperties") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map String String))) :*: (S1 ('MetaSel ('Just "programLocation") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ProgramLocation) :*: S1 ('MetaSel ('Just "programMonitorFiles") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [FilePath])))))

data RegisterOptions Source #

Additional variations in the behaviour for register.

Constructors

RegisterOptions 

Fields

  • registerAllowOverwrite :: Bool

    Allows re-registering / overwriting an existing package

  • registerMultiInstance :: Bool

    Insist on the ability to register multiple instances of a single version of a single package.

  • registerSuppressFilesCheck :: Bool

    Require that no checks are performed on the existence of package files mentioned in the registration info. This must be used if registering prior to putting the files in their final place. This will fail if the hc-pkg does not support it, see suppressFilesCheck.

defaultRegisterOptions :: RegisterOptions Source #

Defaults are True, False and False

Actions

init :: ConfiguredProgram -> Verbosity -> FilePath -> IO () Source #

Call hc-pkg to initialise a package database at the location {path}.

hc-pkg init {path}

invoke :: ConfiguredProgram -> Verbosity -> Maybe (SymbolicPath CWD ('Dir Pkg)) -> PackageDBStack -> [String] -> IO () Source #

Run hc-pkg using a given package DB stack, directly forwarding the provided command-line arguments to it.

register :: ConfiguredProgram -> Verbosity -> Maybe (SymbolicPath CWD ('Dir from)) -> PackageDBStackS from -> InstalledPackageInfo -> RegisterOptions -> IO () Source #

Call hc-pkg to register a package.

hc-pkg register {filename | -} [--user | --global | --package-db]

unregister :: ConfiguredProgram -> Verbosity -> Maybe (SymbolicPath CWD ('Dir Pkg)) -> PackageDB -> PackageId -> IO () Source #

Call hc-pkg to unregister a package

hc-pkg unregister [pkgid] [--user | --global | --package-db]

recache :: ConfiguredProgram -> Verbosity -> Maybe (SymbolicPath CWD ('Dir from)) -> PackageDBS from -> IO () Source #

Call hc-pkg to recache the registered packages.

hc-pkg recache [--user | --global | --package-db]

expose :: ConfiguredProgram -> Verbosity -> Maybe (SymbolicPath CWD ('Dir Pkg)) -> PackageDB -> PackageId -> IO () Source #

Call hc-pkg to expose a package.

hc-pkg expose [pkgid] [--user | --global | --package-db]

hide :: ConfiguredProgram -> Verbosity -> Maybe (SymbolicPath CWD ('Dir Pkg)) -> PackageDB -> PackageId -> IO () Source #

Call hc-pkg to hide a package.

hc-pkg hide [pkgid] [--user | --global | --package-db]

dump :: ConfiguredProgram -> Verbosity -> Maybe (SymbolicPath CWD ('Dir from)) -> PackageDBX (SymbolicPath from ('Dir PkgDB)) -> IO [InstalledPackageInfo] Source #

Call hc-pkg to get all the details of all the packages in the given package database.

describe :: ConfiguredProgram -> Verbosity -> Maybe (SymbolicPath CWD ('Dir Pkg)) -> PackageDBStack -> PackageId -> IO [InstalledPackageInfo] Source #

Call hc-pkg to retrieve a specific package

hc-pkg describe [pkgid] [--user | --global | --package-db]

list :: ConfiguredProgram -> Verbosity -> Maybe (SymbolicPath CWD ('Dir Pkg)) -> PackageDB -> IO [PackageId] Source #

Call hc-pkg to get the source package Id of all the packages in the given package database.

This is much less information than with dump, but also rather quicker. Note in particular that it does not include the UnitId, just the source PackageId which is not necessarily unique in any package db.

Program invocations