Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: tools/migrate_to_bzlmod crashes #2789

Open
ensonic opened this issue Sep 16, 2024 · 4 comments
Open

[Bug]: tools/migrate_to_bzlmod crashes #2789

ensonic opened this issue Sep 16, 2024 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@ensonic
Copy link

ensonic commented Sep 16, 2024

What happened?

migrate_to_bzlmod failed to handle an exception? The resolved_deps.py generated by bazel sync contains a bad line I guess:

"_action_listener": <unknown object com.google.devtools.build.lib.packages.Attribute$LabelListLateBoundDefault>,

Version

Development (host) and target OS/architectures:

Output of bazel --version:

Bazelisk version: v1.19.0
Build label: 6.3.2
Build target: bazel-out/k8-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Tue Aug 8 15:48:33 2023 (1691509713)
Build timestamp: 1691509713
Build timestamp as int: 1691509713

Version of relevant rules from the WORKSPACE or MODULE.bazel file:

Language(s) and/or frameworks involved:
golang, rules_oci, protobuf, ...
https://github.com/googlecloudrobotics/core/blob/main/WORKSPACE

How to reproduce

mkdir bug && cd bug
git clone https://github.com/googlecloudrobotics/core.git
git clone https://github.com/bazelbuild/bazel-central-registry.git
cd core
../bazel-central-registry/tools/migrate_to_bzlmod.py -t //...
INFO: Executing command: bazel --version
bazel 6.3.2
INFO: Detected original workspace name: cloud_robotics
INFO: Generating ./resolved_deps.py file
INFO: Executing command: bazel clean --expunge
INFO: Executing command: bazel build --nobuild --experimental_repository_resolved_file=resolved_deps.py //...
Traceback (most recent call last):
  File "/usr/local/google/home/ensonic/robco_github/core/../bazel-central-registry/tools/migrate_to_bzlmod.py", line 571, in <module>
    sys.exit(main())
             ^^^^^^
  File "/usr/local/google/home/ensonic/robco_github/core/../bazel-central-registry/tools/migrate_to_bzlmod.py", line 525, in main
    resolved_deps = load_resolved_deps(args.target, args.sync, args.force)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/google/home/ensonic/robco_github/core/../bazel-central-registry/tools/migrate_to_bzlmod.py", line 477, in load_resolved_deps
    spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 936, in exec_module
  File "<frozen importlib._bootstrap_external>", line 1074, in get_code
  File "<frozen importlib._bootstrap_external>", line 1004, in source_to_code
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/usr/local/google/home/ensonic/robco_github/core/./resolved_deps.py", line 5952
    "_action_listener": <unknown object com.google.devtools.build.lib.packages.Attribute$LabelListLateBoundDefault>,
                        ^
SyntaxError: invalid syntax


### Any other information?

_No response_
@ensonic ensonic added the bug Something isn't working label Sep 16, 2024
@ensonic
Copy link
Author

ensonic commented Sep 16, 2024

Just upgraded to bazel 6.5.0, same error.

@ensonic
Copy link
Author

ensonic commented Sep 16, 2024

I just deleted the 3 lines containing "unknown object ..." and with that it starts to do something.

@meteorcloudy
Copy link
Member

The migrate_to_bzlmod script is pretty out-dated, I'm trying to find some time to update it.

@meteorcloudy meteorcloudy self-assigned this Sep 16, 2024
@ensonic
Copy link
Author

ensonic commented Sep 16, 2024

We're changing the toolchain rules in googlecloudrobotics/core#422 that seems to also sidestep the issue, so no rush. Thanks for providing the tool in the fist place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants