Skip to content
Snippets Groups Projects
Commit d95a13fc authored by Filippo Cremonese's avatar Filippo Cremonese
Browse files

Fixed component recursive hash computation

parent 46a31077
No related branches found
No related tags found
No related merge requests found
......@@ -243,19 +243,26 @@ def set_build_hash(build: "bld.Build"):
if build.recursive_hash is not None:
return
# The recursive hash of a build depends on all its configure and install dependencies
all_builds = {d.build for d in build.configure.external_dependencies}
# TODO: are install dependencies required to be part of the information to hash?
# In theory they should not influence the artifacts
all_builds.update({d.build for d in build.install.external_dependencies})
all_builds = {b for b in all_builds if b.component is not build.component}
# TODO: should all other builds from the same component be filtered out or just the very same build?
# all_builds = {b for b in all_builds if b.component is not build.component}
# Filter out the same build
all_builds = [b for b in all_builds if b != build]
# Ensure all dependencies hashes are computed
# Ensure the recursive hash of all dependencies is computed
for b in all_builds:
set_build_hash(b)
sorted_dependencies = [(b.qualified_name, b) for b in all_builds]
sorted_dependencies.sort()
# sorted_dependencies = [(b.qualified_name, b) for b in all_builds]
# sorted_dependencies.sort()
all_builds.sort(key=lambda b: b.qualified_name)
to_hash = build.self_hash
for _, b in sorted_dependencies:
to_hash += b.self_hash
for b in all_builds:
to_hash += b.recursive_hash
build.recursive_hash = hashlib.sha1(to_hash.encode("utf-8")).hexdigest()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment