Tom Tanner committed 7af2258

support for --cache-readonly
Setting this will fetch data from the cache but won't update it.

Comments (0)

Files changed (4)


     <releaseinfo>version &buildversion;</releaseinfo>
   <title>SCons &buildversion;</title>
   <subtitle>MAN page</subtitle>
-<refentry id='scons1'> 
+<refentry id='scons1'>
 <!-- body begins here -->
 <refsynopsisdiv id='synopsis'>
-  <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>
 Caching behavior may be disabled and controlled in other ways by the
 command-line options.  The
+  <term>--cache-readonly</term>
+  <listitem>
+<para>Use the cache (if enabled) for reading, but do not not update the
+cache with changed files.
+  </listitem>
+  </varlistentry>
 --cache-disable, --no-cache
 --cache-force, --cache-populate
 -i, --ignore-errors
 <emphasis role="bold">$MYPATH</emphasis>
 construction variable. It lets SCons detect the file
 <emphasis role="bold">incs/</emphasis>
-, even if 
+, even if
 <emphasis role="bold">foo.x</emphasis>
 contains the line
 <emphasis role="bold">include</emphasis>


 cache_debug = False
 cache_force = False
 cache_show = False
+cache_readonly = False
 def CacheRetrieveFunc(target, source, env):
     t = target[0]
 CacheRetrieveSilent = SCons.Action.Action(CacheRetrieveFunc, None)
 def CachePushFunc(target, source, env):
+    if cache_readonly: return
     t = target[0]
     if t.nocache:
     def is_enabled(self):
         return (cache_enabled and not self.path is None)
+    def is_readonly(self):
+        return cache_readonly
     def cachepath(self, node):
         return False
     def push(self, node):
-        if not self.is_enabled():
+        if self.is_readonly() or not self.is_enabled():
         return CachePush(node, [], node.get_build_env())


     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


                   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.")
                   dest='cache_show', default=False,
         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)
                   nargs=1, type="string",
                   dest="config", default="auto",
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.