Re: SConsignFile(None) + Decider('MD5-timestamp')
trevor fitzsimmons <[email protected]>
| Newsgroups | gmane.comp.programming.tools.scons.user |
|---|---|
| Message-ID | <BLAPR19MB42276F468098FF5EBFCB3CCE96420@BLAPR19MB4227.namprd19.prod.outlook.com> |
I've dug more into this issue, and have attached a proposed patch against scons-4.0.1. The general idea is to pass the parent node to _build_dependency_map, to then correlate "children" to signatures the same way Node/__init__.py changed() does, rather than using bsources/etc. This fixes the pathing issues, and should perform the same when building from the same directory repeatedly. Can anyone verify the bug, or provide feedback on the proposed patch? Should I open a bug report instead? Thanks, Trevor ________________________________ From: Scons-users <[email protected]> on behalf of trevor fitzsimmons <[email protected]> Sent: Wednesday, July 29, 2020 11:52 AM To: [email protected] <[email protected]> Subject: [Scons-users] SConsignFile(None) + Decider('MD5-timestamp') Since scons-3.0.2 (through the current scons-4.0.1), using SConsignFile(None) in conjunction with Decider('MD5-timestamp') causes scons to rebuild targets when invoked from different directories in the source code hierarchy. Attached is a simple example to illustrate the issue. Building from test/src will cause an initial build as expecting. Building again from test/src will do nothing, as expected, and report everything is up-to-date. However, if you build from test, everything in test/src will be rebuilt, even though it is already up-to-date. Building again from test will do nothing, as expected, and report everything is up-to-date. Building from test/src will then cause another full rebuild, even though everything is up-to-date, and the cycle continues. This has something to do with the dependency_map which was added in Node/FS.py in scons-3.0.2, but I do not know enough about the inner workings of scons to propose a fix. FS.py changed_timestamp_then_content(self, target, prev_ni, node=None) calls prev_ni = self._get_previous_signatures(dependency_map). Depending on the starting directory, self is either main.cpp or src/main.cpp, while the key in dependency_map is the other. In our full code-base, it's quite usual to build in a subdirectory while changing code, to avoid waiting on a full build, so the current work-around is to not use Decider('MD5-timestamp'). It would be ideal to have a patch that could eventually be applied to scons, to fix the issue in a future version. Thanks _______________________________________________ Scons-users mailing list [email protected] https://pairlist4.pair.net/mailman/listinfo/scons-users
md5_timestamp_stop_unnecessary_rebuilds.patch
(text/x-patch, 1.4 KB)
--- FS.py 2020-08-12 08:33:01.907999875 -0400
+++ FS_new.py 2020-08-12 08:32:49.311341846 -0400
@@ -3310,7 +3310,7 @@
__dmap_sig_cache = {}
- def _build_dependency_map(self, binfo):
+ def _build_dependency_map(self, binfo, node):
"""
Build mapping from file -> signature
@@ -3322,13 +3322,16 @@
dictionary of file->signature mappings
"""
+ if node is None:
+ node = self
+
# For an "empty" binfo properties like bsources
# do not exist: check this to avoid exception.
if (len(binfo.bsourcesigs) + len(binfo.bdependsigs) +
len(binfo.bimplicitsigs)) == 0:
return {}
- binfo.dependency_map = { child:signature for child, signature in zip(chain(binfo.bsources, binfo.bdepends, binfo.bimplicit),
+ binfo.dependency_map = { child:signature for child, signature in zip(node.children(),
chain(binfo.bsourcesigs, binfo.bdependsigs, binfo.bimplicitsigs))}
return binfo.dependency_map
@@ -3456,7 +3459,7 @@
try:
dependency_map = bi.dependency_map
except AttributeError as e:
- dependency_map = self._build_dependency_map(bi)
+ dependency_map = self._build_dependency_map(bi, node)
rebuilt = True
if len(dependency_map) == 0: