From 4856dbb120f6ca98389ad81fe3c48dcc1330c47c Mon Sep 17 00:00:00 2001
From: "Edward Z. Yang" <ezyang@cs.stanford.edu>
Date: Mon, 2 Jan 2017 01:50:43 -0500
Subject: [PATCH] Don't write to targetBuildDepends when flattening.

The recorded build-depends should be consistent with the
extra metadata we created when dep-solving. No need to
overwrite.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
---
 .../PackageDescription/Configuration.hs       | 19 +++----------------
 1 file changed, 3 insertions(+), 16 deletions(-)

diff --git a/Cabal/Distribution/PackageDescription/Configuration.hs b/Cabal/Distribution/PackageDescription/Configuration.hs
index 4c15241e75..fb992c9e3e 100644
--- a/Cabal/Distribution/PackageDescription/Configuration.hs
+++ b/Cabal/Distribution/PackageDescription/Configuration.hs
@@ -389,25 +389,12 @@ flattenTaggedTargets :: TargetSet PDTagged -> (Maybe Library, [(UnqualComponentN
 flattenTaggedTargets (TargetSet targets) = foldr untag (Nothing, []) targets
   where
     untag (_, Lib _) (Just _, _) = userBug "Only one library expected"
-    untag (deps, Lib l) (Nothing, comps) =
-        (Just l', comps)
-      where
-        l' = l {
-                libBuildInfo = (libBuildInfo l) { targetBuildDepends = fromDepMap deps }
-            }
-    untag (deps, SubComp n c) (mb_lib, comps)
+    untag (_, Lib l) (Nothing, comps) = (Just l, comps)
+    untag (_, SubComp n c) (mb_lib, comps)
         | any ((== n) . fst) comps =
           userBug $ "There exist several components with the same name: '" ++ unUnqualComponentName n ++ "'"
 
-        | otherwise = (mb_lib, (n, c') : comps)
-      where
-        updBI bi = bi { targetBuildDepends = fromDepMap deps }
-        c' = case c of
-              CLib   x -> CLib   x { libBuildInfo        = updBI (libBuildInfo        x) }
-              CFLib  x -> CFLib  x { foreignLibBuildInfo = updBI (foreignLibBuildInfo x) }
-              CExe   x -> CExe   x { buildInfo           = updBI (buildInfo           x) }
-              CTest  x -> CTest  x { testBuildInfo       = updBI (testBuildInfo       x) }
-              CBench x -> CBench x { benchmarkBuildInfo  = updBI (benchmarkBuildInfo  x) }
+        | otherwise = (mb_lib, (n, c) : comps)
 
     untag (_, PDNull) x = x  -- actually this should not happen, but let's be liberal
 
-- 
GitLab