@@ -103,15 +103,21 @@ waitForDeps toolMap packageMap activeComps bp pi action = do
103103 isCore = (`member` siCorePackages (bpSystemInfo bp))
104104 isCoreExe = (`member` siCoreExecutables (bpSystemInfo bp))
105105
106+withCounter :: TVar Int -> IO a -> IO a
106107withCounter counter = bracket_
107108 (atomically $ modifyTVar counter (+ 1))
108109 (atomically $ modifyTVar counter (subtract 1))
109110
111+withTSem :: TSem -> IO a -> IO a
110112withTSem sem = bracket_ (atomically $ waitTSem sem) (atomically $ signalTSem sem)
111113
114+-- | Returns @Nothing@ if installing to a global database
115+pbDatabase :: PerformBuild -> Maybe FilePath
112116pbDatabase pb
113117 | pbGlobalInstall pb = Nothing
114118 | otherwise = Just $ pbInstallDest pb </> "pkgdb"
119+
120+pbBinDir, pbLibDir, pbDataDir, pbDocDir :: PerformBuild -> FilePath
115121pbBinDir pb = pbInstallDest pb </> "bin"
116122pbLibDir pb = pbInstallDest pb </> "lib"
117123pbDataDir pb = pbInstallDest pb </> "share"
@@ -260,9 +266,9 @@ singleBuild pb@PerformBuild {..} SingleBuild {..} =
260266 testOut = pbLogDir </> fpFromText namever </> "test.out"
261267 testRunOut = pbLogDir </> fpFromText namever </> "test-run.out"
262268
263− wf fp inner = do
269+ wf fp inner' = do
264270 createTree $ parent fp
265− withBinaryFile (fpToString fp) WriteMode inner
271+ withBinaryFile (fpToString fp) WriteMode inner'
266272
267273 configArgs = ($ []) $ execWriter $ do
268274 tell' "--package-db=clear"
@@ -279,9 +285,9 @@ singleBuild pb@PerformBuild {..} SingleBuild {..} =
279285 flags :: Text
280286 flags = unwords $ map go $ mapToList pcFlagOverrides
281287 where
282− go (name, isOn) = concat
288+ go (name', isOn) = concat
283289 [ if isOn then "" else "-"
284− , unFlagName name
290+ , unFlagName name'
285291 ]
286292
287293 PackageConstraints {..} = ppConstraints $ piPlan sbPackageInfo