From f247c0bf1da0773ce9179c6259c05a829b5e8558 Mon Sep 17 00:00:00 2001 From: Kleidukos <29253044+Kleidukos@users.noreply.github.com> Date: Wed, 12 Jul 2023 22:00:00 +0000 Subject: [PATCH] Don't add `extra-prog-path` to `~/.config/cabal/config` (#8951) (backport #8952) (#9050) Don't add `extra-prog-path` to `~/.config/cabal/config` (#8951) (when initially creating it) (cherry picked from commit ea55955edadcfab7a00c825db0dc5d9d17dbb69e) # Conflicts: # cabal-install/src/Distribution/Client/Config.hs * fix conflict * Merge branch '3.10' into mergify/bp/3.10/pr-8952 --- .../src/Distribution/Client/Config.hs | 50 ++++++++----------- cabal-install/tests/IntegrationTests2.hs | 2 +- .../IntegrationTests2/config/default-config | 2 +- changelog.d/issue-8951 | 3 ++ 4 files changed, 25 insertions(+), 32 deletions(-) create mode 100644 changelog.d/issue-8951 diff --git a/cabal-install/src/Distribution/Client/Config.hs b/cabal-install/src/Distribution/Client/Config.hs index d06a3ccf8ad..a0f65ec4d52 100644 --- a/cabal-install/src/Distribution/Client/Config.hs +++ b/cabal-install/src/Distribution/Client/Config.hs @@ -568,27 +568,27 @@ baseSavedConfig = do -- initialSavedConfig :: IO SavedConfig initialSavedConfig = do - cacheDir <- defaultCacheDir - logsDir <- defaultLogsDir - extraPath <- defaultExtraPath + cacheDir <- defaultCacheDir + logsDir <- defaultLogsDir installPath <- defaultInstallPath - return mempty { - savedGlobalFlags = mempty { - globalCacheDir = toFlag cacheDir, - globalRemoteRepos = toNubList [defaultRemoteRepo] - }, - savedConfigureFlags = mempty { - configProgramPathExtra = toNubList extraPath - }, - savedInstallFlags = mempty { - installSummaryFile = toNubList [toPathTemplate (logsDir "build.log")], - installBuildReports= toFlag NoReports, - installNumJobs = toFlag Nothing - }, - savedClientInstallFlags = mempty { - cinstInstalldir = toFlag installPath - } - } + return + mempty + { savedGlobalFlags = + mempty + { globalCacheDir = toFlag cacheDir + , globalRemoteRepos = toNubList [defaultRemoteRepo] + } + , savedInstallFlags = + mempty + { installSummaryFile = toNubList [toPathTemplate (logsDir "build.log")] + , installBuildReports = toFlag NoReports + , installNumJobs = toFlag Nothing + } + , savedClientInstallFlags = + mempty + { cinstInstalldir = toFlag installPath + } + } -- | Issue a warning if both @$XDG_CONFIG_HOME/cabal/config@ and -- @~/.cabal@ exists. @@ -674,16 +674,6 @@ defaultReportsDir :: IO FilePath defaultReportsDir = getDefaultDir XdgCache "reports" -defaultExtraPath :: IO [FilePath] -defaultExtraPath = do - mDir <- maybeGetCabalDir - case mDir of - Just dir -> - return [dir "bin"] - Nothing -> do - dir <- getHomeDirectory - return [dir ".local" "bin"] - defaultInstallPath :: IO FilePath defaultInstallPath = do mDir <- maybeGetCabalDir diff --git a/cabal-install/tests/IntegrationTests2.hs b/cabal-install/tests/IntegrationTests2.hs index f2fdf2ea3df..3e3907035e1 100644 --- a/cabal-install/tests/IntegrationTests2.hs +++ b/cabal-install/tests/IntegrationTests2.hs @@ -2031,7 +2031,7 @@ testConfigOptionComments = do "-- extra-lib-dirs" @=? findLineWith True "extra-lib-dirs" defaultConfigFile "-- extra-lib-dirs-static" @=? findLineWith True "extra-lib-dirs-static" defaultConfigFile "-- extra-framework-dirs" @=? findLineWith True "extra-framework-dirs" defaultConfigFile - "extra-prog-path" @=? findLineWith False "extra-prog-path" defaultConfigFile + "-- extra-prog-path" @=? findLineWith False "extra-prog-path" defaultConfigFile "-- instantiate-with" @=? findLineWith True "instantiate-with" defaultConfigFile "-- tests" @=? findLineWith True "tests" defaultConfigFile "-- coverage" @=? findLineWith True "coverage" defaultConfigFile diff --git a/cabal-install/tests/IntegrationTests2/config/default-config b/cabal-install/tests/IntegrationTests2/config/default-config index 8e3aa02742c..fab39496295 100644 --- a/cabal-install/tests/IntegrationTests2/config/default-config +++ b/cabal-install/tests/IntegrationTests2/config/default-config @@ -63,7 +63,7 @@ remote-repo-cache: /home/colton/.cabal/packages -- extra-lib-dirs: -- extra-lib-dirs-static: -- extra-framework-dirs: -extra-prog-path: /home/colton/.cabal/bin +-- extra-prog-path: -- instantiate-with: -- tests: False -- coverage: False diff --git a/changelog.d/issue-8951 b/changelog.d/issue-8951 new file mode 100644 index 00000000000..38bc8c7503b --- /dev/null +++ b/changelog.d/issue-8951 @@ -0,0 +1,3 @@ +synopsis: Don't add `extra-prog-path: ~/.local/bin` when initially creating `~/.config/cabal/config` +packages: cabal-install +issues: #8951