on master help sign in
Fix problems with build tool test suite cycles
commitf228b0f9b9efe6f9c3123146af68e55c3d9ffef2 authorMichael Snoyman <michael@snoyman.com> dateThu 13 Mar 2014, 09:23 (13 years ago) parent81f2917
3 files changed+17−11
Stackage/LoadDatabase.hs+13−8 Stackage/Select.hs+2−2 Stackage/Types.hs+2−1
Stackage/LoadDatabase.hs+13−8
@@ -155,12 +155,13 @@ loadPackageDB settings coreMap core deps = do
155155 | otherwise = loop rest
156156
157157 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
159159 return $ mappend pdb $ PackageDB $ Map.singleton p PackageInfo
160160 { piVersion = v
161161 , piDeps = deps'
162162 , piHasTests = hasTests
163− , piBuildTools = buildTools'
163+ , piBuildToolsExe = buildToolsExe'
164+ , piBuildToolsAll = buildToolsExe' `Set.union` buildToolsOther'
164165 , piGPD = mgpd
165166 , piExecs = execs
166167 , piGithubUser = mgithub
@@ -176,25 +177,29 @@ loadPackageDB settings coreMap core deps = do
176177 else mconcat $ map (go gpd . snd) $ condTestSuites gpd
177178 , mconcat $ map (go gpd . snd) $ condBenchmarks gpd
178179 ], 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
180182 , Just gpd
181183 , Set.fromList $ map (Executable . fst) $ condExecutables gpd
182184 , listToMaybe $ catMaybes
183185 $ parseGithubUserHP (homepage $ packageDescription gpd)
184186 : map parseGithubUserSR (sourceRepos $ packageDescription gpd)
185187 )
186− _ -> (mempty, defaultHasTestSuites, Set.empty, Nothing, Set.empty, Nothing)
188+ _ -> (mempty, defaultHasTestSuites, Set.empty, Set.empty, Nothing, Set.empty, Nothing)
187189 where
188− allBuildInfo gpd = concat
190+ allBuildInfo gpd = libExeBuildInfo gpd ++ testBenchBuildInfo gpd
191+ libExeBuildInfo gpd = concat
189192 [ maybe mempty (goBI libBuildInfo) $ condLibrary gpd
190193 , concat $ map (goBI buildInfo . snd) $ condExecutables gpd
191− , if skipTests p
194+ ]
195+ testBenchBuildInfo gpd = concat
196+ [ if skipTests p
192197 then []
193198 else concat $ map (goBI testBuildInfo . snd) $ condTestSuites gpd
194199 , concat $ map (goBI benchmarkBuildInfo . snd) $ condBenchmarks gpd
195200 ]
196− where
197− goBI f x = buildTools $ f $ condTreeData x
201+ goBI f x = buildTools $ f $ condTreeData x
202+
198203 depName (Dependency (PackageName pn) _) = Executable pn
199204 go gpd tree
200205 = Map.filterWithKey (\k _ -> not $ ignoredDep k)
Stackage/Select.hs+2−2
@@ -77,7 +77,7 @@ iiBuildTools InstallInfo { iiPackageDB = PackageDB m, iiPackages = packages } =
7777 $ mapMaybe (flip Map.lookup buildToolMap)
7878 $ Set.toList
7979 $ Set.unions
80− $ map piBuildTools
80+ $ map piBuildToolsAll
8181 $ Map.elems
8282 $ Map.filterWithKey isSelected m
8383 where
@@ -108,7 +108,7 @@ iiBuildTools InstallInfo { iiPackageDB = PackageDB m, iiPackages = packages } =
108108 Just pi -> Set.fromList
109109 $ mapMaybe (flip Map.lookup buildToolMap)
110110 $ Set.toList
111− $ piBuildTools pi
111+ $ piBuildToolsExe pi
112112
113113topSort :: (Show a, Ord a) => [(a, Set a)] -> Either String [a]
114114topSort orig =
Stackage/Types.hs+2−1
@@ -30,7 +30,8 @@ data PackageInfo = PackageInfo
3030 { piVersion :: Version
3131 , piDeps :: Map PackageName VersionRange
3232 , piHasTests :: Bool
33− , piBuildTools :: Set Executable
33+ , piBuildToolsExe :: Set Executable -- ^ required just for building executable/lib
34+ , piBuildToolsAll :: Set Executable -- ^ required for all stanzas
3435 , piGPD :: Maybe GenericPackageDescription
3536 , piExecs :: Set Executable
3637 , piGithubUser :: Maybe String