mirror of https://github.com/mongodb/mongo
SERVER-98869 make pigz usage conditional (#30729)
GitOrigin-RevId: 6805b954ccaeff471d59dd4898a2fef1f669bd97
This commit is contained in:
parent
4ae5941c27
commit
1fc18a6756
|
|
@ -299,8 +299,8 @@ load("@rules_pkg//:deps.bzl", "rules_pkg_dependencies")
|
|||
|
||||
rules_pkg_dependencies()
|
||||
|
||||
new_local_repository(
|
||||
load("//bazel/install_rules:pigz.bzl", "setup_pigz")
|
||||
|
||||
setup_pigz(
|
||||
name = "pigz",
|
||||
build_file = "//bazel:BUILD.pigz",
|
||||
path = "/usr/bin",
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,5 +0,0 @@
|
|||
package(default_visibility = ["//visibility:public"])
|
||||
sh_binary(
|
||||
name = "pigz_bin",
|
||||
srcs = ["pigz"],
|
||||
)
|
||||
|
|
@ -213,6 +213,9 @@ def mongo_install_rule_impl(ctx):
|
|||
)
|
||||
|
||||
runfiles = ctx.runfiles(files = outputs)
|
||||
for input_bin in ctx.attr.srcs:
|
||||
runfiles = runfiles.merge(input_bin[DefaultInfo].data_runfiles)
|
||||
|
||||
if unittest_bin:
|
||||
outputs = depset([unittest_bin])
|
||||
else:
|
||||
|
|
@ -266,9 +269,8 @@ def mongo_install(
|
|||
|
||||
"""
|
||||
compressor = select({
|
||||
"@platforms//os:linux": "@pigz//:pigz_bin",
|
||||
"@platforms//os:windows": None,
|
||||
"@platforms//os:macos": None,
|
||||
"@pigz//:pigz_tool_available": "@pigz//:bin",
|
||||
"//conditions:default": None,
|
||||
})
|
||||
|
||||
ext = select({
|
||||
|
|
|
|||
|
|
@ -0,0 +1,52 @@
|
|||
def _pigz(ctx):
|
||||
pigz_bin = ctx.which("pigz")
|
||||
|
||||
if pigz_bin:
|
||||
ctx.symlink(pigz_bin, "pigz")
|
||||
ctx.file(
|
||||
"BUILD.bazel",
|
||||
"""
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
config_setting(
|
||||
name = "pigz_tool_available",
|
||||
constraint_values = [
|
||||
"@platforms//os:%s",
|
||||
]
|
||||
)
|
||||
|
||||
sh_binary(
|
||||
name = "bin",
|
||||
srcs = ["pigz"],
|
||||
)
|
||||
""" % (ctx.os.name),
|
||||
)
|
||||
|
||||
else:
|
||||
ctx.file(
|
||||
"BUILD.bazel",
|
||||
"""
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
constraint_value(
|
||||
name = "not_set",
|
||||
constraint_setting = "@platforms//cpu",
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "pigz_tool_available",
|
||||
constraint_values = [
|
||||
":not_set",
|
||||
]
|
||||
)
|
||||
|
||||
sh_binary(
|
||||
name = "bin",
|
||||
srcs = [],
|
||||
)
|
||||
""",
|
||||
)
|
||||
|
||||
setup_pigz = repository_rule(
|
||||
implementation = _pigz,
|
||||
)
|
||||
Loading…
Reference in New Issue