@@ -281,6 +281,7 @@ singleBuild pb@PerformBuild {..} registeredPackages SingleBuild {..} =
281281 wfd testComps (runTests withUnpacked)
282282
283283 pname = piName sbPackageInfo
284+ pident = PackageIdentifier pname (ppVersion $ piPlan sbPackageInfo)
284285 name = display pname
285286 namever = concat
286287 [ name
@@ -385,7 +386,7 @@ singleBuild pb@PerformBuild {..} registeredPackages SingleBuild {..} =
385386 -- dependency's haddocks before this finishes
386387 atomically $ putTMVar (piResult sbPackageInfo) True
387388
388− prevHaddockResult <- getPreviousResult pb Haddock pname
389+ prevHaddockResult <- getPreviousResult pb Haddock pident
389390 let needHaddock = pbEnableHaddock
390391 && checkPrevResult prevHaddockResult pcHaddocks
391392 && not (null $ sdModules $ ppDesc $ piPlan sbPackageInfo)
@@ -424,7 +425,7 @@ singleBuild pb@PerformBuild {..} registeredPackages SingleBuild {..} =
424425 $ modifyTVar sbHaddockFiles
425426 $ insertMap namever newPath
426427
427− savePreviousResult pb Haddock pname $ either (const False) (const True) eres
428+ savePreviousResult pb Haddock pident $ either (const False) (const True) eres
428429 case (eres, pcHaddocks) of
429430 (Left e, ExpectSuccess) -> throwM e
430431 (Right (), ExpectFailure) -> warn $ namever ++ ": unexpected Haddock success"
@@ -435,7 +436,7 @@ singleBuild pb@PerformBuild {..} registeredPackages SingleBuild {..} =
435436 runTests withUnpacked = wf testOut $ \outH -> do
436437 let run = runChild outH
437438
438− prevTestResult <- getPreviousResult pb Test pname
439+ prevTestResult <- getPreviousResult pb Test pident
439440 let needTest = pbEnableTests
440441 && checkPrevResult prevTestResult pcTests
441442 when needTest $ withUnpacked $ do
@@ -449,7 +450,7 @@ singleBuild pb@PerformBuild {..} registeredPackages SingleBuild {..} =
449450 log' $ "Test run " ++ namever
450451 run "cabal" ["test", "--log=" ++ fpToText testRunOut]
451452
452− savePreviousResult pb Test pname $ either (const False) (const True) eres
453+ savePreviousResult pb Test pident $ either (const False) (const True) eres
453454 case (eres, pcTests) of
454455 (Left e, ExpectSuccess) -> throwM e
455456 (Right (), ExpectFailure) -> warn $ namever ++ ": unexpected test success"
@@ -501,26 +502,28 @@ data ResultType = Haddock | Test
501502
502503-- | The result generated on a previous run
503504data PrevResult = PRNoResult | PRSuccess | PRFailure
505+ deriving (Show, Enum, Eq, Ord, Bounded, Read)
504506
505507-- | Check if we should rerun based on a PrevResult and the expected status
508+checkPrevResult :: PrevResult -> TestState -> Bool
506509checkPrevResult _ Don'tBuild = False
507510checkPrevResult PRNoResult _ = True
508511checkPrevResult PRSuccess _ = False
509512checkPrevResult PRFailure ExpectSuccess = True
510513checkPrevResult PRFailure _ = False
511514
512−withPRPath :: PerformBuild -> ResultType -> PackageName -> (FilePath -> IO a) -> IO a
513−withPRPath pb rt (PackageName name) inner = do
515+withPRPath :: PerformBuild -> ResultType -> PackageIdentifier -> (FilePath -> IO a) -> IO a
516+withPRPath pb rt ident inner = do
514517 createTree $ parent fp
515518 inner fp
516519 where
517− fp = pbPrevResDir pb </> fpFromString (show rt) </> fpFromString name
520+ fp = pbPrevResDir pb </> fpFromString (show rt) </> fpFromText (display ident)
518521
519522successBS, failureBS :: ByteString
520523successBS = "success"
521524failureBS = "failure"
522525
523−getPreviousResult :: PerformBuild -> ResultType -> PackageName -> IO PrevResult
526+getPreviousResult :: PerformBuild -> ResultType -> PackageIdentifier -> IO PrevResult
524527getPreviousResult w x y = withPRPath w x y $ \fp -> do
525528 eres <- tryIO $ readFile fp
526529 return $ case eres of
@@ -529,12 +532,12 @@ getPreviousResult w x y = withPRPath w x y $ \fp -> do
529532 | bs == failureBS -> PRFailure
530533 _ -> PRNoResult
531534
532−savePreviousResult :: PerformBuild -> ResultType -> PackageName -> Bool -> IO ()
533−savePreviousResult pb rt name res =
534− withPRPath pb rt name $ \fp -> writeFile fp $
535+savePreviousResult :: PerformBuild -> ResultType -> PackageIdentifier -> Bool -> IO ()
536+savePreviousResult pb rt ident res =
537+ withPRPath pb rt ident $ \fp -> writeFile fp $
535538 if res then successBS else failureBS
536539
537−deletePreviousResults :: PerformBuild -> PackageName -> IO ()
540+deletePreviousResults :: PerformBuild -> PackageIdentifier -> IO ()
538541deletePreviousResults pb name =
539542 forM_ [minBound..maxBound] $ \rt ->
540543 withPRPath pb rt name $ \fp ->