@@ -299,9 +299,14 @@ addDeps allowMissing compilerVersion toCalc = do
299299 Nothing -> (Map. empty, [] , Nothing )
300300 Just (_, x, y, z) -> (x, y, z)
301301 in (indexName $ rpIndex rp, [(rp, (cache, ghcOptions, sha))])
302- res <- forM (Map. toList byIndex) $ \ (indexName', pkgs) -> withCabalFiles indexName' pkgs
303- $ \ ident (flags, ghcOptions, mgitSha) cabalBS -> do
304- (_warnings,gpd) <- readPackageUnresolvedBS Nothing cabalBS
302+ res <- forM (Map. toList byIndex) $ \ (indexName', pkgs) ->
303+ fmap Map. unions $ withCabalFiles indexName' pkgs
304+ $ \ ident (flags, ghcOptions, mgitSha) cabalBS ->
305+ case readPackageUnresolvedBS (Right ident) cabalBS of
306+ Left e
307+ | allowedToSkip ident -> return Map. empty
308+ | otherwise -> throwM e
309+ Right (_warnings, gpd) -> do
305310 let packageConfig = PackageConfig
306311 { packageConfigEnableTests = False
307312 , packageConfigEnableBenchmarks = False
@@ -314,7 +319,7 @@ addDeps allowMissing compilerVersion toCalc = do
314319 pd = resolvePackageDescription packageConfig gpd
315320 exes = Set. fromList $ map (ExeName . T. pack . exeName) $ executables pd
316321 notMe = Set. filter (/= name) . Map. keysSet
317- return ( name, MiniPackageInfo
322+ return $ Map. singleton name MiniPackageInfo
318323 { mpiVersion = packageIdentifierVersion ident
319324 , mpiFlags = flags
320325 , mpiGhcOptions = ghcOptions
@@ -326,13 +331,31 @@ addDeps allowMissing compilerVersion toCalc = do
326331 (buildable . libBuildInfo)
327332 (library pd)
328333 , mpiGitSHA1 = mgitSha
329- })
330- return (Map. fromList $ concat res, missingIdents)
334+ }
335+ return (Map. unions res, missingIdents)
331336 where
332337 shaMap = Map. fromList
333338 $ map (\ (n, (v, _f, _ghcOptions, gitsha)) -> (PackageIdentifier n v, gitsha))
334339 $ Map. toList toCalc
335340
341+ -- Michael Snoyman, 2017-07-31:
342+ --
343+ -- This is a stop-gap measure to address a specific concern around
344+ -- the GHC 8.2.1 release. The current Stack version (1.5.0) will
345+ -- eagerly parse all cabal files mentioned in a snapshot,
346+ -- including global packages. Additionally, for the first time
347+ -- (AFAICT), GHC 8.2.1 is providing a package on Hackage with a
348+ -- ghc.cabal file, which requires the (not yet supported) Cabal
349+ -- 2.0 file format. To work around this, we're adding a special
350+ -- dispensation to ignore parse failures for this package.
351+ --
352+ -- Master already does better by simply ignoring global
353+ -- information and looking things up in the database. We may want
354+ -- to consider going a step further and simply ignoring _all_
355+ -- parse failures, or turning them into warnings, though I haven't
356+ -- considered the repercussions of that.
357+ allowedToSkip (PackageIdentifier name _) = name == $ (mkPackageName " ghc" )
358+
336359-- | Resolve all packages necessary to install for the needed packages.
337360getDeps :: MiniBuildPlan
338361 -> (PackageName -> Bool ) -- ^ is it shadowed by a local package?
0 commit comments