Cabal-3.10.1.0: A framework for packaging Haskell software

Copyright | Duncan Coutts 2009 2013
Maintainer | cabal-devel@haskell.org
Portability | portable
Safe Haskell | Safe-Inferred
Language | Haskell2010

Distribution.Simple.Program.HcPkg

Contents

- Types
- Actions
- Program invocations

Description

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

Synopsis

- data HcPkgInfo = HcPkgInfo {
  - hcPkgProgram :: ConfiguredProgram
  - noPkgDbStack :: Bool
  - noVerboseFlag :: Bool
  - flagPackageConf :: Bool
  - supportsDirDbs :: Bool
  - requiresDirDbs :: Bool
  - nativeMultiInstance :: Bool
  - recacheMultiInstance :: Bool
  - suppressFilesCheck :: Bool
  }
- data RegisterOptions = RegisterOptions {
  - registerAllowOverwrite :: Bool
  - registerMultiInstance :: Bool
  - registerSuppressFilesCheck :: Bool
  }
- defaultRegisterOptions :: RegisterOptions
- init :: HcPkgInfo -> Verbosity -> Bool -> FilePath -> IO ()
- invoke :: HcPkgInfo -> Verbosity -> PackageDBStack -> [String] -> IO ()
- register :: HcPkgInfo -> Verbosity -> PackageDBStack -> InstalledPackageInfo -> RegisterOptions -> IO ()
- unregister :: HcPkgInfo -> Verbosity -> PackageDB -> PackageId -> IO ()
- recache :: HcPkgInfo -> Verbosity -> PackageDB -> IO ()
- expose :: HcPkgInfo -> Verbosity -> PackageDB -> PackageId -> IO ()
- hide :: HcPkgInfo -> Verbosity -> PackageDB -> PackageId -> IO ()
- dump :: HcPkgInfo -> Verbosity -> PackageDB -> IO [InstalledPackageInfo]
- describe :: HcPkgInfo -> Verbosity -> PackageDBStack -> PackageId -> IO [InstalledPackageInfo]
- list :: HcPkgInfo -> Verbosity -> PackageDB -> IO [PackageId]
- initInvocation :: HcPkgInfo -> Verbosity -> FilePath -> ProgramInvocation
- registerInvocation :: HcPkgInfo -> Verbosity -> PackageDBStack -> InstalledPackageInfo -> RegisterOptions -> ProgramInvocation
- unregisterInvocation :: HcPkgInfo -> Verbosity -> PackageDB -> PackageId -> ProgramInvocation
- recacheInvocation :: HcPkgInfo -> Verbosity -> PackageDB -> ProgramInvocation
- exposeInvocation :: HcPkgInfo -> Verbosity -> PackageDB -> PackageId -> ProgramInvocation
- hideInvocation :: HcPkgInfo -> Verbosity -> PackageDB -> PackageId -> ProgramInvocation
- dumpInvocation :: HcPkgInfo -> Verbosity -> PackageDB -> ProgramInvocation
- describeInvocation :: HcPkgInfo -> Verbosity -> PackageDBStack -> PackageId -> ProgramInvocation
- listInvocation :: HcPkgInfo -> Verbosity -> PackageDB -> ProgramInvocation

# Types

data HcPkgInfo Source #

Information about the features and capabilities of an `hc-pkg` program.

Constructors

HcPkgInfo |

Fields

- hcPkgProgram :: ConfiguredProgram
- noPkgDbStack :: Bool

  no package DB stack supported

- noVerboseFlag :: Bool

  hc-pkg does not support verbosity flags

- flagPackageConf :: Bool

  use package-conf option instead of package-db

- supportsDirDbs :: Bool

  supports directory style package databases

- requiresDirDbs :: Bool

  requires directory style package databases

- nativeMultiInstance :: Bool

  supports --enable-multi-instance flag

- recacheMultiInstance :: Bool

  supports multi-instance via recache

- suppressFilesCheck :: Bool

  supports --force-files or equivalent

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. This will fail if the `hc-pkg` does not support it, see `nativeMultiInstance` and `recacheMultiInstance`.

- 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 :: HcPkgInfo -> Verbosity -> Bool -> FilePath -> IO () Source #

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

    hc-pkg init {path}

invoke :: HcPkgInfo -> Verbosity -> PackageDBStack -> [String] -> IO () Source #

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

register :: HcPkgInfo -> Verbosity -> PackageDBStack -> InstalledPackageInfo -> RegisterOptions -> IO () Source #

Call `hc-pkg` to register a package.

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

unregister :: HcPkgInfo -> Verbosity -> PackageDB -> PackageId -> IO () Source #

Call `hc-pkg` to unregister a package

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

recache :: HcPkgInfo -> Verbosity -> PackageDB -> IO () Source #

Call `hc-pkg` to recache the registered packages.

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

expose :: HcPkgInfo -> Verbosity -> PackageDB -> PackageId -> IO () Source #

Call `hc-pkg` to expose a package.

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

hide :: HcPkgInfo -> Verbosity -> PackageDB -> PackageId -> IO () Source #

Call `hc-pkg` to hide a package.

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

dump :: HcPkgInfo -> Verbosity -> PackageDB -> IO [InstalledPackageInfo] Source #

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

describe :: HcPkgInfo -> Verbosity -> PackageDBStack -> PackageId -> IO [InstalledPackageInfo] Source #

Call `hc-pkg` to retrieve a specific package

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

list :: HcPkgInfo -> Verbosity -> 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

initInvocation :: HcPkgInfo -> Verbosity -> FilePath -> ProgramInvocation Source #

registerInvocation :: HcPkgInfo -> Verbosity -> PackageDBStack -> InstalledPackageInfo -> RegisterOptions -> ProgramInvocation Source #

unregisterInvocation :: HcPkgInfo -> Verbosity -> PackageDB -> PackageId -> ProgramInvocation Source #

recacheInvocation :: HcPkgInfo -> Verbosity -> PackageDB -> ProgramInvocation Source #

exposeInvocation :: HcPkgInfo -> Verbosity -> PackageDB -> PackageId -> ProgramInvocation Source #

hideInvocation :: HcPkgInfo -> Verbosity -> PackageDB -> PackageId -> ProgramInvocation Source #

dumpInvocation :: HcPkgInfo -> Verbosity -> PackageDB -> ProgramInvocation Source #

describeInvocation :: HcPkgInfo -> Verbosity -> PackageDBStack -> PackageId -> ProgramInvocation Source #

listInvocation :: HcPkgInfo -> Verbosity -> PackageDB -> ProgramInvocation Source #