forked from haskell/cabal
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Apply local configuration to install targets
The target of `cabal install` is not considered to be a local package, which means local configuration (e.g. in cabal.project, or flags like --enable-profiling) does not apply to it. In 76670eb, we changed the behaviour to applying the local flags to cabal install targets, but it used the literal target string as a package name to which the flags were additionally applied. However, `cabal install` targets are NOT necessarily package names, so, e.g., if we did `cabal install exe:mycomp`, the local flags would not apply since "exe:mycomp" is not a recognized /package/. The solution is to parse the target selectors first, and apply the local flags to the package of the resolved targets. Fixes haskell#7297 haskell#8909 and the install part of haskell#7236
- Loading branch information
Showing
6 changed files
with
99 additions
and
9 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{-# LANGUAGE CPP #-} | ||
|
||
#ifdef HELLO | ||
main = putStrLn "hi" | ||
#endif |
44 changes: 44 additions & 0 deletions
44
cabal-testsuite/PackageTests/Install/T7297-8909-7236/cabal.out
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,44 @@ | ||
# cabal install | ||
Wrote tarball sdist to <ROOT>/cabal.dist/work/./dist/sdist/t7297-89097236a-1.0.tar.gz | ||
Resolving dependencies... | ||
Build profile: -w ghc-<GHCVER> -O1 | ||
In order, the following will be built: | ||
- t7297-89097236a-1.0 (exe:my-exe) (requires build) | ||
Warning: installdir is not defined. Set it in your cabal config file or use --installdir=<path>. Using default installdir: "<ROOT>/cabal.dist/home/.cabal/bin" | ||
Configuring t7297-89097236a-1.0... | ||
Preprocessing executable 'my-exe' for t7297-89097236a-1.0... | ||
Building executable 'my-exe' for t7297-89097236a-1.0... | ||
Installing executable my-exe 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. | ||
Warning: installdir is not defined. Set it in your cabal config file or use --installdir=<path>. Using default installdir: "<ROOT>/cabal.dist/home/.cabal/bin" | ||
Symlinking 'my-exe' to '<ROOT>/cabal.dist/home/.cabal/bin/my-exe' | ||
# cabal install | ||
Wrote tarball sdist to <ROOT>/cabal.dist/work/./dist/sdist/t7297-89097236a-1.0.tar.gz | ||
Resolving dependencies... | ||
Warning: installdir is not defined. Set it in your cabal config file or use --installdir=<path>. Using default installdir: "<ROOT>/cabal.dist/home/.cabal/bin" | ||
Warning: installdir is not defined. Set it in your cabal config file or use --installdir=<path>. Using default installdir: "<ROOT>/cabal.dist/home/.cabal/bin" | ||
Symlinking 'my-exe' to '<ROOT>/cabal.dist/home/.cabal/bin/my-exe' | ||
# cabal install | ||
Wrote tarball sdist to <ROOT>/cabal.dist/work/./dist/sdist/t7297-89097236a-1.0.tar.gz | ||
Resolving dependencies... | ||
Warning: installdir is not defined. Set it in your cabal config file or use --installdir=<path>. Using default installdir: "<ROOT>/cabal.dist/home/.cabal/bin" | ||
Warning: installdir is not defined. Set it in your cabal config file or use --installdir=<path>. Using default installdir: "<ROOT>/cabal.dist/home/.cabal/bin" | ||
Symlinking 'my-exe' to '<ROOT>/cabal.dist/home/.cabal/bin/my-exe' | ||
# cabal install | ||
Wrote tarball sdist to <ROOT>/cabal.dist/work/./dist/sdist/t7297-89097236a-1.0.tar.gz | ||
Resolving dependencies... | ||
Warning: installdir is not defined. Set it in your cabal config file or use --installdir=<path>. Using default installdir: "<ROOT>/cabal.dist/home/.cabal/bin" | ||
Warning: installdir is not defined. Set it in your cabal config file or use --installdir=<path>. Using default installdir: "<ROOT>/cabal.dist/home/.cabal/bin" | ||
Symlinking 'my-exe' to '<ROOT>/cabal.dist/home/.cabal/bin/my-exe' | ||
# cabal install | ||
Wrote tarball sdist to <ROOT>/cabal.dist/work/./dist/sdist/t7297-89097236a-1.0.tar.gz | ||
Resolving dependencies... | ||
Warning: installdir is not defined. Set it in your cabal config file or use --installdir=<path>. Using default installdir: "<ROOT>/cabal.dist/home/.cabal/bin" | ||
Warning: installdir is not defined. Set it in your cabal config file or use --installdir=<path>. Using default installdir: "<ROOT>/cabal.dist/home/.cabal/bin" | ||
Symlinking 'my-exe' to '<ROOT>/cabal.dist/home/.cabal/bin/my-exe' | ||
# cabal install | ||
Wrote tarball sdist to <ROOT>/cabal.dist/work/./dist/sdist/t7297-89097236a-1.0.tar.gz | ||
Resolving dependencies... | ||
Warning: installdir is not defined. Set it in your cabal config file or use --installdir=<path>. Using default installdir: "<ROOT>/cabal.dist/home/.cabal/bin" | ||
Warning: installdir is not defined. Set it in your cabal config file or use --installdir=<path>. Using default installdir: "<ROOT>/cabal.dist/home/.cabal/bin" | ||
Symlinking 'my-exe' to '<ROOT>/cabal.dist/home/.cabal/bin/my-exe' |
1 change: 1 addition & 0 deletions
1
cabal-testsuite/PackageTests/Install/T7297-8909-7236/cabal.project
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: . |
12 changes: 12 additions & 0 deletions
12
cabal-testsuite/PackageTests/Install/T7297-8909-7236/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,12 @@ | ||
import Test.Cabal.Prelude | ||
|
||
main = cabalTest $ do | ||
let commonOpts = ["--ghc-options=-DHELLO", "--overwrite-policy=always"] | ||
installWithTgt tgt = cabal "install" (tgt:commonOpts) | ||
|
||
cabal "install" commonOpts -- no target | ||
installWithTgt "t7297-89097236a" | ||
installWithTgt "exe:my-exe" | ||
installWithTgt "my-exe" | ||
installWithTgt "all" | ||
installWithTgt "all:exes" |
8 changes: 8 additions & 0 deletions
8
cabal-testsuite/PackageTests/Install/T7297-8909-7236/t7297-89097236a.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,8 @@ | ||
name: t7297-89097236a | ||
version: 1.0 | ||
build-type: Simple | ||
cabal-version: >= 1.2 | ||
|
||
executable my-exe | ||
main-is: Main.hs | ||
build-depends: base |