Merge pull request #4774 from DomT4/GOCACHE

go: support & use aggressive caching
This commit is contained in:
Dominyk Tiller 2018-08-30 04:44:37 +01:00 committed by GitHub
commit baab9d841f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 1 deletions

View File

@ -36,7 +36,7 @@ module CleanupRefinement
end
def nested_cache?
directory? && %w[glide_home java_cache npm_cache gclient_cache].include?(basename.to_s)
directory? && %w[go_cache glide_home java_cache npm_cache gclient_cache].include?(basename.to_s)
end
def prune?(days)

View File

@ -1678,6 +1678,7 @@ class Formula
PATH: PATH.new(ENV["PATH"], HOMEBREW_PREFIX/"bin"),
HOMEBREW_PATH: nil,
_JAVA_OPTIONS: "#{ENV["_JAVA_OPTIONS"]} -Duser.home=#{HOMEBREW_CACHE}/java_cache",
GOCACHE: "#{HOMEBREW_CACHE}/go_cache",
}
ENV.clear_sensitive_environment!
@ -2029,6 +2030,7 @@ class Formula
stage_env[:HOME] = env_home
stage_env[:_JAVA_OPTIONS] =
"#{ENV["_JAVA_OPTIONS"]} -Duser.home=#{HOMEBREW_CACHE}/java_cache"
stage_env[:GOCACHE] = "#{HOMEBREW_CACHE}/go_cache"
stage_env[:CURL_HOME] = ENV["CURL_HOME"] || ENV["HOME"]
end

View File

@ -225,6 +225,15 @@ describe Homebrew::Cleanup do
expect(incomplete).not_to exist
end
it "cleans up 'go_cache'" do
go_cache = (HOMEBREW_CACHE/"go_cache")
go_cache.mkpath
subject.cleanup_cache
expect(go_cache).not_to exist
end
it "cleans up 'glide_home'" do
glide_home = (HOMEBREW_CACHE/"glide_home")
glide_home.mkpath