summaryrefslogtreecommitdiffstats
path: root/src/engine/SCons/Node
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2004-04-17 12:34:55 (GMT)
committerSteven Knight <knight@baldmt.com>2004-04-17 12:34:55 (GMT)
commit2b875f31e86ca90efb76fd81009876fc57266d31 (patch)
treee89b0387d2448f33c7a1dcf1cc47d12f584787fa /src/engine/SCons/Node
parente29523e3a4612eb77695d921d2bbbfbb6f2dd2e0 (diff)
downloadSCons-2b875f31e86ca90efb76fd81009876fc57266d31.zip
SCons-2b875f31e86ca90efb76fd81009876fc57266d31.tar.gz
SCons-2b875f31e86ca90efb76fd81009876fc57266d31.tar.bz2
Add the highly anticipated --debug=explain option to provide build reasoning.
Diffstat (limited to 'src/engine/SCons/Node')
-rw-r--r--src/engine/SCons/Node/FS.py16
-rw-r--r--src/engine/SCons/Node/FSTests.py10
-rw-r--r--src/engine/SCons/Node/NodeTests.py38
-rw-r--r--src/engine/SCons/Node/__init__.py45
4 files changed, 79 insertions, 30 deletions
diff --git a/src/engine/SCons/Node/FS.py b/src/engine/SCons/Node/FS.py
index bb13afc..a349f77 100644
--- a/src/engine/SCons/Node/FS.py
+++ b/src/engine/SCons/Node/FS.py
@@ -1225,13 +1225,13 @@ class Dir(Base):
"""A directory does not get scanned."""
return None
- def set_bsig(self, bsig):
+ def set_binfo(self, bsig, bkids, bkidsigs, bact, bactsig):
"""A directory has no signature."""
- bsig = None
+ pass
def set_csig(self, csig):
"""A directory has no signature."""
- csig = None
+ pass
def get_contents(self):
"""Return aggregate contents of all our children."""
@@ -1363,8 +1363,12 @@ class File(Base):
def store_csig(self):
self.dir.sconsign().set_csig(self.name, self.get_csig())
- def store_bsig(self):
- self.dir.sconsign().set_bsig(self.name, self.get_bsig())
+ def store_binfo(self):
+ binfo = self.get_binfo()
+ apply(self.dir.sconsign().set_binfo, (self.name,) + binfo)
+
+ def get_stored_binfo(self):
+ return self.dir.sconsign().get_binfo(self.name)
def store_implicit(self):
self.dir.sconsign().set_implicit(self.name, self.implicit)
@@ -1613,7 +1617,7 @@ class File(Base):
# ...and they'd like a local copy.
LocalCopy(self, r, None)
self.set_bsig(bsig)
- self.store_bsig()
+ self.store_binfo()
return 1
self._rfile = self
return None
diff --git a/src/engine/SCons/Node/FSTests.py b/src/engine/SCons/Node/FSTests.py
index b1999e0..6fbcfdc 100644
--- a/src/engine/SCons/Node/FSTests.py
+++ b/src/engine/SCons/Node/FSTests.py
@@ -815,7 +815,7 @@ class FSTestCase(unittest.TestCase):
e8 = fs.Entry("e8")
assert e8.get_bsig() is None, e8.get_bsig()
assert e8.get_csig() is None, e8.get_csig()
- e8.set_bsig('xxx')
+ e8.set_binfo('xxx', [], [], [], [])
e8.set_csig('yyy')
assert e8.get_bsig() == 'xxx', e8.get_bsig()
assert e8.get_csig() == 'yyy', e8.get_csig()
@@ -823,7 +823,7 @@ class FSTestCase(unittest.TestCase):
f9 = fs.File("f9")
assert f9.get_bsig() is None, f9.get_bsig()
assert f9.get_csig() is None, f9.get_csig()
- f9.set_bsig('xxx')
+ f9.set_binfo('xxx', [], [], [], [])
f9.set_csig('yyy')
assert f9.get_bsig() == 'xxx', f9.get_bsig()
assert f9.get_csig() == 'yyy', f9.get_csig()
@@ -831,7 +831,7 @@ class FSTestCase(unittest.TestCase):
d10 = fs.Dir("d10")
assert d10.get_bsig() is None, d10.get_bsig()
assert d10.get_csig() is None, d10.get_csig()
- d10.set_bsig('xxx')
+ d10.set_binfo('xxx', [], [], [], [])
d10.set_csig('yyy')
assert d10.get_bsig() is None, d10.get_bsig()
assert d10.get_csig() is None, d10.get_csig()
@@ -1651,7 +1651,7 @@ class CacheDirTestCase(unittest.TestCase):
SCons.Sig.MD5.collect = my_collect
try:
f5 = fs.File("cd.f5")
- f5.set_bsig('a_fake_bsig')
+ f5.set_binfo('a_fake_bsig', [], [], [], [])
cp = f5.cachepath()
dirname = os.path.join('cache', 'A')
filename = os.path.join(dirname, 'a_fake_bsig')
@@ -1661,7 +1661,7 @@ class CacheDirTestCase(unittest.TestCase):
# Verify that no bsig raises an InternalERror
f6 = fs.File("cd.f6")
- f6.set_bsig(None)
+ f6.set_binfo(None, [], [], [], [])
exc_caught = 0
try:
cp = f6.cachepath()
diff --git a/src/engine/SCons/Node/NodeTests.py b/src/engine/SCons/Node/NodeTests.py
index 63b945f..e9d779c 100644
--- a/src/engine/SCons/Node/NodeTests.py
+++ b/src/engine/SCons/Node/NodeTests.py
@@ -344,18 +344,34 @@ class NodeTestCase(unittest.TestCase):
a = node.builder.get_actions()
assert isinstance(a[0], MyAction), a[0]
- def test_set_bsig(self):
- """Test setting a Node's signature
+ def test_set_binfo(self):
+ """Test setting a Node's build information
+ """
+ node = SCons.Node.Node()
+ node.set_binfo('www', ['w1'], ['w2'], 'w act', 'w actsig')
+ assert node.bsig == 'www', node.bsig
+ assert node.bkids == ['w1'], node.bkdids
+ assert node.bkidsigs == ['w2'], node.bkidsigs
+ assert node.bact == 'w act', node.bkdid
+ assert node.bactsig == 'w actsig', node.bkidsig
+
+ def test_get_binfo(self):
+ """Test fetching a Node's build information
"""
node = SCons.Node.Node()
- node.set_bsig('www')
- assert node.bsig == 'www'
+ node.set_binfo('yyy', ['y1'], ['y2'], 'y act', 'y actsig')
+ bsig, bkids, bkidsigs, bact, bactsig = node.get_binfo()
+ assert bsig == 'yyy', bsig
+ assert bkids == ['y1'], bkdids
+ assert bkidsigs == ['y2'], bkidsigs
+ assert bact == 'y act', bkdid
+ assert bactsig == 'y actsig', bkidsig
def test_get_bsig(self):
"""Test fetching a Node's signature
"""
node = SCons.Node.Node()
- node.set_bsig('xxx')
+ node.set_binfo('xxx', ['x1'], ['x2'], 'x act', 'x actsig')
assert node.get_bsig() == 'xxx'
def test_set_csig(self):
@@ -372,11 +388,11 @@ class NodeTestCase(unittest.TestCase):
node.set_csig('zzz')
assert node.get_csig() == 'zzz'
- def test_store_bsig(self):
- """Test calling the method to store a build signature
+ def test_store_binfo(self):
+ """Test calling the method to store build information
"""
node = SCons.Node.Node()
- node.store_bsig()
+ node.store_binfo()
def test_store_csig(self):
"""Test calling the method to store a content signature
@@ -907,7 +923,7 @@ class NodeTestCase(unittest.TestCase):
n = SCons.Node.Node()
n.set_state(3)
- n.set_bsig('bsig')
+ n.set_binfo('bbb', ['b1'], ['b2'], 'b act', 'b actsig')
n.set_csig('csig')
n.includes = 'testincludes'
n.found_include = {'testkey':'testvalue'}
@@ -917,6 +933,10 @@ class NodeTestCase(unittest.TestCase):
assert n.get_state() is None, n.get_state()
assert not hasattr(n, 'bsig'), n.bsig
+ assert not hasattr(n, 'bkids'), n.bkids
+ assert not hasattr(n, 'bkidsigs'), n.bkidsigs
+ assert not hasattr(n, 'bact'), n.bact
+ assert not hasattr(n, 'bactsig'), n.bactsig
assert not hasattr(n, 'csig'), n.csig
assert n.includes is None, n.includes
assert n.found_includes == {}, n.found_includes
diff --git a/src/engine/SCons/Node/__init__.py b/src/engine/SCons/Node/__init__.py
index 861b554..a9581e4 100644
--- a/src/engine/SCons/Node/__init__.py
+++ b/src/engine/SCons/Node/__init__.py
@@ -205,7 +205,7 @@ class Node:
def built(self):
"""Called just after this node is sucessfully built."""
- self.store_bsig()
+ self.store_binfo()
# Clear out the implicit dependency caches:
# XXX this really should somehow be made more general and put
@@ -217,7 +217,7 @@ class Node:
def get_parents(node, parent): return node.get_parents()
def clear_cache(node, parent):
node.implicit = None
- node.del_bsig()
+ node.del_binfo()
w = Walker(self, get_parents, ignore_cycle, clear_cache)
while w.next(): pass
@@ -241,7 +241,7 @@ class Node:
builds).
"""
self.set_state(None)
- self.del_bsig()
+ self.del_binfo()
self.del_csig()
try:
delattr(self, '_calculated_sig')
@@ -402,7 +402,7 @@ class Node:
self.implicit = []
self.implicit_dict = {}
self._children_reset()
- self.del_bsig()
+ self.del_binfo()
build_env = self.get_build_env()
@@ -495,22 +495,47 @@ class Node:
"""Set the node's build signature (based on the signatures
of its dependency files and build information)."""
self.bsig = bsig
+
+ def get_binfo(self):
+ """Get the node's build signature (based on the signatures
+ of its dependency files and build information)."""
+ result = []
+ for attr in ['bsig', 'bkids', 'bkidsigs', 'bact', 'bactsig']:
+ try:
+ r = getattr(self, attr)
+ except AttributeError:
+ r = None
+ result.append(r)
+ return tuple(result)
+
+ def set_binfo(self, bsig, bkids, bkidsigs, bact, bactsig):
+ """Set the node's build signature (based on the signatures
+ of its dependency files and build information)."""
+ self.bsig = bsig
+ self.bkids = bkids
+ self.bkidsigs = bkidsigs
+ self.bact = bact
+ self.bactsig = bactsig
try:
delattr(self, '_tempbsig')
except AttributeError:
pass
- def store_bsig(self):
+ def store_binfo(self):
"""Make the build signature permanent (that is, store it in the
.sconsign file or equivalent)."""
pass
- def del_bsig(self):
+ def get_stored_binfo(self):
+ return (None, None, None, None, None)
+
+ def del_binfo(self):
"""Delete the bsig from this node."""
- try:
- delattr(self, 'bsig')
- except AttributeError:
- pass
+ for attr in ['bsig', 'bkids', 'bkidsigs', 'bact', 'bactsig']:
+ try:
+ delattr(self, attr)
+ except AttributeError:
+ pass
def get_csig(self):
"""Get the signature of the node's content."""