-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Expand file tree
/
Copy pathldconfig.bzl
More file actions
76 lines (68 loc) 路 2.37 KB
/
Copy pathldconfig.bzl
File metadata and controls
76 lines (68 loc) 路 2.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
"Macros for generating ldconfig cache for python images"
load("@rules_oci//oci:defs.bzl", "oci_load")
def python3_ldconfig(architectures, distro):
"""Generates ldconfig cache targets for python images.
Args:
architectures: list of architectures to support
distro: the distribution name (e.g. debian13)
"""
# 1. Create the oci_load targets (the scripts that load images into docker)
for arch in architectures:
oci_load(
name = "load_python3_root_{}_{}".format(arch, distro),
image = ":python3_root_{}_{}".format(arch, distro),
repo_tags = ["bazel/python3:python3_root_{}_{}".format(arch, distro)],
)
# 2. Create the genrules that actually trigger the loading during 'bazel build'
for arch in architectures:
native.genrule(
name = "do_load_{}".format(arch),
outs = ["do_load_{}.done".format(arch)],
cmd = "$(location :load_python3_root_{arch}_{distro}) && touch $@".format(
arch = arch,
distro = distro,
),
tags = [
"local",
"no-sandbox",
],
tools = [":load_python3_root_{}_{}".format(arch, distro)],
)
# 3. Create the update_ldconfig binary
native.sh_binary(
name = "update_ldconfig",
srcs = ["ldconfig/ldconfig.sh"],
args = ["update"] + architectures,
data = ["ldconfig/ldconfig.sh"] + [":do_load_{}".format(arch) for arch in architectures],
tags = ["local"],
)
# 4. Create the architecture-specific tests
for arch in architectures:
native.sh_test(
name = "check_ldconfig_{}_test".format(arch),
srcs = ["ldconfig/ldconfig.sh"],
args = [
"check",
arch,
],
data = [
"ldconfig/ld.so.cache.{}".format(arch),
":do_load_{}".format(arch),
],
tags = [
arch,
"local",
"manual",
"external",
"no-cache",
],
)
# 5. Create the test suite
native.test_suite(
name = "check_ldconfig_tests",
tests = [
":check_ldconfig_{}_test".format(arch)
for arch in architectures
],
tags = ["manual"],
)