From b545be4a68cfc431cfa9e7f7a68d26bc45ba18f3 Mon Sep 17 00:00:00 2001
From: Ben Gamari <ben@smart-cactus.org>
Date: Mon, 4 Nov 2019 10:26:58 -0500
Subject: [PATCH] ci: Exclude own components from failed dependency check

---
 ci/TestPatches.hs | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/ci/TestPatches.hs b/ci/TestPatches.hs
index cdf8d0e5..b0890b2a 100644
--- a/ci/TestPatches.hs
+++ b/ci/TestPatches.hs
@@ -359,11 +359,17 @@ failedDeps pkgs =
         failedDirectDeps <> failedTransDeps
         where
           failedTransDeps = S.unions $ map (res M.!) (S.toList $ dependencies binfo)
-          failedDirectDeps = S.filter failed (dependencies binfo)
+          failedDirectDeps = S.filter failed $ S.filter excludeSelf (dependencies binfo)
+
+          -- We don't want failures of units in the same package to count as
+          -- failed dependencies.
+          excludeSelf :: UnitId -> Bool
+          excludeSelf unitId = pkgName binfo /= pkgName binfo'
+            where (binfo', _) = pkgs M.! unitId
 
           failed :: UnitId -> Bool
-          failed uid =
-            case snd $ pkgs M.! uid of
+          failed unitId =
+            case snd $ pkgs M.! unitId of
               BuildFailed _ -> True
               _ -> False
   in res
-- 
GitLab