P2help wantedteam-ExternalDepstype: feature request
仓库指标
- Star
- (25,384 star)
- PR 合并指标
- (平均合并 22天 20小时) (30 天内合并 77 个 PR)
描述
Description of the feature request:
Repository rules should be able to perform integrity checks or calculate the integrity of files.
Something like:
# where ctx is repository_ctx
integrity = ctx.calculate_integrity(file = "some_file.txt")
# the format of the integrity object could be:
integrity == struct(
sha1 = "",
sha256 = "",
sha384 = "",
sha512 = "",
)
ctx.verify_integrity(
file = "some_file.txt",
integrity = "sha384-oqVuAfXRKap7fdgcCY5uykM6+R9GqQ8K/uxy9rx7HNQlGYl1kPzQho1wx4JwY8wC",
)
Alternatively, there could be just one ctx.integrity function which will both calculate and verify depending on whether the integrity attribute is given?
What underlying problem are you trying to solve with this feature?
There are cases where resources cannot be fetched over HTTP and external tools must be used. In such case, it would be nice to have a native way to verify integrity without having to rely on the host to have sha256sum, openssl, etc installed.
Which operating system are you running Bazel on?
Linux
What is the output of bazel info release?
5.2.1
If bazel info release returns development version or (@non-git), tell us how you built Bazel.
No response
What's the output of git remote get-url origin; git rev-parse master; git rev-parse HEAD ?
No response
Have you found anything relevant by searching the web?
Not much.
https://github.com/bazelbuild/bazel/issues/7323
Any other information, logs, or outputs that you want to share?
No response