bazel: fix install script default path for standalone builds#9796
bazel: fix install script default path for standalone builds#9796alokkumardalei-wq wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request correctly updates the default installation path in the bazel/install.sh script, making it suitable for standalone builds by default. The change is simple and effectively addresses the issue of the previous path being specific to the OpenROAD-flow-scripts environment. I have one suggestion to improve the usage comment for better clarity.
| @@ -2,10 +2,12 @@ | |||
| set -e | |||
|
|
|||
| # Install binary and runfiles from bazel build | |||
| # Usage: bazel run :install [DEST_DIR] | |||
There was a problem hiding this comment.
The usage comment is slightly incorrect. Arguments for a script executed with bazel run should be passed after --. Please update the comment to reflect the correct usage: bazel run :install -- [DEST_DIR]. This will prevent user confusion.
| # Usage: bazel run :install [DEST_DIR] | |
| # Usage: bazel run :install -- [DEST_DIR] |
|
clang-tidy review says "All clean, LGTM! 👍" |
Change default DEST_DIR from orfs-specific path to workspace-local path. The previous default assumed OpenROAD was part of OpenROAD-flow-scripts. Users can now: - Install to default: bazel run :install - Install to custom: bazel run :install -- /custom/path Fixes The-OpenROAD-Project#9775 Signed-off-by: alokkumardalei-wq <alokkumardalei2@gmail.com>
b34f103 to
408e057
Compare
|
clang-tidy review says "All clean, LGTM! 👍" |
|
Hello @maliberty and @gadfort I think all checks are passing now please have a look onto this when you have time and I would be happy to address further feedback. Thank you. |
oharboe
left a comment
There was a problem hiding this comment.
this breaks the cd flow && make DESIGN_CONFIG... use-case
|
Hello @oharboe, thanks for the review! To fix issue #9775 without breaking the ORFS flow, I can update the script to auto-detect the context: |
|
clang-tidy review says "All clean, LGTM! 👍" |
b5b0a85 to
322ae10
Compare
|
clang-tidy review says "All clean, LGTM! 👍" |
|
Hello @oharboe I have implemented above solution for the issue you have described as no reply from your side for many days I thought I should go implement it and then ask to you if any other optimal approach I can go for . Thank you! |
322ae10 to
db0da0b
Compare
|
clang-tidy review says "All clean, LGTM! 👍" |
oharboe
left a comment
There was a problem hiding this comment.
I don't understand the use-case that this PR is solving.
|
@oharboe The use-case this solves is for developers cloning OpenROAD directly as a standalone repository (outside of ORFS). If a standalone user clones OpenROAD and types \bazel run :install This PR simply adds a clean standalone fallback: If the tool detects it is being executed inside an ORFS hierarchy (by checking for ../flow/Makefile |
|
I see, yes, this is a suckerpunch. But will this fix the problem? Seems to me that we need to follow POLA
What did they expect to happen? |
|
@oharboe You make a totally fair point about POLA! If a brand new developer clones the standalone repo and runs \bazel run :install Since we have to keep that ../install Let me know if you agree with throwing a usage error, and I'll update the PR to enforce it! |
|
@alokkumardalei-wq I think fall back to |
|
I think you're onto something. I'm wondering if we should always never install without a path, but that we can suggest the command to use if we think we're inside ORFS. Otherwise we need a robust check that OpenROAD is a submodule of ORFS... |
I hate that idea. I don't want stale OpenROAD binaries in the path that I didn't specifically ask for. |
|
@oharboe I think I like the suggestion of requiring a path instead of assuming where users want them (it would require a small PR in ORFS if it's used there), but that would avoid any surprising behavior. |
|
Also, I think the use case of using ~/.local is perfectly reasnoable, perhaps we can print out some suggestions to clue in the user to pick a workflow that is right for them? |
Hello @gadfort thanks for considering this but I think I should go with @oharboe suggestion of using ~/.local to show the suggestions directly to the users so that they can decide where to write their files rather automatically write stale binaries to ~/.local/bin. Thank you! |
|
Thanks for working on this, @alokkumardalei-wq. The underlying issue (#9775) is real and worth fixing. I have concerns about the current implementation's readability and the direction it's heading relative to the discussion. Background: why
|
oharboe
left a comment
There was a problem hiding this comment.
Need a bit more work...
|
two more things:
|
db0da0b to
3b09093
Compare
|
clang-tidy review says "All clean, LGTM! 👍" |
3b09093 to
63ffe43
Compare
|
@oharboe Thank you for the detailed feedback—you are completely right about avoiding fragile filesystem probes! I’ve updated the PR with exactly what you suggested: Added the -f flag for ORFS and explicitly require paths otherwise. bazelisk test //:install_test --test_output=allOutput: alokkumardalei@Aloks-MacBook-Air OpenROAD % bazelisk test //:install_test --test_output=all
INFO: Invocation ID: 724606c7-db50-4338-a288-1881701e393f
INFO: Analyzed target //:install_test (0 packages loaded, 0 targets configured).
INFO: Found 1 test target...
Target //:install_test up-to-date:
bazel-bin/install_test
INFO: Elapsed time: 0.328s, Critical Path: 0.15s
INFO: 1 process: 1 action cache hit, 1 internal.
INFO: Build completed successfully, 1 total action
PASSED: //:install_test (see /private/var/tmp/_bazel_alokkumardalei/f60303491871e2fbc066db2794eb7714/execroot/_main/bazel-out/darwin_arm64-opt/testlogs/install_test/test.log)
INFO: From Testing //:install_test
==================== Test output for //:install_test:
Running install.sh argument parser tests...
Mock TARFILE created at: /var/folders/g0/0tdm2_hj22l7kp855lz7xp9w0000gn/T/tmp.Nev0yspoIB/openroad.tar
--- Test 1: Explicit Destination ---
OpenROAD binary installed to /private/var/folders/g0/0tdm2_hj22l7kp855lz7xp9w0000gn/T/tmp.Nev0yspoIB/dest1
PASS: Test 1
--- Test 2: ORFS -f Flag ---
OpenROAD binary installed to /private/var/folders/g0/0tdm2_hj22l7kp855lz7xp9w0000gn/T/install/OpenROAD/bin
PASS: Test 2
--- Test 3: No Arguments Expected Failure ---
Error: Please specify an installation path.
Examples:
bazel run :install -- ~/.local/bin # Add to your PATH
bazel run :install -- ./build/install # Project-local install
If you are using ORFS (OpenROAD-flow-scripts), you can use the -f flag
to install to the path that flow/scripts/variables.mk expects:
bazel run :install -- -f
PASS: Test 3 correctly aborted.
All tests passed successfully!
================================================================================
//:install_test (cached) PASSED in 0.1s
Executed 0 out of 1 test: 1 test passes. |
|
clang-tidy review says "All clean, LGTM! 👍" |
ecff75d to
3bd3c9d
Compare
This addresses oharboe's review comment by replacing non-standard parameter absence checks with standard `[ -n "$1" ]` bash syntax, and clearly restoring the ORFS-agnostic standalone target evaluation. Signed-off-by: alokkumardalei-wq <alokkumardalei2@gmail.com>
606b097 to
86649bc
Compare
|
clang-tidy review says "All clean, LGTM! 👍" |
Signed-off-by: Alok Kumar Dalei <alokkumardalei2@gmail.com>
|
clang-tidy review says "All clean, LGTM! 👍" |
|
Author: @alokkumardalei-wq | Fixes: #9775 | State: Open, CHANGES_REQUESTED SummaryThe PR modifies Current state of the code vs. intentWhat's good
Problems remaining1. CI is failing: Buildifier lintThe The PR removed the 2. Unrelated deletions in
|
|
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 21 days if no further activity occurs. Remove the |
What does this PR do?
Fixes #9775
The install script now uses a standalone-friendly default path instead of assuming orfs directory structure.
Change default DEST_DIR from orfs-specific path to workspace-local path. The previous default assumed OpenROAD was part of OpenROAD-flow-scripts.
Users can now: