on master help sign in
Fix problems with build tool test suite cycles
f228b0fMichael Snoyman
Stackage/LoadDatabase.hs+13−8
@@ -155,12 +155,13 @@ loadPackageDB settings coreMap core deps = do
155 | otherwise = loop rest
155 | otherwise = loop rest
156
156
157 addPackage p v lbs pdb = do
157 addPackage p v lbs pdb = do
158− let (deps', hasTests, buildTools', mgpd, execs, mgithub) = parseDeps p lbs
158+ let (deps', hasTests, buildToolsExe', buildToolsOther', mgpd, execs, mgithub) = parseDeps p lbs
159 return $ mappend pdb $ PackageDB $ Map.singleton p PackageInfo
159 return $ mappend pdb $ PackageDB $ Map.singleton p PackageInfo
160 { piVersion = v
160 { piVersion = v
161 , piDeps = deps'
161 , piDeps = deps'
162 , piHasTests = hasTests
162 , piHasTests = hasTests
163− , piBuildTools = buildTools'
163+ , piBuildToolsExe = buildToolsExe'
164+ , piBuildToolsAll = buildToolsExe' `Set.union` buildToolsOther'
164 , piGPD = mgpd
165 , piGPD = mgpd
165 , piExecs = execs
166 , piExecs = execs
166 , piGithubUser = mgithub
167 , piGithubUser = mgithub
@@ -176,25 +177,29 @@ loadPackageDB settings coreMap core deps = do
176 else mconcat $ map (go gpd . snd) $ condTestSuites gpd
177 else mconcat $ map (go gpd . snd) $ condTestSuites gpd
177 , mconcat $ map (go gpd . snd) $ condBenchmarks gpd
178 , mconcat $ map (go gpd . snd) $ condBenchmarks gpd
178 ], not $ null $ condTestSuites gpd
179 ], not $ null $ condTestSuites gpd
179− , Set.fromList $ map depName $ allBuildInfo gpd
180+ , Set.fromList $ map depName $ libExeBuildInfo gpd
181+ , Set.fromList $ map depName $ testBenchBuildInfo gpd
180 , Just gpd
182 , Just gpd
181 , Set.fromList $ map (Executable . fst) $ condExecutables gpd
183 , Set.fromList $ map (Executable . fst) $ condExecutables gpd
182 , listToMaybe $ catMaybes
184 , listToMaybe $ catMaybes
183 $ parseGithubUserHP (homepage $ packageDescription gpd)
185 $ parseGithubUserHP (homepage $ packageDescription gpd)
184 : map parseGithubUserSR (sourceRepos $ packageDescription gpd)
186 : map parseGithubUserSR (sourceRepos $ packageDescription gpd)
185 )
187 )
186− _ -> (mempty, defaultHasTestSuites, Set.empty, Nothing, Set.empty, Nothing)
188+ _ -> (mempty, defaultHasTestSuites, Set.empty, Set.empty, Nothing, Set.empty, Nothing)
187 where
189 where
188− allBuildInfo gpd = concat
190+ allBuildInfo gpd = libExeBuildInfo gpd ++ testBenchBuildInfo gpd
191+ libExeBuildInfo gpd = concat
189 [ maybe mempty (goBI libBuildInfo) $ condLibrary gpd
192 [ maybe mempty (goBI libBuildInfo) $ condLibrary gpd
190 , concat $ map (goBI buildInfo . snd) $ condExecutables gpd
193 , concat $ map (goBI buildInfo . snd) $ condExecutables gpd
194+ ]
195+ testBenchBuildInfo gpd = concat
191− , if skipTests p
196+ [ if skipTests p
192 then []
197 then []
193 else concat $ map (goBI testBuildInfo . snd) $ condTestSuites gpd
198 else concat $ map (goBI testBuildInfo . snd) $ condTestSuites gpd
194 , concat $ map (goBI benchmarkBuildInfo . snd) $ condBenchmarks gpd
199 , concat $ map (goBI benchmarkBuildInfo . snd) $ condBenchmarks gpd
195 ]
200 ]
196− where
197− goBI f x = buildTools $ f $ condTreeData x
201+ goBI f x = buildTools $ f $ condTreeData x
202+
198 depName (Dependency (PackageName pn) _) = Executable pn
203 depName (Dependency (PackageName pn) _) = Executable pn
199 go gpd tree
204 go gpd tree
200 = Map.filterWithKey (\k _ -> not $ ignoredDep k)
205 = Map.filterWithKey (\k _ -> not $ ignoredDep k)
Stackage/Select.hs+2−2
@@ -77,7 +77,7 @@ iiBuildTools InstallInfo { iiPackageDB = PackageDB m, iiPackages = packages } =
77 $ mapMaybe (flip Map.lookup buildToolMap)
77 $ mapMaybe (flip Map.lookup buildToolMap)
78 $ Set.toList
78 $ Set.toList
79 $ Set.unions
79 $ Set.unions
80− $ map piBuildTools
80+ $ map piBuildToolsAll
81 $ Map.elems
81 $ Map.elems
82 $ Map.filterWithKey isSelected m
82 $ Map.filterWithKey isSelected m
83 where
83 where
@@ -108,7 +108,7 @@ iiBuildTools InstallInfo { iiPackageDB = PackageDB m, iiPackages = packages } =
108 Just pi -> Set.fromList
108 Just pi -> Set.fromList
109 $ mapMaybe (flip Map.lookup buildToolMap)
109 $ mapMaybe (flip Map.lookup buildToolMap)
110 $ Set.toList
110 $ Set.toList
111− $ piBuildTools pi
111+ $ piBuildToolsExe pi
112
112
113topSort :: (Show a, Ord a) => [(a, Set a)] -> Either String [a]
113topSort :: (Show a, Ord a) => [(a, Set a)] -> Either String [a]
114topSort orig =
114topSort orig =
Stackage/Types.hs+2−1
@@ -30,7 +30,8 @@ data PackageInfo = PackageInfo
30 { piVersion :: Version
30 { piVersion :: Version
31 , piDeps :: Map PackageName VersionRange
31 , piDeps :: Map PackageName VersionRange
32 , piHasTests :: Bool
32 , piHasTests :: Bool
33− , piBuildTools :: Set Executable
33+ , piBuildToolsExe :: Set Executable -- ^ required just for building executable/lib
34+ , piBuildToolsAll :: Set Executable -- ^ required for all stanzas
34 , piGPD :: Maybe GenericPackageDescription
35 , piGPD :: Maybe GenericPackageDescription
35 , piExecs :: Set Executable
36 , piExecs :: Set Executable
36 , piGithubUser :: Maybe String
37 , piGithubUser :: Maybe String