diff --git a/src/Stack/Build/ConstructPlan.hs b/src/Stack/Build/ConstructPlan.hs index 54f0c548aa..bdca7e9b77 100644 --- a/src/Stack/Build/ConstructPlan.hs +++ b/src/Stack/Build/ConstructPlan.hs @@ -1109,7 +1109,7 @@ pprintExceptions exceptions stackYaml stackRoot parentMap wanted' prunedGlobalDe let prunedDeps = map (style Current . fromString . packageNameString) pruned in Just $ flow "Can't use GHC boot package" <+> (style Current . fromString . packageNameString $ name) <+> - flow "when it has an overriden dependency, " <+> + flow "when it has an overridden dependency (issue #4510);" <+> flow "you need to add the following as explicit dependencies to the project:" <+> line <+> encloseSep "" "" ", " prunedDeps | otherwise = Just $ flow "Unknown package:" <+> (style Current . fromString . packageNameString $ name) @@ -1121,13 +1121,22 @@ pprintExceptions exceptions stackYaml stackRoot parentMap wanted' prunedGlobalDe pprintFlag (name, False) = "-" <> fromString (flagNameString name) pprintDep (name, (range, mlatestApplicable, badDep)) = case badDep of - NotInBuildPlan -> Just $ - style Error (fromString $ packageNameString name) <+> - align ((if range == Cabal.anyVersion - then flow "needed" - else flow "must match" <+> goodRange) <> "," <> softline <> - flow "but the stack configuration has no specified version" <+> - latestApplicable Nothing) + NotInBuildPlan + | name `elem` fold prunedGlobalDeps -> Just $ + style Error (fromString $ packageNameString name) <+> + align ((if range == Cabal.anyVersion + then flow "needed" + else flow "must match" <+> goodRange) <> "," <> softline <> + flow "but this GHC boot package has been pruned (issue #4510);" <+> + flow "you need to add the package explicitly to extra-deps" <+> + latestApplicable Nothing) + | otherwise -> Just $ + style Error (fromString $ packageNameString name) <+> + align ((if range == Cabal.anyVersion + then flow "needed" + else flow "must match" <+> goodRange) <> "," <> softline <> + flow "but the stack configuration has no specified version" <+> + latestApplicable Nothing) -- TODO: For local packages, suggest editing constraints DependencyMismatch version -> Just $ (style Error . fromString . packageIdentifierString) (PackageIdentifier name version) <+> diff --git a/test/integration/tests/4897-boot-package-pruned/Main.hs b/test/integration/tests/4897-boot-package-pruned/Main.hs new file mode 100644 index 0000000000..7ba05377d9 --- /dev/null +++ b/test/integration/tests/4897-boot-package-pruned/Main.hs @@ -0,0 +1,16 @@ +import Control.Monad (unless) +import Data.List (isInfixOf) +import StackTest + +planFailure :: String +planFailure = + "but this GHC boot package has been pruned (issue #4510);" + +main :: IO () +main = do + stackErrStderr ["build"] (expectMessage planFailure) + +expectMessage :: String -> String -> IO () +expectMessage msg stderr = do + unless (words msg `isInfixOf` words stderr) + (error $ "Expected an error: \n" ++ show msg) diff --git a/test/integration/tests/4897-boot-package-pruned/files/directory/directory.cabal b/test/integration/tests/4897-boot-package-pruned/files/directory/directory.cabal new file mode 100644 index 0000000000..78abfda5cf --- /dev/null +++ b/test/integration/tests/4897-boot-package-pruned/files/directory/directory.cabal @@ -0,0 +1,8 @@ +name: directory +version: 1.3.3.0 +build-type: Simple +cabal-version: >=1.10 + +library + build-depends: base + default-language: Haskell2010 diff --git a/test/integration/tests/4897-boot-package-pruned/files/files.cabal b/test/integration/tests/4897-boot-package-pruned/files/files.cabal new file mode 100644 index 0000000000..fd7c274440 --- /dev/null +++ b/test/integration/tests/4897-boot-package-pruned/files/files.cabal @@ -0,0 +1,8 @@ +name: files +version: 0.1.0.0 +build-type: Simple +cabal-version: >=1.10 + +library + build-depends: base, directory, process + default-language: Haskell2010 diff --git a/test/integration/tests/4897-boot-package-pruned/files/stack.yaml b/test/integration/tests/4897-boot-package-pruned/files/stack.yaml new file mode 100644 index 0000000000..4a1ebfdd38 --- /dev/null +++ b/test/integration/tests/4897-boot-package-pruned/files/stack.yaml @@ -0,0 +1,3 @@ +resolver: lts-13.26 +packages: [.] +extra-deps: [./directory]