-
Notifications
You must be signed in to change notification settings - Fork 4.1k
/
Copy pathBUILD
141 lines (130 loc) · 3.38 KB
/
BUILD
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
load("@rules_pkg//:pkg.bzl", "pkg_deb", "pkg_tar")
filegroup(
name = "srcs",
srcs = glob(["**"]),
visibility = ["//scripts:__subpackages__"],
)
pkg_tar(
name = "bazel-bin",
srcs = [
"//scripts/packages:with-jdk/bazel",
"//scripts/packages:with-jdk/bazel-real",
],
mode = "0755",
package_dir = "/usr/bin",
strip_prefix = "/scripts/packages/with-jdk",
)
pkg_tar(
name = "bazel-rc",
srcs = ["//scripts/packages:bazel.bazelrc"],
mode = "0644",
package_dir = "/etc",
strip_prefix = "/scripts/packages",
)
genrule(
name = "rename-bazel-completion",
srcs = ["//scripts:bash_completion"],
outs = ["etc/bash_completion.d/bazel"],
cmd = "cp $< $@",
)
pkg_tar(
name = "bazel-completion",
srcs = [":etc/bash_completion.d/bazel"],
mode = "0644",
strip_prefix = ".",
)
pkg_tar(
name = "debian-data",
extension = "tar.gz",
deps = [
":bazel-bin",
":bazel-completion",
":bazel-rc",
],
)
genrule(
name = "debian_version",
srcs = ["//scripts/packages:version.txt"],
outs = [
"version.txt",
],
cmd =
"cat $(location //scripts/packages:version.txt) " +
# Debian package manager does not order our rcs correctly, insert a tilde
# Non RC version number are not matched by the regex, example translations:
# 0.1.2 0.1.2
# 0.1.2rc2 0.1.2~rc2
# 0.1.2rc2-jdk7 0.1.2~rc2-jdk7
" | sed -E 's/^([0-9\\.]+)([^0-9\\.].*)$$/\\1~\\2/'" +
" > $@\n",
)
pkg_deb(
name = "bazel-debian",
architecture = "amd64",
built_using = "bazel",
conffiles = [
"/etc/bash_completion.d/bazel",
"/etc/bazel.bazelrc",
],
data = ":debian-data",
depends = [
# Keep in sync with Depends section in ./control
"g++",
"zlib1g-dev",
"unzip",
],
description_file = "description",
homepage = "https://bazel.build",
maintainer = "The Bazel Authors <bazel-dev@googlegroups.com>",
package = "bazel",
suggests = [
# Keep in sync with Suggests section in ./control
"google-jdk | java8-sdk-headless | java8-jdk | java8-sdk | oracle-java8-installer",
"bash-completion",
],
version_file = ":version.txt",
visibility = ["//scripts/packages:__pkg__"],
)
filegroup(
name = "debian-files",
srcs = [
"compat",
"control",
"copyright",
"rules",
],
)
genrule(
name = "generate-changelog-file",
srcs = [
"generate_changelog.py",
"//:bazel-srcs", # Force a rebuild on source change
],
outs = ["changelog"],
cmd = "python2.7 $(location generate_changelog.py) bazel-out/volatile-status.txt $(location changelog)",
stamp = 1,
)
genrule(
name = "bazel-debian-src",
srcs = [
"//:bazel-srcs",
":debian-files",
":changelog",
],
outs = [
"bazel.dsc",
"bazel.tar.gz",
],
cmd = """
mkdir -p bazel/debian
tar -xf $(location //:bazel-srcs) -C ./bazel
for f in $(locations :debian-files); do
cp $$f ./bazel/debian/
done
cp $(location :changelog) ./bazel/debian
dpkg-source -b ./bazel
cp ./bazel_*.dsc $(location bazel.dsc)
cp ./bazel_*.tar.gz $(location bazel.tar.gz)
""",
visibility = ["//scripts/packages:__pkg__"],
)