Commits

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)

doc/man/scons.xml

 
     <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>
 <!-- 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>
 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
 
   </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>
 --cache-debug=FILE
 --cache-disable, --no-cache
 --cache-force, --cache-populate
+--cache-readonly
 --cache-show
 --debug=TYPE
 -i, --ignore-errors
 <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>

src/engine/SCons/CacheDir.py

 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:
         return
     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
         return CachePush(node, [], node.get_build_env())
 

src/engine/SCons/Script/Main.py

         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

src/engine/SCons/Script/SConsOptions.py

                   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",
         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",
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 ProjectModifiedEvent.java.
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.