Skip to content

Commit

Permalink
Add overlay file SHA's in setup file
Browse files Browse the repository at this point in the history
  • Loading branch information
revati-naik-apex committed Feb 25, 2025
1 parent 9c707dd commit 6f2706f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
10 changes: 6 additions & 4 deletions repos/config/detail/generate_ros2_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def get_sha256sum(file):
sha256_hash.update(byte_block)
return sha256_hash.hexdigest()

def print_setup(repos, output_file, repos_file, use_tar = False):
def print_setup(repos, output_file, repos_file, overlay_files, use_tar = False):
workspace_name = os.getenv("WORKSPACE_NAME", "Unknown")
BZL_CMD = f"bazel run @{workspace_name}//:repos_lock.update"
if use_tar:
Expand All @@ -34,6 +34,8 @@ def print_setup(repos, output_file, repos_file, use_tar = False):
# To update, call `{BZL_CMD}` with the right distro set in the WORKSPACE
#
# SHA256 of @{workspace_name}//:ros.repos: {get_sha256sum(repos_file)}
# SHA256 of overlays:
#{', '.join([f' @{workspace_name}//:{os.path.basename(overlay)}: {get_sha256sum(overlay)}' for overlay in overlay_files]) if overlay_files else ""}
load("@bazel_tools//tools/build_defs/repo:utils.bzl", _maybe = "maybe")
load("@rules_ros//repos/config/detail:git_repository.bzl", "git_repository")
Expand Down Expand Up @@ -127,9 +129,9 @@ def merge_dict(origin, to_add):
origin[key]=value


def print_setup_file(repos, yaml_files, output_file, repos_file, use_tar = False):
for input_path in yaml_files:
def print_setup_file(repos, overlay_files, output_file, repos_file, use_tar = False):
for input_path in overlay_files:
with (open(input_path,"r")) as repo_file:
merge_dict(repos, yaml.safe_load(repo_file)["repositories"])

print_setup(repos, output_file, repos_file, use_tar)
print_setup(repos, output_file, repos_file, overlay_files, use_tar)
2 changes: 1 addition & 1 deletion repos/config/detail/lock_repos.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def main():

with open(args.setup_bzl, mode='w', encoding='utf8') as setup_bzl:
print_setup_file(repos = repos["repositories"],
yaml_files=args.overlays,
overlay_files=args.overlays,
output_file=setup_bzl,
repos_file = args.repos,
use_tar=args.tar)
Expand Down
2 changes: 2 additions & 0 deletions repos/config/setup_humble.lock.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
# To update, call `bazel run @ros2_config//:repos_lock.update` with the right distro set in the WORKSPACE
#
# SHA256 of @ros2_config//:ros.repos: 09a14ede568810d8120e3f3228af03a35c192cff5c718422cb2d88c5cd4b2824
# SHA256 of overlays:
# @ros2_config//:overlay_0.bzl: 43155011b10a9af3dce4fa93380de34278ab3a639a3e7a8932aefed2383a49e8

load("@bazel_tools//tools/build_defs/repo:utils.bzl", _maybe = "maybe")
load("@rules_ros//repos/config/detail:git_repository.bzl", "git_repository")
Expand Down

0 comments on commit 6f2706f

Please sign in to comment.