Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prepend rather than append extra prog path #8506

Merged
merged 9 commits into from
Jan 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cabal/src/Distribution/Simple/Configure.hs
Original file line number Diff line number Diff line change
Expand Up @@ -850,9 +850,9 @@ mkProgramDb cfg initialProgramDb = programDb
. userSpecifyPaths (configProgramPaths cfg)
. setProgramSearchPath searchpath
$ initialProgramDb
searchpath = getProgramSearchPath initialProgramDb
++ map ProgramSearchPathDir
searchpath = map ProgramSearchPathDir
(fromNubList $ configProgramPathExtra cfg)
++ getProgramSearchPath initialProgramDb

-- -----------------------------------------------------------------------------
-- Helper functions for configure
Expand Down
4 changes: 2 additions & 2 deletions cabal-install/src/Distribution/Client/ProjectPlanning.hs
Original file line number Diff line number Diff line change
Expand Up @@ -446,8 +446,8 @@ configureCompiler verbosity
progdb =
userSpecifyPaths (Map.toList (getMapLast packageConfigProgramPaths))
. modifyProgramSearchPath
(++ [ ProgramSearchPathDir dir
| dir <- fromNubList packageConfigProgramPathExtra ])
([ ProgramSearchPathDir dir
| dir <- fromNubList packageConfigProgramPathExtra ] ++)
$ defaultProgramDb


Expand Down
1 change: 1 addition & 0 deletions cabal-testsuite/PackageTests/ExtraProgPath/MyLibrary.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module MyLibrary () where
1 change: 1 addition & 0 deletions cabal-testsuite/PackageTests/ExtraProgPath/cabal.project
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
packages: *.cabal
20 changes: 20 additions & 0 deletions cabal-testsuite/PackageTests/ExtraProgPath/my.cabal
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: CheckExtraProgPath
version: 0.1
license: BSD3
license-file: LICENSE
author: Alexander Vershilov
maintainer: Alexander Vershilov
synopsis: Check Extra Prog Path
category: PackageTests
build-type: Simple
cabal-version: 2.0

description:
Check that Cabal recognizes an override of the prog path.

Library
pkgconfig-depends: zlib
default-language: Haskell2010
build-depends: base <5.0
exposed-modules:
MyLibrary
3 changes: 3 additions & 0 deletions cabal-testsuite/PackageTests/ExtraProgPath/pkg-config
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/sh

exit 1;
11 changes: 11 additions & 0 deletions cabal-testsuite/PackageTests/ExtraProgPath/setup.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# cabal v2-build
Warning: cannot determine version of <ROOT>/./pkg-config :
""
Warning: cannot determine version of <ROOT>/./pkg-config :
""
Resolving dependencies...
Error: cabal: Could not resolve dependencies:
[__0] next goal: CheckExtraProgPath (user goal)
[__0] rejecting: CheckExtraProgPath-0.1 (conflict: pkg-config package zlib-any, not found in the pkg-config database)
[__0] fail (backjumping, conflict set: CheckExtraProgPath)
After searching the rest of the dependency tree exhaustively, these were the goals I've had most trouble fulfilling: CheckExtraProgPath (2)
8 changes: 8 additions & 0 deletions cabal-testsuite/PackageTests/ExtraProgPath/setup.test.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import Test.Cabal.Prelude

-- Test that extra-prog-path overrides the path for pkg-config
main = cabalTest $ do
-- skipped on windows because using a script to dummy up an executable doesn't work the same.
skipIfWindows
cdir <- testCurrentDir `fmap` getTestEnv
fails $ cabal "v2-build" ["--extra-prog-path="++cdir]
7 changes: 7 additions & 0 deletions changelog.d/pr-8506
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
synopsis: prepend rather than append extra prog path
packages: Cabal
prs: #8506
issues: #6304
description: {
Prepends the extra-prog-path to the system path rather than appending, to allow binaries in the extra path to override defaults.
}