Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions Cabal/src/Distribution/Utils/LogProgress.hs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import Prelude ()
import Distribution.Simple.Utils
import Distribution.Utils.Progress
import Distribution.Verbosity
import GHC.Stack (HasCallStack, callStack, prettyCallStack)
import System.IO (hPutStrLn)
import Text.PrettyPrint

Expand Down Expand Up @@ -76,10 +77,14 @@ infoProgress s = LogProgress $ \env ->
stepProgress s

-- | Fail the computation with an error message.
dieProgress :: Doc -> LogProgress a
dieProgress :: HasCallStack => Doc -> LogProgress a
dieProgress s = LogProgress $ \env ->
failProgress $
hang (text "Error:") 4 (formatMsg (le_context env) s)
hang (text "Error:") 4 $
vcat
[ formatMsg (le_context env) s
, vcat (map text (lines (prettyCallStack callStack)))
]

-- | Format a message with context. (Something simple for now.)
formatMsg :: [CtxMsg] -> Doc -> Doc
Expand Down
16 changes: 10 additions & 6 deletions cabal-install/src/Distribution/Client/ProjectPlanning.hs
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ import qualified Data.Map as Map
import qualified Data.Set as Set
import Distribution.Client.Errors
import Distribution.Solver.Types.ProjectConfigPath
import GHC.Stack (HasCallStack)
import System.Directory (getCurrentDirectory)
import System.FilePath
import qualified Text.PrettyPrint as Disp
Expand Down Expand Up @@ -352,7 +353,8 @@ sanityCheckElaboratedPackage
-- | Return the up-to-date project config and information about the local
-- packages within the project.
rebuildProjectConfig
:: Verbosity
:: HasCallStack
=> Verbosity
-> HttpTransport
-> DistDirLayout
-> ProjectConfig
Expand Down Expand Up @@ -633,7 +635,8 @@ See #9840 for more information about the problems surrounding the lossy
-- dependencies of executables and setup scripts.
--
rebuildInstallPlan
:: Verbosity
:: HasCallStack
=> Verbosity
-> DistDirLayout
-> CabalDirLayout
-> ProjectConfig
Expand Down Expand Up @@ -874,7 +877,8 @@ rebuildInstallPlan
-- version of the plan has the final nix-style hashed ids.
--
phaseElaboratePlan
:: ProjectConfig
:: HasCallStack
=> ProjectConfig
-> (Compiler, Platform, ProgramDb)
-> Maybe PkgConfigDb
-> SolverInstallPlan
Expand Down Expand Up @@ -1629,7 +1633,8 @@ planPackages
-- In theory should be able to make an elaborated install plan with a policy
-- matching that of the classic @cabal install --user@ or @--global@
elaborateInstallPlan
:: Verbosity
:: HasCallStack
=> Verbosity
-> Platform
-> Compiler
-> ProgramDb
Expand Down Expand Up @@ -1688,8 +1693,7 @@ elaborateInstallPlan
)
f _ = Nothing

elaboratedInstallPlan
:: LogProgress (InstallPlan.GenericInstallPlan IPI.InstalledPackageInfo ElaboratedConfiguredPackage)
elaboratedInstallPlan :: HasCallStack => LogProgress ElaboratedInstallPlan
elaboratedInstallPlan =
flip InstallPlan.fromSolverInstallPlanWithProgress solverPlan $ \mapDep planpkg ->
case planpkg of
Expand Down
2 changes: 2 additions & 0 deletions cabal-testsuite/PackageTests/Backpack/Fail1/setup.cabal.out
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ Error:
MissingReq
In mixins: Fail1:sig requires (MissingReq as A)
In the stanza library
CallStack (from HasCallStack):
dieProgress, called at src/Distribution/Backpack/LinkedComponent.hs:_:_ in Cabal-3.17.0.0-inplace:Distribution.Backpack.LinkedComponent
2 changes: 2 additions & 0 deletions cabal-testsuite/PackageTests/Backpack/Fail1/setup.out
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ Error:
MissingReq
In mixins: Fail1:sig requires (MissingReq as A)
In the stanza library
CallStack (from HasCallStack):
dieProgress, called at src/Distribution/Backpack/LinkedComponent.hs:_:_ in Cabal-3.17.0.0-inplace:Distribution.Backpack.LinkedComponent
2 changes: 2 additions & 0 deletions cabal-testsuite/PackageTests/Backpack/Fail2/setup.cabal.out
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ Configuring Fail2-0.1.0.0...
Error:
Mix-in refers to non-existent library 'non-existent'
(did you forget to add the package to build-depends?)
CallStack (from HasCallStack):
dieProgress, called at src/Distribution/Backpack/ConfiguredComponent.hs:_:_ in Cabal-3.17.0.0-inplace:Distribution.Backpack.ConfiguredComponent
2 changes: 2 additions & 0 deletions cabal-testsuite/PackageTests/Backpack/Fail2/setup.out
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ Configuring Fail2-0.1.0.0...
Error:
Mix-in refers to non-existent library 'non-existent'
(did you forget to add the package to build-depends?)
CallStack (from HasCallStack):
dieProgress, called at src/Distribution/Backpack/ConfiguredComponent.hs:_:_ in Cabal-3.17.0.0-inplace:Distribution.Backpack.ConfiguredComponent
2 changes: 2 additions & 0 deletions cabal-testsuite/PackageTests/Backpack/Fail3/setup.cabal.out
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ Error:
Non-library component has unfilled requirements:
UnfilledSig brought into scope by build-depends: Fail1
In the stanza executable foo
CallStack (from HasCallStack):
dieProgress, called at src/Distribution/Backpack/LinkedComponent.hs:_:_ in Cabal-3.17.0.0-inplace:Distribution.Backpack.LinkedComponent
2 changes: 2 additions & 0 deletions cabal-testsuite/PackageTests/Backpack/Fail3/setup.out
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ Error:
Non-library component has unfilled requirements:
UnfilledSig brought into scope by build-depends: Fail1
In the stanza executable foo
CallStack (from HasCallStack):
dieProgress, called at src/Distribution/Backpack/LinkedComponent.hs:_:_ in Cabal-3.17.0.0-inplace:Distribution.Backpack.LinkedComponent
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ Error:
brought into scope by mixins: fail:postgresql (Database.PostgreSQL as Database)
While filling requirements of build-depends: fail:mylib
In the stanza library
CallStack (from HasCallStack):
dieProgress, called at src/Distribution/Backpack/LinkedComponent.hs:_:_ in Cabal-3.17.0.0-inplace:Distribution.Backpack.LinkedComponent
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ Error:
brought into scope by mixins: fail:postgresql (Database.PostgreSQL as Database)
While filling requirements of build-depends: fail:mylib
In the stanza library
CallStack (from HasCallStack):
dieProgress, called at src/Distribution/Backpack/LinkedComponent.hs:_:_ in Cabal-3.17.0.0-inplace:Distribution.Backpack.LinkedComponent
2 changes: 2 additions & 0 deletions cabal-testsuite/PackageTests/Backpack/Reexport2/cabal.out
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ Error:
nor any of its 'build-depends' dependencies.
In the stanza 'library'
In the inplace package 'Reexport2-1.0'
CallStack (from HasCallStack):
dieProgress, called at src/Distribution/Backpack/LinkedComponent.hs:_:_ in Cabal-3.17.0.0-inplace:Distribution.Backpack.LinkedComponent
2 changes: 2 additions & 0 deletions cabal-testsuite/PackageTests/Backpack/T4447/setup.cabal.out
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ Error:
Try moving this module to a separate library, e.g.,
create a new stanza: library 'sublib'.
In the stanza executable foo-exe
CallStack (from HasCallStack):
dieProgress, called at src/Distribution/Backpack/LinkedComponent.hs:_:_ in Cabal-3.17.0.0-inplace:Distribution.Backpack.LinkedComponent
2 changes: 2 additions & 0 deletions cabal-testsuite/PackageTests/Backpack/T4447/setup.out
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ Error:
Try moving this module to a separate library, e.g.,
create a new stanza: library 'sublib'.
In the stanza executable foo-exe
CallStack (from HasCallStack):
dieProgress, called at src/Distribution/Backpack/LinkedComponent.hs:_:_ in Cabal-3.17.0.0-inplace:Distribution.Backpack.LinkedComponent
4 changes: 3 additions & 1 deletion cabal-testsuite/PackageTests/Backpack/T8582/setup.cabal.out
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ Error:
Cannot instantiate requirement 'ImplA'
Ensure "build-depends:" doesn't include any library with signatures: 'A'
as this creates a cyclic dependency, which GHC does not support.
In the stanza executable exe
In the stanza executable exe
CallStack (from HasCallStack):
dieProgress, called at src/Distribution/Backpack/LinkedComponent.hs:_:_ in Cabal-3.17.0.0-inplace:Distribution.Backpack.LinkedComponent
4 changes: 3 additions & 1 deletion cabal-testsuite/PackageTests/Backpack/T8582/setup.out
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ Error:
Cannot instantiate requirement 'ImplA'
Ensure "build-depends:" doesn't include any library with signatures: 'A'
as this creates a cyclic dependency, which GHC does not support.
In the stanza executable exe
In the stanza executable exe
CallStack (from HasCallStack):
dieProgress, called at src/Distribution/Backpack/LinkedComponent.hs:_:_ in Cabal-3.17.0.0-inplace:Distribution.Backpack.LinkedComponent
5 changes: 5 additions & 0 deletions cabal-testsuite/PackageTests/BuildDeps/DepCycle/cabal.out
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,8 @@ Error:
library bar
library foo
In the inplace package 'DepCycle-1.0'
CallStack (from HasCallStack):
dieProgress, called at src/Distribution/Client/ProjectPlanning.hs:_:_ in cabal-install-3.17.0.0-inplace:Distribution.Client.ProjectPlanning
elaborateInstallPlan, called at src/Distribution/Client/ProjectPlanning.hs:_:_ in cabal-install-3.17.0.0-inplace:Distribution.Client.ProjectPlanning
phaseElaboratePlan, called at src/Distribution/Client/ProjectPlanning.hs:_:_ in cabal-install-3.17.0.0-inplace:Distribution.Client.ProjectPlanning
rebuildInstallPlan, called at src/Distribution/Client/ProjectOrchestration.hs:_:_ in cabal-install-3.17.0.0-inplace:Distribution.Client.ProjectOrchestration
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ Configuring DepCycle-1.0...
Error:
Components in the package DepCycle-1.0 depend on each other in a cyclic way:
'library 'bar'' depends on 'library 'foo'' depends on 'library 'bar''
CallStack (from HasCallStack):
dieProgress, called at src/Distribution/Backpack/Configure.hs:_:_ in Cabal-3.17.0.0-inplace:Distribution.Backpack.Configure
2 changes: 2 additions & 0 deletions cabal-testsuite/PackageTests/BuildDeps/DepCycle/setup.out
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ Configuring DepCycle-1.0...
Error:
Components in the package DepCycle-1.0 depend on each other in a cyclic way:
'library 'bar'' depends on 'library 'foo'' depends on 'library 'bar''
CallStack (from HasCallStack):
dieProgress, called at src/Distribution/Backpack/Configure.hs:_:_ in Cabal-3.17.0.0-inplace:Distribution.Backpack.Configure
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,8 @@ Error:
Internal libraries only supported with per-component builds.
Per-component builds were disabled because you passed --disable-per-component
In the inplace package 'p-0.1.0.0'
CallStack (from HasCallStack):
dieProgress, called at src/Distribution/Client/ProjectPlanning.hs:_:_ in cabal-install-3.17.0.0-inplace:Distribution.Client.ProjectPlanning
elaborateInstallPlan, called at src/Distribution/Client/ProjectPlanning.hs:_:_ in cabal-install-3.17.0.0-inplace:Distribution.Client.ProjectPlanning
phaseElaboratePlan, called at src/Distribution/Client/ProjectPlanning.hs:_:_ in cabal-install-3.17.0.0-inplace:Distribution.Client.ProjectPlanning
rebuildInstallPlan, called at src/Distribution/Client/ProjectOrchestration.hs:_:_ in cabal-install-3.17.0.0-inplace:Distribution.Client.ProjectOrchestration
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@ Error:
re-export with a package name.
The syntax is 'packagename:ModuleName [as NewName]'.
In the stanza library
CallStack (from HasCallStack):
dieProgress, called at src/Distribution/Backpack/LinkedComponent.hs:_:_ in Cabal-3.17.0.0-inplace:Distribution.Backpack.LinkedComponent
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@ Error:
re-export with a package name.
The syntax is 'packagename:ModuleName [as NewName]'.
In the stanza library
CallStack (from HasCallStack):
dieProgress, called at src/Distribution/Backpack/LinkedComponent.hs:_:_ in Cabal-3.17.0.0-inplace:Distribution.Backpack.LinkedComponent
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ Error:
It occurs in neither the 'exposed-modules' of this package,
nor any of its 'build-depends' dependencies.
In the stanza library
CallStack (from HasCallStack):
dieProgress, called at src/Distribution/Backpack/LinkedComponent.hs:_:_ in Cabal-3.17.0.0-inplace:Distribution.Backpack.LinkedComponent
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ Error:
It occurs in neither the 'exposed-modules' of this package,
nor any of its 'build-depends' dependencies.
In the stanza library
CallStack (from HasCallStack):
dieProgress, called at src/Distribution/Backpack/LinkedComponent.hs:_:_ in Cabal-3.17.0.0-inplace:Distribution.Backpack.LinkedComponent
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ Error:
It occurs in neither the 'exposed-modules' of this package,
nor any of its 'build-depends' dependencies.
In the stanza library
CallStack (from HasCallStack):
dieProgress, called at src/Distribution/Backpack/LinkedComponent.hs:_:_ in Cabal-3.17.0.0-inplace:Distribution.Backpack.LinkedComponent
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ Error:
It occurs in neither the 'exposed-modules' of this package,
nor any of its 'build-depends' dependencies.
In the stanza library
CallStack (from HasCallStack):
dieProgress, called at src/Distribution/Backpack/LinkedComponent.hs:_:_ in Cabal-3.17.0.0-inplace:Distribution.Backpack.LinkedComponent
1 change: 1 addition & 0 deletions cabal-testsuite/src/Test/Cabal/OutputNormalizer.hs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ normalizeOutput nenv =
-- hackage-security locks occur non-deterministically
. resub "(Released|Acquired|Waiting) .*hackage-security-lock\n" ""
. resub "installed: [0-9]+(\\.[0-9]+)*" "installed: <VERSION>"
. resub "\\.hs:[0-9]+:[0-9]+" ".hs:_:_"
where
sameDir = "(\\.((\\\\)+|\\/))*"
packageIdRegex pid =
Expand Down
Loading