GenericInstallPlan specialised to most commonly used types.
Modulecabal-install-3.12.1.0Haskell2010
Distribution.Client.InstallPlan
Package installation plan
- 8 types
- 30 values
- Packagecabal-install-3.12.1.0
- Exports38
- LanguageHaskell2010
- LicenceBSD-3-Clause
- SourceInstallPlan.hs
Instances2Binary, Structured
(IsNode ipkg, Key ipkg ~ UnitId, IsNode srcpkg, Key srcpkg ~ UnitId, Binary ipkg, Binary srcpkg) => Binary (GenericInstallPlan ipkg srcpkg)Defined in cabal-install-3.12.1.0 · Distribution.Client.InstallPlan(Structured ipkg, Structured srcpkg) => Structured (GenericInstallPlan ipkg srcpkg)Defined in cabal-install-3.12.1.0 · Distribution.Client.InstallPlan
Packages in an install plan
NOTE: ConfiguredPackage, GenericReadyPackage and GenericPlanPackage
intentionally have no PackageInstalled instance. `This is important:
PackageInstalled returns only library dependencies, but for package that
aren't yet installed we know many more kinds of dependencies (setup
dependencies, exe, test-suite, benchmark, ..). Any functions that operate on
dependencies in cabal-install should consider what to do with these
dependencies; if we give a PackageInstalled instance it would be too easy
to get this wrong (and, for instance, call graph traversal functions from
Cabal rather than from cabal-install). Instead, see PackageInstalled.
Constructors
PreExisting ipkgConfigured srcpkgInstalled srcpkg
Instances12Eq, Show, Generic, Binary, Structured, IsNode, …
(Eq ipkg, Eq srcpkg) => Eq (GenericPlanPackage ipkg srcpkg)Defined in cabal-install-3.12.1.0 · Distribution.Client.InstallPlan(Show ipkg, Show srcpkg) => Show (GenericPlanPackage ipkg srcpkg)Defined in cabal-install-3.12.1.0 · Distribution.Client.InstallPlanGeneric (GenericPlanPackage ipkg srcpkg)Defined in cabal-install-3.12.1.0 · Distribution.Client.InstallPlan(Binary ipkg, Binary srcpkg) => Binary (GenericPlanPackage ipkg srcpkg)Defined in cabal-install-3.12.1.0 · Distribution.Client.InstallPlan(Structured ipkg, Structured srcpkg) => Structured (GenericPlanPackage ipkg srcpkg)Defined in cabal-install-3.12.1.0 · Distribution.Client.InstallPlan(IsNode ipkg, IsNode srcpkg, Key ipkg ~ UnitId, Key srcpkg ~ UnitId) => IsNode (GenericPlanPackage ipkg srcpkg)Defined in cabal-install-3.12.1.0 · Distribution.Client.InstallPlan(HasMungedPackageId ipkg, HasMungedPackageId srcpkg) => HasMungedPackageId (GenericPlanPackage ipkg srcpkg)Defined in cabal-install-3.12.1.0 · Distribution.Client.InstallPlan(HasUnitId ipkg, HasUnitId srcpkg) => HasUnitId (GenericPlanPackage ipkg srcpkg)Defined in cabal-install-3.12.1.0 · Distribution.Client.InstallPlan(Package ipkg, Package srcpkg) => Package (GenericPlanPackage ipkg srcpkg)Defined in cabal-install-3.12.1.0 · Distribution.Client.InstallPlan(HasConfiguredId ipkg, HasConfiguredId srcpkg) => HasConfiguredId (GenericPlanPackage ipkg srcpkg)Defined in cabal-install-3.12.1.0 · Distribution.Client.InstallPlantype Rep (GenericPlanPackage ipkg srcpkg) = D1 ('MetaDataDefined in cabal-install-3.12.1.0 · Distribution.Client.InstallPlan"GenericPlanPackage"
"Distribution.Client.InstallPlan"
"cabal-install-3.12.1.0-1D90DH9PPem9Tqn79I9vRN"
'False) (C1 ('MetaCons"PreExisting"
'PrefixI 'False) (S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ipkg)) :+: (C1 ('MetaCons"Configured"
'PrefixI 'False) (S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 srcpkg)) :+: C1 ('MetaCons"Installed"
'PrefixI 'False) (S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 srcpkg))))type Key (GenericPlanPackage ipkg srcpkg) = UnitIdDefined in cabal-install-3.12.1.0 · Distribution.Client.InstallPlan
Convenience combinator for destructing GenericPlanPackage. This is handy because if you case manually, you have to handle Configured and Installed separately (where often you want them to be the same.)
Operations on InstallPlans
16 declarationsBuild an installation plan from a valid set of resolved packages.
Conversion of SolverInstallPlan to InstallPlan.
Similar to elaboratedInstallPlan
Remove packages from the install plan. This will result in an error if there are remaining packages that depend on any matching package. This is primarily useful for obtaining an install plan for the dependencies of a package or set of packages without actually installing the package itself, as when doing development.
Change a number of packages in the Configured state to the Installed state.
To preserve invariants, the package must have all of its dependencies already installed too (that is PreExisting or Installed).
Lookup a package in the plan.
Find all the direct dependencies of the given package.
Note that the package must exist in the plan or it is an error.
Find all the direct reverse dependencies of the given package.
Note that the package must exist in the plan or it is an error.
Traversal
4 declarationsFlatten an InstallPlan, producing the sequence of source packages in the order in which they would be processed when the plan is executed. This can be used for simulations or presenting execution dry-runs.
It is guaranteed to give the same order as using execute (with a serial in-order JobControl), which is a reverse topological orderings of the source packages in the dependency graph, albeit not necessarily exactly the same ordering as that produced by reverseTopologicalOrder.
execute :: (IsUnit ipkg, IsUnit srcpkg, Monad m)=> JobControl m (UnitId, Either failure result)-> BoolKeep going after failure
-> (srcpkg -> failure)Value for dependents of failed packages
-> GenericInstallPlan ipkg srcpkg-> (GenericReadyPackage srcpkg -> m (Either failure result))-> m (BuildOutcomes failure result)
Execute an install plan. This traverses the plan in dependency order.
Executing each individual package can fail and if so all dependents fail too. The result for each package is collected as a BuildOutcomes map.
Visiting each package happens with optional parallelism, as determined by the JobControl. By default, after any failure we stop as soon as possible (using the JobControl to try to cancel in-progress tasks). This behaviour can be reversed to keep going and build as many packages as possible.
Note that the BuildOutcomes is not guaranteed to cover all the packages in the plan. In particular in the default mode where we stop as soon as possible after a failure then there may be packages which are skipped and these will have no BuildOutcome.
The set of results we get from executing an install plan.
Lookup the build result for a single package.
Traversal helpers
Algorithms to traverse or execute an InstallPlan, especially in parallel, may make use of the Processing type and the associated operations ready, completed and failed.
The Processing type is used to keep track of the state of a traversal and includes the set of packages that are in the processing state, e.g. in the process of being installed, plus those that have been completed and those where processing failed.
Traversal algorithms start with an InstallPlan:
Initially there will be certain packages that can be processed immediately (since they are configured source packages and have all their dependencies installed already). The function ready returns these packages plus a Processing state that marks these same packages as being in the processing state.
The algorithm must now arrange for these packages to be processed (possibly in parallel). When a package has completed processing, the algorithm needs to know which other packages (if any) are now ready to process as a result. The completed function marks a package as completed and returns any packages that are newly in the processing state (ie ready to process), along with the updated Processing state.
If failure is possible then when processing a package fails, the algorithm needs to know which other packages have also failed as a result. The failed function marks the given package as failed as well as all the other packages that depend on the failed package. In addition it returns the other failed packages.
The Processing type is used to keep track of the state of a traversal and includes the set of packages that are in the processing state, e.g. in the process of being installed, plus those that have been completed and those where processing failed.
The packages in the plan that are initially ready to be installed. That is they are in the configured state and have all their dependencies installed already.
The result is both the packages that are now ready to be installed and also a Processing state containing those same packages. The assumption is that all the packages that are ready will now be processed and so we can consider them to be in the processing state.
Given a package in the processing state, mark the package as completed and return any packages that are newly in the processing state (ie ready to process), along with the updated Processing state.
Display
5 declarationsConstructors
Generic way to show a GenericInstallPlan which elicits quite a lot of information
Graph-like operations
3 declarationsReturn the packages in the plan that are direct or indirect dependencies of the given packages.
Return all the packages in the InstallPlan in reverse topological order. That is, for each package, all dependencies of the package appear first.
Compared to executionOrder, this function returns all the installed and source packages rather than just the source ones. Also, while both this and executionOrder produce reverse topological orderings of the package dependency graph, it is not necessarily exactly the same order.
Return the packages in the plan that depend directly or indirectly on the given packages.