Commit 81691044 authored by Duncan Coutts's avatar Duncan Coutts
Browse files

Distinguish PreExisting vs Installed in BuildStatus

Not a big deal, but should be useful later for more precise status
reporting. For now just means the rebuild reasons can be more precise.
parent f6feb199
...@@ -146,6 +146,10 @@ data BuildStatus = ...@@ -146,6 +146,10 @@ data BuildStatus =
-- need building. -- need building.
BuildStatusPreExisting BuildStatusPreExisting
-- | The package is in the 'InstallPlan.Installed' state, so does not
-- need building.
| BuildStatusInstalled
-- | The package has not been downloaded yet, so it will have to be -- | The package has not been downloaded yet, so it will have to be
-- downloaded, unpacked and built. -- downloaded, unpacked and built.
| BuildStatusDownload | BuildStatusDownload
...@@ -166,6 +170,7 @@ data BuildStatus = ...@@ -166,6 +170,7 @@ data BuildStatus =
buildStatusToString :: BuildStatus -> String buildStatusToString :: BuildStatus -> String
buildStatusToString BuildStatusPreExisting = "BuildStatusPreExisting" buildStatusToString BuildStatusPreExisting = "BuildStatusPreExisting"
buildStatusToString BuildStatusInstalled = "BuildStatusInstalled"
buildStatusToString BuildStatusDownload = "BuildStatusDownload" buildStatusToString BuildStatusDownload = "BuildStatusDownload"
buildStatusToString (BuildStatusUnpack fp) = "BuildStatusUnpack " ++ show fp buildStatusToString (BuildStatusUnpack fp) = "BuildStatusUnpack " ++ show fp
buildStatusToString (BuildStatusRebuild fp _) = "BuildStatusRebuild " ++ show fp buildStatusToString (BuildStatusRebuild fp _) = "BuildStatusRebuild " ++ show fp
...@@ -229,6 +234,7 @@ data BuildReason = ...@@ -229,6 +234,7 @@ data BuildReason =
-- --
buildStatusRequiresBuild :: BuildStatus -> Bool buildStatusRequiresBuild :: BuildStatus -> Bool
buildStatusRequiresBuild BuildStatusPreExisting = False buildStatusRequiresBuild BuildStatusPreExisting = False
buildStatusRequiresBuild BuildStatusInstalled = False
buildStatusRequiresBuild BuildStatusUpToDate {} = False buildStatusRequiresBuild BuildStatusUpToDate {} = False
buildStatusRequiresBuild _ = True buildStatusRequiresBuild _ = True
...@@ -263,7 +269,7 @@ rebuildTargetsDryRun verbosity distDirLayout@DistDirLayout{..} shared = \install ...@@ -263,7 +269,7 @@ rebuildTargetsDryRun verbosity distDirLayout@DistDirLayout{..} shared = \install
return BuildStatusPreExisting return BuildStatusPreExisting
dryRunPkg (InstallPlan.Installed _pkg) _depsBuildStatus = dryRunPkg (InstallPlan.Installed _pkg) _depsBuildStatus =
return BuildStatusPreExisting --TODO: distinguish installed state return BuildStatusInstalled
dryRunPkg (InstallPlan.Configured pkg) depsBuildStatus = do dryRunPkg (InstallPlan.Configured pkg) depsBuildStatus = do
mloc <- checkFetched (elabPkgSourceLocation pkg) mloc <- checkFetched (elabPkgSourceLocation pkg)
...@@ -743,6 +749,7 @@ rebuildTarget verbosity ...@@ -743,6 +749,7 @@ rebuildTarget verbosity
-- TODO: perhaps re-nest the types to make these impossible -- TODO: perhaps re-nest the types to make these impossible
BuildStatusPreExisting {} -> unexpectedState BuildStatusPreExisting {} -> unexpectedState
BuildStatusInstalled {} -> unexpectedState
BuildStatusUpToDate {} -> unexpectedState BuildStatusUpToDate {} -> unexpectedState
where where
unexpectedState = error "rebuildTarget: unexpected package status" unexpectedState = error "rebuildTarget: unexpected package status"
......
...@@ -534,7 +534,8 @@ printPlan verbosity ...@@ -534,7 +534,8 @@ printPlan verbosity
partialConfigureFlags partialConfigureFlags
showBuildStatus status = case status of showBuildStatus status = case status of
BuildStatusPreExisting -> "already installed" BuildStatusPreExisting -> "existing package"
BuildStatusInstalled -> "already installed"
BuildStatusDownload {} -> "requires download & build" BuildStatusDownload {} -> "requires download & build"
BuildStatusUnpack {} -> "requires build" BuildStatusUnpack {} -> "requires build"
BuildStatusRebuild _ rebuild -> case rebuild of BuildStatusRebuild _ rebuild -> case rebuild of
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment