Skip to content

bazel: replace genrule sed/cat with skylib rules for hermeticity#9737

Open
oharboe wants to merge 1 commit intoThe-OpenROAD-Project:masterfrom
Pinata-Consulting:bazel-hermeticity-nits
Open

bazel: replace genrule sed/cat with skylib rules for hermeticity#9737
oharboe wants to merge 1 commit intoThe-OpenROAD-Project:masterfrom
Pinata-Consulting:bazel-hermeticity-nits

Conversation

@oharboe
Copy link
Collaborator

@oharboe oharboe commented Mar 12, 2026

Use expand_template and copy_file from bazel_skylib instead of genrule with sed/cat in the OpenMP overlay BUILD file. This avoids depending on host shell tools and sets a better example for contributors who copy existing patterns.

Remaining hermeticity nits for later:

  • BUILD.bazel OpenRoadVersion genrule uses grep/cut/printf
  • src/sta StaConfig genrule uses echo -e (fix pending in sta repo)

Use expand_template and copy_file from bazel_skylib instead of
genrule with sed/cat in the OpenMP overlay BUILD file. This avoids
depending on host shell tools and sets a better example for
contributors who copy existing patterns.

Remaining hermeticity nits for later:
- BUILD.bazel OpenRoadVersion genrule uses grep/cut/printf
- src/sta StaConfig genrule uses echo -e (fix pending in sta repo)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
@oharboe oharboe requested a review from maliberty March 12, 2026 06:43
@oharboe
Copy link
Collaborator Author

oharboe commented Mar 12, 2026

@hzeller FYI

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request improves build hermeticity by replacing non-hermetic genrule calls that use shell tools like sed and cat with their bazel_skylib equivalents, expand_template and copy_file. The changes are correct and achieve the stated goal. I've added a couple of suggestions to further improve maintainability by addressing hardcoded version information and ensuring build rules correctly reflect the intent for template files.

@github-actions
Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@maliberty
Copy link
Member

@codex review

@maliberty maliberty enabled auto-merge March 12, 2026 13:31
@chatgpt-codex-connector
Copy link

Codex Review: Didn't find any major issues. Swish!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@hzeller
Copy link
Collaborator

hzeller commented Mar 12, 2026

Nice!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants