From 56875f9b7463ebb9cd1478187d9cd3ca25fd40d2 Mon Sep 17 00:00:00 2001 From: Tom Tanner Date: Tue, 1 Oct 2013 11:38:32 +0100 Subject: support for --cache-readonly Setting this will fetch data from the cache but won't update it. --- doc/man/scons.xml | 23 +++++++++++++++++------ src/engine/SCons/CacheDir.py | 8 +++++++- src/engine/SCons/Script/Main.py | 1 + src/engine/SCons/Script/SConsOptions.py | 7 +++++++ 4 files changed, 32 insertions(+), 7 deletions(-) diff --git a/doc/man/scons.xml b/doc/man/scons.xml index 602bdbe..947d86d 100644 --- a/doc/man/scons.xml +++ b/doc/man/scons.xml @@ -61,12 +61,12 @@ version &buildversion; - + SCons &buildversion; MAN page - - - + + + SCONS 1 @@ -79,7 +79,7 @@ - scons + scons options name=val targets @@ -381,6 +381,7 @@ will be retrieved from the cache instead of being rebuilt locally. Caching behavior may be disabled and controlled in other ways by the , , +, and command-line options. The @@ -542,6 +543,15 @@ option. + + --cache-readonly + +Use the cache (if enabled) for reading, but do not not update the +cache with changed files. + + + + --cache-show @@ -1094,6 +1104,7 @@ command: --cache-debug=FILE --cache-disable, --no-cache --cache-force, --cache-populate +--cache-readonly --cache-show --debug=TYPE -i, --ignore-errors @@ -6775,7 +6786,7 @@ specified in the $MYPATH construction variable. It lets SCons detect the file incs/foo.inc -, even if +, even if foo.x contains the line include foo.inc diff --git a/src/engine/SCons/CacheDir.py b/src/engine/SCons/CacheDir.py index 3516018..9dd18e5 100644 --- a/src/engine/SCons/CacheDir.py +++ b/src/engine/SCons/CacheDir.py @@ -37,6 +37,7 @@ cache_enabled = True cache_debug = False cache_force = False cache_show = False +cache_readonly = False def CacheRetrieveFunc(target, source, env): t = target[0] @@ -70,6 +71,8 @@ CacheRetrieve = SCons.Action.Action(CacheRetrieveFunc, CacheRetrieveString) CacheRetrieveSilent = SCons.Action.Action(CacheRetrieveFunc, None) def CachePushFunc(target, source, env): + if cache_readonly: return + t = target[0] if t.nocache: return @@ -150,6 +153,9 @@ class CacheDir(object): def is_enabled(self): return (cache_enabled and not self.path is None) + def is_readonly(self): + return cache_readonly + def cachepath(self, node): """ """ @@ -201,7 +207,7 @@ class CacheDir(object): return False def push(self, node): - if not self.is_enabled(): + if self.is_readonly() or not self.is_enabled(): return return CachePush(node, [], node.get_build_env()) diff --git a/src/engine/SCons/Script/Main.py b/src/engine/SCons/Script/Main.py index 837c103..fea0916 100644 --- a/src/engine/SCons/Script/Main.py +++ b/src/engine/SCons/Script/Main.py @@ -1089,6 +1089,7 @@ def _build_targets(fs, options, targets, target_top): SCons.Node.FS.set_diskcheck(options.diskcheck) SCons.CacheDir.cache_enabled = not options.cache_disable + SCons.CacheDir.cache_readonly = options.cache_readonly SCons.CacheDir.cache_debug = options.cache_debug SCons.CacheDir.cache_force = options.cache_force SCons.CacheDir.cache_show = options.cache_show diff --git a/src/engine/SCons/Script/SConsOptions.py b/src/engine/SCons/Script/SConsOptions.py index c1f389a..62033ba 100644 --- a/src/engine/SCons/Script/SConsOptions.py +++ b/src/engine/SCons/Script/SConsOptions.py @@ -564,6 +564,11 @@ def Parser(version): action="store_true", help="Copy already-built targets into the CacheDir.") + op.add_option('--cache-readonly', + dest='cache_readonly', default=False, + action="store_true", + help="Do not update CacheDir with built targets.") + op.add_option('--cache-show', dest='cache_show', default=False, action="store_true", @@ -579,8 +584,10 @@ def Parser(version): if not value in c_options: raise OptionValueError(opt_invalid('config', value, c_options)) setattr(parser.values, option.dest, value) + opt_config_help = "Controls Configure subsystem: %s." \ % ", ".join(config_options) + op.add_option('--config', nargs=1, type="string", dest="config", default="auto", -- cgit v0.12