summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/man/scons.xml10
-rw-r--r--src/CHANGES.txt7
-rw-r--r--src/engine/SCons/CacheDir.py24
-rw-r--r--src/engine/SCons/Warnings.py4
4 files changed, 39 insertions, 6 deletions
diff --git a/doc/man/scons.xml b/doc/man/scons.xml
index 5c832c2a..59ac6785 100644
--- a/doc/man/scons.xml
+++ b/doc/man/scons.xml
@@ -1707,6 +1707,16 @@ specifies the type of warnings to be enabled or disabled:</para>
</listitem>
</varlistentry>
<varlistentry>
+ <term>--warn=cache-v1, --warn=no-cache-v1</term>
+ <listitem>
+<para>Enables or disables warnings about the cache directory being in the
+original (v1) layout.
+<emphasis role="bold">CacheDir</emphasis>().
+These warnings are enabled by default.</para>
+
+ </listitem>
+ </varlistentry>
+ <varlistentry>
<term>--warn=cache-write-error, --warn=no-cache-write-error</term>
<listitem>
<para>Enables or disables warnings about errors trying to
diff --git a/src/CHANGES.txt b/src/CHANGES.txt
index dc8a281f..52cff625 100644
--- a/src/CHANGES.txt
+++ b/src/CHANGES.txt
@@ -6,6 +6,13 @@
RELEASE VERSION/DATE TO BE FILLED IN LATER
+ From Tom Tanner:
+ - change cache to use 2 character subdirectories, rather than one character.
+ For existing caches, you will need to run the scons-rename-cachedirs.py
+ script to update them to the new format. You will get a warning for this
+ every time you build.
+ - Fix a bunch of unit tests on windows
+
From Dirk Baechle:
- Removed a lot of compatibility methods and workarounds
for Python versions < 2.7, in order to prepare the work
diff --git a/src/engine/SCons/CacheDir.py b/src/engine/SCons/CacheDir.py
index 728871fa..5b60bae8 100644
--- a/src/engine/SCons/CacheDir.py
+++ b/src/engine/SCons/CacheDir.py
@@ -129,6 +129,10 @@ def CachePushFunc(target, source, env):
CachePush = SCons.Action.Action(CachePushFunc, None)
+# Nasty hack to cut down to one warning for each cachedir path that needs
+# upgrading.
+warned = dict()
+
class CacheDir(object):
def __init__(self, path):
@@ -147,8 +151,8 @@ class CacheDir(object):
# See if there's a config file in the cache directory
config_file = os.path.join(path, 'config')
if not os.path.exists(config_file):
- # If the directory exists we're likely version 1, otherwise
- # assume we're latest.
+ # If the directory exists and is not empty, we're likely version 1.
+ #
# A note: There is a race hazard here, if two processes start and
# attempt to create the cache directory at the same time. However,
# python doesn't really give you the option to do exclusive file
@@ -157,16 +161,26 @@ class CacheDir(object):
# as an attempt to alleviate this, on the basis that it's a pretty
# unlikely occurence (it'd require two builds with a brand new cache
# directory)
- if os.path.isdir(path):
+ if os.path.isdir(path) and len(os.listdir(path)) != 0:
self.config['prefix_len'] = 1
- else:
- os.makedirs(path)
+ else:
+ if not os.path.isdir(path):
+ os.makedirs(path)
self.config['prefix_len'] = 2
if not os.path.exists(config_file):
with open(config_file, 'w') as config:
self.config = json.dump(self.config, config)
with open(config_file) as config:
self.config = json.load(config)
+ # When building the project I was testing this on, this was output
+ # over 20 times. That seems excessive
+ global warned
+ if self.config['prefix_len'] == 1 and self.path not in warned:
+ msg = "Please update your cache by going into " + self.path +\
+ " and running scons-rename-cachedirs.py"
+ SCons.Warnings.warn(SCons.Warnings.CacheV1Warning, msg)
+ warned[self.path] = True
+
def CacheDebug(self, fmt, target, cachefile):
if cache_debug != self.current_cache_debug:
diff --git a/src/engine/SCons/Warnings.py b/src/engine/SCons/Warnings.py
index 5c278252..16319b92 100644
--- a/src/engine/SCons/Warnings.py
+++ b/src/engine/SCons/Warnings.py
@@ -41,10 +41,12 @@ class WarningOnByDefault(Warning):
# NOTE: If you add a new warning class, add it to the man page, too!
-
class TargetNotBuiltWarning(Warning): # Should go to OnByDefault
pass
+class CacheV1Warning(WarningOnByDefault):
+ pass
+
class CacheWriteErrorWarning(Warning):
pass