Skip to content

Commit

Permalink
Merge pull request #7380 from haskell/mergify/bp/3.6/pr-7378
Browse files Browse the repository at this point in the history
 Fix --only-download making install fail (backport #7378)
  • Loading branch information
emilypi authored May 4, 2021
2 parents 5771a24 + 7fd9b25 commit 795d57c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
12 changes: 5 additions & 7 deletions cabal-install/src/Distribution/Client/CmdInstall.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE ViewPatterns #-}

-- | cabal-install CLI command: build
--
Expand Down Expand Up @@ -46,7 +45,8 @@ import Distribution.Types.PackageId
import Distribution.Client.ProjectConfig
( ProjectPackageLocation(..)
, fetchAndReadSourcePackages
)
, projectConfigWithBuilderRepoContext
, resolveBuildTimeSettings, withProjectOrGlobalConfig )
import Distribution.Client.NixStyleOptions
( NixStyleFlags (..), nixStyleOptions, defaultNixStyleFlags )
import Distribution.Client.ProjectFlags (ProjectFlags (..))
Expand Down Expand Up @@ -78,9 +78,6 @@ import Distribution.Solver.Types.PackageConstraint
( PackageProperty(..) )
import Distribution.Client.IndexUtils
( getSourcePackages, getInstalledPackages )
import Distribution.Client.ProjectConfig
( projectConfigWithBuilderRepoContext
, resolveBuildTimeSettings, withProjectOrGlobalConfig )
import Distribution.Client.ProjectPlanning
( storePackageInstallDirs' )
import Distribution.Client.ProjectPlanning.Types
Expand Down Expand Up @@ -382,10 +379,11 @@ installAction flags@NixStyleFlags { extraFlags = clientInstallFlags', .. } targe
-- Now that we built everything we can do the installation part.
-- First, figure out if / what parts we want to install:
let
dryRun = buildSettingDryRun $ buildSettings baseCtx
dryRun = buildSettingDryRun (buildSettings baseCtx)
|| buildSettingOnlyDownload (buildSettings baseCtx)

-- Then, install!
when (not dryRun) $
unless dryRun $
if installLibs
then installLibraries verbosity
buildCtx compiler packageDbs progDb envFile nonGlobalEnvEntries
Expand Down
8 changes: 8 additions & 0 deletions cabal-install/src/Distribution/Client/ProjectBuilding.hs
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,14 @@ rebuildTarget verbosity
sharedPackageConfig
plan rpkg@(ReadyPackage pkg)
pkgBuildStatus
-- Technically, doing the --only-download filtering only in this function is
-- not perfect. We could also prune the plan at an earlier stage, like it's
-- done with --only-dependencies. But...
-- * the benefit would be minimal (practically just avoiding to print the
-- "requires build" parts of the plan)
-- * we currently don't have easy access to the BuildStatus of packages
-- in the pruning phase
-- * we still have to check it here to avoid performing successive phases
| buildSettingOnlyDownload buildSettings = do
case pkgBuildStatus of
BuildStatusDownload ->
Expand Down

0 comments on commit 795d57c

Please sign in to comment.