Skip to content

Commit 83e372d

Browse files
author
Petr Velan
committed
Added an experimental option to build RPM packages
1 parent 1c3be25 commit 83e372d

File tree

9 files changed

+257
-10
lines changed

9 files changed

+257
-10
lines changed

ansible/README.md

+7-1
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,10 @@ There is a tag for each plugin and its dependency. LibFastbit library can be ins
3737

3838
## <a name="libfastbit"></a>LibFastbit compilation
3939

40-
The LibFastbit is a fairly large beast and takes some time to compile. Therefore, we usually install it using binaries, which are pre-compiled for all supported systems (see above). However, if you are installing on unsupported an distribution or you just want to build from sources, you can force this by using `--extra-vars "build_fastbit_compile=true"`
40+
The LibFastbit is a fairly large beast and takes some time to compile. Therefore, we usually install it using binaries, which are pre-compiled for all supported systems (see above). However, if you are installing on unsupported an distribution or you just want to build from sources, you can force this by using `--extra-vars "build_fastbit_compile=true"`
41+
42+
## <a name="rpm-build"></a>Building RPM packages
43+
44+
This is an experimental feature used by maintainers. You have been warned.
45+
46+
On systems which support building of RPM packages, using `--extra-vars "build_rpms=true"` forces the playbook to try to build RPM packages for all plugins and tools. It was tested only on Centos 7 and will certainly fail for all non-RPM distributions.

ansible/roles/ipfixcol/tasks/base.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@
1010
with_items:
1111
- "{{ build.cmds }}"
1212
- ldconfig
13-
- "touch /tmp/ipfixcol-base.installed"
13+
- "touch /tmp/ipfixcol-base.installed"
+230
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,230 @@
1+
# FDependency repos
2+
3+
- name: Add IPFIXcol repo
4+
get_url:
5+
url: https://copr.fedorainfracloud.org/coprs/g/CESNET/IPFIXcol/repo/epel-7/group_CESNET-IPFIXcol-epel-7.repo
6+
dest: /etc/yum.repos.d/copr-ipfixcol.repo
7+
mode: 664
8+
when: build_rpms | bool
9+
tags:
10+
- fastbit
11+
- fbitdump
12+
- fbitmerge
13+
14+
- name: Install fastbit dependency packages
15+
yum: "name=libfastbit-devel,graphviz state=latest"
16+
when: build_rpms | bool
17+
tags:
18+
- fastbit
19+
- fbitdump
20+
- fbitmerge
21+
22+
- name: Add NEMEA repo
23+
get_url:
24+
url: https://copr.fedorainfracloud.org/coprs/g/CESNET/NEMEA/repo/epel-7/group_CESNET-NEMEA-epel-7.repo
25+
dest: /etc/yum.repos.d/copr-nemea.repo
26+
mode: 664
27+
when: build_rpms | bool
28+
tags:
29+
- lnfstore
30+
- unirec
31+
32+
- name: Install lnfstore dependency packages
33+
yum: "name=libnf-devel,bloom_filter_indexes state=latest"
34+
when: build_rpms | bool
35+
tags: lnfstore
36+
37+
- name: Install unirec dependency packages
38+
yum: "name=libtrap-devel state=latest"
39+
when: build_rpms | bool
40+
tags: unirec
41+
42+
# Base
43+
- name: Build IPFIXcol rpms
44+
shell: >
45+
{{ item }}
46+
chdir={{ build.dir }}/base/
47+
creates=/usr/include/ipfixcol.h
48+
with_items:
49+
- make rpm
50+
- yum info ipfixcol-devel | grep installed > /dev/null || yum install -y {{ build.dir }}/base/RPMBUILD/RPMS/*/*.rpm
51+
when: build_rpms | bool
52+
tags: base
53+
54+
# Input plugins
55+
56+
- name: Build nfdump input plugin rpm
57+
command: >
58+
make rpm
59+
chdir={{ build.dir }}/plugins/input/nfdump
60+
creates={{ build.dir }}/plugins/input/nfdump/RPMBUILD/SRPMS/*.src.rpm
61+
when: build_rpms | bool
62+
tags: nfdump-input
63+
64+
- name: Build UDP CPG input plugin rpm
65+
command: >
66+
make rpm
67+
chdir={{ build.dir }}/plugins/input/udp_cpg
68+
creates={{ build.dir }}/plugins/input/udp_cpg/RPMBUILD/SRPMS/*.src.rpm
69+
when: build_rpms | bool
70+
tags: udp_cpg
71+
72+
# Intermediate plugins
73+
74+
- name: Build dhcp intermediate plugin rpm
75+
command: >
76+
make rpm
77+
chdir={{ build.dir }}/plugins/intermediate/dhcp
78+
creates={{ build.dir }}/plugins/intermediate/dhcp/RPMBUILD/SRPMS/*.src.rpm
79+
when: build_rpms | bool
80+
tags: dhcp
81+
82+
- name: Build geoip intermediate plugin rpm
83+
command: >
84+
make rpm
85+
chdir={{ build.dir }}/plugins/intermediate/geoip
86+
creates={{ build.dir }}/plugins/intermediate/geoip/RPMBUILD/SRPMS/*.src.rpm
87+
when: build_rpms | bool
88+
tags: geoip
89+
90+
- name: Build profiler intermediate plugin rpm
91+
command: >
92+
make rpm
93+
chdir={{ build.dir }}/plugins/intermediate/profiler
94+
creates={{ build.dir }}/plugins/intermediate/profiler/RPMBUILD/SRPMS/*.src.rpm
95+
when: build_rpms | bool
96+
tags: profiler
97+
98+
- name: Build profile_stats intermediate plugin rpm
99+
command: >
100+
make rpm
101+
chdir={{ build.dir }}/plugins/intermediate/profile_stats
102+
creates={{ build.dir }}/plugins/intermediate/profile_stats/RPMBUILD/SRPMS/*.src.rpm
103+
when: build_rpms | bool
104+
tags: profile_stats
105+
106+
- name: Build stats intermediate plugin rpm
107+
command: >
108+
make rpm
109+
chdir={{ build.dir }}/plugins/intermediate/stats
110+
creates={{ build.dir }}/plugins/intermediate/stats/RPMBUILD/SRPMS/*.src.rpm
111+
when: build_rpms | bool
112+
tags: stats
113+
114+
- name: Build uid intermediate plugin rpm
115+
command: >
116+
make rpm
117+
chdir={{ build.dir }}/plugins/intermediate/uid
118+
creates={{ build.dir }}/plugins/intermediate/uid/RPMBUILD/SRPMS/*.src.rpm
119+
when: build_rpms | bool
120+
tags: uid
121+
122+
# Storage plugins
123+
124+
- name: Build fastbit storage plugin rpm
125+
command: >
126+
make rpm
127+
chdir={{ build.dir }}/plugins/storage/fastbit
128+
creates={{ build.dir }}/plugins/storage/fastbit/RPMBUILD/SRPMS/*.src.rpm
129+
when: build_rpms | bool
130+
tags: fastbit
131+
132+
- name: Build json storage plugin rpm
133+
command: >
134+
make rpm
135+
chdir={{ build.dir }}/plugins/storage/json
136+
creates={{ build.dir }}/plugins/storage/json/RPMBUILD/SRPMS/*.src.rpm
137+
when: build_rpms | bool
138+
tags: json
139+
140+
- name: Build nfdump storage plugin rpm
141+
command: >
142+
make rpm
143+
chdir={{ build.dir }}/plugins/storage/nfdump
144+
creates={{ build.dir }}/plugins/storage/nfdump/RPMBUILD/SRPMS/*.src.rpm
145+
when: build_rpms | bool
146+
tags: nfdump
147+
148+
- name: Build postgres storage plugin rpm
149+
command: >
150+
make rpm
151+
chdir={{ build.dir }}/plugins/storage/postgres
152+
creates={{ build.dir }}/plugins/storage/postgres/RPMBUILD/SRPMS/*.src.rpm
153+
when: build_rpms | bool
154+
tags: postgres
155+
156+
- name: Build statistics storage plugin rpm
157+
command: >
158+
make rpm
159+
chdir={{ build.dir }}/plugins/storage/statistics
160+
creates={{ build.dir }}/plugins/storage/statistics/RPMBUILD/SRPMS/*.src.rpm
161+
when: build_rpms | bool
162+
tags: statistics
163+
164+
#These need to be build first:
165+
#lnfstore
166+
- name: Build lnfstore storage plugin rpm
167+
command: >
168+
{{ item }}
169+
chdir={{ build.dir }}/plugins/storage/lnfstore
170+
creates={{ build.dir }}/plugins/storage/lnfstore/RPMBUILD/SRPMS/*.src.rpm
171+
with_items:
172+
- "{{ build.cmds }}"
173+
- "make rpm"
174+
tags: lnfstore
175+
176+
# unirec
177+
- name: Build unirec storage plugin rpm
178+
command: >
179+
{{ item }}
180+
chdir={{ build.dir }}/plugins/storage/unirec
181+
creates={{ build.dir }}/plugins/storage/unirec/RPMBUILD/SRPMS/*.src.rpm
182+
with_items:
183+
- "{{ build.cmds }}"
184+
- "make rpm"
185+
tags: unirec
186+
187+
# Tools
188+
- name: Build fbitconvert tool rpm
189+
command: >
190+
make rpm
191+
chdir={{ build.dir }}/tools/fbitconvert
192+
creates={{ build.dir }}tools/fbitconvert/RPMBUILD/SRPMS/*.src.rpm
193+
when: build_rpms | bool
194+
tags: fbitconvert
195+
196+
197+
- name: Build fbitdump tool rpm
198+
command: >
199+
make rpm
200+
chdir={{ build.dir }}/tools/fbitdump
201+
creates={{ build.dir }}/tools/fbitdump/RPMBUILD/SRPMS/*.src.rpm
202+
when: build_rpms | bool
203+
tags: fbitdump
204+
205+
206+
- name: Build fbitexpire tool rpm
207+
command: >
208+
make rpm
209+
chdir={{ build.dir }}/tools/fbitexpire
210+
creates={{ build.dir }}/tools/fbitexpire/RPMBUILD/SRPMS/*.src.rpm
211+
when: build_rpms | bool
212+
tags: fbitexpire
213+
214+
215+
- name: Build fbitmerge tool rpm
216+
command: >
217+
make rpm
218+
chdir={{ build.dir }}/tools/fbitmerge
219+
creates={{ build.dir }}/tools/fbitmerge/RPMBUILD/SRPMS/*.src.rpm
220+
when: build_rpms | bool
221+
tags: fbitmerge
222+
223+
224+
- name: Build profilesdaemon tool rpm
225+
command: >
226+
make rpm
227+
chdir={{ build.dir }}/tools/profilesdaemon
228+
creates={{ build.dir }}/tools/profilesdaemon/RPMBUILD/SRPMS/*.src.rpm
229+
when: build_rpms | bool
230+
tags: profilesdaemon

ansible/roles/ipfixcol/tasks/dependencies.yml

+6
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,9 @@
6666
action: "{{ ansible_pkg_mgr }} name={{ item }} state=latest"
6767
with_items: "{{ packages.dhcp }}"
6868
tags: dhcp
69+
70+
- name: RPM package dependencies
71+
action: "{{ ansible_pkg_mgr }} name={{ item }} state=latest"
72+
with_items: "{{ packages.build_rpms }}"
73+
when: build_rpms | bool
74+
tags: always

ansible/roles/ipfixcol/tasks/intermediate-plugins.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
with_items: "{{ build.cmds }}"
2828
tags: profiler
2929

30-
3130
# profile_stats
3231
- name: Build profile_stats intermediate plugin
3332
command: >
@@ -53,4 +52,4 @@
5352
chdir={{ build.dir }}/plugins/intermediate/uid
5453
creates=/usr/local/share/ipfixcol/plugins/ipfixcol-uid-inter.so
5554
with_items: "{{ build.cmds }}"
56-
tags: uid
55+
tags: uid

ansible/roles/ipfixcol/tasks/main.yml

+8-3
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,14 @@
1010

1111
- name: IPFIXcol intermediate plugins
1212
include: intermediate-plugins.yml
13-
13+
1414
- name: IPFIXcol storage plugins
1515
include: storage-plugins.yml
16-
16+
1717
- name: IPFIXcol tools
18-
include: tools.yml
18+
include: tools.yml
19+
20+
# This is included last since it requires that individual sources are
21+
# configured already
22+
- name: Build RPMs
23+
include: build-rpms.yml

ansible/roles/ipfixcol/tasks/storage-plugins.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
with_items: "{{ build.cmds }}"
1010
tags: fastbit
1111

12-
1312
# json
1413
- name: Build json storage plugin
1514
command: >
@@ -55,7 +54,7 @@
5554
creates=/usr/local/share/ipfixcol/plugins/ipfixcol-statistics-output.so
5655
with_items: "{{ build.cmds }}"
5756
tags: statistics
58-
57+
5958
# unirec
6059
# requires libunirec from https://github.com/CESNET/Nemea-Framework
6160
#- name: Build unirec storage plugin

ansible/roles/ipfixcol/vars/main.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@ build:
1515
dir: /tmp/libfastbit
1616

1717
# this can be easily changed from command line
18-
build_fastbit_compile: false
18+
build_fastbit_compile: false
19+
build_rpms: false

ansible/roles/ipfixcol/vars/packages.yum.yml

+1
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,4 @@ packages:
2323
uid: [sqlite-devel]
2424
dhcp: [sqlite-devel]
2525
postgres: [postgresql-devel]
26+
build_rpms: [rpm-build]

0 commit comments

Comments
 (0)