-
Notifications
You must be signed in to change notification settings - Fork 698
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Find build-tool installed programs before programs in path
We must consider the path to the installed build-tool before the path to existing versions of the build tool in paths such as `extra-prog-path` or in the system path. This was previously fixed by #8972 but undone by #9527. This also renames `appendProgramSearchPath` to `prependProgramSearchPath` to describe correctly what that function does. Fixes #9756
- Loading branch information
Showing
21 changed files
with
144 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{-# LANGUAGE TemplateHaskell #-} | ||
module OK where | ||
|
||
import Data.List | ||
import System.Process | ||
import Language.Haskell.TH | ||
|
||
$(do | ||
out <- runIO $ readProcess "mybuilder" [] "" | ||
if "0.2.0.0" `isInfixOf` out then | ||
[d| x = () |] | ||
else | ||
error ("Expecting Version 0.2.0.0, but got: " ++ out) | ||
) |
10 changes: 10 additions & 0 deletions
10
cabal-testsuite/PackageTests/Regression/T9756/cabal-bug-build-tool.cabal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
cabal-version: 1.12 | ||
name: cabal-bug-build-tool | ||
version: 0 | ||
build-type: Simple | ||
|
||
library | ||
exposed-modules: OK | ||
default-language: Haskell2010 | ||
build-depends: base, template-haskell, process | ||
build-tool-depends: mybuilder:mybuilder >=0.2.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# cabal v2-update | ||
Downloading the latest package list from test-local-repo | ||
# cabal v2-install | ||
Resolving dependencies... | ||
Build profile: -w ghc-<GHCVER> -O1 | ||
In order, the following will be built: | ||
- mybuilder-0.1.0.0 (exe:mybuilder) (requires build) | ||
Configuring executable 'mybuilder' for mybuilder-0.1.0.0... | ||
Preprocessing executable 'mybuilder' for mybuilder-0.1.0.0... | ||
Building executable 'mybuilder' for mybuilder-0.1.0.0... | ||
Installing executable mybuilder in <PATH> | ||
Warning: The directory <ROOT>/cabal.dist/home/.cabal/store/ghc-<GHCVER>/incoming/new-<RAND><ROOT>/cabal.dist/home/.cabal/store/ghc-<GHCVER>/<PACKAGE>-<HASH>/bin is not in the system search path. | ||
Symlinking 'mybuilder' to '<ROOT>/cabal.dist/install/mybuilder' | ||
# cabal v2-build | ||
Resolving dependencies... | ||
Build profile: -w ghc-<GHCVER> -O1 | ||
In order, the following will be built: | ||
- mybuilder-0.2.0.0 (exe:mybuilder) (requires build) | ||
- cabal-bug-build-tool-0 (lib) (first run) | ||
Configuring executable 'mybuilder' for mybuilder-0.2.0.0... | ||
Preprocessing executable 'mybuilder' for mybuilder-0.2.0.0... | ||
Building executable 'mybuilder' for mybuilder-0.2.0.0... | ||
Installing executable mybuilder in <PATH> | ||
Warning: The directory <ROOT>/cabal.dist/home/.cabal/store/ghc-<GHCVER>/incoming/new-<RAND><ROOT>/cabal.dist/home/.cabal/store/ghc-<GHCVER>/<PACKAGE>-<HASH>/bin is not in the system search path. | ||
Configuring library for cabal-bug-build-tool-0... | ||
Preprocessing library for cabal-bug-build-tool-0... | ||
Building library for cabal-bug-build-tool-0... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
packages: . |
13 changes: 13 additions & 0 deletions
13
cabal-testsuite/PackageTests/Regression/T9756/cabal.test.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import Test.Cabal.Prelude | ||
|
||
-- We are testing if the build-tools program is found in path before programs e.g. in extra-prog-path or the system path | ||
-- For that, we need | ||
-- * A repo with a build tool that is up to date | ||
-- * An older version of the build tool in the extra-prog-path | ||
-- * A project that requires the more up-to-date version of the build-tool | ||
|
||
main = cabalTest $ withRepo "repo" $ do | ||
dir <- testWorkDir <$> getTestEnv | ||
cabal "v2-install" ["mybuilder-0.1.0.0", "--installdir=" ++ dir ++ "/install", "--overwrite-policy=always"] | ||
cabal "v2-build" ["cabal-bug-build-tool", "--extra-prog-path=" ++ dir ++ "/install"] | ||
|
5 changes: 5 additions & 0 deletions
5
cabal-testsuite/PackageTests/Regression/T9756/repo/mybuilder-0.1.0.0/CHANGELOG.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Revision history for mybuilder0100 | ||
|
||
## 0.1.0.0 -- YYYY-mm-dd | ||
|
||
* First version. Released on an unsuspecting world. |
4 changes: 4 additions & 0 deletions
4
cabal-testsuite/PackageTests/Regression/T9756/repo/mybuilder-0.1.0.0/app/Main.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module Main where | ||
|
||
main :: IO () | ||
main = putStrLn "0.1.0.0" |
18 changes: 18 additions & 0 deletions
18
cabal-testsuite/PackageTests/Regression/T9756/repo/mybuilder-0.1.0.0/mybuilder.cabal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
cabal-version: 3.0 | ||
name: mybuilder | ||
version: 0.1.0.0 | ||
license: NONE | ||
author: Rodrigo Mesquita | ||
maintainer: rodrigo.m.mesquita@gmail.com | ||
build-type: Simple | ||
extra-doc-files: CHANGELOG.md | ||
|
||
common warnings | ||
ghc-options: -Wall | ||
|
||
executable mybuilder | ||
import: warnings | ||
main-is: Main.hs | ||
build-depends: base | ||
hs-source-dirs: app | ||
default-language: Haskell2010 |
5 changes: 5 additions & 0 deletions
5
cabal-testsuite/PackageTests/Regression/T9756/repo/mybuilder-0.2.0.0/CHANGELOG.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Revision history for mybuilder0100 | ||
|
||
## 0.1.0.0 -- YYYY-mm-dd | ||
|
||
* First version. Released on an unsuspecting world. |
4 changes: 4 additions & 0 deletions
4
cabal-testsuite/PackageTests/Regression/T9756/repo/mybuilder-0.2.0.0/app/Main.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module Main where | ||
|
||
main :: IO () | ||
main = putStrLn "0.2.0.0" |
18 changes: 18 additions & 0 deletions
18
cabal-testsuite/PackageTests/Regression/T9756/repo/mybuilder-0.2.0.0/mybuilder.cabal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
cabal-version: 3.0 | ||
name: mybuilder | ||
version: 0.2.0.0 | ||
license: NONE | ||
author: Rodrigo Mesquita | ||
maintainer: rodrigo.m.mesquita@gmail.com | ||
build-type: Simple | ||
extra-doc-files: CHANGELOG.md | ||
|
||
common warnings | ||
ghc-options: -Wall | ||
|
||
executable mybuilder | ||
import: warnings | ||
main-is: Main.hs | ||
build-depends: base | ||
hs-source-dirs: app | ||
default-language: Haskell2010 |