Skip to content

Commit 225c7a4

Browse files
committed
fixup! Lock Configure per build
1 parent db4f461 commit 225c7a4

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

Cabal/src/Distribution/Simple/ConfigureScript.hs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ import qualified Data.Map as Map
5252
import Control.Concurrent.MVar
5353
import Data.IORef
5454
import System.IO.Unsafe (unsafePerformIO)
55-
--- BEGIN MODIFICATION: Locking Mechanism ---
5655

5756
-- Global state for locks, one MVar per build directory path.
5857
-- The MVar () acts as a mutex: it's full when the lock is available (unlocked),
@@ -72,7 +71,6 @@ getOrCreateLock path = do
7271
case Map.lookup path currentMap of
7372
Just existingLock -> (currentMap, existingLock) -- Lock already exists, return it. The newLock we created is discarded.
7473
Nothing -> (Map.insert path newLock currentMap, newLock) -- New lock inserted, return it.
75-
--- END MODIFICATION: Locking Mechanism ---
7674

7775
runConfigureScript
7876
:: ConfigFlags
@@ -205,10 +203,9 @@ runConfigureScript cfg flags programDb hp = do
205203
lookupProgram shProg
206204
`fmap` configureProgram verbosity shProg progDb
207205

208-
--- BEGIN MODIFICATION: Apply Locking ---
209206
-- Acquire the lock specific to this build_dir
210207
-- build_dir is used as the key for the lock.
211-
configureLock <- getOrCreateLock (interpretSymbolicPath mbWorkDir build_dir)
208+
configureLock <- getOrCreateLock configureFile'
212209

213210
let runLockedConfigureAction = do
214211
case shConfiguredProg of
@@ -222,14 +219,14 @@ runConfigureScript cfg flags programDb hp = do
222219
}
223220
Nothing -> dieWithException verbosity NotFoundMsg
224221

225-
warn verbosity $ "Attempting to acquire configure lock for " ++ interpretSymbolicPath mbWorkDir build_dir
222+
warn verbosity $ "Attempting to acquire configure lock for " ++ configureFile'
226223
-- withMVar takes the MVar (blocks if already taken), runs the action,
227224
-- and ensures the MVar is put back, even if the action throws an exception.
228225
withMVar configureLock $ \() ->
229226
-- The '()' means the MVar holds a unit value; we're interested in its full/empty state.
230227
runLockedConfigureAction
231-
warn verbosity $ "Configure lock released for " ++ interpretSymbolicPath mbWorkDir build_dir
232-
--- END MODIFICATION: Apply Locking ---
228+
warn verbosity $ "Configure lock released for " ++ configureFile'
229+
233230
where
234231
args = configureArgs backwardsCompatHack cfg
235232
backwardsCompatHack = False

cabal-install/src/Distribution/Client/ProjectPlanning.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1836,7 +1836,7 @@ elaborateInstallPlan
18361836
PD.Custom -> [CuzBuildType CuzCustomBuildType]
18371837
PD.Hooks -> [CuzBuildType CuzHooksBuildType]
18381838
PD.Make -> [CuzBuildType CuzMakeBuildType]
1839-
PD.Simple -> []
1839+
_ -> []
18401840
-- cabal-format versions prior to 1.8 have different build-depends semantics
18411841
-- for now it's easier to just fallback to legacy-mode when specVersion < 1.8
18421842
-- see, https://github.com/haskell/cabal/issues/4121

0 commit comments

Comments
 (0)