Skip to content

Commit 50f3e76

Browse files
committed
chore(core): build nftables
Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
1 parent 26ad6d1 commit 50f3e76

3 files changed

Lines changed: 83 additions & 0 deletions

File tree

component_versions/version_map.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ package:
66
swtpm: 0.10.0
77
xorriso: 1.5.6
88
numactl: 2.0.19
9+
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: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ packages:
127127
- iptables
128128
- libffi8
129129
- nftables
130+
- numactl
130131
- openssl
131132
- passt
132133
- pcre
@@ -252,6 +253,11 @@ import:
252253
to: /xorriso
253254
before: install
254255

256+
- image: packages/binaries/nftables
257+
add: /nftables
258+
to: /nftables
259+
before: install
260+
255261
- image: tools/coreutils
256262
add: /
257263
to: /relocate
@@ -316,6 +322,7 @@ shell:
316322
cp -a /xorriso/. /
317323
cp -a /swtpm/. /
318324
cp -a /numactl/. /
325+
cp -a /nftables/. /
319326
320327
echo "Show libs after relocation in /relocate/usr/lib64"
321328
ls -la /relocate/usr/lib64

0 commit comments

Comments
 (0)