Commit 5f159699 authored by Andres Löh's avatar Andres Löh
Browse files

merging changes from HEAD into modular-solver branch

parent f8ed7b55
......@@ -85,35 +85,9 @@ getInstalledPackages verbosity comp packageDbs conf =
--FIXME: make getInstalledPackages use sensible verbosity in the first place
verbosity' = lessVerbose verbosity
convert :: InstalledPackageIndex.PackageIndex -> PackageIndex InstalledPackage
convert index = PackageIndex.fromList
-- There can be multiple installed instances of each package version,
-- like when the same package is installed in the global & user dbs.
-- InstalledPackageIndex.allPackagesByName gives us the installed
-- packages with the most preferred instances first, so by picking the
-- first we should get the user one. This is almost but not quite the
-- same as what ghc does.
[ InstalledPackage ipkg (sourceDeps index ipkg)
| ipkgs <- InstalledPackageIndex.allPackagesByName index
, (ipkg:_) <- groupBy (equating packageVersion) ipkgs ]
-- The InstalledPackageInfo only lists dependencies by the
-- InstalledPackageId, which means we do not directly know the corresponding
-- source dependency. The only way to find out is to lookup the
-- InstalledPackageId to get the InstalledPackageInfo and look at its
-- source PackageId. But if the package is broken because it depends on
-- other packages that do not exist then we have a problem we cannot find
-- the original source package id. Instead we make up a bogus package id.
-- This should have the same effect since it should be a dependency on a
-- non-existant package.
sourceDeps index ipkg =
[ maybe (brokenPackageId depid) packageId mdep
| let depids = InstalledPackageInfo.depends ipkg
getpkg = InstalledPackageIndex.lookupInstalledPackageId index
, (depid, mdep) <- zip depids (map getpkg depids) ]
brokenPackageId (InstalledPackageId str) =
PackageIdentifier (PackageName (str ++ "-broken")) (Version [] [])
-- Reading the source package index
-- | Read a repository index from disk, from the local files specified by
-- a list of 'Repo's.
......@@ -612,7 +612,10 @@ defaultInstallFlags = InstallFlags {
docIndexFile = toPathTemplate ("$datadir" </> "doc" </> "index.html")
installCommand :: CommandUI (ConfigFlags, ConfigExFlags, InstallFlags)
defaultMaxBackjumps :: Int
defaultMaxBackjumps = 200
installCommand :: CommandUI (ConfigFlags, ConfigExFlags, InstallFlags, HaddockFlags)
installCommand = CommandUI {
commandName = "install",
commandSynopsis = "Installs a list of packages.",
Supports Markdown
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