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

Make url overrides for downloading toolchains work. #874

Merged
merged 1 commit into from
Aug 3, 2021

Conversation

wt
Copy link
Contributor

@wt wt commented Aug 3, 2021

Previously, the default url template for downloading toolchains
was always present as the first place to download tools from. This
prevents overriding the default location for the tools so that an
internal mirror can be used.

Fixes #867

Copy link
Collaborator

@illicitonion illicitonion left a comment

Choose a reason for hiding this comment

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

Thanks for putting this together! Just one question/suggestion :)

@@ -526,8 +526,7 @@ def load_arbitrary_tool(ctx, tool_name, tool_subdirectories, version, iso_date,
# View the indices mentioned in the docstring to find the tool_suburl for a given
# tool.
tool_suburl = produce_tool_suburl(tool_name, target_triple, version, iso_date)
static_rust = ctx.os.environ.get("STATIC_RUST_URL", "https://static.rust-lang.org")
urls = ["{}/dist/{}.tar.gz".format(static_rust, tool_suburl)]
urls = []
Copy link
Collaborator

Choose a reason for hiding this comment

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

This code used to allow adding a URL by setting an env var, and this PR removes that ability - how would you feel about making this look something like:

urls = []
static_rust_url_from_env = ctx.os.environ.get("STATIC_RUST_URL")
if static_rust_url_from_env:
    urls.append("{}/dist/{}.tar.gz".format(static_rust_url_from_env, tool_suburl))

that way if the env var isn't set, it still behaves exactly as you've written, but if it is we still pay attention to it.

Copy link
Contributor Author

@wt wt Aug 3, 2021

Choose a reason for hiding this comment

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

Thats a good point. +1

I'll push a new revision.

Previously, the default url template for downloading toolchains
was always present as the first place to download tools from. This
prevents overriding the default location for the tools so that an
internal mirror can be used.

Fixes bazelbuild#867
Copy link
Collaborator

@illicitonion illicitonion left a comment

Choose a reason for hiding this comment

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

LGTM - thanks!

@illicitonion illicitonion merged commit 68dc0dc into bazelbuild:main Aug 3, 2021
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.

tools fetched from upstream rust static repo even when override URL template is provided
2 participants