Skip to content

Commit

Permalink
update submodules, update docker&rpms.sh, add mock configs
Browse files Browse the repository at this point in the history
  • Loading branch information
cejkato2 committed Aug 12, 2024
1 parent 981ba15 commit 0bef9c1
Show file tree
Hide file tree
Showing 11 changed files with 112 additions and 9 deletions.
4 changes: 2 additions & 2 deletions docker/rocky8/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ RUN curl -s 'https://copr.fedorainfracloud.org/coprs/g/CESNET/NEMEA/repo/epel-8/
RUN dnf -y --enablerepo=devel --enablerepo=powertools install epel-rpm-macros \
python3-rpm-macros python-rpm-macros python-srpm-macros rpm-build git which \
doxygen bison flex libcurl-devel lua-devel bzip2-devel libpcap-devel \
openssl-devel libxml2-devel libidn-devel make automake autoconf \
pkgconfig gcc gcc-c++ libtool cmake \
ncurses-devel fuse3-devel openssl-devel libxml2-devel libidn-devel make automake \
autoconf pkgconfig gcc gcc-c++ libtool cmake \
python3-devel python3-setuptools python3-pip python3-wheel \
python38 python38-devel python38-pip python38-wheel python38-setuptools \
python39 python39-devel python39-pip python39-wheel python39-setuptools \
Expand Down
14 changes: 14 additions & 0 deletions docker/rocky8/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Explanation

This directory contains `Dockerfile` to build an image based on RockyLinux8 with
all required dependencies installed.

The image can be used to create a container and build all NEMEA RPM packages
and Python wheels.

To do this, just run `build.sh`, and the results should be in `rpms/` an `wheels/`.

# Requirements

* podman or docker

25 changes: 25 additions & 0 deletions docker/rocky8/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

CONT_BIN="`which podman 2>/dev/null`"
if [ -n "$CONT_BIN" ]; then
CONT_BIN="`which docker 2>/dev/null`"
fi
if [ -n "$CONT_BIN" ]; then
echo "Missing podman or docker."
exit 1
fi

"$CONT_BIN" build --tag rl8docker:latest .
"$CONT_BIN" run -ti --rm --name rl8docker -d rl8docker:latest
"$CONT_BIN" cp ../../ rl8docker:/nemea
"$CONT_BIN" exec -ti rl8docker bash -c 'cd /nemea; ./rpms.sh root'
"$CONT_BIN" exec -ti rl8docker bash -c 'cd /nemea; ls -l rpms'
"$CONT_BIN" cp rl8docker:/nemea/rpms rpms
"$CONT_BIN" cp rl8docker:/nemea/nemea-framework/pytrap/dist/ wheels/

# This will remove the container:
"$CONT_BIN" stop rl8docker

# This would remove the image:
# "$CONT_BIN" rmi rl8docker:latest

3 changes: 2 additions & 1 deletion generate-rpm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,6 @@
# if advised of the possibility of such damage.

pwd
./bootstrap.sh >/dev/null 2>/dev/null&& ./configure -q && make -j4 && make rpm
git submodule init; git submodule update;
./bootstrap.sh >/dev/null 2>/dev/null&& ./configure -q && make rpm

12 changes: 12 additions & 0 deletions mock/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Explanation

This directory contains `mock` configuration files, which include @CESNET/NEMEA
copr repo with dependencies.

Example how to rebuild a package for, e.g., libtrap for RockyLinux8 is as follows:

```
mock -r rocky+epel+nemea-8-x86_64.cfg path/to/srpms/libtrap-1.18.1-1.src.rpm
```

See the output of the command to find the results and logs.
20 changes: 20 additions & 0 deletions mock/rocky+epel+nemea-8-x86_64.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
include('rocky+epel-8-x86_64.cfg')

config_opts['dnf.conf'] += """
[copr:copr.fedorainfracloud.org:group_CESNET:NEMEA]
name=Copr repo for NEMEA owned by @CESNET
baseurl=https://download.copr.fedorainfracloud.org/results/@CESNET/NEMEA/epel-8-$basearch/
type=rpm-md
skip_if_unavailable=True
gpgcheck=1
gpgkey=https://download.copr.fedorainfracloud.org/results/@CESNET/NEMEA/pubkey.gpg
repo_gpgcheck=0
enabled=1
enabled_metadata=1
"""

config_opts['description'] = 'Rocky Linux 8 + EPEL + NEMEA'
config_opts['root'] = "rocky+epel+nemea-8-{{ target_arch }}"


19 changes: 19 additions & 0 deletions mock/rocky+epel+nemea-9-x86_64.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
include('rocky+epel-9-x86_64.cfg')

config_opts['dnf.conf'] += """
[copr:copr.fedorainfracloud.org:group_CESNET:NEMEA]
name=Copr repo for NEMEA owned by @CESNET
baseurl=https://download.copr.fedorainfracloud.org/results/@CESNET/NEMEA/epel-9-$basearch/
type=rpm-md
skip_if_unavailable=True
gpgcheck=1
gpgkey=https://download.copr.fedorainfracloud.org/results/@CESNET/NEMEA/pubkey.gpg
repo_gpgcheck=0
enabled=1
enabled_metadata=1
"""

config_opts['description'] = 'Rocky Linux 9 + EPEL + NEMEA'
config_opts['root'] = "rocky+epel+nemea-9-{{ target_arch }}"

2 changes: 1 addition & 1 deletion nemea-framework
Submodule nemea-framework updated 98 files
+2 −1 .github/workflows/c-cpp.yml
+0 −3 common/Makefile.am
+11 −0 libtrap/ChangeLog
+16 −0 libtrap/NEWS
+1 −1 libtrap/configure.ac
+59 −0 libtrap/include/libtrap/trap.h
+1 −1 libtrap/libtrap-varrun.conf.in
+2 −2 libtrap/libtrap.spec.in
+1 −1 libtrap/src/Makefile.am
+108 −31 libtrap/src/ifc_tcpip.c
+15 −5 libtrap/src/ifc_tcpip_internal.h
+35 −10 libtrap/src/ifc_tls.c
+45 −4 libtrap/src/trap.c
+37 −0 libtrap/src/trap_ifc.h
+3 −8 pycommon/README-RPM-release.md
+5 −2 pycommon/nemea-pycommon.spec
+73 −54 pycommon/report2idea.py
+177 −62 pycommon/reporter_config/Config.py
+11 −5 pycommon/reporter_config/Parser.py
+67 −10 pycommon/reporter_config/Rule.py
+1 −0 pycommon/reporter_config/actions/Email.py
+2 −2 pycommon/setup.py
+2 −4 pycommon/test/rc_01_basic.py
+9 −21 pycommon/test/rc_01_empty.py
+1 −2 pycommon/test/rc_02_tautology.py
+1 −2 pycommon/test/rc_11_drop.py
+1 −2 pycommon/test/rc_12_mark.py
+2 −4 pycommon/test/rc_14_mongo.py
+2 −4 pycommon/test/rc_15_file.py
+8 −8 pycommon/test/rc_17_syslog.py
+1 −2 pycommon/test/rc_20_multiple_actions.py
+1 −2 pycommon/test/rc_21_multiple_elseactions.py
+3 −5 pycommon/test/rc_22_addressgroup.py
+1 −1 pycommon/test/rc_23_testreporter.py
+1 −1 pycommon/test/rc_24_testreporter_ips.py
+12 −2 pytrap/Makefile.am
+9 −2 pytrap/nemea-pytrap.spec
+4 −2 pytrap/setup.py
+0 −0 pytrap/src/ipblacklist.c
+377 −0 pytrap/src/iplist.c
+20 −0 pytrap/src/iplist.h
+3 −20 pytrap/src/pytrapmodule.c
+196 −7 pytrap/src/unirecipaddr.c
+1 −0 pytrap/src/unirecipaddr.h
+40 −62 pytrap/src/unirecmodule.c
+127 −0 pytrap/test/ipblacklist_unittest.py
+145 −10 pytrap/test/unirectemplate_unittest.py
+19 −0 unirec/ChangeLog
+2 −2 unirec/Doxyfile.in
+8 −29 unirec/Makefile.am
+24 −0 unirec/NEWS
+10 −7 unirec/configure.ac
+2 −0 unirec/include/Makefile.am
+18 −0 unirec/include/unirec++/Makefile.am
+212 −0 unirec/include/unirec++/bidirectionalInterface.hpp
+114 −0 unirec/include/unirec++/inputInterface.hpp
+24 −0 unirec/include/unirec++/interfaceStats.hpp
+81 −0 unirec/include/unirec++/ipAddress.hpp
+13 −0 unirec/include/unirec++/macAddress.hpp
+146 −0 unirec/include/unirec++/outputInterface.hpp
+52 −0 unirec/include/unirec++/trapModuleInfo.hpp
+53 −0 unirec/include/unirec++/unirec.hpp
+140 −0 unirec/include/unirec++/unirecArray.hpp
+30 −0 unirec/include/unirec++/unirecException.hpp
+396 −0 unirec/include/unirec++/unirecRecord.hpp
+183 −0 unirec/include/unirec++/unirecRecordView.hpp
+64 −0 unirec/include/unirec++/unirecTypeTraits.hpp
+218 −0 unirec/include/unirec++/unirecTypes.hpp
+21 −0 unirec/include/unirec++/urTime.hpp
+22 −0 unirec/include/unirec/Makefile.am
+0 −0 unirec/include/unirec/inline.h
+0 −0 unirec/include/unirec/ip_prefix_search.h
+0 −0 unirec/include/unirec/ipaddr.h
+0 −0 unirec/include/unirec/links.h
+0 −0 unirec/include/unirec/macaddr.h
+0 −0 unirec/include/unirec/unirec.h
+0 −0 unirec/include/unirec/unirec2csv.h
+0 −0 unirec/include/unirec/ur_time.h
+3 −2 unirec/ip_prefix_search.c
+1 −1 unirec/tests/Makefile.am
+1 −1 unirec/tests/ip_prefix_search_test.c
+1 −1 unirec/tests/test_basic.c
+1 −1 unirec/tests/test_ipaddr.c
+1 −1 unirec/tests/test_iter.c
+1 −1 unirec/tests/test_macaddr.c
+1 −1 unirec/tests/test_template_cmp.c
+1 −1 unirec/tests/test_time.c
+2 −2 unirec/tests/test_ur2csv.c
+10 −0 unirec/unirec++/Makefile.am
+234 −0 unirec/unirec++/bidirectionalInterface.cpp
+138 −0 unirec/unirec++/inputInterface.cpp
+53 −0 unirec/unirec++/ipAddress.cpp
+129 −0 unirec/unirec++/outputInterface.cpp
+13 −0 unirec/unirec++/unirec++.pc.in
+91 −0 unirec/unirec++/unirec.cpp
+3 −3 unirec/unirec.c
+19 −2 unirec/unirec.spec.in
+1 −1 unirec/unirec2csv.c
2 changes: 1 addition & 1 deletion nemea-supervisor
18 changes: 15 additions & 3 deletions rpms.sh
Original file line number Diff line number Diff line change
Expand Up @@ -103,16 +103,19 @@ export chuser
(
cd pytrap
su $chuser -p -c "make rpm"
$pkginst install -y -q $(find \( -name '*.rpm' -o -name '*64.rpm' \))
$pkginst install -y -q $(find \( -name '*noarch.rpm' -o -name '*64.rpm' \))
su $chuser -p -c "python3.6 setup.py bdist_wheel"
su $chuser -p -c "python3.8 setup.py bdist_wheel"
su $chuser -p -c "python3.9 setup.py bdist_wheel"
)
(
cd pycommon
su $chuser -p -c "make && make rpm"
su $chuser -p -c "make rpm"
su $chuser -p -c "python3.6 setup.py bdist_wheel"
$pkginst install -y -q $(find \( -name '*noarch.rpm' -o -name '*64.rpm' \))
)
su $chuser -p -c "make rpm"
$pkginst install -y -q $(find -name 'nemea-framework-*noarch.rpm')
)
(
cd modules
Expand All @@ -124,6 +127,11 @@ export chuser
su $chuser -p -c "$topdir/generate-rpm.sh"
$pkginst install -y -q $(find \( -name '*noarch.rpm' -o -name '*64.rpm' \))
)
(
cd modules-ng
su $chuser -p -c "cmake . && make rpm"
$pkginst install -y -q $(find \( -name '*noarch.rpm' -o -name '*64.rpm' \))
)
(
cd nemea-supervisor
su $chuser -p -c "$topdir/generate-rpm.sh"
Expand All @@ -134,6 +142,10 @@ su $chuser -p -c "$topdir/bootstrap.sh >/dev/null 2>/dev/null&& $topdir/configur
mkdir -p "`pwd`/RPMBUILD"
rpmbuild -ba nemea.spec --define "_topdir `pwd`/RPMBUILD"
mkdir -p "`pwd`/rpms"
find -name *.rpm -not -path "./rpms/*" -exec mv {} rpms/ \;
find -name '*.rpm' -not -path "./rpms/*" -exec mv {} rpms/ \;
chown -R $chuser rpms/

mkdir -p "`pwd`/wheels"
find -name '*.whl' -not -path "./wheels/*" -exec mv {} wheels/ \;


0 comments on commit 0bef9c1

Please sign in to comment.