Skip to content

Commit

Permalink
Merge pull request #4676 from commercialhaskell/3861-ignore-globals-i…
Browse files Browse the repository at this point in the history
…n-snapshot-plan

Ignore dependencies in snapshot
  • Loading branch information
snoyberg authored Apr 1, 2019
2 parents cde979b + 99ed9a4 commit 7010953
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/Stack/Build/ConstructPlan.hs
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,11 @@ import RIO.Process (findExecutable, HasProcessContext (..))
data PackageInfo
=
-- | This indicates that the package is already installed, and
-- that we shouldn't build it from source. This is always the case
-- for snapshot packages.
-- that we shouldn't build it from source. This is only the case
-- for global packages.
PIOnlyInstalled InstallLocation Installed
-- | This indicates that the package isn't installed, and we know
-- where to find its source (either a hackage package or a local
-- directory).
-- where to find its source.
| PIOnlySource PackageSource
-- | This indicates that the package is installed and we know
-- where to find its source. We may want to reinstall from source.
Expand Down Expand Up @@ -701,16 +700,12 @@ addPackageDeps package = do
warn_ " (allow-newer enabled)"
return True
else do
-- TODO: dependencies between snapshot packages are allowed
-- to ignore bounds, MSS told an idea to tag explicitly
-- dependencies for which bounds could be ignored and why,
-- this needs to be explored,
-- the current designed is based on #3185 for Stackage
-- We ignore dependency information for packages in a snapshot
x <- inSnapshot (packageName package) (packageVersion package)
y <- inSnapshot depname (adrVersion adr)
if x && y
then do
warn_ " (trusting snapshot over Hackage revisions)"
warn_ " (trusting snapshot over cabal file dependency information)"
return True
else return False
if inRange
Expand Down Expand Up @@ -950,7 +945,7 @@ stripNonDeps deps plan = plan
modify'(<> Set.singleton pid)
mapM_ (collectMissing (pid:dependents)) (fromMaybe mempty $ M.lookup pid missing)

-- | Is the given package/version combo defined in the snapshot?
-- | Is the given package/version combo defined in the snapshot or in the global database?
inSnapshot :: PackageName -> Version -> M Bool
inSnapshot name version = do
ctx <- ask
Expand All @@ -961,6 +956,11 @@ inSnapshot name version = do
return $ srcVersion == version
PIBoth (PSRemote _ srcVersion FromSnapshot _) _ ->
return $ srcVersion == version
-- OnlyInstalled occurs for global database
PIOnlyInstalled loc (Library pid _gid _lic) ->
assert (loc == Snap) $
assert (pkgVersion pid == version) $
Just True
_ -> return False

data ConstructPlanException
Expand Down

0 comments on commit 7010953

Please sign in to comment.