Skip to content

Commit

Permalink
Delete unpacked upstream pkg when done building #3018
Browse files Browse the repository at this point in the history
  • Loading branch information
mgsloan committed Mar 10, 2017
1 parent 5c9ca3c commit d3a10bf
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/Stack/Build/Execute.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1388,6 +1388,15 @@ singleBuild runInBase ac@ActionContext {..} ee@ExecuteEnv {..} task@Task {..} in
mpkgid (packageExes package)
Local -> return ()

case taskType of
-- For upstream packages, pkgDir is in the tmp directory. We
-- eagerly delete it if no other tasks require it, to reduce
-- space usage in tmp (#3018).
TTUpstream{} -> do
let remaining = filter (\(ActionId x _) -> x == taskProvides) (Set.toList acRemaining)
when (null remaining) $ removeDirRecur pkgDir
_ -> return ()

return mpkgid

loadInstalledPkg menv wc pkgDbs tvar name = do
Expand Down

0 comments on commit d3a10bf

Please sign in to comment.