forked from kubevirt/kubevirt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rpm-deps.sh
executable file
·381 lines (343 loc) · 9.84 KB
/
rpm-deps.sh
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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
#!/usr/bin/env bash
set -ex
source hack/common.sh
source hack/bootstrap.sh
source hack/config.sh
LIBVIRT_VERSION=${LIBVIRT_VERSION:-0:9.0.0-3.el9}
QEMU_VERSION=${QEMU_VERSION:-17:7.2.0-14.el9}
SEABIOS_VERSION=${SEABIOS_VERSION:-0:1.16.1-1.el9}
EDK2_VERSION=${EDK2_VERSION:-0:20230301gitf80f052277c8-2.el9}
LIBGUESTFS_VERSION=${LIBGUESTFS_VERSION:-1:1.48.4-4.el9}
GUESTFSTOOLS_VERSION=${GUESTFSTOOLS_VERSION:-0:1.48.2-8.el9}
PASST_VERSION=${PASST_VERSION:-0:0^20221110.g4129764-1.el9}
VIRTIOFSD_VERSION=${VIRTIOFSD_VERSION:-0:1.5.0-1.el9}
SWTPM_VERSION=${SWTPM_VERSION:-0:0.8.0-1.el9}
SINGLE_ARCH=${SINGLE_ARCH:-""}
BASESYSTEM=${BASESYSTEM:-"centos-stream-release"}
bazeldnf_repos="--repofile rpm/repo.yaml"
if [ "${CUSTOM_REPO}" ]; then
bazeldnf_repos="--repofile ${CUSTOM_REPO} ${bazeldnf_repos}"
fi
# Packages that we want to be included in all container images.
#
# Further down we define per-image package lists, which just like
# this one are split across multiple variables:
#
# * $foo_main => packages that we want to have in the image;
#
# * $foo_ARCH => same as above, but specific to one architecture;
#
# * $foo_extra => (indirect) dependencies that can be satisfied by
# more than one package.
#
# Listing the "extra" packages explicitly ensures that bazeldnf will
# always reach the same solution, and thus keeps things reproducible
centos_main="
acl
curl-minimal
vim-minimal
"
centos_extra="
coreutils-single
glibc-minimal-langpack
libcurl-minimal
"
# create a rpmtree for our test image with misc. tools.
testimage_main="
device-mapper
e2fsprogs
iputils
nmap-ncat
procps-ng
qemu-img-${QEMU_VERSION}
sevctl
tar
targetcli
util-linux
which
"
# create a rpmtree for libvirt-devel. libvirt-devel is needed for compilation and unit-testing.
libvirtdevel_main="
libvirt-devel-${LIBVIRT_VERSION}
"
libvirtdevel_extra="
keyutils-libs
krb5-libs
libmount
lz4-libs
"
# TODO: Remove the sssd-client and use a better sssd config
# This requires a way to inject files into the sandbox via bazeldnf
sandboxroot_main="
findutils
gcc
glibc-static
python3
sssd-client
"
# create a rpmtree for virt-launcher and virt-handler. This is the OS for our node-components.
launcherbase_main="
libvirt-client-${LIBVIRT_VERSION}
libvirt-daemon-driver-qemu-${LIBVIRT_VERSION}
passt-${PASST_VERSION}
qemu-kvm-core-${QEMU_VERSION}
swtpm-tools-${SWTPM_VERSION}
"
launcherbase_x86_64="
edk2-ovmf-${EDK2_VERSION}
qemu-kvm-device-usb-redirect-${QEMU_VERSION}
seabios-${SEABIOS_VERSION}
"
launcherbase_aarch64="
edk2-aarch64-${EDK2_VERSION}
qemu-kvm-device-display-virtio-gpu-${QEMU_VERSION}
qemu-kvm-device-display-virtio-gpu-pci-${QEMU_VERSION}
"
launcherbase_extra="
ethtool
findutils
nftables
nmap-ncat
procps-ng
selinux-policy
selinux-policy-targeted
tar
virtiofsd-${VIRTIOFSD_VERSION}
xorriso
"
handlerbase_main="
qemu-img-${QEMU_VERSION}
"
handlerbase_extra="
findutils
iproute
nftables
procps-ng
selinux-policy
selinux-policy-targeted
tar
util-linux
xorriso
"
libguestfstools_main="
libguestfs-${LIBGUESTFS_VERSION}
guestfs-tools-${GUESTFSTOOLS_VERSION}
libvirt-daemon-driver-qemu-${LIBVIRT_VERSION}
qemu-kvm-core-${QEMU_VERSION}
seabios-${SEABIOS_VERSION}
"
libguestfstools_x86_64="
edk2-ovmf-${EDK2_VERSION}
"
libguestfstools_extra="
selinux-policy
selinux-policy-targeted
"
exportserverbase_main="
tar
"
pr_helper="
qemu-pr-helper
"
# get latest repo data from repo.yaml
bazel run \
--config=${ARCHITECTURE} \
//:bazeldnf -- fetch \
${bazeldnf_repos}
if [ -z "${SINGLE_ARCH}" ] || [ "${SINGLE_ARCH}" == "x86_64" ]; then
bazel run \
--config=${ARCHITECTURE} \
//:bazeldnf -- rpmtree \
--public --nobest \
--name testimage_x86_64 \
--basesystem ${BASESYSTEM} \
${bazeldnf_repos} \
$centos_main \
$centos_extra \
$testimage_main
bazel run \
--config=${ARCHITECTURE} \
//:bazeldnf -- rpmtree \
--public --nobest \
--name libvirt-devel_x86_64 \
--basesystem ${BASESYSTEM} \
${bazeldnf_repos} \
$centos_main \
$centos_extra \
$libvirtdevel_main \
$libvirtdevel_extra
bazel run \
--config=${ARCHITECTURE} \
//:bazeldnf -- rpmtree \
--public --nobest \
--name sandboxroot_x86_64 \
--basesystem ${BASESYSTEM} \
${bazeldnf_repos} \
$centos_main \
$centos_extra \
$sandboxroot_main
bazel run \
--config=${ARCHITECTURE} \
//:bazeldnf -- rpmtree \
--public --nobest \
--name launcherbase_x86_64 \
--basesystem ${BASESYSTEM} \
--force-ignore-with-dependencies '^mozjs60' \
--force-ignore-with-dependencies 'python' \
${bazeldnf_repos} \
$centos_main \
$centos_extra \
$launcherbase_main \
$launcherbase_x86_64 \
$launcherbase_extra
# create a rpmtree for virt-handler
bazel run \
--config=${ARCHITECTURE} \
//:bazeldnf -- rpmtree \
--public --nobest \
--name handlerbase_x86_64 \
--basesystem ${BASESYSTEM} \
--force-ignore-with-dependencies 'python' \
${bazeldnf_repos} \
$centos_main \
$centos_extra \
$handlerbase_main \
$handlerbase_extra
bazel run \
//:bazeldnf -- rpmtree \
--public --nobest \
--name libguestfs-tools \
--basesystem ${BASESYSTEM} \
$centos_main \
$centos_extra \
$libguestfstools_main \
$libguestfstools_x86_64 \
$libguestfstools_extra \
${bazeldnf_repos} \
--force-ignore-with-dependencies '^(kernel-|linux-firmware)' \
--force-ignore-with-dependencies '^(python[3]{0,1}-)' \
--force-ignore-with-dependencies '^mozjs60' \
--force-ignore-with-dependencies '^(libvirt-daemon-kvm|swtpm)' \
--force-ignore-with-dependencies '^(man-db|mandoc)' \
--force-ignore-with-dependencies '^dbus'
bazel run \
--config=${ARCHITECTURE} \
//:bazeldnf -- rpmtree \
--public --nobest \
--name exportserverbase_x86_64 \
--basesystem ${BASESYSTEM} \
${bazeldnf_repos} \
$centos_main \
$centos_extra \
$exportserverbase_main
bazel run \
--config=${ARCHITECTURE} \
//:bazeldnf -- rpmtree \
--public --nobest \
--name pr-helper_x86_64 \
--basesystem ${BASESYSTEM} \
${bazeldnf_repos} \
$pr_helper
# remove all RPMs which are no longer referenced by a rpmtree
bazel run \
--config=${ARCHITECTURE} \
//:bazeldnf -- prune
# update tar2files targets which act as an adapter between rpms
# and cc_library which we need for virt-launcher and virt-handler
bazel run \
--config=${ARCHITECTURE} \
//rpm:ldd_x86_64
# regenerate sandboxes
rm ${SANDBOX_DIR} -rf
kubevirt::bootstrap::regenerate x86_64
fi
if [ -z "${SINGLE_ARCH}" ] || [ "${SINGLE_ARCH}" == "aarch64" ]; then
bazel run \
--config=${ARCHITECTURE} \
//:bazeldnf -- rpmtree \
--public --nobest \
--name testimage_aarch64 --arch aarch64 \
--basesystem ${BASESYSTEM} \
${bazeldnf_repos} \
$centos_main \
$centos_extra \
$testimage_main
bazel run \
--config=${ARCHITECTURE} \
//:bazeldnf -- rpmtree \
--public --nobest \
--name libvirt-devel_aarch64 --arch aarch64 \
--basesystem ${BASESYSTEM} \
${bazeldnf_repos} \
$centos_main \
$centos_extra \
$libvirtdevel_main \
$libvirtdevel_extra
bazel run \
--config=${ARCHITECTURE} \
//:bazeldnf -- rpmtree \
--public --nobest \
--name sandboxroot_aarch64 --arch aarch64 \
--basesystem ${BASESYSTEM} \
${bazeldnf_repos} \
$centos_main \
$centos_extra \
$sandboxroot_main
bazel run \
--config=${ARCHITECTURE} \
//:bazeldnf -- rpmtree \
--public --nobest \
--name launcherbase_aarch64 --arch aarch64 \
--basesystem ${BASESYSTEM} \
--force-ignore-with-dependencies '^mozjs60' \
--force-ignore-with-dependencies 'python' \
${bazeldnf_repos} \
$centos_main \
$centos_extra \
$launcherbase_main \
$launcherbase_aarch64 \
$launcherbase_extra
# create a rpmtree for virt-handler
bazel run \
--config=${ARCHITECTURE} \
//:bazeldnf -- rpmtree \
--public --nobest \
--name handlerbase_aarch64 --arch aarch64 \
--basesystem ${BASESYSTEM} \
--force-ignore-with-dependencies 'python' \
${bazeldnf_repos} \
$centos_main \
$centos_extra \
$handlerbase_main \
$handlerbase_extra
bazel run \
--config=${ARCHITECTURE} \
//:bazeldnf -- rpmtree \
--public --nobest \
--name exportserverbase_aarch64 --arch aarch64 \
--basesystem ${BASESYSTEM} \
${bazeldnf_repos} \
$centos_main \
$centos_extra \
$exportserverbase_main
bazel run \
--config=${ARCHITECTURE} \
//:bazeldnf -- rpmtree \
--public --nobest \
--name pr-helper_aarch64 --arch aarch64 \
--basesystem ${BASESYSTEM} \
${bazeldnf_repos} \
$pr_helper
# remove all RPMs which are no longer referenced by a rpmtree
bazel run \
--config=${ARCHITECTURE} \
//:bazeldnf -- prune
# update tar2files targets which act as an adapter between rpms
# and cc_library which we need for virt-launcher and virt-handler
bazel run \
--config=${ARCHITECTURE} \
//rpm:ldd_aarch64
# regenerate sandboxes
rm ${SANDBOX_DIR} -rf
kubevirt::bootstrap::regenerate aarch64
fi