Fix problems with build tool test suite cycles

This commit is contained in:
Michael Snoyman 2014-03-13 09:23:37 +02:00
parent 81f2917f77
commit f228b0f9b9
3 changed files with 17 additions and 11 deletions

View File

@ -155,12 +155,13 @@ loadPackageDB settings coreMap core deps = do
| otherwise = loop rest
addPackage p v lbs pdb = do
let (deps', hasTests, buildTools', mgpd, execs, mgithub) = parseDeps p lbs
let (deps', hasTests, buildToolsExe', buildToolsOther', mgpd, execs, mgithub) = parseDeps p lbs
return $ mappend pdb $ PackageDB $ Map.singleton p PackageInfo
{ piVersion = v
, piDeps = deps'
, piHasTests = hasTests
, piBuildTools = buildTools'
, piBuildToolsExe = buildToolsExe'
, piBuildToolsAll = buildToolsExe' `Set.union` buildToolsOther'
, piGPD = mgpd
, piExecs = execs
, piGithubUser = mgithub
@ -176,25 +177,29 @@ loadPackageDB settings coreMap core deps = do
else mconcat $ map (go gpd . snd) $ condTestSuites gpd
, mconcat $ map (go gpd . snd) $ condBenchmarks gpd
], not $ null $ condTestSuites gpd
, Set.fromList $ map depName $ allBuildInfo gpd
, Set.fromList $ map depName $ libExeBuildInfo gpd
, Set.fromList $ map depName $ testBenchBuildInfo gpd
, Just gpd
, Set.fromList $ map (Executable . fst) $ condExecutables gpd
, listToMaybe $ catMaybes
$ parseGithubUserHP (homepage $ packageDescription gpd)
: map parseGithubUserSR (sourceRepos $ packageDescription gpd)
)
_ -> (mempty, defaultHasTestSuites, Set.empty, Nothing, Set.empty, Nothing)
_ -> (mempty, defaultHasTestSuites, Set.empty, Set.empty, Nothing, Set.empty, Nothing)
where
allBuildInfo gpd = concat
allBuildInfo gpd = libExeBuildInfo gpd ++ testBenchBuildInfo gpd
libExeBuildInfo gpd = concat
[ maybe mempty (goBI libBuildInfo) $ condLibrary gpd
, concat $ map (goBI buildInfo . snd) $ condExecutables gpd
, if skipTests p
]
testBenchBuildInfo gpd = concat
[ if skipTests p
then []
else concat $ map (goBI testBuildInfo . snd) $ condTestSuites gpd
, concat $ map (goBI benchmarkBuildInfo . snd) $ condBenchmarks gpd
]
where
goBI f x = buildTools $ f $ condTreeData x
goBI f x = buildTools $ f $ condTreeData x
depName (Dependency (PackageName pn) _) = Executable pn
go gpd tree
= Map.filterWithKey (\k _ -> not $ ignoredDep k)

View File

@ -77,7 +77,7 @@ iiBuildTools InstallInfo { iiPackageDB = PackageDB m, iiPackages = packages } =
$ mapMaybe (flip Map.lookup buildToolMap)
$ Set.toList
$ Set.unions
$ map piBuildTools
$ map piBuildToolsAll
$ Map.elems
$ Map.filterWithKey isSelected m
where
@ -108,7 +108,7 @@ iiBuildTools InstallInfo { iiPackageDB = PackageDB m, iiPackages = packages } =
Just pi -> Set.fromList
$ mapMaybe (flip Map.lookup buildToolMap)
$ Set.toList
$ piBuildTools pi
$ piBuildToolsExe pi
topSort :: (Show a, Ord a) => [(a, Set a)] -> Either String [a]
topSort orig =

View File

@ -30,7 +30,8 @@ data PackageInfo = PackageInfo
{ piVersion :: Version
, piDeps :: Map PackageName VersionRange
, piHasTests :: Bool
, piBuildTools :: Set Executable
, piBuildToolsExe :: Set Executable -- ^ required just for building executable/lib
, piBuildToolsAll :: Set Executable -- ^ required for all stanzas
, piGPD :: Maybe GenericPackageDescription
, piExecs :: Set Executable
, piGithubUser :: Maybe String