Skip to content

bazel: use pkg_tar for the install procedure#9656

Merged
maliberty merged 1 commit intoThe-OpenROAD-Project:masterfrom
fredowski:install
Mar 6, 2026
Merged

bazel: use pkg_tar for the install procedure#9656
maliberty merged 1 commit intoThe-OpenROAD-Project:masterfrom
fredowski:install

Conversation

@fredowski
Copy link
Contributor

I updated the install procedure to use the pkg_tar module. The install works as before, but now you
can also install optionally to another location.

Closes: #9635

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 refactors the installation process to use pkg_tar for creating a distributable tarball. This is a good improvement that makes packaging more robust. The changes in the Bazel build files are correct, and the updated install.sh script correctly handles the new tar-based installation and adds support for custom installation paths. I've found one minor issue in the installation script that could cause it to fail, and I've provided a suggestion for a fix.

bazel/install.sh Outdated
Comment on lines +22 to +25
if [ -e openroad.repo_mapping ]; then
chmod u+w openroad.repo_mapping
fi
rm -r openroad.repo_mapping
Copy link
Contributor

Choose a reason for hiding this comment

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

high

This block for removing openroad.repo_mapping is brittle. The rm -r command on line 25 will cause the script to fail if openroad.repo_mapping does not exist, because set -e is active.

This can be simplified and made more robust by using rm -rf, which is idempotent and handles files, directories, and non-existent paths without error. This is also consistent with its use on the next line.

Suggested change
if [ -e openroad.repo_mapping ]; then
chmod u+w openroad.repo_mapping
fi
rm -r openroad.repo_mapping
rm -rf openroad.repo_mapping

@github-actions
Copy link
Contributor

github-actions bot commented Mar 5, 2026

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

@github-actions
Copy link
Contributor

github-actions bot commented Mar 5, 2026

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

@QuantamHD
Copy link
Collaborator

Do you need to remove the repo mapping file?

@fredowski
Copy link
Contributor Author

Do you need to remove the repo mapping file?

It will work also if I do not delete that file. But the relevant repo_mapping file is in openroad.runfiles/_repo_mapping. Without that, the gui crashes.

@oharboe
Copy link
Collaborator

oharboe commented Mar 5, 2026

The approach looks good — using pkg_tar with include_runfiles = True is the right way to make a relocatable install per Bazel conventions.

One request: the custom install path usage instructions are currently buried in comments inside bazel/install.sh:

# Run this from bazel build directory with
# bazelisk run --//:platform=gui //:install

# If you want to install to another location, e.g. /tmp, then do
# bazelisk run --//:platform=gui //:install -- /tmp

These should go into docs/user/Build.md instead, where users will actually find them. The Bazel install section there (lines 19-28) already documents the basic install command but doesn't mention the custom path option. Something like:

## Build and install with Bazel

Build OpenROAD with GUI support and install into ../install/OpenROAD/bin

    bazelisk run --//:platform=gui //:install

To install to a custom location:

    bazelisk run --//:platform=gui //:install -- /tmp/myinstall

To embed the real git version string, add `--config=release`:

    bazelisk run --config=release --//:platform=gui //:install

See [Bazel](Bazel.md) for more details on testing, profiling and build configurations.

Then remove the usage comments from install.sh — shell scripts shouldn't be the documentation surface for user-facing features.

@fredowski
Copy link
Contributor Author

Good idea! I adapted the description in docs/user/Build.md and removed the comments in the install.sh script.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 6, 2026

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

BUILD.bazel Outdated
# This can be untarred and run standalone
# This includes
# ./openroad.runfiles/_main/openroad
# which is again the binary.
Copy link
Collaborator

Choose a reason for hiding this comment

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

remove these comments, these days you can ask e.g. Claude to explain what is going on and it will read the README.md and these comments are only going to be out of date....

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for your review! I removed the comments.

I updated the install procedure to use the pkg_tar
module. The install works as before, but now you
can also install optionally to another location.

Closes: The-OpenROAD-Project#9635

Signed-off-by: Friedrich Beckmann <friedrich.beckmann@tha.de>
@oharboe
Copy link
Collaborator

oharboe commented Mar 6, 2026

@fredowski FYI, this project prefers not force pushing because then the review history is preserved. This makes the commit history very messy, but it is more information. Perhaps in this day and age of AI, that is information that can be used to train an automatic reviewer 😄

@oharboe
Copy link
Collaborator

oharboe commented Mar 6, 2026

@fredowski and perhaps reading a messy git history automatically with AI to answer questions for hoomans will pay off...

@github-actions
Copy link
Contributor

github-actions bot commented Mar 6, 2026

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

@fredowski
Copy link
Contributor Author

O.k. - yes the history vanishes with the squashing...

@maliberty maliberty merged commit 0b9b8b3 into The-OpenROAD-Project:master Mar 6, 2026
14 checks passed
@fredowski
Copy link
Contributor Author

Thanks everybody for reviewing the code and spending your time on this topic!

@oharboe
Copy link
Collaborator

oharboe commented Mar 6, 2026

😌

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.

bazel: After install, openroad still reads file openroad.repo_mapping from build location

4 participants