diff options
author | Andrew Morrow <acm@mongodb.com> | 2017-04-20 15:23:35 -0400 |
---|---|---|
committer | Andrew Morrow <acm@mongodb.com> | 2017-04-21 13:33:29 -0400 |
commit | ab0fc1ebb4df846367d409e0223a085e0db1b98e (patch) | |
tree | 1f08cfda2a039651bc7fb9846062898b8328dafc | |
parent | 49140247ca85644438e7394b6950f7687fbd4c91 (diff) | |
download | mongo-ab0fc1ebb4df846367d409e0223a085e0db1b98e.tar.gz |
SERVER-28888 Ensure scanner stability across rebuilds
Also, a quick fix to eliminate a needless sort, since Node.sources
is expected to be stable across rebuilds, unlike Node.sources_set
-rw-r--r-- | site_scons/libdeps.py | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/site_scons/libdeps.py b/site_scons/libdeps.py index 07857d7d3c9..adba8dae77c 100644 --- a/site_scons/libdeps.py +++ b/site_scons/libdeps.py @@ -73,16 +73,6 @@ class dependency(object): self.target_node = value self.dependency_type = dependency.Public -def sorted_by_str(iterable): - """Shorthand for sorting an iterable according to its string representation. - - We use this instead of sorted(), below, because SCons.Node objects are - compared on object identity, rather than value, so sorts aren't stable - across invocations of SCons. Since dependency order changes force rebuilds, - we use this sort to create stable dependency orders. - """ - return sorted(iterable, key=str) - class DependencyCycleError(SCons.Errors.UserError): """Exception representing a cycle discovered in library dependencies.""" @@ -183,9 +173,9 @@ def update_scanner(builder): if old_scanner: path_function = old_scanner.path_function def new_scanner(node, env, path=()): - result = set(old_scanner.function(node, env, path)) - result.update(__get_libdeps(node)) - return list(result) + result = old_scanner.function(node, env, path) + result.extend(__get_libdeps(node)) + return result else: path_function = None def new_scanner(node, env, path=()): @@ -204,10 +194,11 @@ def get_libdeps(source, target, env, for_signature): return __get_libdeps(target[0]) def get_libdeps_objs(source, target, env, for_signature): - objs = set() + objs = [] for lib in get_libdeps(source, target, env, for_signature): - objs.update(lib.sources_set) - return sorted_by_str(objs) + # This relies on Node.sources being order stable build-to-build. + objs.extend(lib.sources) + return objs def get_syslibdeps(source, target, env, for_signature): deps = __get_syslibdeps(target[0]) |