Commit 6326e532 authored by Edward Z. Yang's avatar Edward Z. Yang

Bugfixes.

* Add missing record selector.

* Correctly mkPackageIndex

* Skip T4375 on GHC 8.2, it doesn't have a Cabal to actually use!
Signed-off-by: default avatarEdward Z. Yang <ezyang@cs.stanford.edu>
parent 79f1981b
......@@ -342,6 +342,7 @@ toReadyComponents pid_map subst0 comps
}
return $ Just ReadyComponent {
rc_ann_id = (lc_ann_id lc) { ann_id = uid },
rc_cid = lc_cid lc,
rc_open_uid = lc_uid lc,
rc_component = lc_component lc,
-- It's always fully built
......
......@@ -118,6 +118,7 @@ import qualified Data.Graph as Graph
import Data.List as List ( groupBy, deleteBy, deleteFirstsBy )
import qualified Data.Tree as Tree
import Control.Monad
import Distribution.Compat.Stack
-- | The collection of information about packages from one or more 'PackageDB's.
-- These packages generally should have an instance of 'PackageInstalled'
......@@ -162,10 +163,14 @@ instance Monoid (PackageIndex IPI.InstalledPackageInfo) where
instance Semigroup (PackageIndex IPI.InstalledPackageInfo) where
(<>) = merge
invariant :: InstalledPackageIndex -> Bool
{-# NOINLINE invariant #-}
invariant :: WithCallStack (InstalledPackageIndex -> Bool)
invariant (PackageIndex pids pnames) =
map installedUnitId (Map.elems pids)
== sort
-- trace (show pids' ++ "\n" ++ show pnames') $
pids' == pnames'
where
pids' = map installedUnitId (Map.elems pids)
pnames' = sort
[ assert pinstOk (installedUnitId pinst)
| ((pname, plib), pvers) <- Map.toList pnames
, let pversOk = not (Map.null pvers)
......@@ -189,10 +194,10 @@ invariant (PackageIndex pids pnames) =
-- * Internal helpers
--
mkPackageIndex :: Map UnitId IPI.InstalledPackageInfo
mkPackageIndex :: WithCallStack (Map UnitId IPI.InstalledPackageInfo
-> Map (PackageName, Maybe UnqualComponentName)
(Map Version [IPI.InstalledPackageInfo])
-> InstalledPackageIndex
-> InstalledPackageIndex)
mkPackageIndex pids pnames = assert (invariant index) index
where index = PackageIndex pids pnames
......@@ -214,7 +219,7 @@ fromList pkgs = mkPackageIndex pids pnames
Map.fromList
[ (liftM2 (,) packageName IPI.sourceLibName (head pkgsN), pvers)
| pkgsN <- groupBy (equating (liftM2 (,) packageName IPI.sourceLibName))
. sortBy (comparing packageId)
. sortBy (comparing (liftM2 (,) packageId IPI.sourceLibName))
$ pkgs
, let pvers =
Map.fromList
......
......@@ -3,5 +3,9 @@ main = cabalTest $ do
-- Don't run this test unless the GHC is sufficiently recent
-- to not ship boot old-time/old-locale
skipUnless =<< ghcVersionIs (>= mkVersion [7,11])
-- Don't run this test on GHC 8.2, which ships with Cabal 2.0,
-- which is not eligible for old-style Custom setup (if
-- we had the full Hackage index, we'd try it.)
skipUnless =<< ghcVersionIs (< mkVersion [8,1])
withRepo "repo" $ do
cabal "new-build" ["a"]
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