Skip to content

docs: make //docs:man_pages hermetic by managing pandoc via Bazel#10764

Open
luarss wants to merge 4 commits into
The-OpenROAD-Project:masterfrom
luarss:fix/issue-10692-hermetic-manpages
Open

docs: make //docs:man_pages hermetic by managing pandoc via Bazel#10764
luarss wants to merge 4 commits into
The-OpenROAD-Project:masterfrom
luarss:fix/issue-10692-hermetic-manpages

Conversation

@luarss

@luarss luarss commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

The previous rule called make, pandoc, nroff, and col via the host PATH with use_default_shell_env=True and no-sandbox=1, breaking hermetic and remote-execution builds (issue #10692).

Summary

  • MODULE.bazel: download pandoc 3.10 pre-built binaries for Linux amd64/arm64 and macOS x86_64/arm64 via http_archive (pandoc is not on BCR).
  • bazel/BUILD: add config_setting per platform, a filegroup that selects the correct pandoc binary at build time, and a py_binary driver
    target.
  • bazel/manpages_impl.py: new Python driver replacing make + link_readmes.sh + nroff/col. All inputs (pandoc binary, README files, messages,
    scripts) arrive as explicit CLI arguments; pandoc --to=plain replaces nroff -man | col -b for cat pages.
  • bazel/man_pages.bzl: rewritten to use ctx.actions.run with declared tool inputs; removes use_default_shell_env and no-sandbox.
  • docs/BUILD.bazel: drop Makefile and link_readmes.sh from inputs; add //docs:man_pages_build_test to catch regressions.
  • docs/Makefile: remove dead bazel-manpages target (no longer called by Bazel).

Type of Change

  • Bug fix

Impact

[How does this change the tool's behavior?]

Verification

  • I have verified that the local build succeeds (./etc/Build.sh).
  • I have run the relevant tests and they pass.
  • My code follows the repository's formatting guidelines.
  • I have included tests to prevent regressions.
  • I have signed my commits (DCO).

Related Issues

fixes #10692

luarss added 2 commits June 26, 2026 15:15
The previous rule called make, pandoc, nroff, and col via the host
PATH with use_default_shell_env=True and no-sandbox=1, breaking
hermetic and remote-execution builds (issue The-OpenROAD-Project#10692).

Changes:
- MODULE.bazel: add http_archive downloads of pandoc 3.10 pre-built
  binaries for Linux amd64/arm64 and macOS x86_64/arm64 (pandoc is
  not on BCR yet).
- bazel/BUILD: add config_setting per platform, a filegroup that
  selects the right pandoc binary, and a py_binary driver.
- bazel/manpages_impl.py: new Python driver that replaces make +
  link_readmes.sh + nroff/col.  All inputs arrive as explicit CLI
  args; pandoc --to=plain replaces nroff -man | col -b.
- bazel/man_pages.bzl: rewrite to use ctx.actions.run with declared
  tool inputs; removes use_default_shell_env and no-sandbox.
- docs/BUILD.bazel: drop Makefile and link_readmes.sh from inputs.

Signed-off-by: Jack Luar <39641663+luarss@users.noreply.github.com>
  Add //docs:man_pages_build_test to catch regressions in the hermetic
  man page build. Remove the now-dead bazel-manpages Makefile target
  which was previously called by Bazel but is no longer needed since
  manpages_impl.py drives the build directly.

Signed-off-by: Jack Luar <39641663+luarss@users.noreply.github.com>
@luarss luarss requested a review from a team as a code owner June 26, 2026 15:52
@luarss luarss requested a review from osamahammad21 June 26, 2026 15:52

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

Copy link
Copy Markdown
Contributor

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 replaces the host-dependent make and nroff workflow for generating man pages with a hermetic Bazel rule. It downloads pre-built platform-specific pandoc binaries and orchestrates the generation using a new Python driver script (manpages_impl.py). The review feedback highlights two important issues in the new Python script: first, pandoc needs an explicit -f man format specification when reading generated roff files to prevent them from being parsed as markdown; second, the script should preserve and append to the existing PYTHONPATH instead of overwriting it entirely, which could break Bazel's Python runtime environment.

Comment thread bazel/manpages_impl.py
Comment thread bazel/manpages_impl.py Outdated
Comment thread bazel/manpages_impl.py
- Add docstrings to _run_pandoc, _process_section, and main()
- Document skip_stems parameter in _process_section
- Clarify messages.txt copy comment
- Fix capitalization in man_pages.bzl module docstring (html → HTML)

Signed-off-by: Jack Luar <39641663+luarss@users.noreply.github.com>
@luarss

luarss commented Jun 26, 2026

Copy link
Copy Markdown
Contributor Author

Comments fixed in 0fe6274

Signed-off-by: Jack Luar <39641663+luarss@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Man-page generation is highly non-hermetic

1 participant