Skip to content

fix(repo setup): Skip aliases for unloaded toolchains #1473

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

Merged
merged 1 commit into from
Oct 10, 2023

Conversation

kilian-funk
Copy link
Contributor

@kilian-funk kilian-funk commented Oct 7, 2023

Some platforms don't contain every version, e.g. s390x doesn't have 3.8, which is
indicated by a missing sha256 value. When this happens, no repository for the runtime
is created (python_repository rule).

Similar logic needs to be in the toolchains setup logic because otherwise a reference
to an undefined repository exists in the select() expression of the aliases. Because those
references are lazily evaluated, they don't always cause a problem, but do mean that
query operations (e.g., rdeps()) can't work and the order of entries is important
(which is surprising).

Closes #1472

@kilian-funk kilian-funk requested a review from f0rmiga as a code owner October 7, 2023 15:26
@google-cla
Copy link

google-cla bot commented Oct 7, 2023

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@kilian-funk kilian-funk requested a review from rickeylev as a code owner October 7, 2023 15:32
@kilian-funk kilian-funk changed the title Fix: Skip aliases for unloaded toolchains (#1472) fix(repo setup): Skip aliases for unloaded toolchains Oct 7, 2023
Copy link
Collaborator

@rickeylev rickeylev left a comment

Choose a reason for hiding this comment

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

mostly lgtm, just move the platforms constant out of the generated defs.bzl

@@ -195,6 +196,9 @@ load("{rules_python}//python:pip.bzl", _compile_pip_requirements = "compile_pip_

host_platform = "{host_platform}"
interpreter = "@{py_repository}_{host_platform}//:{python3_binary_path}"
PLATFORMS = [
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please take this out of defs.bzl -- defs.bzl is a public entry point, and this isn't a detail we want to make part of our public API.

Instead, it can be inlined in build_contents directly:

_plaforms = [
  {loaded_platforms}
]

Copy link
Contributor Author

Choose a reason for hiding this comment

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

IMO the selection of platforms is valuable information, but I am not sure if this is the right form to make that available. So, I am fine with removing it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed as suggested.

CHANGELOG.md Outdated
Comment on lines 24 to 27
* Skip aliases for unloaded toolchains. Toolchains without a checksum are skipped
in the repo load phase. These skipped repos now don't have aliases in the toolchains repo.
This is relevant when working with older python versions that don't have full platform
support.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
* Skip aliases for unloaded toolchains. Toolchains without a checksum are skipped
in the repo load phase. These skipped repos now don't have aliases in the toolchains repo.
This is relevant when working with older python versions that don't have full platform
support.
* Skip aliases for unloaded toolchains. Some Python versions that don't have full
platform support, and referencing their undefined repositories can break operations
like `bazel query rdeps(...)`.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@rickeylev
Copy link
Collaborator

CI is unhappy, but it's not immediately apparent why. It gives me the feeling there might be a syntax error somewhere? Or maybe what's happening is the BUILD file is trying to load defs.bzl before something defs.bzl needs is ready? Maybe removing that load(defs.bzl) as I commented will fix it.

Toolchains without a checksum are skipped in python_register_toolchain.
This commit also skips the creation of aliases to those toolchains.

Closes bazel-contrib#1472
@kilian-funk
Copy link
Contributor Author

@rickeylev I have addressed your concerns. CI is happy now, even without knowing the root cause of the original failures.

Could you please re-review?

Copy link
Collaborator

@aignas aignas left a comment

Choose a reason for hiding this comment

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

LGTM

@kilian-funk kilian-funk requested a review from rickeylev October 10, 2023 14:43
@rickeylev rickeylev added this pull request to the merge queue Oct 10, 2023
Merged via the queue into bazel-contrib:main with commit ff30935 Oct 10, 2023
@kilian-funk kilian-funk deleted the skip_alias_creation branch October 10, 2023 20:48
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.

Missing dependencies when not using latest Python version
4 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy