diff options
| author | Ludwig Hähne <pankrat@tigris.org> | 2008-09-03 16:18:49 (GMT) |
|---|---|---|
| committer | Ludwig Hähne <pankrat@tigris.org> | 2008-09-03 16:18:49 (GMT) |
| commit | 43528ea6633d5d0d2005de38298b45d631642436 (patch) | |
| tree | 09549e9b8a8ce0dc9891a8b5d439895b8013b502 /src/engine/SCons/Node/FS.py | |
| parent | 9946a5cb4b0e73b12aaec78e2c25a4c3dc81a6a7 (diff) | |
| download | SCons-43528ea6633d5d0d2005de38298b45d631642436.zip SCons-43528ea6633d5d0d2005de38298b45d631642436.tar.gz SCons-43528ea6633d5d0d2005de38298b45d631642436.tar.bz2 | |
Issue 2177: Dir get_contents changed to return list of signatures
Diffstat (limited to 'src/engine/SCons/Node/FS.py')
| -rw-r--r-- | src/engine/SCons/Node/FS.py | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/src/engine/SCons/Node/FS.py b/src/engine/SCons/Node/FS.py index a2c7244..eda6e71 100644 --- a/src/engine/SCons/Node/FS.py +++ b/src/engine/SCons/Node/FS.py @@ -1593,9 +1593,24 @@ class Dir(Base): return None def get_contents(self): - """Return aggregate contents of all our children.""" - contents = map(lambda n: n.get_contents(), self.children()) - return string.join(contents, '') + """Return content signatures and names of all our children + separated by new-lines. Ensure that the nodes are sorted.""" + contents = [] + name_cmp = lambda a, b: cmp(a.name, b.name) + sorted_children = self.children()[:] + sorted_children.sort(name_cmp) + for node in sorted_children: + contents.append('%s %s\n' % (node.get_csig(), node.name)) + return string.join(contents, '') + + def get_csig(self): + """Compute the content signature for Directory nodes. In + general, this is not needed and the content signature is not + stored in the DirNodeInfo. However, if get_contents on a Dir + node is called which has a child directory, the child + directory should return the hash of its contents.""" + contents = self.get_contents() + return SCons.Util.MD5signature(contents) def do_duplicate(self, src): pass |
