You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Change default Rust distribution downloads from .tar.gz to .tar.xz (#2399)
Rust infra folks requested that I send this change.
According to Rust's logs, currently 30% of bytes served by
static.rust-lang.org are .gz tarballs, and primarily that is attributed
to Bazel according to user-agent.
The .gz tarballs are needlessly large and consume more bandwidth for
Rust than we want to serve.
This PR changes rules_rust to default to .xz tarballs instead. Rustup
has been using xz downloads for the past 6.5 years.
The default set of tars downloaded by rules_rust (rustc, rust-std,
cargo, clippy, rustfmt, llvm-tools) is 215M in gz and 127M in xz, which
is 41% smaller. If adopted, this PR would save static.rust-lang.org more
than 12% of its bandwidth.
As a tradeoff, decompressing that set of 6 files with xz is slower: 3.6
seconds for gz and 8.4 seconds for xz. (Single-threaded. If Bazel
extracts different files in parallel than the magnitude of the
difference would be smaller but the ratio is similar.)
In rust-lang/infra-team#89 we intend to sunset
gz downloads, or do something to push users away from them (such as
throttling), so gz will be the wrong choice no matter what. To make up
for decompression speed we are investigating providing zstd tarballs in
rust-lang/infra-team#97 which decompress
significantly faster than gz while being not much larger than xz.
Copy file name to clipboardExpand all lines: docs/flatten.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1321,7 +1321,7 @@ A given instance of this rule should be accompanied by a toolchain_repository_pr
1321
1321
| <aid="rust_toolchain_tools_repository-rustfmt_version"></a>rustfmt_version | The version of the tool among "nightly", "beta", or an exact version. | String | optional | <code>""</code> |
1322
1322
| <aid="rust_toolchain_tools_repository-sha256s"></a>sha256s | A dict associating tool subdirectories to sha256 hashes. See [rust_repositories](#rust_repositories) for more details. | <ahref="https://bazel.build/rules/lib/dict">Dictionary: String -> String</a> | optional | <code>{}</code> |
1323
1323
| <aid="rust_toolchain_tools_repository-target_triple"></a>target_triple | The Rust-style target that this compiler builds for. | String | required ||
1324
-
| <aid="rust_toolchain_tools_repository-urls"></a>urls | A list of mirror urls containing the tools from the Rust-lang static file server. These must contain the '{}' used to substitute the tool being fetched (using .format). | List of strings | optional | <code>["https://static.rust-lang.org/dist/{}.tar.gz"]</code> |
1324
+
| <aid="rust_toolchain_tools_repository-urls"></a>urls | A list of mirror urls containing the tools from the Rust-lang static file server. These must contain the '{}' used to substitute the tool being fetched (using .format). | List of strings | optional | <code>["https://static.rust-lang.org/dist/{}.tar.xz"]</code> |
1325
1325
| <aid="rust_toolchain_tools_repository-version"></a>version | The version of the tool among "nightly", "beta", or an exact version. | String | required ||
1326
1326
1327
1327
@@ -1737,7 +1737,7 @@ Assemble a remote rust_analyzer_toolchain target based on the given params.
1737
1737
| <aid="rust_analyzer_toolchain_repository-target_compatible_with"></a>target_compatible_with | A list of constraints for the target platform for this toolchain. |`[]`|
1738
1738
| <aid="rust_analyzer_toolchain_repository-iso_date"></a>iso_date | The date of the tool. |`None`|
1739
1739
| <aid="rust_analyzer_toolchain_repository-sha256s"></a>sha256s | A dict associating tool subdirectories to sha256 hashes. See [rust_repositories](#rust_repositories) for more details. |`None`|
1740
-
| <aid="rust_analyzer_toolchain_repository-urls"></a>urls | A list of mirror urls containing the tools from the Rust-lang static file server. These must contain the '{}' used to substitute the tool being fetched (using .format). Defaults to ['https://static.rust-lang.org/dist/{}.tar.gz']|`None`|
1740
+
| <aid="rust_analyzer_toolchain_repository-urls"></a>urls | A list of mirror urls containing the tools from the Rust-lang static file server. These must contain the '{}' used to substitute the tool being fetched (using .format). Defaults to ['https://static.rust-lang.org/dist/{}.tar.xz']|`None`|
1741
1741
| <aid="rust_analyzer_toolchain_repository-auth"></a>auth | Auth object compatible with repository_ctx.download to use when downloading files. See [repository_ctx.download](https://docs.bazel.build/versions/main/skylark/lib/repository_ctx.html#download) for more details. |`None`|
1742
1742
1743
1743
**RETURNS**
@@ -1954,7 +1954,7 @@ See `load_arbitrary_tool` in `@rules_rust//rust:repositories.bzl` for more detai
1954
1954
| <aid="rust_register_toolchains-extra_target_triples"></a>extra_target_triples | Additional rust-style targets that rust toolchains should support. |`["wasm32-unknown-unknown", "wasm32-wasi"]`|
1955
1955
| <aid="rust_register_toolchains-extra_rustc_flags"></a>extra_rustc_flags | Dictionary of target triples to list of extra flags to pass to rustc in non-exec configuration. |`None`|
1956
1956
| <aid="rust_register_toolchains-extra_exec_rustc_flags"></a>extra_exec_rustc_flags | Extra flags to pass to rustc in exec configuration. |`None`|
1957
-
| <aid="rust_register_toolchains-urls"></a>urls | A list of mirror urls containing the tools from the Rust-lang static file server. These must contain the '{}' used to substitute the tool being fetched (using .format). |`["https://static.rust-lang.org/dist/{}.tar.gz"]`|
1957
+
| <aid="rust_register_toolchains-urls"></a>urls | A list of mirror urls containing the tools from the Rust-lang static file server. These must contain the '{}' used to substitute the tool being fetched (using .format). |`["https://static.rust-lang.org/dist/{}.tar.xz"]`|
1958
1958
| <aid="rust_register_toolchains-version"></a>version |**Deprecated**: Use <code>versions</code> instead. |`None`|
1959
1959
| <aid="rust_register_toolchains-versions"></a>versions | A list of toolchain versions to download. This paramter only accepts one versions per channel. E.g. <code>["1.65.0", "nightly/2022-11-02", "beta/2020-12-30"]</code>. |`[]`|
1960
1960
@@ -2012,7 +2012,7 @@ Assembles a remote repository for the given toolchain params, produces a proxy r
2012
2012
| <aid="rust_repository_set-extra_exec_rustc_flags"></a>extra_exec_rustc_flags | Extra flags to pass to rustc in exec configuration. |`None`|
2013
2013
| <aid="rust_repository_set-opt_level"></a>opt_level | Dictionary of target triples to optimiztion config. |`None`|
2014
2014
| <aid="rust_repository_set-sha256s"></a>sha256s | A dict associating tool subdirectories to sha256 hashes. See [rust_repositories](#rust_repositories) for more details. |`None`|
2015
-
| <aid="rust_repository_set-urls"></a>urls | A list of mirror urls containing the tools from the Rust-lang static file server. These must contain the '{}' used to substitute the tool being fetched (using .format). |`["https://static.rust-lang.org/dist/{}.tar.gz"]`|
2015
+
| <aid="rust_repository_set-urls"></a>urls | A list of mirror urls containing the tools from the Rust-lang static file server. These must contain the '{}' used to substitute the tool being fetched (using .format). |`["https://static.rust-lang.org/dist/{}.tar.xz"]`|
2016
2016
| <aid="rust_repository_set-auth"></a>auth | Auth object compatible with repository_ctx.download to use when downloading files. See [repository_ctx.download](https://docs.bazel.build/versions/main/skylark/lib/repository_ctx.html#download) for more details. |`None`|
2017
2017
| <aid="rust_repository_set-register_toolchain"></a>register_toolchain | If True, the generated <code>rust_toolchain</code> target will become a registered toolchain. |`True`|
2018
2018
| <aid="rust_repository_set-exec_compatible_with"></a>exec_compatible_with | A list of constraints for the execution platform for this toolchain. |`None`|
@@ -2120,7 +2120,7 @@ Assembles a remote repository for the given toolchain params, produces a proxy r
2120
2120
| <aid="rust_toolchain_repository-extra_exec_rustc_flags"></a>extra_exec_rustc_flags | Extra flags to pass to rustc in exec configuration. |`None`|
2121
2121
| <aid="rust_toolchain_repository-opt_level"></a>opt_level | Optimization level config for this toolchain. |`None`|
2122
2122
| <aid="rust_toolchain_repository-sha256s"></a>sha256s | A dict associating tool subdirectories to sha256 hashes. See [rust_repositories](#rust_repositories) for more details. |`None`|
2123
-
| <aid="rust_toolchain_repository-urls"></a>urls | A list of mirror urls containing the tools from the Rust-lang static file server. These must contain the '{}' used to substitute the tool being fetched (using .format). Defaults to ['https://static.rust-lang.org/dist/{}.tar.gz']|`["https://static.rust-lang.org/dist/{}.tar.gz"]`|
2123
+
| <aid="rust_toolchain_repository-urls"></a>urls | A list of mirror urls containing the tools from the Rust-lang static file server. These must contain the '{}' used to substitute the tool being fetched (using .format). Defaults to ['https://static.rust-lang.org/dist/{}.tar.xz']|`["https://static.rust-lang.org/dist/{}.tar.xz"]`|
2124
2124
| <aid="rust_toolchain_repository-auth"></a>auth | Auth object compatible with repository_ctx.download to use when downloading files. See [repository_ctx.download](https://docs.bazel.build/versions/main/skylark/lib/repository_ctx.html#download) for more details. |`None`|
Copy file name to clipboardExpand all lines: docs/rust_repositories.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -182,7 +182,7 @@ A given instance of this rule should be accompanied by a toolchain_repository_pr
182
182
| <aid="rust_toolchain_tools_repository-rustfmt_version"></a>rustfmt_version | The version of the tool among "nightly", "beta", or an exact version. | String | optional | <code>""</code> |
183
183
| <aid="rust_toolchain_tools_repository-sha256s"></a>sha256s | A dict associating tool subdirectories to sha256 hashes. See [rust_repositories](#rust_repositories) for more details. | <ahref="https://bazel.build/rules/lib/dict">Dictionary: String -> String</a> | optional | <code>{}</code> |
184
184
| <aid="rust_toolchain_tools_repository-target_triple"></a>target_triple | The Rust-style target that this compiler builds for. | String | required ||
185
-
| <aid="rust_toolchain_tools_repository-urls"></a>urls | A list of mirror urls containing the tools from the Rust-lang static file server. These must contain the '{}' used to substitute the tool being fetched (using .format). | List of strings | optional | <code>["https://static.rust-lang.org/dist/{}.tar.gz"]</code> |
185
+
| <aid="rust_toolchain_tools_repository-urls"></a>urls | A list of mirror urls containing the tools from the Rust-lang static file server. These must contain the '{}' used to substitute the tool being fetched (using .format). | List of strings | optional | <code>["https://static.rust-lang.org/dist/{}.tar.xz"]</code> |
186
186
| <aid="rust_toolchain_tools_repository-version"></a>version | The version of the tool among "nightly", "beta", or an exact version. | String | required ||
187
187
188
188
@@ -220,7 +220,7 @@ Assemble a remote rust_analyzer_toolchain target based on the given params.
220
220
| <aid="rust_analyzer_toolchain_repository-target_compatible_with"></a>target_compatible_with | A list of constraints for the target platform for this toolchain. |`[]`|
221
221
| <aid="rust_analyzer_toolchain_repository-iso_date"></a>iso_date | The date of the tool. |`None`|
222
222
| <aid="rust_analyzer_toolchain_repository-sha256s"></a>sha256s | A dict associating tool subdirectories to sha256 hashes. See [rust_repositories](#rust_repositories) for more details. |`None`|
223
-
| <aid="rust_analyzer_toolchain_repository-urls"></a>urls | A list of mirror urls containing the tools from the Rust-lang static file server. These must contain the '{}' used to substitute the tool being fetched (using .format). Defaults to ['https://static.rust-lang.org/dist/{}.tar.gz']|`None`|
223
+
| <aid="rust_analyzer_toolchain_repository-urls"></a>urls | A list of mirror urls containing the tools from the Rust-lang static file server. These must contain the '{}' used to substitute the tool being fetched (using .format). Defaults to ['https://static.rust-lang.org/dist/{}.tar.xz']|`None`|
224
224
| <aid="rust_analyzer_toolchain_repository-auth"></a>auth | Auth object compatible with repository_ctx.download to use when downloading files. See [repository_ctx.download](https://docs.bazel.build/versions/main/skylark/lib/repository_ctx.html#download) for more details. |`None`|
225
225
226
226
**RETURNS**
@@ -273,7 +273,7 @@ See `load_arbitrary_tool` in `@rules_rust//rust:repositories.bzl` for more detai
273
273
| <aid="rust_register_toolchains-extra_target_triples"></a>extra_target_triples | Additional rust-style targets that rust toolchains should support. |`["wasm32-unknown-unknown", "wasm32-wasi"]`|
274
274
| <aid="rust_register_toolchains-extra_rustc_flags"></a>extra_rustc_flags | Dictionary of target triples to list of extra flags to pass to rustc in non-exec configuration. |`None`|
275
275
| <aid="rust_register_toolchains-extra_exec_rustc_flags"></a>extra_exec_rustc_flags | Extra flags to pass to rustc in exec configuration. |`None`|
276
-
| <aid="rust_register_toolchains-urls"></a>urls | A list of mirror urls containing the tools from the Rust-lang static file server. These must contain the '{}' used to substitute the tool being fetched (using .format). |`["https://static.rust-lang.org/dist/{}.tar.gz"]`|
276
+
| <aid="rust_register_toolchains-urls"></a>urls | A list of mirror urls containing the tools from the Rust-lang static file server. These must contain the '{}' used to substitute the tool being fetched (using .format). |`["https://static.rust-lang.org/dist/{}.tar.xz"]`|
277
277
| <aid="rust_register_toolchains-version"></a>version |**Deprecated**: Use <code>versions</code> instead. |`None`|
278
278
| <aid="rust_register_toolchains-versions"></a>versions | A list of toolchain versions to download. This paramter only accepts one versions per channel. E.g. <code>["1.65.0", "nightly/2022-11-02", "beta/2020-12-30"]</code>. |`[]`|
279
279
@@ -331,7 +331,7 @@ Assembles a remote repository for the given toolchain params, produces a proxy r
331
331
| <aid="rust_repository_set-extra_exec_rustc_flags"></a>extra_exec_rustc_flags | Extra flags to pass to rustc in exec configuration. |`None`|
332
332
| <aid="rust_repository_set-opt_level"></a>opt_level | Dictionary of target triples to optimiztion config. |`None`|
333
333
| <aid="rust_repository_set-sha256s"></a>sha256s | A dict associating tool subdirectories to sha256 hashes. See [rust_repositories](#rust_repositories) for more details. |`None`|
334
-
| <aid="rust_repository_set-urls"></a>urls | A list of mirror urls containing the tools from the Rust-lang static file server. These must contain the '{}' used to substitute the tool being fetched (using .format). |`["https://static.rust-lang.org/dist/{}.tar.gz"]`|
334
+
| <aid="rust_repository_set-urls"></a>urls | A list of mirror urls containing the tools from the Rust-lang static file server. These must contain the '{}' used to substitute the tool being fetched (using .format). |`["https://static.rust-lang.org/dist/{}.tar.xz"]`|
335
335
| <aid="rust_repository_set-auth"></a>auth | Auth object compatible with repository_ctx.download to use when downloading files. See [repository_ctx.download](https://docs.bazel.build/versions/main/skylark/lib/repository_ctx.html#download) for more details. |`None`|
336
336
| <aid="rust_repository_set-register_toolchain"></a>register_toolchain | If True, the generated <code>rust_toolchain</code> target will become a registered toolchain. |`True`|
337
337
| <aid="rust_repository_set-exec_compatible_with"></a>exec_compatible_with | A list of constraints for the execution platform for this toolchain. |`None`|
@@ -375,7 +375,7 @@ Assembles a remote repository for the given toolchain params, produces a proxy r
375
375
| <aid="rust_toolchain_repository-extra_exec_rustc_flags"></a>extra_exec_rustc_flags | Extra flags to pass to rustc in exec configuration. |`None`|
376
376
| <aid="rust_toolchain_repository-opt_level"></a>opt_level | Optimization level config for this toolchain. |`None`|
377
377
| <aid="rust_toolchain_repository-sha256s"></a>sha256s | A dict associating tool subdirectories to sha256 hashes. See [rust_repositories](#rust_repositories) for more details. |`None`|
378
-
| <aid="rust_toolchain_repository-urls"></a>urls | A list of mirror urls containing the tools from the Rust-lang static file server. These must contain the '{}' used to substitute the tool being fetched (using .format). Defaults to ['https://static.rust-lang.org/dist/{}.tar.gz']|`["https://static.rust-lang.org/dist/{}.tar.gz"]`|
378
+
| <aid="rust_toolchain_repository-urls"></a>urls | A list of mirror urls containing the tools from the Rust-lang static file server. These must contain the '{}' used to substitute the tool being fetched (using .format). Defaults to ['https://static.rust-lang.org/dist/{}.tar.xz']|`["https://static.rust-lang.org/dist/{}.tar.xz"]`|
379
379
| <aid="rust_toolchain_repository-auth"></a>auth | Auth object compatible with repository_ctx.download to use when downloading files. See [repository_ctx.download](https://docs.bazel.build/versions/main/skylark/lib/repository_ctx.html#download) for more details. |`None`|
opt_level (dict, optional): Optimization level config for this toolchain.
535
535
sha256s (str, optional): A dict associating tool subdirectories to sha256 hashes. See
536
536
[rust_repositories](#rust_repositories) for more details.
537
-
urls (list, optional): A list of mirror urls containing the tools from the Rust-lang static file server. These must contain the '{}' used to substitute the tool being fetched (using .format). Defaults to ['https://static.rust-lang.org/dist/{}.tar.gz']
537
+
urls (list, optional): A list of mirror urls containing the tools from the Rust-lang static file server. These must contain the '{}' used to substitute the tool being fetched (using .format). Defaults to ['https://static.rust-lang.org/dist/{}.tar.xz']
538
538
auth (dict): Auth object compatible with repository_ctx.download to use when downloading files.
539
539
See [repository_ctx.download](https://docs.bazel.build/versions/main/skylark/lib/repository_ctx.html#download) for more details.
sha256s (str, optional): A dict associating tool subdirectories to sha256 hashes. See
675
675
[rust_repositories](#rust_repositories) for more details.
676
-
urls (list, optional): A list of mirror urls containing the tools from the Rust-lang static file server. These must contain the '{}' used to substitute the tool being fetched (using .format). Defaults to ['https://static.rust-lang.org/dist/{}.tar.gz']
676
+
urls (list, optional): A list of mirror urls containing the tools from the Rust-lang static file server. These must contain the '{}' used to substitute the tool being fetched (using .format). Defaults to ['https://static.rust-lang.org/dist/{}.tar.xz']
677
677
auth (dict): Auth object compatible with repository_ctx.download to use when downloading files.
678
678
See [repository_ctx.download](https://docs.bazel.build/versions/main/skylark/lib/repository_ctx.html#download) for more details.
channel (str, optional): The channel value to with which to constrain the toolchain.
793
793
sha256s (str, optional): A dict associating tool subdirectories to sha256 hashes. See
794
794
[rust_repositories](#rust_repositories) for more details.
795
-
urls (list, optional): A list of mirror urls containing the tools from the Rust-lang static file server. These must contain the '{}' used to substitute the tool being fetched (using .format). Defaults to ['https://static.rust-lang.org/dist/{}.tar.gz']
795
+
urls (list, optional): A list of mirror urls containing the tools from the Rust-lang static file server. These must contain the '{}' used to substitute the tool being fetched (using .format). Defaults to ['https://static.rust-lang.org/dist/{}.tar.xz']
796
796
auth (dict): Auth object compatible with repository_ctx.download to use when downloading files.
797
797
See [repository_ctx.download](https://docs.bazel.build/versions/main/skylark/lib/repository_ctx.html#download) for more details.
0 commit comments