Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue #3428 #3470

Merged
merged 2 commits into from
May 31, 2016
Merged
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
7 changes: 5 additions & 2 deletions cabal-install/Distribution/Client/InstallPlan.hs
Original file line number Diff line number Diff line change
Expand Up @@ -427,12 +427,15 @@ lookupReadyPackage plan pkg = do
Just (Configured _) -> Nothing
Just (Processing _) -> Nothing
Just (Installed _ (Just ipkg) _) -> Just ipkg
Just (Installed _ Nothing _) -> internalError depOnNonLib
Just (Installed _ Nothing _) -> internalError (depOnNonLib pkgid)
Just (Failed _ _) -> internalError depOnFailed
Nothing -> internalError incomplete
incomplete = "install plan is not closed"
depOnFailed = "configured package depends on failed package"
depOnNonLib = "configured package depends on a non-library package"
depOnNonLib dep = "the configured package "
++ display (packageId pkg)
++ " depends on a non-library package "
++ display dep

-- | Marks packages in the graph as currently processing (e.g. building).
--
Expand Down
24 changes: 20 additions & 4 deletions cabal-install/Distribution/Client/ProjectBuilding.hs
Original file line number Diff line number Diff line change
Expand Up @@ -823,8 +823,19 @@ executeInstallPlan verbosity jobCtl plan0 installPkg =
-> GenericInstallPlan ipkg srcpkg iresult BuildFailure
updatePlan pkg (BuildSuccess ipkgs buildSuccess) =
InstallPlan.completed (installedPackageId pkg)
(find (\ipkg -> installedPackageId ipkg == installedPackageId pkg) ipkgs)
mipkg
buildSuccess
where
mipkg = case (ipkgs, find (\ipkg -> installedPackageId ipkg
== installedPackageId pkg) ipkgs) of
([], _) -> Nothing
((_:_), Just ipkg) -> Just ipkg
((_:_), Nothing) ->
error $ "executeInstallPlan: package " ++ display (packageId pkg)
++ " was expected to register the unit "
++ display (installedPackageId pkg)
++ " but is actually registering the unit(s) "
++ intercalate ", " (map (display . installedPackageId) ipkgs)

updatePlan pkg (BuildFailure buildFailure) =
InstallPlan.failed (installedPackageId pkg) buildFailure depsFailure
Expand Down Expand Up @@ -1025,13 +1036,18 @@ buildAndInstallUnpackedPackage verbosity
-- Case A and B
[ipkg] -> [ipkg { Installed.installedUnitId = ipkgid }]
-- Case C
_ -> assert (any ((== ipkgid) . Installed.installedUnitId)
ipkgs) ipkgs
_ -> ipkgs
unless (any ((== ipkgid) . Installed.installedUnitId) ipkgs') $
die $ "the package " ++ display (packageId pkg) ++ " was expected "
++ " to produce registeration info for the unit Id "
++ display ipkgid ++ " but it actually produced info for "
++ intercalate ", "
(map (display . Installed.installedUnitId) ipkgs')
forM_ ipkgs' $ \ipkg' ->
Cabal.registerPackage verbosity compiler progdb
HcPkg.MultiInstance
(pkgRegisterPackageDBStack pkg) ipkg'
return ipkgs
return ipkgs'
else return []

--TODO: [required feature] docs and test phases
Expand Down
2 changes: 1 addition & 1 deletion cabal-install/cabal-install.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ test-suite integration-tests2
type: exitcode-stdio-1.0
main-is: IntegrationTests2.hs
hs-source-dirs: tests, .
ghc-options: -Wall -fwarn-tabs
ghc-options: -Wall -fwarn-tabs -fno-ignore-asserts
other-modules:
build-depends:
async,
Expand Down