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
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions rust/private/repository_utils.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -526,8 +526,11 @@ 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.


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))

for url in getattr(ctx.attr, "urls", DEFAULT_STATIC_RUST_URL_TEMPLATES):
new_url = url.format(tool_suburl)
Expand Down