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.
Merge pull request haskell#10056 from wismill/install/fix-program-suffix
Fix --program-suffix resulting in invalid symlink
- Loading branch information
Showing
6 changed files
with
54 additions
and
1 deletion.
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 @@ | ||
main = pure () |
1 change: 1 addition & 0 deletions
1
cabal-testsuite/PackageTests/Install/ProgramAffixes/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: . |
27 changes: 27 additions & 0 deletions
27
cabal-testsuite/PackageTests/Install/ProgramAffixes/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,27 @@ | ||
import Test.Cabal.Prelude | ||
import Data.Foldable (traverse_) | ||
|
||
-- Test that program affixes options result in successful installation: | ||
-- • Valid symlinks (--install-method=symlink) | ||
-- • Valid copy of executables (--install-method=copy) | ||
main = cabalTest $ do | ||
env <- getTestEnv | ||
recordMode DoNotRecord $ do | ||
let installdir = testPrefixDir env </> "bin" | ||
commonOpts = ["p", "--installdir", installdir, "--overwrite-policy=always"] | ||
testAllAffixes installMethod = do | ||
let testAffixes' = testAffixes | ||
(commonOpts ++ ["--install-method", installMethod]) | ||
testAffixes' Nothing Nothing | ||
testAffixes' (Just "a-") Nothing | ||
testAffixes' Nothing (Just "-z") | ||
testAffixes' (Just "a-") (Just "-z") | ||
traverse_ testAllAffixes ["symlink", "copy"] | ||
where | ||
mkAffixOption option = maybe [] (\a -> ["--program-" ++ option, a]) | ||
mkProgramName p s = maybe [] id p ++ "p" ++ maybe [] id s | ||
testAffixes commonOpts prefix suffix = do | ||
cabal "install" ( commonOpts | ||
++ mkAffixOption "prefix" prefix | ||
++ mkAffixOption "suffix" suffix) | ||
runInstalledExe (mkProgramName prefix suffix) [] |
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: p | ||
version: 1.0 | ||
build-type: Simple | ||
cabal-version: >= 1.2 | ||
|
||
executable p | ||
main-is: Main.hs | ||
build-depends: base |
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 @@ | ||
synopsis: Fix --program-suffix resulting in invalid installation | ||
packages: cabal-install | ||
issues: #8823 #9919 | ||
prs: #10056 |