diff options
author | Thomas Tanner <trtanner@btinternet.com> | 2016-01-30 22:35:38 (GMT) |
---|---|---|
committer | Thomas Tanner <trtanner@btinternet.com> | 2016-01-30 22:35:38 (GMT) |
commit | a88dd02a03343dd0a0e17f6ad589148bf77d0493 (patch) | |
tree | 45b4fbf27d5f1f074ba8b343378303513784225c /src/script | |
parent | b7bf26899595e90e1cc6937fb18fd5702bec8d8d (diff) | |
download | SCons-a88dd02a03343dd0a0e17f6ad589148bf77d0493.zip SCons-a88dd02a03343dd0a0e17f6ad589148bf77d0493.tar.gz SCons-a88dd02a03343dd0a0e17f6ad589148bf77d0493.tar.bz2 |
Change the cache to use the first two characters of the md5 for the directory
name (more smaller directories, because they tend to get huge otherwise)
Diffstat (limited to 'src/script')
-rw-r--r-- | src/script/scons-rename-cachedirs.py | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/src/script/scons-rename-cachedirs.py b/src/script/scons-rename-cachedirs.py new file mode 100644 index 0000000..dd76a42 --- /dev/null +++ b/src/script/scons-rename-cachedirs.py @@ -0,0 +1,62 @@ +#! /usr/bin/env python
+#
+# SCons - a Software Constructor
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+__version__ = "__VERSION__"
+
+__build__ = "__BUILD__"
+
+__buildsys__ = "__BUILDSYS__"
+
+__date__ = "__DATE__"
+
+__developer__ = "__DEVELOPER__"
+
+import glob
+import os
+
+# The entire purpose of this script is to rename the files in the specified
+# cache directory from the 16 single hex digit directories to 256 2 hex digit
+# directories.
+
+# You run this in the cache directory.
+expected = ['{:X}'.format(x) for x in range(0, 16)]
+# check there are 16 directories, 0 - 9, A - F
+if sorted(glob.glob('*')) != [x]:
+ raise RuntimeError("This doesn't look like a cache directory")
+dirs = set()
+for file in glob.iglob(os.path.join('*', '*')):
+ name = os.path.basename(file)
+ dir = name[:2].upper()
+ print dir, name
+ if dir not in dirs:
+ os.mkdir(dir)
+ dirs.add(dir)
+ os.rename(file, os.path.join(dir, name))
+
+ # Now delete the original directories
+ for dir in expected:
+ os.rmdir(dir)
\ No newline at end of file |