Skip to content

Commit 8c0b4ca

Browse files
committed
Remove extreme logging
1 parent 57863e5 commit 8c0b4ca

File tree

6 files changed

+15
-106
lines changed

6 files changed

+15
-106
lines changed

Cabal/src/Distribution/Simple/Program/Find.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ logExtraProgramSearchPath
6969
-> [FilePath]
7070
-> IO ()
7171
logExtraProgramSearchPath verbosity extraPaths =
72-
info verbosity . unlines $
72+
debug verbosity . unlines $
7373
"Including the following directories in PATH:"
7474
: map ("- " ++) extraPaths
7575

@@ -78,7 +78,7 @@ logExtraProgramOverrideEnv
7878
-> [(String, Maybe String)]
7979
-> IO ()
8080
logExtraProgramOverrideEnv verbosity extraEnv =
81-
info verbosity . unlines $
81+
debug verbosity . unlines $
8282
"Including the following environment variable overrides:"
8383
: [ "- " ++ case mbVal of
8484
Nothing -> "unset " ++ var

cabal-install/cabal-install.cabal

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,6 @@ library
265265
, regex-posix >= 0.96.0.0 && <0.97
266266
, safe-exceptions >= 0.1.7.0 && < 0.2
267267
, semaphore-compat >= 1.0.0 && < 1.1
268-
, ansi-terminal
269268

270269
if flag(native-dns)
271270
if os(windows)

cabal-install/src/Distribution/Client/Dependency.hs

Lines changed: 3 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,6 @@ import qualified Distribution.Solver.Types.ComponentDeps as CD
142142
import Distribution.Solver.Types.ConstraintSource
143143
import Distribution.Solver.Types.DependencyResolver
144144
import Distribution.Solver.Types.InstalledPreference as Preference
145-
import Distribution.Solver.Types.InstSolverPackage (InstSolverPackage(..))
146145
import Distribution.Solver.Types.LabeledPackageConstraint
147146
import Distribution.Solver.Types.OptionalStanza
148147
import Distribution.Solver.Types.PackageConstraint
@@ -169,7 +168,6 @@ import qualified Data.Map as Map
169168
import qualified Data.Set as Set
170169
import Text.PrettyPrint hiding ((<>))
171170
import GHC.Stack (HasCallStack)
172-
import Distribution.Client.InstallPlan (renderForest')
173171

174172
-- ------------------------------------------------------------
175173

@@ -776,7 +774,6 @@ resolveDependencies
776774
-> DepResolverParams
777775
-> Progress String String SolverInstallPlan
778776
resolveDependencies toolchains pkgConfigDB installedPkgIndex params = do
779-
step (showDepResolverParams finalparams)
780777
pkgs <- runSolver
781778
config
782779
toolchains
@@ -786,47 +783,7 @@ resolveDependencies toolchains pkgConfigDB installedPkgIndex params = do
786783
preferences
787784
constraints
788785
targets
789-
let pkgs' = sortBy (comparing solverId) pkgs
790-
step $ render $ vcat
791-
[ text "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
792-
, text "Solver plan"
793-
, text "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
794-
]
795-
for_ pkgs' $ \pkg -> do
796-
step $ render $
797-
hang (pretty (solverQPN pkg) <+> text "->" <+> pretty (solverId pkg)) 4 $ case pkg of
798-
PreExisting InstSolverPackage{instSolverPkgExeDeps, instSolverPkgLibDeps} ->
799-
vcat
800-
[ hang (pretty comp) 2 $ vcat
801-
[ vcat [ hang (text "lib-deps:") 2 (vcat (map pretty libDeps)) | not (null libDeps) ]
802-
, vcat [ hang (text "exe-deps:") 2 (vcat (map pretty exeDeps)) | not (null exeDeps) ]
803-
]
804-
| (comp, (libDeps, exeDeps)) <- CD.toList (CD.zip instSolverPkgLibDeps instSolverPkgExeDeps)
805-
]
806-
Configured SolverPackage{solverPkgExeDeps, solverPkgLibDeps} ->
807-
vcat
808-
[ hang (pretty comp) 2 $ vcat
809-
[ vcat [ hang (text "lib-deps:") 2 (vcat (map pretty libDeps)) | not (null libDeps) ]
810-
, vcat [ hang (text "exe-deps:") 2 (vcat (map pretty exeDeps)) | not (null exeDeps) ]
811-
]
812-
| (comp, (libDeps, exeDeps)) <- CD.toList (CD.zip solverPkgLibDeps solverPkgExeDeps)
813-
]
814-
815-
step $ render $ vcat
816-
[ text "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
817-
, text "Scopes"
818-
, text "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
819-
, renderSolverPlanScopes pkgs'
820-
]
821-
822-
step $ render $ vcat
823-
[ text "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
824-
, text "Dependency tree"
825-
, text "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
826-
, text (renderForest' (\p -> show (pretty (solverQPN p) <+> text "->" <+> pretty (Graph.nodeKey p))) $ Graph.fromDistinctList pkgs')
827-
]
828-
829-
validateSolverResult toolchains pkgs'
786+
validateSolverResult toolchains $ sortBy (comparing solverId) pkgs
830787
where
831788
installedPkgIndex' = Staged $ \case
832789
Build -> getStage installedPkgIndex Build
@@ -848,7 +805,7 @@ resolveDependencies toolchains pkgConfigDB installedPkgIndex params = do
848805
verbosity
849806
(PruneAfterFirstSuccess False)
850807

851-
finalparams@( DepResolverParams
808+
DepResolverParams
852809
targets
853810
constraints
854811
prefs
@@ -869,25 +826,14 @@ resolveDependencies toolchains pkgConfigDB installedPkgIndex params = do
869826
solveExes
870827
order
871828
verbosity
872-
) =
829+
=
873830
if asBool (depResolverAllowBootLibInstalls params)
874831
then params
875832
else dontInstallNonReinstallablePackages params
876833

877834
preferences :: PackageName -> PackagePreferences
878835
preferences = interpretPackagesPreference targets defpref prefs
879836

880-
renderSolverPlanScopes :: [SolverInstallPlan.SolverPlanPackage] -> Doc
881-
renderSolverPlanScopes pkgs = vcat
882-
[ vcat [ (pretty pp <+> text "/") $+$ nest 4 (vcat (map pretty (Set.toList sids)))
883-
| (pp, sids) <- Map.toList (SolverInstallPlan.qualifications g)
884-
]
885-
-- , vcat [ hang (pretty key) 4 (vcat [ text "-" <+> pretty n | n <- neigh]) | (_pkg, key, neigh) <- mapG ]
886-
]
887-
where
888-
g = Graph.fromDistinctList pkgs
889-
-- (_g', mapG, _invG) = Data.Graph.graphFromEdges [ (pkg, Graph.nodeKey pkg, Graph.nodeNeighbors pkg) | pkg <- pkgs]
890-
891837
-- | Give an interpretation to the global 'PackagesPreference' as
892838
-- specific per-package 'PackageVersionPreference'.
893839
interpretPackagesPreference

cabal-install/src/Distribution/Client/ProjectBuilding/UnpackedPackage.hs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -191,34 +191,34 @@ buildAndRegisterUnpackedPackage
191191
-- Configure phase
192192
delegate $
193193
PBConfigurePhase $ do
194-
-- annotateFailure mlogFile ConfigureFailed $ do
194+
annotateFailure mlogFile ConfigureFailed $ do
195195
info verbosity $ "--- Configure phase " ++ prettyShow (Graph.nodeKey pkg)
196196
setup configureCommand Cabal.configCommonFlags configureFlags configureArgs
197197

198198
-- Build phase
199199
delegate $
200200
PBBuildPhase $ do
201-
-- annotateFailure mlogFile BuildFailed $ do
201+
annotateFailure mlogFile BuildFailed $ do
202202
info verbosity $ "--- Build phase " ++ prettyShow (Graph.nodeKey pkg)
203203
setup buildCommand Cabal.buildCommonFlags (return . buildFlags) buildArgs
204204

205205
-- Haddock phase
206206
whenHaddock $
207207
delegate $
208208
PBHaddockPhase $ do
209-
-- annotateFailure mlogFile HaddocksFailed $ do
209+
annotateFailure mlogFile HaddocksFailed $ do
210210
info verbosity $ "--- Haddock phase " ++ prettyShow (Graph.nodeKey pkg)
211211
setup haddockCommand Cabal.haddockCommonFlags (return . haddockFlags) haddockArgs
212212

213213
-- Install phase
214214
delegate $
215215
PBInstallPhase
216216
{ runCopy = \destdir -> do
217-
-- annotateFailure mlogFile InstallFailed $ do
217+
annotateFailure mlogFile InstallFailed $ do
218218
info verbosity $ "--- Install phase, copy " ++ prettyShow (Graph.nodeKey pkg)
219219
setup Cabal.copyCommand Cabal.copyCommonFlags (return . copyFlags destdir) copyArgs
220220
, runRegister = \pkgDBStack registerOpts -> do
221-
-- annotateFailure mlogFile InstallFailed $ do
221+
annotateFailure mlogFile InstallFailed $ do
222222
info verbosity $ "--- Install phase, register " ++ prettyShow (Graph.nodeKey pkg)
223223
-- We register ourselves rather than via Setup.hs. We need to
224224
-- grab and modify the InstalledPackageInfo. We decide what
@@ -241,23 +241,23 @@ buildAndRegisterUnpackedPackage
241241
whenTest $
242242
delegate $
243243
PBTestPhase $ do
244-
-- annotateFailure mlogFile TestsFailed $ do
244+
annotateFailure mlogFile TestsFailed $ do
245245
info verbosity $ "--- Test phase " ++ prettyShow (Graph.nodeKey pkg)
246246
setup testCommand Cabal.testCommonFlags (return . testFlags) testArgs
247247

248248
-- Bench phase
249249
whenBench $
250250
delegate $
251251
PBBenchPhase $ do
252-
-- annotateFailure mlogFile BenchFailed $ do
252+
annotateFailure mlogFile BenchFailed $ do
253253
info verbosity $ "--- Benchmark phase " ++ prettyShow (Graph.nodeKey pkg)
254254
setup benchCommand Cabal.benchmarkCommonFlags (return . benchFlags) benchArgs
255255

256256
-- Repl phase
257257
whenRepl $
258258
delegate $
259259
PBReplPhase $ do
260-
-- annotateFailure mlogFile ReplFailed $ do
260+
annotateFailure mlogFile ReplFailed $ do
261261
info verbosity $ "--- Repl phase " ++ prettyShow (Graph.nodeKey pkg)
262262
setupInteractive replCommand Cabal.replCommonFlags replFlags replArgs
263263

cabal-install/src/Distribution/Client/ProjectPlanning.hs

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ import qualified Distribution.Compat.Graph as Graph
232232
import Control.Exception (assert)
233233
import Control.Monad (sequence)
234234
import Control.Monad.IO.Class (liftIO)
235-
import Control.Monad.State (StateT (..), evalStateT, execStateT, gets, modify, get)
235+
import Control.Monad.State (StateT (..), execStateT, gets, modify)
236236
import Data.Foldable (fold)
237237
import Data.List (deleteBy, groupBy)
238238
import qualified Data.List.NonEmpty as NE
@@ -246,7 +246,6 @@ import GHC.Stack (HasCallStack)
246246
import Distribution.Client.InstallPlan (foldPlanPackage)
247247
import Distribution.Solver.Types.ResolverPackage (solverId)
248248
import qualified Distribution.Solver.Types.ResolverPackage as ResolverPackage
249-
import System.Console.ANSI
250249

251250
-- | Check that an 'ElaboratedConfiguredPackage' actually makes
252251
-- sense under some 'ElaboratedSharedConfig'.
@@ -696,23 +695,6 @@ rebuildInstallPlan
696695
-- changes, so it's worth caching them separately.
697696
improvedPlan <- phaseImprovePlan elaboratedPlan elaboratedShared
698697

699-
let s = flip foldMap (InstallPlan.toList elaboratedPlan) $
700-
foldPlanPackage
701-
(Set.singleton . Graph.nodeKey)
702-
(const Set.empty)
703-
badMsg s = Disp.text (setSGRCode [SetColor Foreground Vivid Red] <> s <> setSGRCode [Reset])
704-
goodMsg s = Disp.text (setSGRCode [SetColor Foreground Vivid Green] <> s <> setSGRCode [Reset])
705-
flip evalStateT s $ for_ (InstallPlan.executionOrder elaboratedPlan) $ \(ReadyPackage pkg) -> do
706-
s' <- get
707-
liftIO $ infoNoWrap verbosity $ show $
708-
Disp.hang (Disp.text "Elaborated package: " <+> pretty (Graph.nodeKey pkg)) 4 $ vcat
709-
[ Disp.hang (text "elabOrderDependencies") 4 $ Disp.vcat
710-
[ pretty dep <+> Disp.parens (if Set.member dep s' then goodMsg "preset" else badMsg "missing")
711-
| dep <- sort (elabOrderDependencies pkg)
712-
]
713-
]
714-
modify (Set.insert (Graph.nodeKey pkg))
715-
716698
return (improvedPlan, elaboratedPlan, elaboratedShared, totalIndexState, activeRepos)
717699
where
718700
fileMonitorSolverPlan = newFileMonitorInCacheDir "solver-plan"
@@ -1628,13 +1610,7 @@ elaborateInstallPlan
16281610

16291611
elaboratedInstallPlan :: LogProgress ElaboratedInstallPlan
16301612
elaboratedInstallPlan = do
1631-
infoProgress (Disp.text "elaboratedInstallPlan")
1632-
1633-
infoProgress $ hang (Disp.text "pkgsLocalToProject") 4 $ vcat $ map pretty $ Set.toList pkgsLocalToProject
1634-
infoProgress $ hang (Disp.text "pkgsToBuildInplaceOnly") 4 $ vcat $ map pretty $ Set.toList pkgsToBuildInplaceOnly
1635-
16361613
flip InstallPlan.fromSolverInstallPlanWithProgress solverPlan $ \mapDep planpkg -> do
1637-
infoProgress (text "Elaborating" <+> pretty (solverId planpkg))
16381614
case planpkg of
16391615
SolverInstallPlan.PreExisting pkg -> do
16401616
let ipkg = InstallPlan.PreExisting (WithStage (instSolverStage pkg) (instSolverPkgIPI pkg))
@@ -1649,7 +1625,6 @@ elaborateInstallPlan
16491625
<+> text "package"
16501626
<+> quotes (pretty (packageId pkg))
16511627
) (elaborateSolverToComponents mapDep pkg)
1652-
infoProgress $ hang (pretty (solverId planpkg) <+> text "->") 4 $ vcat (map pretty elabs)
16531628
return $ map InstallPlan.Configured elabs
16541629

16551630
-- NB: We don't INSTANTIATE packages at this point. That's
@@ -2106,7 +2081,7 @@ elaborateInstallPlan
21062081
-> LogProgress ElaboratedConfiguredPackage
21072082
elaborateSolverToPackage
21082083
pkgWhyNotPerComponent
2109-
pkg@SolverPackage {solverPkgStage, solverPkgSource = SourcePackage {srcpkgPackageId}}
2084+
pkg@SolverPackage {solverPkgSource = SourcePackage {srcpkgPackageId}}
21102085
compGraph
21112086
comps = do
21122087
infoProgress $ hang (text "[elaborateSolverToPackage]") 4 $ vcat

cabal-install/src/Distribution/Client/SetupWrapper.hs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,6 @@ import Distribution.Simple.Utils
156156
, die'
157157
, dieWithException
158158
, info
159-
, infoNoWrap
160159
, installExecutableFile
161160
, maybeExit
162161
, rawSystemProc
@@ -432,12 +431,6 @@ getSetup verbosity options mpkg = do
432431
(bt, _) -> bt
433432
(version, method, options'') <-
434433
getSetupMethod verbosity options' pkg buildType'
435-
info verbosity $ unlines
436-
[ "choosen setup method:"
437-
, "version: " ++ show version
438-
, "method: " ++ show method
439-
, show $ hang (text "options:") 4 (pretty options'')
440-
]
441434
return
442435
Setup
443436
{ setupMethod = method
@@ -1152,10 +1145,6 @@ getExternalSetupMethod verbosity options pkg bt = do
11521145
-- when compiling a Simple Setup.hs file.
11531146
, ghcOptExtensionMap = Map.fromList . Simple.compilerExtensions $ compiler
11541147
}
1155-
infoNoWrap verbosity $ prettyShow options'
1156-
infoNoWrap verbosity $ "maybeCabalLibInstalledPkgId: " ++ show maybeCabalLibInstalledPkgId
1157-
infoNoWrap verbosity $ "cabalDep: " ++ show cabalDep
1158-
infoNoWrap verbosity $ "packages: " ++ show selectedDeps
11591148
let ghcCmdLine = renderGhcOptions compiler platform ghcOptions
11601149
when (useVersionMacros options') $
11611150
rewriteFileEx verbosity (i cppMacrosFile) $

0 commit comments

Comments
 (0)