From 0bef9c1c612062303c0b89b3c1f77206364de70a Mon Sep 17 00:00:00 2001 From: Tomas Cejka Date: Tue, 13 Aug 2024 00:39:34 +0200 Subject: [PATCH] update submodules, update docker&rpms.sh, add mock configs --- docker/rocky8/Dockerfile | 4 ++-- docker/rocky8/README.md | 14 ++++++++++++++ docker/rocky8/build.sh | 25 +++++++++++++++++++++++++ generate-rpm.sh | 3 ++- mock/README.md | 12 ++++++++++++ mock/rocky+epel+nemea-8-x86_64.cfg | 20 ++++++++++++++++++++ mock/rocky+epel+nemea-9-x86_64.cfg | 19 +++++++++++++++++++ modules | 2 +- nemea-framework | 2 +- nemea-supervisor | 2 +- rpms.sh | 18 +++++++++++++++--- 11 files changed, 112 insertions(+), 9 deletions(-) create mode 100644 docker/rocky8/README.md create mode 100755 docker/rocky8/build.sh create mode 100644 mock/README.md create mode 100644 mock/rocky+epel+nemea-8-x86_64.cfg create mode 100644 mock/rocky+epel+nemea-9-x86_64.cfg diff --git a/docker/rocky8/Dockerfile b/docker/rocky8/Dockerfile index 187eaf5..af06061 100644 --- a/docker/rocky8/Dockerfile +++ b/docker/rocky8/Dockerfile @@ -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 \ diff --git a/docker/rocky8/README.md b/docker/rocky8/README.md new file mode 100644 index 0000000..b83210c --- /dev/null +++ b/docker/rocky8/README.md @@ -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 + diff --git a/docker/rocky8/build.sh b/docker/rocky8/build.sh new file mode 100755 index 0000000..80f4d13 --- /dev/null +++ b/docker/rocky8/build.sh @@ -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 + diff --git a/generate-rpm.sh b/generate-rpm.sh index 7ea9b83..41cd86e 100755 --- a/generate-rpm.sh +++ b/generate-rpm.sh @@ -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 diff --git a/mock/README.md b/mock/README.md new file mode 100644 index 0000000..30cacb3 --- /dev/null +++ b/mock/README.md @@ -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. diff --git a/mock/rocky+epel+nemea-8-x86_64.cfg b/mock/rocky+epel+nemea-8-x86_64.cfg new file mode 100644 index 0000000..debc1de --- /dev/null +++ b/mock/rocky+epel+nemea-8-x86_64.cfg @@ -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 }}" + + diff --git a/mock/rocky+epel+nemea-9-x86_64.cfg b/mock/rocky+epel+nemea-9-x86_64.cfg new file mode 100644 index 0000000..0112df0 --- /dev/null +++ b/mock/rocky+epel+nemea-9-x86_64.cfg @@ -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 }}" + diff --git a/modules b/modules index c167667..1873c23 160000 --- a/modules +++ b/modules @@ -1 +1 @@ -Subproject commit c16766702209b4b899cf1ee101ae97c08e0e0b05 +Subproject commit 1873c230e84d07e617427ba2ef65fcc46574b0a1 diff --git a/nemea-framework b/nemea-framework index a554edf..a8d19d1 160000 --- a/nemea-framework +++ b/nemea-framework @@ -1 +1 @@ -Subproject commit a554edfb3bb834218ba4a1268188a641cd07ae6f +Subproject commit a8d19d1e66dd8e794c8d83f91936bb61f1b963df diff --git a/nemea-supervisor b/nemea-supervisor index 89afda1..cd0e74c 160000 --- a/nemea-supervisor +++ b/nemea-supervisor @@ -1 +1 @@ -Subproject commit 89afda171fc119db253235f7a8e0c71614296dec +Subproject commit cd0e74cbc4450e918e011d5b202fc5aa8809188c diff --git a/rpms.sh b/rpms.sh index b128b2a..99e8358 100755 --- a/rpms.sh +++ b/rpms.sh @@ -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 @@ -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" @@ -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/ \; + +