From f2560252cd76191e8a7c473eb0a76633e45cf9d1 Mon Sep 17 00:00:00 2001 From: Fabian Meumertzheim Date: Sun, 12 Nov 2023 11:50:05 +0100 Subject: [PATCH 1/9] Emit actual hashes in same format as expected --- MODULE.bazel.lock | 883 ------------------ .../bazel/repository/downloader/Checksum.java | 33 +- .../downloader/HashInputStream.java | 10 +- .../downloader/HashOutputStream.java | 10 +- .../starlark/StarlarkBaseExternalContext.java | 2 +- .../shell/bazel/external_integration_test.sh | 3 +- 6 files changed, 44 insertions(+), 897 deletions(-) diff --git a/MODULE.bazel.lock b/MODULE.bazel.lock index 9f56bf2e0829da..1d7d0b2cc96e25 100644 --- a/MODULE.bazel.lock +++ b/MODULE.bazel.lock @@ -2156,25 +2156,6 @@ } }, "moduleExtensions": { - "//:extensions.bzl%bazel_android_deps": { - "general": { - "bzlTransitiveDigest": "JIUppb9cYpap/pfU76BpY/F/Qd6Qld7XVEsAa78X0T4=", - "accumulatedFileDigests": {}, - "envVariables": {}, - "generatedRepoSpecs": { - "desugar_jdk_libs": { - "bzlFile": "@@//tools/build_defs/repo:http.bzl", - "ruleClassName": "http_archive", - "attributes": { - "name": "_main~bazel_android_deps~desugar_jdk_libs", - "sha256": "ef71be474fbb3b3b7bd70cda139f01232c63b9e1bbd08c058b00a8d538d4db17", - "strip_prefix": "desugar_jdk_libs-24dcd1dead0b64aae3d7c89ca9646b5dc4068009", - "url": "https://github.com/google/desugar_jdk_libs/archive/24dcd1dead0b64aae3d7c89ca9646b5dc4068009.zip" - } - } - } - } - }, "//:extensions.bzl%bazel_build_deps": { "general": { "bzlTransitiveDigest": "JIUppb9cYpap/pfU76BpY/F/Qd6Qld7XVEsAa78X0T4=", @@ -2459,70 +2440,6 @@ } } }, - "//:rbe_extension.bzl%bazel_rbe_deps": { - "general": { - "bzlTransitiveDigest": "oNMQ9KtzGcqNHdpe8zMO3lRAVIKWWDmz8n5SMubtIIc=", - "accumulatedFileDigests": {}, - "envVariables": {}, - "generatedRepoSpecs": { - "rbe_ubuntu2004_java11": { - "bzlFile": "@@_main~bazel_test_deps~bazelci_rules//:rbe_repo.bzl", - "ruleClassName": "rbe_preconfig", - "attributes": { - "name": "_main~bazel_rbe_deps~rbe_ubuntu2004_java11", - "toolchain": "ubuntu2004-bazel-java11" - } - } - } - } - }, - "//tools/android:android_extensions.bzl%remote_android_tools_extensions": { - "general": { - "bzlTransitiveDigest": "hL6dUUghnqmrcFrs2bvFCvxPHBnPOY3ymycjIbgRQac=", - "accumulatedFileDigests": {}, - "envVariables": {}, - "generatedRepoSpecs": { - "android_tools": { - "bzlFile": "@@//tools/build_defs/repo:http.bzl", - "ruleClassName": "http_archive", - "attributes": { - "name": "_main~remote_android_tools_extensions~android_tools", - "sha256": "2b661a761a735b41c41b3a78089f4fc1982626c76ddb944604ae3ff8c545d3c2", - "url": "https://mirror.bazel.build/bazel_android_tools/android_tools_pkg-0.30.0.tar" - } - }, - "android_gmaven_r8": { - "bzlFile": "@@//tools/build_defs/repo:http.bzl", - "ruleClassName": "http_jar", - "attributes": { - "name": "_main~remote_android_tools_extensions~android_gmaven_r8", - "sha256": "57a696749695a09381a87bc2f08c3a8ed06a717a5caa3ef878a3077e0d3af19d", - "url": "https://maven.google.com/com/android/tools/r8/8.1.56/r8-8.1.56.jar" - } - } - } - } - }, - "//tools/test:extensions.bzl%remote_coverage_tools_extension": { - "general": { - "bzlTransitiveDigest": "DEE4EmNqW6/brpzbLQMxPvdWKALzpq/MeZyydMFsjLI=", - "accumulatedFileDigests": {}, - "envVariables": {}, - "generatedRepoSpecs": { - "remote_coverage_tools": { - "bzlFile": "@@//tools/build_defs/repo:http.bzl", - "ruleClassName": "http_archive", - "attributes": { - "name": "_main~remote_coverage_tools_extension~remote_coverage_tools", - "sha256": "7006375f6756819b7013ca875eab70a541cf7d89142d9c511ed78ea4fefa38af", - "urls": [ - "https://mirror.bazel.build/bazel_coverage_output_generator/releases/coverage_output_generator-v2.6.zip" - ] - } - } - } - } - }, "@apple_support~1.5.0//crosstool:setup.bzl%apple_cc_configure_extension": { "general": { "bzlTransitiveDigest": "jHojdO5WHRVU9tk3Qspqa1HdHApA7p3vMRe5vEKWQkg=", @@ -2546,61 +2463,6 @@ } } }, - "@bazel_features~1.1.0//private:extensions.bzl%version_extension": { - "general": { - "bzlTransitiveDigest": "LKmXjK1avT44pRhO3x6Hplu1mU9qrNOaHP+/tJ0VFfE=", - "accumulatedFileDigests": {}, - "envVariables": {}, - "generatedRepoSpecs": { - "bazel_features_version": { - "bzlFile": "@@bazel_features~1.1.0//private:version_repo.bzl", - "ruleClassName": "version_repo", - "attributes": { - "name": "bazel_features~1.1.0~version_extension~bazel_features_version" - } - }, - "bazel_features_globals": { - "bzlFile": "@@bazel_features~1.1.0//private:globals_repo.bzl", - "ruleClassName": "globals_repo", - "attributes": { - "name": "bazel_features~1.1.0~version_extension~bazel_features_globals", - "globals": { - "RunEnvironmentInfo": "5.3.0", - "DefaultInfo": "0.0.1", - "__TestingOnly_NeverAvailable": "1000000000.0.0" - } - } - } - } - } - }, - "@bazel_tools//tools/android:android_extensions.bzl%remote_android_tools_extensions": { - "general": { - "bzlTransitiveDigest": "4+Dj2H7maLh8JtpJKiuaI7PSXiIZw6oWX9xsVhnJ5DU=", - "accumulatedFileDigests": {}, - "envVariables": {}, - "generatedRepoSpecs": { - "android_tools": { - "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", - "ruleClassName": "http_archive", - "attributes": { - "name": "bazel_tools~remote_android_tools_extensions~android_tools", - "sha256": "1afa4b7e13c82523c8b69e87f8d598c891ec7e2baa41d9e24e08becd723edb4d", - "url": "https://mirror.bazel.build/bazel_android_tools/android_tools_pkg-0.27.0.tar.gz" - } - }, - "android_gmaven_r8": { - "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", - "ruleClassName": "http_jar", - "attributes": { - "name": "bazel_tools~remote_android_tools_extensions~android_gmaven_r8", - "sha256": "ab1379835c7d3e5f21f80347c3c81e2f762e0b9b02748ae5232c3afa14adf702", - "url": "https://maven.google.com/com/android/tools/r8/8.0.40/r8-8.0.40.jar" - } - } - } - } - }, "@bazel_tools//tools/cpp:cc_configure.bzl%cc_configure_extension": { "general": { "bzlTransitiveDigest": "sftnIlf92nP/IUiWiMkgL9Sh8Drk9kKhTXHvoavVJZg=", @@ -2624,24 +2486,6 @@ } } }, - "@bazel_tools//tools/osx:xcode_configure.bzl%xcode_configure_extension": { - "general": { - "bzlTransitiveDigest": "CtmyZVPtInM72JKIFfarSKOF0R/GbDRl8HBuOsRWhRs=", - "accumulatedFileDigests": {}, - "envVariables": {}, - "generatedRepoSpecs": { - "local_config_xcode": { - "bzlFile": "@@bazel_tools//tools/osx:xcode_configure.bzl", - "ruleClassName": "xcode_autoconf", - "attributes": { - "name": "bazel_tools~xcode_configure_extension~local_config_xcode", - "xcode_locator": "@bazel_tools//tools/osx:xcode_locator.m", - "remote_xcode": "" - } - } - } - } - }, "@bazel_tools//tools/sh:sh_configure.bzl%sh_configure_extension": { "general": { "bzlTransitiveDigest": "hp4NgmNjEg5+xgvzfh6L83bt9/aiiWETuNpwNuF1MSU=", @@ -2658,314 +2502,6 @@ } } }, - "@bazel_tools//tools/test:extensions.bzl%remote_coverage_tools_extension": { - "general": { - "bzlTransitiveDigest": "IWFtZ+6M0WGmNpfnHZMxnVFSDZ6pRTEWt7jixp7XffQ=", - "accumulatedFileDigests": {}, - "envVariables": {}, - "generatedRepoSpecs": { - "remote_coverage_tools": { - "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", - "ruleClassName": "http_archive", - "attributes": { - "name": "bazel_tools~remote_coverage_tools_extension~remote_coverage_tools", - "sha256": "7006375f6756819b7013ca875eab70a541cf7d89142d9c511ed78ea4fefa38af", - "urls": [ - "https://mirror.bazel.build/bazel_coverage_output_generator/releases/coverage_output_generator-v2.6.zip" - ] - } - } - } - } - }, - "@gazelle~0.30.0//:extensions.bzl%go_deps": { - "general": { - "bzlTransitiveDigest": "BoYvkoiu4JJx2ptGuMiFUuXn9wupdeJIWbn2MXOkBb8=", - "accumulatedFileDigests": { - "@@rules_go~0.39.1//:go.sum": "022d36c9ebcc7b5dee1e9b85b3da9c9f3a529ee6f979946d66e4955b8d54614a", - "@@rules_go~0.39.1//:go.mod": "a7143f329c2a3e0b983ce74a96c0c25b0d0c59d236d75f7e1b069aadd988d55e", - "@@gazelle~0.30.0//:go.sum": "c9624aa41e5ffd61a8581d57a3c4046e62b46630dddc8b191e65017f34ff12a5", - "@@gazelle~0.30.0//:go.mod": "5346019bf0673364b383d56ffbc9fced98b7b4ee921e865dfe905a1ebe82d326" - }, - "envVariables": {}, - "generatedRepoSpecs": { - "com_github_fsnotify_fsnotify": { - "bzlFile": "@@gazelle~0.30.0//internal:go_repository.bzl", - "ruleClassName": "go_repository", - "attributes": { - "name": "gazelle~0.30.0~go_deps~com_github_fsnotify_fsnotify", - "importpath": "github.com/fsnotify/fsnotify", - "sum": "h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY=", - "replace": "", - "version": "v1.6.0", - "build_directives": [] - } - }, - "org_golang_x_text": { - "bzlFile": "@@gazelle~0.30.0//internal:go_repository.bzl", - "ruleClassName": "go_repository", - "attributes": { - "name": "gazelle~0.30.0~go_deps~org_golang_x_text", - "importpath": "golang.org/x/text", - "sum": "h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k=", - "replace": "", - "version": "v0.3.3", - "build_directives": [] - } - }, - "org_golang_google_protobuf": { - "bzlFile": "@@gazelle~0.30.0//internal:go_repository.bzl", - "ruleClassName": "go_repository", - "attributes": { - "name": "gazelle~0.30.0~go_deps~org_golang_google_protobuf", - "importpath": "google.golang.org/protobuf", - "sum": "h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw=", - "replace": "", - "version": "v1.28.0", - "build_directives": [] - } - }, - "com_github_bmatcuk_doublestar_v4": { - "bzlFile": "@@gazelle~0.30.0//internal:go_repository.bzl", - "ruleClassName": "go_repository", - "attributes": { - "name": "gazelle~0.30.0~go_deps~com_github_bmatcuk_doublestar_v4", - "importpath": "github.com/bmatcuk/doublestar/v4", - "sum": "h1:HTuxyug8GyFbRkrffIpzNCSK4luc0TY3wzXvzIZhEXc=", - "replace": "", - "version": "v4.6.0", - "build_directives": [] - } - }, - "com_github_pmezard_go_difflib": { - "bzlFile": "@@gazelle~0.30.0//internal:go_repository.bzl", - "ruleClassName": "go_repository", - "attributes": { - "name": "gazelle~0.30.0~go_deps~com_github_pmezard_go_difflib", - "importpath": "github.com/pmezard/go-difflib", - "sum": "h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=", - "replace": "", - "version": "v1.0.0", - "build_directives": [] - } - }, - "org_golang_x_mod": { - "bzlFile": "@@gazelle~0.30.0//internal:go_repository.bzl", - "ruleClassName": "go_repository", - "attributes": { - "name": "gazelle~0.30.0~go_deps~org_golang_x_mod", - "importpath": "golang.org/x/mod", - "sum": "h1:KENHtAZL2y3NLMYZeHY9DW8HW8V+kQyJsY/V9JlKvCs=", - "replace": "", - "version": "v0.9.0", - "build_directives": [] - } - }, - "org_golang_x_tools": { - "bzlFile": "@@gazelle~0.30.0//internal:go_repository.bzl", - "ruleClassName": "go_repository", - "attributes": { - "name": "gazelle~0.30.0~go_deps~org_golang_x_tools", - "importpath": "golang.org/x/tools", - "sum": "h1:W4OVu8VVOaIO0yzWMNdepAulS7YfoS3Zabrm8DOXXU4=", - "replace": "", - "version": "v0.7.0", - "build_directives": [] - } - }, - "org_golang_x_net": { - "bzlFile": "@@gazelle~0.30.0//internal:go_repository.bzl", - "ruleClassName": "go_repository", - "attributes": { - "name": "gazelle~0.30.0~go_deps~org_golang_x_net", - "importpath": "golang.org/x/net", - "sum": "h1:4nGaVu0QrbjT/AK2PRLuQfQuh6DJve+pELhqTdAj3x0=", - "replace": "", - "version": "v0.0.0-20210405180319-a5a99cb37ef4", - "build_directives": [] - } - }, - "com_github_bazelbuild_buildtools": { - "bzlFile": "@@gazelle~0.30.0//internal:go_repository.bzl", - "ruleClassName": "go_repository", - "attributes": { - "name": "gazelle~0.30.0~go_deps~com_github_bazelbuild_buildtools", - "importpath": "github.com/bazelbuild/buildtools", - "sum": "h1:XmPu4mXICgdGnC5dXGjUGbwUD/kUmS0l5Aop3LaevBM=", - "replace": "", - "version": "v0.0.0-20230317132445-9c3c1fc0106e", - "build_directives": [] - } - }, - "org_golang_google_genproto": { - "bzlFile": "@@gazelle~0.30.0//internal:go_repository.bzl", - "ruleClassName": "go_repository", - "attributes": { - "name": "gazelle~0.30.0~go_deps~org_golang_google_genproto", - "importpath": "google.golang.org/genproto", - "sum": "h1:+kGHl1aib/qcwaRi1CbqBZ1rk19r85MNUf8HaBghugY=", - "replace": "", - "version": "v0.0.0-20200526211855-cb27e3aa2013", - "build_directives": [] - } - }, - "com_github_gogo_protobuf": { - "bzlFile": "@@gazelle~0.30.0//internal:go_repository.bzl", - "ruleClassName": "go_repository", - "attributes": { - "name": "gazelle~0.30.0~go_deps~com_github_gogo_protobuf", - "importpath": "github.com/gogo/protobuf", - "sum": "h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=", - "replace": "", - "version": "v1.3.2", - "build_directives": [ - "gazelle:proto disable" - ] - } - }, - "com_github_pelletier_go_toml": { - "bzlFile": "@@gazelle~0.30.0//internal:go_repository.bzl", - "ruleClassName": "go_repository", - "attributes": { - "name": "gazelle~0.30.0~go_deps~com_github_pelletier_go_toml", - "importpath": "github.com/pelletier/go-toml", - "sum": "h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8=", - "replace": "", - "version": "v1.9.5", - "build_directives": [] - } - }, - "com_github_golang_protobuf": { - "bzlFile": "@@gazelle~0.30.0//internal:go_repository.bzl", - "ruleClassName": "go_repository", - "attributes": { - "name": "gazelle~0.30.0~go_deps~com_github_golang_protobuf", - "importpath": "github.com/golang/protobuf", - "sum": "h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw=", - "replace": "", - "version": "v1.5.2", - "build_directives": [] - } - }, - "com_github_golang_mock": { - "bzlFile": "@@gazelle~0.30.0//internal:go_repository.bzl", - "ruleClassName": "go_repository", - "attributes": { - "name": "gazelle~0.30.0~go_deps~com_github_golang_mock", - "importpath": "github.com/golang/mock", - "sum": "h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc=", - "replace": "", - "version": "v1.6.0", - "build_directives": [] - } - }, - "org_golang_x_sync": { - "bzlFile": "@@gazelle~0.30.0//internal:go_repository.bzl", - "ruleClassName": "go_repository", - "attributes": { - "name": "gazelle~0.30.0~go_deps~org_golang_x_sync", - "importpath": "golang.org/x/sync", - "sum": "h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o=", - "replace": "", - "version": "v0.1.0", - "build_directives": [] - } - }, - "bazel_gazelle_go_repository_config": { - "bzlFile": "@@gazelle~0.30.0//internal/bzlmod:go_deps.bzl", - "ruleClassName": "_go_repository_config", - "attributes": { - "name": "gazelle~0.30.0~go_deps~bazel_gazelle_go_repository_config", - "importpaths": { - "com_github_gogo_protobuf": "github.com/gogo/protobuf", - "com_github_golang_mock": "github.com/golang/mock", - "com_github_golang_protobuf": "github.com/golang/protobuf", - "org_golang_google_protobuf": "google.golang.org/protobuf", - "org_golang_x_net": "golang.org/x/net", - "org_golang_x_sys": "golang.org/x/sys", - "org_golang_x_text": "golang.org/x/text", - "org_golang_google_genproto": "google.golang.org/genproto", - "org_golang_google_grpc": "google.golang.org/grpc", - "com_github_bazelbuild_buildtools": "github.com/bazelbuild/buildtools", - "com_github_bmatcuk_doublestar_v4": "github.com/bmatcuk/doublestar/v4", - "com_github_fsnotify_fsnotify": "github.com/fsnotify/fsnotify", - "com_github_google_go_cmp": "github.com/google/go-cmp", - "com_github_pelletier_go_toml": "github.com/pelletier/go-toml", - "com_github_pmezard_go_difflib": "github.com/pmezard/go-difflib", - "org_golang_x_mod": "golang.org/x/mod", - "org_golang_x_sync": "golang.org/x/sync", - "org_golang_x_tools": "golang.org/x/tools" - }, - "build_naming_conventions": {} - } - }, - "org_golang_google_grpc": { - "bzlFile": "@@gazelle~0.30.0//internal:go_repository.bzl", - "ruleClassName": "go_repository", - "attributes": { - "name": "gazelle~0.30.0~go_deps~org_golang_google_grpc", - "importpath": "google.golang.org/grpc", - "sum": "h1:fPVVDxY9w++VjTZsYvXWqEf9Rqar/e+9zYfxKK+W+YU=", - "replace": "", - "version": "v1.50.0", - "build_directives": [ - "gazelle:proto disable" - ] - } - }, - "org_golang_x_sys": { - "bzlFile": "@@gazelle~0.30.0//internal:go_repository.bzl", - "ruleClassName": "go_repository", - "attributes": { - "name": "gazelle~0.30.0~go_deps~org_golang_x_sys", - "importpath": "golang.org/x/sys", - "sum": "h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ=", - "replace": "", - "version": "v0.6.0", - "build_directives": [] - } - }, - "com_github_google_go_cmp": { - "bzlFile": "@@gazelle~0.30.0//internal:go_repository.bzl", - "ruleClassName": "go_repository", - "attributes": { - "name": "gazelle~0.30.0~go_deps~com_github_google_go_cmp", - "importpath": "github.com/google/go-cmp", - "sum": "h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=", - "replace": "", - "version": "v0.5.9", - "build_directives": [] - } - } - } - } - }, - "@gazelle~0.30.0//internal/bzlmod:non_module_deps.bzl%non_module_deps": { - "general": { - "bzlTransitiveDigest": "30wev+wJfzc4s72MCfbP9U8W+3Js2b+Xbo5ofgZbHw8=", - "accumulatedFileDigests": {}, - "envVariables": {}, - "generatedRepoSpecs": { - "bazel_gazelle_go_repository_tools": { - "bzlFile": "@@gazelle~0.30.0//internal:go_repository_tools.bzl", - "ruleClassName": "go_repository_tools", - "attributes": { - "name": "gazelle~0.30.0~non_module_deps~bazel_gazelle_go_repository_tools", - "go_cache": "@@gazelle~0.30.0~non_module_deps~bazel_gazelle_go_repository_cache//:go.env" - } - }, - "bazel_gazelle_go_repository_cache": { - "bzlFile": "@@gazelle~0.30.0//internal:go_repository_cache.bzl", - "ruleClassName": "go_repository_cache", - "attributes": { - "name": "gazelle~0.30.0~non_module_deps~bazel_gazelle_go_repository_cache", - "go_sdk_name": "go_default_sdk", - "go_env": {} - } - } - } - } - }, "@grpc~1.48.1.bcr.1//bazel:grpc_deps.bzl%grpc_repo_deps_ext": { "general": { "bzlTransitiveDigest": "S5rdtWt3QVZgX2cP/Ot1NLUmlqgtcoz1cPNksEQYtFQ=", @@ -3472,231 +3008,6 @@ } } }, - "@rules_go~0.39.1//go/private:extensions.bzl%non_module_dependencies": { - "general": { - "bzlTransitiveDigest": "lISD5Aqr6V4eTUAf5oZ4MilfT1BSlMybWvnRzRfSmM4=", - "accumulatedFileDigests": {}, - "envVariables": {}, - "generatedRepoSpecs": { - "org_golang_x_xerrors": { - "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", - "ruleClassName": "http_archive", - "attributes": { - "name": "rules_go~0.39.1~non_module_dependencies~org_golang_x_xerrors", - "urls": [ - "https://mirror.bazel.build/github.com/golang/xerrors/archive/04be3eba64a22a838cdb17b8dca15a52871c08b4.zip", - "https://github.com/golang/xerrors/archive/04be3eba64a22a838cdb17b8dca15a52871c08b4.zip" - ], - "sha256": "ffad2b06ef2e09d040da2ff08077865e99ab95d4d0451737fc8e33706bb01634", - "strip_prefix": "xerrors-04be3eba64a22a838cdb17b8dca15a52871c08b4", - "patches": [ - "@@rules_go~0.39.1//third_party:org_golang_x_xerrors-gazelle.patch" - ], - "patch_args": [ - "-p1" - ] - } - }, - "gogo_special_proto": { - "bzlFile": "@@rules_go~0.39.1//proto:gogo.bzl", - "ruleClassName": "gogo_special_proto", - "attributes": { - "name": "rules_go~0.39.1~non_module_dependencies~gogo_special_proto" - } - }, - "org_golang_google_protobuf": { - "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", - "ruleClassName": "http_archive", - "attributes": { - "name": "rules_go~0.39.1~non_module_dependencies~org_golang_google_protobuf", - "sha256": "cb1a05581c33b3705ede6c08edf9b9c1dbc579559ba30f532704c324e42bf801", - "urls": [ - "https://mirror.bazel.build/github.com/protocolbuffers/protobuf-go/archive/refs/tags/v1.30.0.zip", - "https://github.com/protocolbuffers/protobuf-go/archive/refs/tags/v1.30.0.zip" - ], - "strip_prefix": "protobuf-go-1.30.0", - "patches": [ - "@@rules_go~0.39.1//third_party:org_golang_google_protobuf-gazelle.patch" - ], - "patch_args": [ - "-p1" - ] - } - }, - "com_github_mwitkow_go_proto_validators": { - "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", - "ruleClassName": "http_archive", - "attributes": { - "name": "rules_go~0.39.1~non_module_dependencies~com_github_mwitkow_go_proto_validators", - "urls": [ - "https://mirror.bazel.build/github.com/mwitkow/go-proto-validators/archive/refs/tags/v0.3.2.zip", - "https://github.com/mwitkow/go-proto-validators/archive/refs/tags/v0.3.2.zip" - ], - "sha256": "d8697f05a2f0eaeb65261b480e1e6035301892d9fc07ed945622f41b12a68142", - "strip_prefix": "go-proto-validators-0.3.2" - } - }, - "org_golang_x_tools": { - "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", - "ruleClassName": "http_archive", - "attributes": { - "name": "rules_go~0.39.1~non_module_dependencies~org_golang_x_tools", - "urls": [ - "https://mirror.bazel.build/github.com/golang/tools/archive/refs/tags/v0.7.0.zip", - "https://github.com/golang/tools/archive/refs/tags/v0.7.0.zip" - ], - "sha256": "9f20a20f29f4008d797a8be882ef82b69cf8f7f2b96dbdfe3814c57d8280fa4b", - "strip_prefix": "tools-0.7.0", - "patches": [ - "@@rules_go~0.39.1//third_party:org_golang_x_tools-deletegopls.patch", - "@@rules_go~0.39.1//third_party:org_golang_x_tools-gazelle.patch" - ], - "patch_args": [ - "-p1" - ] - } - }, - "go_googleapis": { - "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", - "ruleClassName": "http_archive", - "attributes": { - "name": "rules_go~0.39.1~non_module_dependencies~go_googleapis", - "urls": [ - "https://mirror.bazel.build/github.com/googleapis/googleapis/archive/83c3605afb5a39952bf0a0809875d41cf2a558ca.zip", - "https://github.com/googleapis/googleapis/archive/83c3605afb5a39952bf0a0809875d41cf2a558ca.zip" - ], - "sha256": "ba694861340e792fd31cb77274eacaf6e4ca8bda97707898f41d8bebfd8a4984", - "strip_prefix": "googleapis-83c3605afb5a39952bf0a0809875d41cf2a558ca", - "patches": [ - "@@rules_go~0.39.1//third_party:go_googleapis-deletebuild.patch", - "@@rules_go~0.39.1//third_party:go_googleapis-directives.patch", - "@@rules_go~0.39.1//third_party:go_googleapis-gazelle.patch" - ], - "patch_args": [ - "-E", - "-p1" - ] - } - }, - "org_golang_google_genproto": { - "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", - "ruleClassName": "http_archive", - "attributes": { - "name": "rules_go~0.39.1~non_module_dependencies~org_golang_google_genproto", - "urls": [ - "https://mirror.bazel.build/github.com/googleapis/go-genproto/archive/6ac7f18bb9d5eeeb13a9f1ae4f21e4374a1952f8.zip", - "https://github.com/googleapis/go-genproto/archive/6ac7f18bb9d5eeeb13a9f1ae4f21e4374a1952f8.zip" - ], - "sha256": "3470e7a89b24971b20c4bb8900a668df25279e4b741f72bc09418c1f22543215", - "strip_prefix": "go-genproto-6ac7f18bb9d5eeeb13a9f1ae4f21e4374a1952f8", - "patches": [ - "@@rules_go~0.39.1//third_party:org_golang_google_genproto-gazelle.patch" - ], - "patch_args": [ - "-p1" - ] - } - }, - "bazel_skylib": { - "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", - "ruleClassName": "http_archive", - "attributes": { - "name": "rules_go~0.39.1~non_module_dependencies~bazel_skylib", - "urls": [ - "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.4.1/bazel-skylib-1.4.1.tar.gz", - "https://github.com/bazelbuild/bazel-skylib/releases/download/1.4.1/bazel-skylib-1.4.1.tar.gz" - ], - "sha256": "b8a1527901774180afc798aeb28c4634bdccf19c4d98e7bdd1ce79d1fe9aaad7", - "strip_prefix": "" - } - }, - "com_github_gogo_protobuf": { - "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", - "ruleClassName": "http_archive", - "attributes": { - "name": "rules_go~0.39.1~non_module_dependencies~com_github_gogo_protobuf", - "urls": [ - "https://mirror.bazel.build/github.com/gogo/protobuf/archive/refs/tags/v1.3.2.zip", - "https://github.com/gogo/protobuf/archive/refs/tags/v1.3.2.zip" - ], - "sha256": "f89f8241af909ce3226562d135c25b28e656ae173337b3e58ede917aa26e1e3c", - "strip_prefix": "protobuf-1.3.2", - "patches": [ - "@@rules_go~0.39.1//third_party:com_github_gogo_protobuf-gazelle.patch" - ], - "patch_args": [ - "-p1" - ] - } - }, - "com_github_golang_protobuf": { - "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", - "ruleClassName": "http_archive", - "attributes": { - "name": "rules_go~0.39.1~non_module_dependencies~com_github_golang_protobuf", - "urls": [ - "https://mirror.bazel.build/github.com/golang/protobuf/archive/refs/tags/v1.5.3.zip", - "https://github.com/golang/protobuf/archive/refs/tags/v1.5.3.zip" - ], - "sha256": "2dced4544ae5372281e20f1e48ca76368355a01b31353724718c4d6e3dcbb430", - "strip_prefix": "protobuf-1.5.3", - "patches": [ - "@@rules_go~0.39.1//third_party:com_github_golang_protobuf-gazelle.patch" - ], - "patch_args": [ - "-p1" - ] - } - }, - "io_bazel_rules_nogo": { - "bzlFile": "@@rules_go~0.39.1//go/private:nogo.bzl", - "ruleClassName": "go_register_nogo", - "attributes": { - "name": "rules_go~0.39.1~non_module_dependencies~io_bazel_rules_nogo", - "nogo": "@io_bazel_rules_go//:default_nogo" - } - }, - "com_github_golang_mock": { - "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", - "ruleClassName": "http_archive", - "attributes": { - "name": "rules_go~0.39.1~non_module_dependencies~com_github_golang_mock", - "urls": [ - "https://mirror.bazel.build/github.com/golang/mock/archive/refs/tags/v1.7.0-rc.1.zip", - "https://github.com/golang/mock/archive/refs/tags/v1.7.0-rc.1.zip" - ], - "patches": [ - "@@rules_go~0.39.1//third_party:com_github_golang_mock-gazelle.patch" - ], - "patch_args": [ - "-p1" - ], - "sha256": "5359c78b0c1649cf7beb3b48ff8b1d1aaf0243b22ea4789aba94805280075d8e", - "strip_prefix": "mock-1.7.0-rc.1" - } - }, - "org_golang_x_sys": { - "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", - "ruleClassName": "http_archive", - "attributes": { - "name": "rules_go~0.39.1~non_module_dependencies~org_golang_x_sys", - "urls": [ - "https://mirror.bazel.build/github.com/golang/sys/archive/refs/tags/v0.6.0.zip", - "https://github.com/golang/sys/archive/refs/tags/v0.6.0.zip" - ], - "sha256": "7f2399398b2eb4f1f495cc754d6353566e0ad934ee0eb46505e55162e0def56d", - "strip_prefix": "sys-0.6.0", - "patches": [ - "@@rules_go~0.39.1//third_party:org_golang_x_sys-gazelle.patch" - ], - "patch_args": [ - "-p1" - ] - } - } - } - } - }, "@rules_java~7.1.0//java:extensions.bzl%toolchains": { "general": { "bzlTransitiveDigest": "p7Arq0FCdeuM/UFxax3JGDCetBx8pIqr2m77/MWrf8w=", @@ -7988,200 +7299,6 @@ } } }, - "@rules_jvm_external~5.2//:non-module-deps.bzl%non_module_deps": { - "general": { - "bzlTransitiveDigest": "QlnkwH7xmrau2+KLjoV5wWr0r3Ne+JfXhrHUVpwVloQ=", - "accumulatedFileDigests": {}, - "envVariables": {}, - "generatedRepoSpecs": { - "io_bazel_rules_kotlin": { - "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", - "ruleClassName": "http_archive", - "attributes": { - "name": "rules_jvm_external~5.2~non_module_deps~io_bazel_rules_kotlin", - "sha256": "946747acdbeae799b085d12b240ec346f775ac65236dfcf18aa0cd7300f6de78", - "urls": [ - "https://github.com/bazelbuild/rules_kotlin/releases/download/v1.7.0-RC-2/rules_kotlin_release.tgz" - ] - } - } - } - } - }, - "@rules_python~0.26.0//python/extensions:pip.bzl%pip": { - "os:osx,arch:aarch64": { - "bzlTransitiveDigest": "E4QgOqZbBS/oj8Ee3OTJc/aHg+JLL1isQX37e9bF+jc=", - "accumulatedFileDigests": { - "@@//:requirements.txt": "ff12967a755bb8e9b4c92524f6471a99e14c30474a3d428547c55745ec8f23a0" - }, - "envVariables": {}, - "generatedRepoSpecs": { - "bazel_pip_dev_deps": { - "bzlFile": "@@rules_python~0.26.0//python/pip_install:pip_repository.bzl", - "ruleClassName": "pip_hub_repository_bzlmod", - "attributes": { - "name": "rules_python~0.26.0~pip~bazel_pip_dev_deps", - "repo_name": "bazel_pip_dev_deps", - "whl_map": { - "bazel_runfiles": [ - "3.8.18" - ] - }, - "default_version": "3.8.18" - } - }, - "bazel_pip_dev_deps_38_bazel_runfiles": { - "bzlFile": "@@rules_python~0.26.0//python/pip_install:pip_repository.bzl", - "ruleClassName": "whl_library", - "attributes": { - "name": "rules_python~0.26.0~pip~bazel_pip_dev_deps_38_bazel_runfiles", - "requirement": "bazel-runfiles==0.24.0", - "repo": "bazel_pip_dev_deps_38", - "repo_prefix": "bazel_pip_dev_deps_38_", - "python_interpreter": "", - "python_interpreter_target": "@@rules_python~0.26.0~python~python_3_8_aarch64-apple-darwin//:bin/python3", - "quiet": true, - "timeout": 600, - "isolated": true, - "extra_pip_args": [], - "download_only": false, - "pip_data_exclude": [], - "enable_implicit_namespace_pkgs": false, - "environment": {} - } - } - } - }, - "os:osx,arch:x86_64": { - "bzlTransitiveDigest": "5EamR6lYbDoZchZjoF0opxKmFTBnPc4IRBqvtfKzQBg=", - "accumulatedFileDigests": { - "@@//:requirements.txt": "ff12967a755bb8e9b4c92524f6471a99e14c30474a3d428547c55745ec8f23a0" - }, - "envVariables": {}, - "generatedRepoSpecs": { - "bazel_pip_dev_deps": { - "bzlFile": "@@rules_python~0.26.0//python/pip_install:pip_repository.bzl", - "ruleClassName": "pip_hub_repository_bzlmod", - "attributes": { - "name": "rules_python~0.26.0~pip~bazel_pip_dev_deps", - "repo_name": "bazel_pip_dev_deps", - "whl_map": { - "bazel_runfiles": [ - "3.8.18" - ] - }, - "default_version": "3.8.18" - } - }, - "bazel_pip_dev_deps_38_bazel_runfiles": { - "bzlFile": "@@rules_python~0.26.0//python/pip_install:pip_repository.bzl", - "ruleClassName": "whl_library", - "attributes": { - "name": "rules_python~0.26.0~pip~bazel_pip_dev_deps_38_bazel_runfiles", - "requirement": "bazel-runfiles==0.24.0", - "repo": "bazel_pip_dev_deps_38", - "repo_prefix": "bazel_pip_dev_deps_38_", - "python_interpreter": "", - "python_interpreter_target": "@@rules_python~0.26.0~python~python_3_8_x86_64-apple-darwin//:bin/python3", - "quiet": true, - "timeout": 600, - "isolated": true, - "extra_pip_args": [], - "download_only": false, - "pip_data_exclude": [], - "enable_implicit_namespace_pkgs": false, - "environment": {} - } - } - } - }, - "os:windows,arch:amd64": { - "bzlTransitiveDigest": "TXSsRggvq8p1Am/XZURcY+/3pp6aMvMI4CIzUjNNoVc=", - "accumulatedFileDigests": { - "@@//:requirements.txt": "ff12967a755bb8e9b4c92524f6471a99e14c30474a3d428547c55745ec8f23a0" - }, - "envVariables": {}, - "generatedRepoSpecs": { - "bazel_pip_dev_deps": { - "bzlFile": "@@rules_python~0.26.0//python/pip_install:pip_repository.bzl", - "ruleClassName": "pip_hub_repository_bzlmod", - "attributes": { - "name": "rules_python~0.26.0~pip~bazel_pip_dev_deps", - "repo_name": "bazel_pip_dev_deps", - "whl_map": { - "bazel_runfiles": [ - "3.8.18" - ] - }, - "default_version": "3.8.18" - } - }, - "bazel_pip_dev_deps_38_bazel_runfiles": { - "bzlFile": "@@rules_python~0.26.0//python/pip_install:pip_repository.bzl", - "ruleClassName": "whl_library", - "attributes": { - "name": "rules_python~0.26.0~pip~bazel_pip_dev_deps_38_bazel_runfiles", - "requirement": "bazel-runfiles==0.24.0", - "repo": "bazel_pip_dev_deps_38", - "repo_prefix": "bazel_pip_dev_deps_38_", - "python_interpreter": "", - "python_interpreter_target": "@@rules_python~0.26.0~python~python_3_8_x86_64-pc-windows-msvc//:python.exe", - "quiet": true, - "timeout": 600, - "isolated": true, - "extra_pip_args": [], - "download_only": false, - "pip_data_exclude": [], - "enable_implicit_namespace_pkgs": false, - "environment": {} - } - } - } - }, - "os:linux,arch:amd64": { - "bzlTransitiveDigest": "8ozZeXZLMP2XAUvOsoOqqAh+f3capth/BEC9p7XrFHQ=", - "accumulatedFileDigests": { - "@@//:requirements.txt": "ff12967a755bb8e9b4c92524f6471a99e14c30474a3d428547c55745ec8f23a0" - }, - "envVariables": {}, - "generatedRepoSpecs": { - "bazel_pip_dev_deps": { - "bzlFile": "@@rules_python~0.26.0//python/pip_install:pip_repository.bzl", - "ruleClassName": "pip_hub_repository_bzlmod", - "attributes": { - "name": "rules_python~0.26.0~pip~bazel_pip_dev_deps", - "repo_name": "bazel_pip_dev_deps", - "whl_map": { - "bazel_runfiles": [ - "3.8.18" - ] - }, - "default_version": "3.8.18" - } - }, - "bazel_pip_dev_deps_38_bazel_runfiles": { - "bzlFile": "@@rules_python~0.26.0//python/pip_install:pip_repository.bzl", - "ruleClassName": "whl_library", - "attributes": { - "name": "rules_python~0.26.0~pip~bazel_pip_dev_deps_38_bazel_runfiles", - "requirement": "bazel-runfiles==0.24.0", - "repo": "bazel_pip_dev_deps_38", - "repo_prefix": "bazel_pip_dev_deps_38_", - "python_interpreter": "", - "python_interpreter_target": "@@rules_python~0.26.0~python~python_3_8_x86_64-unknown-linux-gnu//:bin/python3", - "quiet": true, - "timeout": 600, - "isolated": true, - "extra_pip_args": [], - "download_only": false, - "pip_data_exclude": [], - "enable_implicit_namespace_pkgs": false, - "environment": {} - } - } - } - } - }, "@rules_python~0.26.0//python/extensions:python.bzl%python": { "general": { "bzlTransitiveDigest": "xlkyXQiU87j2f+jKiO4buHXyNexVt0a6ildROtqkRMA=", diff --git a/src/main/java/com/google/devtools/build/lib/bazel/repository/downloader/Checksum.java b/src/main/java/com/google/devtools/build/lib/bazel/repository/downloader/Checksum.java index 09b3aeea884ac0..f7d82a7400be4e 100644 --- a/src/main/java/com/google/devtools/build/lib/bazel/repository/downloader/Checksum.java +++ b/src/main/java/com/google/devtools/build/lib/bazel/repository/downloader/Checksum.java @@ -34,18 +34,26 @@ private InvalidChecksumException(String msg) { private final KeyType keyType; private final HashCode hashCode; + private final boolean useSubresourceIntegrity; - private Checksum(KeyType keyType, HashCode hashCode) { + private Checksum(KeyType keyType, HashCode hashCode, boolean useSubresourceIntegrity) { this.keyType = keyType; this.hashCode = hashCode; + this.useSubresourceIntegrity = useSubresourceIntegrity; } /** Constructs a new Checksum for a given key type and hash, in hex format. */ public static Checksum fromString(KeyType keyType, String hash) throws InvalidChecksumException { + return fromString(keyType, hash, /* useSubresourceIntegrity= */ false); + } + + private static Checksum fromString(KeyType keyType, String hash, boolean useSubresourceIntegrity) + throws InvalidChecksumException { if (!keyType.isValid(hash)) { throw new InvalidChecksumException(keyType, hash); } - return new Checksum(keyType, HashCode.fromString(Ascii.toLowerCase(hash))); + return new Checksum( + keyType, HashCode.fromString(Ascii.toLowerCase(hash)), useSubresourceIntegrity); } /** Constructs a new Checksum from a hash in Subresource Integrity format. */ @@ -89,16 +97,25 @@ public static Checksum fromSubresourceIntegrity(String integrity) "Invalid " + keyType + " SRI checksum '" + integrity + "'"); } - return Checksum.fromString(keyType, HashCode.fromBytes(hash).toString()); + return Checksum.fromString( + keyType, HashCode.fromBytes(hash).toString(), /* useSubresourceIntegrity= */ true); } - public String toSubresourceIntegrity() { + private static String toSubresourceIntegrity(KeyType keyType, HashCode hashCode) { String encoded = Base64.getEncoder().encodeToString(hashCode.asBytes()); return keyType.getHashName() + "-" + encoded; } + public String toSubresourceIntegrity() { + return toSubresourceIntegrity(keyType, hashCode); + } + @Override public String toString() { + return emitOtherHashInSameFormat(hashCode); + } + + public String toHexString() { return hashCode.toString(); } @@ -109,4 +126,12 @@ public HashCode getHashCode() { public KeyType getKeyType() { return keyType; } + + public String emitOtherHashInSameFormat(HashCode otherHash) { + if (useSubresourceIntegrity) { + return toSubresourceIntegrity(keyType, otherHash); + } else { + return otherHash.toString(); + } + } } diff --git a/src/main/java/com/google/devtools/build/lib/bazel/repository/downloader/HashInputStream.java b/src/main/java/com/google/devtools/build/lib/bazel/repository/downloader/HashInputStream.java index 51695a52187b00..f68df3e03d4158 100644 --- a/src/main/java/com/google/devtools/build/lib/bazel/repository/downloader/HashInputStream.java +++ b/src/main/java/com/google/devtools/build/lib/bazel/repository/downloader/HashInputStream.java @@ -37,13 +37,13 @@ final class HashInputStream extends InputStream { private final InputStream delegate; private final Hasher hasher; - private final HashCode code; + private final Checksum checksum; @Nullable private volatile HashCode actual; HashInputStream(@WillCloseWhenClosed InputStream delegate, Checksum checksum) { this.delegate = delegate; this.hasher = checksum.getKeyType().newHasher(); - this.code = checksum.getHashCode(); + this.checksum = checksum; } @Override @@ -83,9 +83,11 @@ private void check() throws IOException { if (actual == null) { actual = hasher.hash(); } - if (!code.equals(actual)) { + if (!checksum.getHashCode().equals(actual)) { throw new UnrecoverableHttpException( - String.format("Checksum was %s but wanted %s", actual, code)); + String.format( + "Checksum was %s but wanted %s", + checksum.emitOtherHashInSameFormat(actual), checksum)); } } } diff --git a/src/main/java/com/google/devtools/build/lib/bazel/repository/downloader/HashOutputStream.java b/src/main/java/com/google/devtools/build/lib/bazel/repository/downloader/HashOutputStream.java index 9235fc73af48c8..7c8281e33aff72 100644 --- a/src/main/java/com/google/devtools/build/lib/bazel/repository/downloader/HashOutputStream.java +++ b/src/main/java/com/google/devtools/build/lib/bazel/repository/downloader/HashOutputStream.java @@ -39,13 +39,13 @@ public final class HashOutputStream extends OutputStream { private final OutputStream delegate; private final Hasher hasher; - private final HashCode code; + private final Checksum checksum; @Nullable private volatile HashCode actual; public HashOutputStream(@WillCloseWhenClosed OutputStream delegate, Checksum checksum) { this.delegate = delegate; this.hasher = checksum.getKeyType().newHasher(); - this.code = checksum.getHashCode(); + this.checksum = checksum; } @Override @@ -81,9 +81,11 @@ private void check() throws IOException { if (actual == null) { actual = hasher.hash(); } - if (!code.equals(actual)) { + if (!checksum.getHashCode().equals(actual)) { throw new UnrecoverableHttpException( - String.format("Checksum was %s but wanted %s", actual, code)); + String.format( + "Checksum was %s but wanted %s", + checksum.emitOtherHashInSameFormat(actual), checksum)); } } } diff --git a/src/main/java/com/google/devtools/build/lib/bazel/repository/starlark/StarlarkBaseExternalContext.java b/src/main/java/com/google/devtools/build/lib/bazel/repository/starlark/StarlarkBaseExternalContext.java index f34fb44603f63d..043b4ebbfabd02 100644 --- a/src/main/java/com/google/devtools/build/lib/bazel/repository/starlark/StarlarkBaseExternalContext.java +++ b/src/main/java/com/google/devtools/build/lib/bazel/repository/starlark/StarlarkBaseExternalContext.java @@ -358,7 +358,7 @@ private StructImpl calculateDownloadResult(Optional checksum, Path dow // For compatibility with older Bazel versions that don't support non-SHA256 checksums. if (finalChecksum.getKeyType() == KeyType.SHA256) { - out.put("sha256", finalChecksum.toString()); + out.put("sha256", finalChecksum.toHexString()); } return StarlarkInfo.create(StructProvider.STRUCT, out.buildOrThrow(), Location.BUILTIN); } diff --git a/src/test/shell/bazel/external_integration_test.sh b/src/test/shell/bazel/external_integration_test.sh index 5cf80e7cca7621..83223138173ed7 100755 --- a/src/test/shell/bazel/external_integration_test.sh +++ b/src/test/shell/bazel/external_integration_test.sh @@ -1104,6 +1104,7 @@ function test_integrity_incorrect() { create_workspace_with_default_repos WORKSPACE touch BUILD zip -r repo.zip * + integrity="sha256-$(cat repo.zip | openssl dgst -sha256 -binary | openssl base64 -A)" startup_server $PWD cd - @@ -1118,7 +1119,7 @@ EOF bazel build @repo//... &> $TEST_log 2>&1 && fail "Expected to fail" expect_log "Error downloading \\[http://127.0.0.1:$fileserver_port/repo.zip\\] to" # Bazel translates the integrity value back to the sha256 checksum. - expect_log "but wanted 61a6f762aaf60652cbf332879b8dcc2cfd81be2129a061da957d039eae77f0b0" + expect_log "Checksum was $integrity but wanted sha256-Yab3Yqr2BlLL8zKHm43MLP2BviEpoGHalX0Dnq538LA=" shutdown_server } From 6afbf13c5b004d64fcf104da28d5727ff8966ac9 Mon Sep 17 00:00:00 2001 From: Fabian Meumertzheim Date: Sun, 12 Nov 2023 14:40:42 +0100 Subject: [PATCH 2/9] Update bazel_repository_cache_test.sh --- src/test/shell/bazel/bazel_repository_cache_test.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/test/shell/bazel/bazel_repository_cache_test.sh b/src/test/shell/bazel/bazel_repository_cache_test.sh index 4836db5b09ebef..4cd4506f9c4311 100755 --- a/src/test/shell/bazel/bazel_repository_cache_test.sh +++ b/src/test/shell/bazel/bazel_repository_cache_test.sh @@ -124,6 +124,7 @@ EOF zip -0 -ry "$repo2_zip" WORKSPACE fox >& $TEST_log repo2_name=$(basename "$repo2_zip") sha256=$(sha256sum "$repo2_zip" | cut -f 1 -d ' ') + integrity="sha256-$(cat repo.zip | openssl dgst -sha256 -binary | openssl base64 -A)" fi serve_file "$repo2_zip" @@ -278,7 +279,7 @@ EOF //zoo:breeding-program >& $TEST_log \ || fail "expected fetch to succeed" - expect_log "${sha256}" + expect_log "${integrity}" # Shutdown the server; so fetching again won't work shutdown_server From ec52531004b1c95c9c2fa24b42f0964bf5605c80 Mon Sep 17 00:00:00 2001 From: Fabian Meumertzheim Date: Sun, 12 Nov 2023 14:43:57 +0100 Subject: [PATCH 3/9] Update bazel_repository_cache_test.sh --- src/test/shell/bazel/bazel_repository_cache_test.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/test/shell/bazel/bazel_repository_cache_test.sh b/src/test/shell/bazel/bazel_repository_cache_test.sh index 4cd4506f9c4311..4836db5b09ebef 100755 --- a/src/test/shell/bazel/bazel_repository_cache_test.sh +++ b/src/test/shell/bazel/bazel_repository_cache_test.sh @@ -124,7 +124,6 @@ EOF zip -0 -ry "$repo2_zip" WORKSPACE fox >& $TEST_log repo2_name=$(basename "$repo2_zip") sha256=$(sha256sum "$repo2_zip" | cut -f 1 -d ' ') - integrity="sha256-$(cat repo.zip | openssl dgst -sha256 -binary | openssl base64 -A)" fi serve_file "$repo2_zip" @@ -279,7 +278,7 @@ EOF //zoo:breeding-program >& $TEST_log \ || fail "expected fetch to succeed" - expect_log "${integrity}" + expect_log "${sha256}" # Shutdown the server; so fetching again won't work shutdown_server From a19be18b3525995d445eea2fcb6aacfb93b03a2a Mon Sep 17 00:00:00 2001 From: Fabian Meumertzheim Date: Sun, 12 Nov 2023 15:18:20 +0100 Subject: [PATCH 4/9] TMP: Update .bazelrc --- .bazelrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.bazelrc b/.bazelrc index f4e78f88780b1e..986eba35f88677 100644 --- a/.bazelrc +++ b/.bazelrc @@ -68,7 +68,7 @@ build:docs --workspace_status_command=scripts/docs/get_workspace_status.sh # Flags for CI builds ## Common -common:ci-common --lockfile_mode=error +common:ci-common --lockfile_mode=update ## For Linux common:ci-linux --config=ci-common From cb21e676b1079ed1d0ce92edfebe1f2a83d7766a Mon Sep 17 00:00:00 2001 From: Fabian Meumertzheim Date: Mon, 13 Nov 2023 12:00:35 +0100 Subject: [PATCH 5/9] Update Checksum.java --- .../build/lib/bazel/repository/downloader/Checksum.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/main/java/com/google/devtools/build/lib/bazel/repository/downloader/Checksum.java b/src/main/java/com/google/devtools/build/lib/bazel/repository/downloader/Checksum.java index f7d82a7400be4e..2f6db1497d9538 100644 --- a/src/main/java/com/google/devtools/build/lib/bazel/repository/downloader/Checksum.java +++ b/src/main/java/com/google/devtools/build/lib/bazel/repository/downloader/Checksum.java @@ -112,10 +112,6 @@ public String toSubresourceIntegrity() { @Override public String toString() { - return emitOtherHashInSameFormat(hashCode); - } - - public String toHexString() { return hashCode.toString(); } From 8b38e74e5d4e679239bfd6ec334139aea98e2445 Mon Sep 17 00:00:00 2001 From: Fabian Meumertzheim Date: Mon, 13 Nov 2023 12:02:17 +0100 Subject: [PATCH 6/9] Update HashInputStream.java --- .../build/lib/bazel/repository/downloader/HashInputStream.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/google/devtools/build/lib/bazel/repository/downloader/HashInputStream.java b/src/main/java/com/google/devtools/build/lib/bazel/repository/downloader/HashInputStream.java index f68df3e03d4158..087d96c6d63ef7 100644 --- a/src/main/java/com/google/devtools/build/lib/bazel/repository/downloader/HashInputStream.java +++ b/src/main/java/com/google/devtools/build/lib/bazel/repository/downloader/HashInputStream.java @@ -87,7 +87,8 @@ private void check() throws IOException { throw new UnrecoverableHttpException( String.format( "Checksum was %s but wanted %s", - checksum.emitOtherHashInSameFormat(actual), checksum)); + checksum.emitOtherHashInSameFormat(actual), + checksum.emitOtherHashInSameFormat(checksum.getHashCode()))); } } } From 90a64d757970fa22aa9798a8b29c5a6af846d1ba Mon Sep 17 00:00:00 2001 From: Fabian Meumertzheim Date: Mon, 13 Nov 2023 12:03:12 +0100 Subject: [PATCH 7/9] Update StarlarkBaseExternalContext.java --- .../bazel/repository/starlark/StarlarkBaseExternalContext.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/google/devtools/build/lib/bazel/repository/starlark/StarlarkBaseExternalContext.java b/src/main/java/com/google/devtools/build/lib/bazel/repository/starlark/StarlarkBaseExternalContext.java index 043b4ebbfabd02..f34fb44603f63d 100644 --- a/src/main/java/com/google/devtools/build/lib/bazel/repository/starlark/StarlarkBaseExternalContext.java +++ b/src/main/java/com/google/devtools/build/lib/bazel/repository/starlark/StarlarkBaseExternalContext.java @@ -358,7 +358,7 @@ private StructImpl calculateDownloadResult(Optional checksum, Path dow // For compatibility with older Bazel versions that don't support non-SHA256 checksums. if (finalChecksum.getKeyType() == KeyType.SHA256) { - out.put("sha256", finalChecksum.toHexString()); + out.put("sha256", finalChecksum.toString()); } return StarlarkInfo.create(StructProvider.STRUCT, out.buildOrThrow(), Location.BUILTIN); } From e17dff255c359465435ff729dc35ac03d5772326 Mon Sep 17 00:00:00 2001 From: Fabian Meumertzheim Date: Mon, 13 Nov 2023 12:04:07 +0100 Subject: [PATCH 8/9] Update HashOutputStream.java --- .../lib/bazel/repository/downloader/HashOutputStream.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/google/devtools/build/lib/bazel/repository/downloader/HashOutputStream.java b/src/main/java/com/google/devtools/build/lib/bazel/repository/downloader/HashOutputStream.java index 7c8281e33aff72..a79be39fc9261c 100644 --- a/src/main/java/com/google/devtools/build/lib/bazel/repository/downloader/HashOutputStream.java +++ b/src/main/java/com/google/devtools/build/lib/bazel/repository/downloader/HashOutputStream.java @@ -85,7 +85,8 @@ private void check() throws IOException { throw new UnrecoverableHttpException( String.format( "Checksum was %s but wanted %s", - checksum.emitOtherHashInSameFormat(actual), checksum)); + checksum.emitOtherHashInSameFormat(actual), + checksum.emitOtherHashInSameFormat(checksum.getHashCode()))); } } } From 298f7dba44e7df46292708f2e6d1d9a5ee50f64f Mon Sep 17 00:00:00 2001 From: Fabian Meumertzheim Date: Mon, 13 Nov 2023 13:34:56 +0100 Subject: [PATCH 9/9] Update external_patching_test.sh --- src/test/shell/bazel/external_patching_test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/shell/bazel/external_patching_test.sh b/src/test/shell/bazel/external_patching_test.sh index 257b45cd8bebbe..1e336d02cb5094 100755 --- a/src/test/shell/bazel/external_patching_test.sh +++ b/src/test/shell/bazel/external_patching_test.sh @@ -291,7 +291,7 @@ EOF bazel build @ext//... &> $TEST_log 2>&1 && fail "Expected to fail" expect_log "Error downloading \\[.*/remote.patch\\] to" - expect_log "but wanted 61a6f762aaf60652cbf332879b8dcc2cfd81be2129a061da957d039eae77f0b0" + expect_log "but wanted sha256-Yab3Yqr2BlLL8zKHm43MLP2BviEpoGHalX0Dnq538LA=" } test_remote_patches_with_same_base_name() {