Skip to content

Commit 7a01895

Browse files
committed
chore(core): build nftables
Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
1 parent 85dae6c commit 7a01895

3 files changed

Lines changed: 88 additions & 6 deletions

File tree

component_versions/version_map.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ firmware:
44
edk2: stable202411
55
package:
66
swtpm: 0.10.0
7+
nftables: 1.1.3
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
---
2+
image: {{ $.ImageType }}/{{ $.ImageName }}
3+
final: false
4+
fromImage: builder/scratch
5+
import:
6+
- image: {{ $.ImageType }}/{{ $.ImageName }}-builder
7+
add: /out
8+
to: /nftables
9+
before: setup
10+
11+
---
12+
{{- $version := get $.Package $.ImageName }}
13+
{{- $gitRepoUrl := "nftables.git" }}
14+
15+
{{- $name := print $.ImageName "-dependencies" -}}
16+
{{- define "$name" -}}
17+
packages:
18+
- gcc
19+
- git pkg-config trousers
20+
- automake autoconf make makeinfo libtool
21+
- flex bison asciidoc-a2x
22+
- tree
23+
{{- end -}}
24+
25+
{{ $builderDependencies := include "$name" . | fromYaml }}
26+
27+
image: {{ $.ImageType }}/{{ $.ImageName }}-builder
28+
final: false
29+
fromImage: builder/alt
30+
secrets:
31+
- id: SOURCE_REPO
32+
value: {{ $.SOURCE_REPO_GIT }}
33+
shell:
34+
beforeInstall:
35+
- |
36+
apt-get update && apt-get install -y \
37+
{{ $builderDependencies.packages | join " " }}
38+
39+
# libtpms libtpms-devel requares version 0.10 that in sisyphus repo
40+
cat >/etc/apt/sources.list.d/alt-sisyphus.list<<EOF
41+
rpm [alt] http://ftp.altlinux.org/pub/distributions/ALTLinux/Sisyphus x86_64 classic
42+
rpm [alt] http://ftp.altlinux.org/pub/distributions/ALTLinux/Sisyphus noarch classic
43+
EOF
44+
apt-get update
45+
apt-get install -y libmnl-devel libnftnl-devel libgmp-devel libreadline-devel libjansson-devel libedit-devel
46+
rm -f /etc/apt/sources.list.d/alt-sisyphus.list
47+
48+
apt-get update
49+
apt-get clean
50+
rm --recursive --force /var/lib/apt/lists/ftp.altlinux.org* /var/cache/apt/*.bin
51+
52+
install:
53+
- |
54+
OUTDIR=/out
55+
mkdir -p ~/.ssh && echo "StrictHostKeyChecking accept-new" > ~/.ssh/config
56+
57+
git clone --depth=1 $(cat /run/secrets/SOURCE_REPO)/{{ $gitRepoUrl }} --branch v{{ $version }} /src
58+
cd /src
59+
60+
./autogen.sh
61+
62+
./configure --prefix=/usr --libdir=/usr/lib64 --enable-python --with-python-bin=/usr/bin/python3 --with-json --with-cli=readline
63+
64+
make -j$(nproc)
65+
66+
make DESTDIR=$OUTDIR install
67+
68+
strip $OUTDIR/usr/sbin/nft
69+
70+
# We don't need man, test and samples files
71+
rm -rf $OUTDIR/usr/include
72+
rm -rf $OUTDIR/usr/share
73+
rm -rf $OUTDIR/usr/lib64/pkgconfig
74+
75+
tree $OUTDIR

images/virt-launcher/werf.inc.yaml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ packages:
125125
- hwclock
126126
- iptables
127127
- libffi8
128-
- nftables
129128
- numactl
130129
- openssl
131130
- passt
@@ -242,6 +241,11 @@ import:
242241
to: /
243242
before: install
244243

244+
- image: packages/binaries/nftables
245+
add: /nftables
246+
to: /nftables
247+
before: install
248+
245249
- image: tools/coreutils
246250
add: /
247251
to: /relocate
@@ -263,7 +267,7 @@ shell:
263267
apt-get update && apt-get install -y {{ $virtLauncherDependencies.libs | join " " }} {{ $virtLauncherDependencies.packages | join " " }}
264268
265269
# libtpms libtpms-devel require version 0.10 that in sisyphus repo
266-
cat >/etc/apt/sources.list.d/alt-sisyphus.list<<EOF
270+
cat >/etc/apt/sources.list.d/alt-sisyphus.list<<EOF
267271
rpm [alt] http://ftp.altlinux.org/pub/distributions/ALTLinux/Sisyphus x86_64 classic
268272
rpm [alt] http://ftp.altlinux.org/pub/distributions/ALTLinux/Sisyphus noarch classic
269273
EOF
@@ -289,20 +293,22 @@ shell:
289293
echo "find and copy additional libs"
290294
FILES=$(find /VBINS/usr/bin/ -type f)
291295
FILES+=" $(find /VBINS/usr/sbin/ -type f)"
292-
296+
293297
LIBS="/usr/lib64/libbsd.so* /usr/lib64/libnbd.so* /usr/lib64/libfuse3.so*"
294298
LIBS+=" /usr/lib64/libjson-c.so* /usr/lib64/libssh.so* /usr/lib64/libssh2.so*"
295299
LIBS+=" /usr/lib64/libtpms* /usr/lib64/libjson* /usr/lib64/libfuse*"
296300
LIBS+=" /usr/lib64/libxml2.so* /usr/lib64/libgcc_s*"
297301
298302
echo "Relocate additional libs for files in /VBINS"
299303
./relocate_binaries.sh -i "$FILES" -o /VBINS
300-
304+
301305
echo "Relocate additional libs to /VBINS"
302306
./relocate_binaries.sh -i "$LIBS" -o /VBINS
303307
304308
cp -a /VBINS/. /relocate
305309
310+
cp -a /nftables/. /
311+
306312
echo "Show libs after relocation in /relocate/usr/lib64"
307313
ls -la /relocate/usr/lib64
308314
# Cleanup
@@ -382,7 +388,7 @@ shell:
382388
383389
echo "List files in /relocate/usr/local/lib64"
384390
ls -la usr/local/lib64
385-
391+
386392
- |
387393
cd /relocate
388394
@@ -455,7 +461,7 @@ shell:
455461
apt-get update && apt-get install --yes gcc musl-dev musl-tools
456462
apt-get clean
457463
install:
458-
- |
464+
- |
459465
echo "Building simple app that prints I'am temp pod"
460466
mkdir -p /bins
461467
musl-gcc -static -Os -o /bins/temp_pod temp_pod.c

0 commit comments

Comments
 (0)