Merge pull request #14816 from rraallvv/cache_2.1

Purge large files faster from SCons cache (2.1)
This commit is contained in:
Rémi Verschelde 2017-12-19 07:50:09 +01:00 committed by GitHub
commit 1d3a7c07ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 12 deletions

View File

@ -498,9 +498,9 @@ class cache_progress:
# decay since the ctime, and return a list with the entries # decay since the ctime, and return a list with the entries
# (filename, size, weight). # (filename, size, weight).
current_time = time.time() current_time = time.time()
file_stat = [(x[0], x[1][0], x[1][0] * math.exp(self.exponent_scale * (x[1][1] - current_time))) for x in file_stat] file_stat = [(x[0], x[1][0], (current_time - x[1][1])) for x in file_stat]
# Sort by highest weight (most sensible to keep) first # Sort by the most resently accessed files (most sensible to keep) first
file_stat.sort(key=lambda x: x[2], reverse=True) file_stat.sort(key=lambda x: x[2])
# Search for the first entry where the storage limit is # Search for the first entry where the storage limit is
# reached # reached
sum, mark = 0, None sum, mark = 0, None

View File

@ -1657,16 +1657,16 @@ def precious_program(env, program, sources, **args):
return program return program
def add_shared_library(env, name, sources, **args): def add_shared_library(env, name, sources, **args):
library = env.SharedLibrary(name, sources, **args) library = env.SharedLibrary(name, sources, **args)
env.NoCache(library) env.NoCache(library)
return library return library
def add_library(env, name, sources, **args): def add_library(env, name, sources, **args):
library = env.Library(name, sources, **args) library = env.Library(name, sources, **args)
env.NoCache(library) env.NoCache(library)
return library return library
def add_program(env, name, sources, **args): def add_program(env, name, sources, **args):
program = env.Program(name, sources, **args) program = env.Program(name, sources, **args)
env.NoCache(program) env.NoCache(program)
return program return program