summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Tanner <ttanner2@bloomberg.net>2013-10-01 11:38:32 +0100
committerTom Tanner <ttanner2@bloomberg.net>2013-10-01 11:38:32 +0100
commit1a50903a2f142a5b087d59b6f94dca92cca8b0a2 (patch)
tree48289137aaf68513dab77985db2699bbd2b7e5c8
parent4dadb3d7c86ffe507f847f513e0a64addde3a1e4 (diff)
downloadscons-1a50903a2f142a5b087d59b6f94dca92cca8b0a2.tar.gz
support for --cache-readonly
Setting this will fetch data from the cache but won't update it.
-rw-r--r--doc/man/scons.xml23
-rw-r--r--src/engine/SCons/CacheDir.py8
-rw-r--r--src/engine/SCons/Script/Main.py1
-rw-r--r--src/engine/SCons/Script/SConsOptions.py7
4 files changed, 32 insertions, 7 deletions
diff --git a/doc/man/scons.xml b/doc/man/scons.xml
index 602bdbee..947d86d6 100644
--- a/doc/man/scons.xml
+++ b/doc/man/scons.xml
@@ -61,12 +61,12 @@
<releaseinfo>version &buildversion;</releaseinfo>
</referenceinfo>
-
+
<title>SCons &buildversion;</title>
<subtitle>MAN page</subtitle>
-
-
-<refentry id='scons1'>
+
+
+<refentry id='scons1'>
<refmeta>
<refentrytitle>SCONS</refentrytitle>
<manvolnum>1</manvolnum>
@@ -79,7 +79,7 @@
<!-- body begins here -->
<refsynopsisdiv id='synopsis'>
<cmdsynopsis>
- <command>scons</command>
+ <command>scons</command>
<arg choice='opt' rep='repeat'><replaceable>options</replaceable></arg>
<arg choice='opt' rep='repeat'><replaceable>name=val</replaceable></arg>
<arg choice='opt' rep='repeat'><replaceable>targets</replaceable></arg>
@@ -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
<option>--cache-force</option>,
<option>--cache-disable</option>,
+<option>--cache-readonly</option>,
and
<option>--cache-show</option>
command-line options. The
@@ -542,6 +543,15 @@ option.</para>
</listitem>
</varlistentry>
+<varlistentry>
+ <term>--cache-readonly</term>
+ <listitem>
+<para>Use the cache (if enabled) for reading, but do not not update the
+cache with changed files.
+</para>
+
+ </listitem>
+ </varlistentry>
<varlistentry>
<term>--cache-show</term>
<listitem>
@@ -1094,6 +1104,7 @@ command:</para>
--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
<emphasis role="bold">$MYPATH</emphasis>
construction variable. It lets SCons detect the file
<emphasis role="bold">incs/foo.inc</emphasis>
-, even if
+, even if
<emphasis role="bold">foo.x</emphasis>
contains the line
<emphasis role="bold">include foo.inc</emphasis>
diff --git a/src/engine/SCons/CacheDir.py b/src/engine/SCons/CacheDir.py
index 3516018b..9dd18e50 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 837c1039..fea0916c 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 c1f389a6..62033ba1 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",