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

Take extra program search paths into account when searching for VCS programs. #8538

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
15 changes: 10 additions & 5 deletions cabal-install/src/Distribution/Client/ProjectConfig.hs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ import Distribution.Client.Types.SourceRepo
import Distribution.Simple.Compiler
( Compiler, compilerInfo )
import Distribution.Simple.Program
( ConfiguredProgram(..) )
( Program(..), ConfiguredProgram(..), ProgramSearchPathEntry(..), findProgramOnSearchPath )
import Distribution.Simple.Setup
( Flag(Flag), toFlag, flagToMaybe, flagToList
, fromFlag, fromFlagOrDefault )
Expand Down Expand Up @@ -1139,11 +1139,16 @@ syncAndReadSourcePackagesRemoteRepos verbosity
[ ((rtype, rloc), [(repo, vcsRepoType vcs)])
| (repo, rloc, rtype, vcs) <- repos' ]

--TODO: pass progPathExtra on to 'configureVCS'
let _progPathExtra = fromNubList projectConfigProgPathExtra
let progPathExtra = fromNubList projectConfigProgPathExtra
getConfiguredVCS <- delayInitSharedResources $ \repoType ->
let vcs = Map.findWithDefault (error $ "Unknown VCS: " ++ prettyShow repoType) repoType knownVCSs in
configureVCS verbosity {-progPathExtra-} vcs
let vcs = Map.findWithDefault (error $ "Unknown VCS: " ++ prettyShow repoType) repoType knownVCSs
vcsProgramName = programName (vcsProgram vcs)
vcs2 = vcs {vcsProgram = (vcsProgram vcs) {programFindLocation = findProgramOnExtraPath}}
findProgramOnExtraPath v p = do
r1 <- findProgramOnSearchPath v (map ProgramSearchPathDir progPathExtra) vcsProgramName
r2 <- findProgramOnSearchPath v p vcsProgramName
return (r1 <|> r2)
in configureVCS verbosity vcs2

concat <$> sequenceA
[ rerunIfChanged verbosity monitor repoGroup' $ do
Expand Down
3 changes: 3 additions & 0 deletions changelog.d/pr-8538
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
synopsis: Look into ~/.cabal/bin when searching for VCS programs
packages: cabal-install
prs: #8538