-
Notifications
You must be signed in to change notification settings - Fork 697
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Show installed versions when configuring fails
When `act-as-setup configure` fails, it doesn't indicate which dependencies are missing entirely and which ones don't satisfy the version constraints. The errors from `cabal build` are more informative, but aren't available in all contexts (nixpkgs Haskell builds, for example, use the `act-as-setup` interface). This makes it immediately clear what sort of dependency error has occurred. Before (cabal-install 3.12.1.0): Configuring test-pkg-0.1.0.0... Error: [Cabal-8010] Encountered missing or private dependencies: base <=4.18, foobar, test-pkg:{bar-internal, foo-internal} After: Configuring test-pkg-0.1.0.0... Error: [Cabal-8010] Encountered missing or private dependencies: base <=4.18 (installed: 4.19.1.0), foobar (missing), test-pkg:{bar-internal,foo-internal} (missing: :bar-internal)
- Loading branch information
Showing
29 changed files
with
328 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
Cabal-syntax/src/Distribution/Types/DependencySatisfaction.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
module Distribution.Types.DependencySatisfaction | ||
( DependencySatisfaction (..) | ||
) where | ||
|
||
import Distribution.Types.MissingDependencyReason (MissingDependencyReason) | ||
|
||
-- | Whether or not a dependency constraint is satisfied. | ||
data DependencySatisfaction | ||
= -- | The dependency constraint is satisfied. | ||
Satisfied | ||
| -- | The dependency constraint is not satisfied. | ||
-- | ||
-- Includes a reason for explanation. | ||
Unsatisfied MissingDependencyReason |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
module Distribution.Types.MissingDependency | ||
( MissingDependency (..) | ||
) where | ||
|
||
import Distribution.Compat.Prelude | ||
import Distribution.Pretty | ||
import Distribution.Types.Dependency | ||
( Dependency | ||
, simplifyDependency | ||
) | ||
import Distribution.Types.LibraryName | ||
( prettyLibraryNames | ||
) | ||
import Distribution.Types.MissingDependencyReason | ||
( MissingDependencyReason (..) | ||
) | ||
|
||
import qualified Text.PrettyPrint as PP | ||
|
||
-- | A missing dependency and information on why it's missing. | ||
data MissingDependency = MissingDependency Dependency MissingDependencyReason | ||
deriving (Show) | ||
|
||
instance Pretty MissingDependency where | ||
pretty (MissingDependency dependency reason) = | ||
let prettyReason = | ||
case reason of | ||
MissingLibrary libraries -> | ||
PP.text "missing" <+> prettyLibraryNames PP.empty libraries | ||
MissingPackage -> PP.text "missing" | ||
MissingComponent name -> PP.text "missing component" <+> pretty name | ||
WrongVersion versions -> | ||
PP.text "installed:" <+> commaSpaceSep versions | ||
in pretty (simplifyDependency dependency) <+> PP.parens prettyReason |
25 changes: 25 additions & 0 deletions
25
Cabal-syntax/src/Distribution/Types/MissingDependencyReason.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
module Distribution.Types.MissingDependencyReason | ||
( MissingDependencyReason (..) | ||
) where | ||
|
||
import Data.List.NonEmpty (NonEmpty) | ||
import Distribution.Types.LibraryName (LibraryName) | ||
import Distribution.Types.PackageName (PackageName) | ||
import Distribution.Types.Version (Version) | ||
|
||
-- | A reason for a depency failing to solve. | ||
-- | ||
-- This helps pinpoint dependencies that are installed with an incorrect | ||
-- version vs. dependencies that are not installed at all. | ||
data MissingDependencyReason | ||
= -- | One or more libraries is missing. | ||
MissingLibrary (NonEmpty LibraryName) | ||
| -- | A package is not installed. | ||
MissingPackage | ||
| -- | A package is installed, but the versions don't match. | ||
-- | ||
-- Contains the available versions. | ||
WrongVersion [Version] | ||
| -- | A component is not installed. | ||
MissingComponent PackageName | ||
deriving (Show) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.