From e6fa22f432ce5dafca7c980f6f7286593e3c28ff Mon Sep 17 00:00:00 2001 From: Michael Snoyman Date: Wed, 22 Feb 2017 11:41:23 +0200 Subject: [PATCH 1/4] Fix typo --- src/Stack/Build/Execute.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Stack/Build/Execute.hs b/src/Stack/Build/Execute.hs index f3627f200c..ad9800904c 100644 --- a/src/Stack/Build/Execute.hs +++ b/src/Stack/Build/Execute.hs @@ -1013,7 +1013,7 @@ withSingleContext runInBase ActionContext {..} ExecuteEnv {..} task@Task {..} md (Nothing, _) -> return ( cabalPackageArg ++ -- NOTE: This is different from - -- packageDBArgs above inthat it does not + -- packageDBArgs above in that it does not -- include the local database and does not -- pass in the -hide-all-packages argument ("-clear-package-db" From c94d8f95f50753a3d8a8415d4243bae552ab0221 Mon Sep 17 00:00:00 2001 From: Michael Snoyman Date: Wed, 22 Feb 2017 11:47:48 +0200 Subject: [PATCH 2/4] Add warnings for missing custom-setup stanzas --- src/Stack/Build/Execute.hs | 38 ++++++++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/src/Stack/Build/Execute.hs b/src/Stack/Build/Execute.hs index ad9800904c..5134ba5ea3 100644 --- a/src/Stack/Build/Execute.hs +++ b/src/Stack/Build/Execute.hs @@ -982,14 +982,21 @@ withSingleContext runInBase ActionContext {..} ExecuteEnv {..} task@Task {..} md -- This branch is taken when -- 'explicit-setup-deps' is requested in your -- stack.yaml file. - (Nothing, Just deps) | explicitSetupDeps (packageName package) config -> + (Nothing, Just deps) | explicitSetupDeps (packageName package) config -> do + $logWarn $ T.pack $ concat + [ "Package " + , packageNameString $ packageName package + , " uses a custom Cabal build, but does not use a custom-setup stanza" + ] + $logWarn "Using the explicit setup deps approach based on configuration" + $logWarn "Strongly recommend fixing the package's cabal file" -- Stack always builds with the global Cabal for various -- reproducibility issues. let depsMinusCabal = map ghcPkgIdString $ Set.toList $ addGlobalPackages deps (Map.elems eeGlobalDumpPkgs) - in return ( + return ( packageDBArgs ++ cabalPackageArg ++ map ("-package-id=" ++) depsMinusCabal) @@ -1010,16 +1017,23 @@ withSingleContext runInBase ActionContext {..} ExecuteEnv {..} task@Task {..} md -- Currently, this branch is only taken via `stack -- sdist` or when explicitly requested in the -- stack.yaml file. - (Nothing, _) -> return ( - cabalPackageArg ++ - -- NOTE: This is different from - -- packageDBArgs above in that it does not - -- include the local database and does not - -- pass in the -hide-all-packages argument - ("-clear-package-db" - : "-global-package-db" - : map (("-package-db=" ++) . toFilePathNoTrailingSep) (bcoExtraDBs eeBaseConfigOpts) - ++ ["-package-db=" ++ toFilePathNoTrailingSep (bcoSnapDB eeBaseConfigOpts)])) + (Nothing, _) -> do + $logWarn $ T.pack $ concat + [ "Package " + , packageNameString $ packageName package + , " uses a custom Cabal build, but does not use a custom-setup stanza" + ] + $logWarn "Not using the explicit setup deps approach based on configuration" + $logWarn "Strongly recommend fixing the package's cabal file" + return $ cabalPackageArg ++ + -- NOTE: This is different from + -- packageDBArgs above in that it does not + -- include the local database and does not + -- pass in the -hide-all-packages argument + ("-clear-package-db" + : "-global-package-db" + : map (("-package-db=" ++) . toFilePathNoTrailingSep) (bcoExtraDBs eeBaseConfigOpts) + ++ ["-package-db=" ++ toFilePathNoTrailingSep (bcoSnapDB eeBaseConfigOpts)]) setupArgs = ("--builddir=" ++ toFilePathNoTrailingSep distRelativeDir') : args runExe exeName fullArgs = From 08d8b5d6e27f941f7e61c93c5ba0ada66bbf3042 Mon Sep 17 00:00:00 2001 From: Michael Snoyman Date: Wed, 22 Feb 2017 11:49:43 +0200 Subject: [PATCH 3/4] Fix typo in -package argument --- src/Stack/Build/Execute.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Stack/Build/Execute.hs b/src/Stack/Build/Execute.hs index 5134ba5ea3..78e13f5582 100644 --- a/src/Stack/Build/Execute.hs +++ b/src/Stack/Build/Execute.hs @@ -970,7 +970,7 @@ withSingleContext runInBase ActionContext {..} ExecuteEnv {..} task@Task {..} md return ("-package-id=" ++ ghcPkgIdString (snd x), Just (toCabalPackageIdentifier (fst x))) [] -> do $logWarn (T.pack ("Could not find custom-setup dep: " ++ packageNameString name)) - return ("--package=" ++ packageNameString name, Nothing) + return ("-package=" ++ packageNameString name, Nothing) let depsArgs = map fst matchedDeps -- Generate setup_macros.h and provide it to ghc let macroDeps = mapMaybe snd matchedDeps From c89a3c8622bd24109cd5ba24f8a51285420d7890 Mon Sep 17 00:00:00 2001 From: Michael Snoyman Date: Wed, 22 Feb 2017 11:35:19 +0200 Subject: [PATCH 4/4] Revert "Merge pull request #2970 from lwm/add-warning" This reverts commit ca8af286bd25377e99c4b199e6185c29b00448bc, reversing changes made to 9285c1857a94639f308b198b6b2588c0873adff4. --- src/Stack/Build/Installed.hs | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/src/Stack/Build/Installed.hs b/src/Stack/Build/Installed.hs index 7a54cb3a80..747dd45e7d 100644 --- a/src/Stack/Build/Installed.hs +++ b/src/Stack/Build/Installed.hs @@ -196,13 +196,11 @@ processLoadResult _ True (WrongVersion actual wanted, lh) ] return (Just lh) processLoadResult mdb _ (reason, lh) = do - let pkgName = packageNameText (fst (lhPair lh)) - warnIfCabalUpgradeNecessary pkgName reason $logDebug $ T.concat $ - ["Ignoring package ", pkgName] - ++ - maybe [] (\db -> [", from ", T.pack (show db), ","]) mdb - ++ + [ "Ignoring package " + , packageNameText (fst (lhPair lh)) + ] ++ + maybe [] (\db -> [", from ", T.pack (show db), ","]) mdb ++ [ " due to" , case reason of Allowed -> " the impossible?!?!" @@ -220,14 +218,6 @@ processLoadResult mdb _ (reason, lh) = do ] return Nothing -warnIfCabalUpgradeNecessary :: MonadLogger m => T.Text -> Allowed -> m () -warnIfCabalUpgradeNecessary pkg reason = do - let msg = "Cabal version mismatch detected. Try running 'stack setup --upgrade-cabal'" - case reason of - WrongVersion _ _ -> when (pkg == T.pack "Cabal") $ do - $logWarn msg - _ -> return () - data Allowed = Allowed | NeedsProfiling