Skip to content

Commit a13eb4b

Browse files
authored
Merge branch 'master' into varosi/mingw_bin
2 parents 66a02ce + 0e5a2e1 commit a13eb4b

File tree

20 files changed

+263
-123
lines changed

20 files changed

+263
-123
lines changed

CONTRIBUTING.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ and use the provided template to include all necessary details.
77

88
The more detailed your report, the faster it can be resolved and will ensure it
99
is resolved in the right way. Once your bug has been resolved, the responsible
10-
will tag the issue as _Needs confirmation_ and assign the issue back to you.
11-
Once you have tested and confirmed that the issue is resolved, close the issue.
12-
If you are not a member of the project, you will be asked for confirmation and
13-
we will close it.
10+
person will tag the issue as _Needs confirmation_ and assign the issue back to
11+
you. Once you have tested and confirmed that the issue is resolved, close the
12+
issue. If you are not a member of the project, you will be asked for
13+
confirmation and we will close it.
1414

1515

1616
## Documentation

ChangeLog.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ Other enhancements:
4949
a method to ensure PVP compliance without having to proactively fix
5050
bounds issues for Stackage maintenance.
5151
* Expose a `save-hackage-creds` configuration option
52+
* On GHC <= 7.8, filters out spurious linker warnings on windows
53+
See [#3127](https://github.com/commercialhaskell/stack/pull/3127)
54+
* Better error messages when creating or building packages which alias
55+
wired-in packages. See
56+
[#3172](https://github.com/commercialhaskell/stack/issues/3172).
5257
* MinGW bin folder now is searched for dynamic libraries. See [#3126](https://github.com/commercialhaskell/stack/issues/3126)
5358

5459
Bug fixes:
@@ -74,6 +79,11 @@ Bug fixes:
7479
* Switching a package between extra-dep and local package now forces
7580
rebuild (previously it wouldn't if versions were the same).
7681
See [#2147](https://github.com/commercialhaskell/stack/issues/2147)
82+
* `stack upload` no longer reveals your password when you type it on
83+
MinTTY-based Windows shells, such as Cygwin and MSYS2.
84+
See [#3142](https://github.com/commercialhaskell/stack/issues/3142)
85+
* `stack script`'s import parser will now properly parse files that
86+
have Windows-style line endings (CRLF)
7787

7888

7989
## 1.4.0
@@ -168,6 +178,8 @@ Other enhancements:
168178
* Upgraded `http-client-tls` version, which now offers support for the
169179
`socks5://` and `socks5h://` values in the `http_proxy` and `https_proxy`
170180
environment variables.
181+
* Binary "stack upgrade" will now warn if the installed executable is not
182+
on the PATH or shadowed by another entry.
171183

172184
Bug fixes:
173185

doc/yaml_configuration.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@ and [non-project-specific](#non-project-specific-config) options in:
1616
- The project file itself may also contain non-project specific options
1717

1818
*Note:* When stack is invoked outside a stack project it will source project
19-
specific options from `~/.stack/global-project/stack.yaml`. Options in this file will
20-
be ignored for a project with its own `<project dir>/stack.yaml`.
19+
specific options from `~/.stack/global-project/stack.yaml`. When stack is
20+
invoked inside a stack project, only options from `<project dir>/stack.yaml` are
21+
used, and `~/.stack/global-project/stack.yaml` is ignored.
2122

2223
## Project-specific config
2324

etc/dockerfiles/stack-build/lts-8.0/Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,9 @@ RUN stack --system-ghc --resolver=$LTS_SLUG --local-bin-path=/usr/local/bin inst
4242
# Install proper 'pid1' init daemon
4343
#
4444

45-
RUN wget -O- "https://github.com/fpco/pid1/releases/download/pid1%2F$PID1_VERSION/pid1-$PID1_VERSION-linux-x86_64.tar.gz" |tar xzf - -C /usr/local
46-
45+
RUN wget -O- "https://github.com/fpco/pid1/releases/download/pid1%2F$PID1_VERSION/pid1-$PID1_VERSION-linux-x86_64.tar.gz" | tar xzf - -C /usr/local && \
46+
chown root:root /usr/local/sbin && \
47+
chown root:root /usr/local/sbin/pid1
4748
#
4849
# Set up pid1 entrypoint and default command
4950
#

src/Path/CheckInstall.hs

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
{-# LANGUAGE FlexibleContexts #-}
2+
{-# LANGUAGE TemplateHaskell #-}
3+
{-# LANGUAGE OverloadedStrings #-}
4+
5+
module Path.CheckInstall where
6+
7+
import Control.Monad (unless)
8+
import Control.Monad.Extra (anyM, (&&^))
9+
import Control.Monad.IO.Class
10+
import Control.Monad.Logger
11+
import Data.Foldable (forM_)
12+
import Data.Text (Text)
13+
import qualified Data.Text as T
14+
import qualified System.Directory as D
15+
import qualified System.FilePath as FP
16+
17+
-- | Checks if the installed executable will be available on the user's
18+
-- PATH. This doesn't use @envSearchPath menv@ because it includes paths
19+
-- only visible when running in the stack environment.
20+
warnInstallSearchPathIssues :: (MonadIO m, MonadLogger m) => FilePath -> [Text] -> m ()
21+
warnInstallSearchPathIssues destDir installed = do
22+
searchPath <- liftIO FP.getSearchPath
23+
destDirIsInPATH <- liftIO $
24+
anyM (\dir -> D.doesDirectoryExist dir &&^ fmap (FP.equalFilePath destDir) (D.canonicalizePath dir)) searchPath
25+
if destDirIsInPATH
26+
then forM_ installed $ \exe -> do
27+
mexePath <- (liftIO . D.findExecutable . T.unpack) exe
28+
case mexePath of
29+
Just exePath -> do
30+
exeDir <- (liftIO . fmap FP.takeDirectory . D.canonicalizePath) exePath
31+
unless (exeDir `FP.equalFilePath` destDir) $ do
32+
$logWarn ""
33+
$logWarn $ T.concat
34+
[ "WARNING: The \""
35+
, exe
36+
, "\" executable found on the PATH environment variable is "
37+
, T.pack exePath
38+
, ", and not the version that was just installed."
39+
]
40+
$logWarn $ T.concat
41+
[ "This means that \""
42+
, exe
43+
, "\" calls on the command line will not use this version."
44+
]
45+
Nothing -> do
46+
$logWarn ""
47+
$logWarn $ T.concat
48+
[ "WARNING: Installation path "
49+
, T.pack destDir
50+
, " is on the PATH but the \""
51+
, exe
52+
, "\" executable that was just installed could not be found on the PATH."
53+
]
54+
else do
55+
$logWarn ""
56+
$logWarn $ T.concat
57+
[ "WARNING: Installation path "
58+
, T.pack destDir
59+
, " not found on the PATH environment variable"
60+
]

src/Stack/Build/ConstructPlan.hs

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{-# OPTIONS_GHC -fno-warn-orphans #-}
12
{-# LANGUAGE ConstraintKinds #-}
23
{-# LANGUAGE DeriveDataTypeable #-}
34
{-# LANGUAGE DeriveGeneric #-}
@@ -10,6 +11,7 @@
1011
{-# LANGUAGE TemplateHaskell #-}
1112
{-# LANGUAGE TupleSections #-}
1213
{-# LANGUAGE ViewPatterns #-}
14+
{-# LANGUAGE StandaloneDeriving #-}
1315
-- | Construct a @Plan@ for how to build
1416
module Stack.Build.ConstructPlan
1517
( constructPlan
@@ -24,7 +26,9 @@ import Control.Monad.State.Strict (execState)
2426
import Control.Monad.Trans.Resource
2527
import Data.Either
2628
import Data.Function
29+
import qualified Data.HashSet as HashSet
2730
import Data.List
31+
import Data.List.Extra (nubOrd)
2832
import Data.Map.Strict (Map)
2933
import qualified Data.Map.Strict as M
3034
import qualified Data.Map.Strict as Map
@@ -892,7 +896,9 @@ data ConstructPlanException
892896
| DependencyPlanFailures Package (Map PackageName (VersionRange, LatestApplicableVersion, BadDependency))
893897
| UnknownPackage PackageName -- TODO perhaps this constructor will be removed, and BadDependency will handle it all
894898
-- ^ Recommend adding to extra-deps, give a helpful version number?
895-
deriving (Typeable, Eq, Show)
899+
deriving (Typeable, Eq, Ord, Show)
900+
901+
deriving instance Ord VersionRange
896902

897903
-- | For display purposes only, Nothing if package not found
898904
type LatestApplicableVersion = Maybe Version
@@ -902,7 +908,7 @@ data BadDependency
902908
= NotInBuildPlan
903909
| Couldn'tResolveItsDependencies Version
904910
| DependencyMismatch Version
905-
deriving (Typeable, Eq, Show)
911+
deriving (Typeable, Eq, Ord, Show)
906912

907913
-- TODO: Consider intersecting version ranges for multiple deps on a
908914
-- package. This is why VersionRange is in the parent map.
@@ -926,7 +932,7 @@ pprintExceptions exceptions stackYaml parentMap wanted =
926932
line <>
927933
"You may also want to try the 'stack solver' command"
928934
where
929-
exceptions' = nub exceptions
935+
exceptions' = nubOrd exceptions
930936

931937
extras = Map.unions $ map getExtras exceptions'
932938
getExtras (DependencyCycleDetected _) = Map.empty
@@ -940,11 +946,16 @@ pprintExceptions exceptions stackYaml parentMap wanted =
940946
pprintExtra (name, version) =
941947
fromString (concat ["- ", packageNameString name, "-", versionString version])
942948

949+
allNotInBuildPlan = Set.fromList $ concatMap toNotInBuildPlan exceptions'
950+
toNotInBuildPlan (DependencyPlanFailures _ pDeps) =
951+
map fst $ filter (\(_, (_, _, badDep)) -> badDep == NotInBuildPlan) $ Map.toList pDeps
952+
toNotInBuildPlan _ = []
953+
943954
pprintException (DependencyCycleDetected pNames) = Just $
944955
"Dependency cycle detected in packages:" <> line <>
945956
indent 4 (encloseSep "[" "]" "," (map (errorRed . fromString . packageNameString) pNames))
946-
pprintException (DependencyPlanFailures pkg (Map.toList -> pDeps)) =
947-
case mapMaybe pprintDep pDeps of
957+
pprintException (DependencyPlanFailures pkg pDeps) =
958+
case mapMaybe pprintDep (Map.toList pDeps) of
948959
[] -> Nothing
949960
depErrors -> Just $
950961
"In the dependencies for" <+> pkgIdent <>
@@ -961,9 +972,12 @@ pprintExceptions exceptions stackYaml parentMap wanted =
961972
[pkgIdent]
962973
where
963974
pkgIdent = displayCurrentPkgId (packageIdentifier pkg)
964-
-- TODO: optionally show these?
965-
-- Skip these because they are redundant with 'NotInBuildPlan' info.
966-
pprintException (UnknownPackage _) = Nothing
975+
-- Skip these when they are redundant with 'NotInBuildPlan' info.
976+
pprintException (UnknownPackage name)
977+
| name `Set.member` allNotInBuildPlan = Nothing
978+
| name `HashSet.member` wiredInPackages =
979+
Just $ "Can't build a package with same name as a wired-in-package:" <+> displayCurrentPkgName name
980+
| otherwise = Just $ "Unknown package:" <+> displayCurrentPkgName name
967981

968982
pprintFlags flags
969983
| Map.null flags = ""

0 commit comments

Comments
 (0)