Skip to content

Commit 9bd67a2

Browse files
committed
Fix rpm build. Add rpm build to github actions
1 parent 5779dbd commit 9bd67a2

File tree

6 files changed

+72
-7
lines changed

6 files changed

+72
-7
lines changed

.github/workflows/build_redhat.yml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: WFB-ng package builder for RedHat
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
# The branches below must be a subset of the branches above
8+
branches: [ master ]
9+
10+
jobs:
11+
build_and_test:
12+
runs-on: ubuntu-22.04
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
version: [8, 9]
17+
arch: [ "amd64.amd64.max" ]
18+
19+
steps:
20+
- name: Checkout repository
21+
uses: actions/checkout@v4
22+
- name: build package
23+
run: |
24+
curl -s -L https://github.com/svpcom/wfb-ng/releases/download/wifibroadcast-17.10/qemu-7.2.15-fixed.tar.gz | sudo tar xzv -C /
25+
make rpm_docker QEMU_CPU=$(echo ${{ matrix.arch }} | cut -f3 -d.) DOCKER_ARCH=$(echo ${{ matrix.arch }} | cut -f1 -d.) DOCKER_SRC_IMAGE=$(echo ${{ matrix.arch }} | cut -f2 -d.)/rockylinux:${{ matrix.version }}
26+
- name: Archive production artifacts
27+
uses: actions/upload-artifact@v4
28+
id: artifact-upload-step
29+
if: github.event_name != 'pull_request'
30+
with:
31+
name: wfb-ng-${{ github.ref_name }}-redhat${{ matrix.version }}-${{ matrix.arch }}
32+
path: |
33+
dist/*.rpm

Makefile

+13-5
Original file line numberDiff line numberDiff line change
@@ -68,19 +68,19 @@ wfb_rtsp: src/rtsp_server.c
6868
test: all_bin
6969
PYTHONPATH=`pwd` trial3 wfb_ng.tests
7070

71-
rpm: all_bin $(ENV)
71+
rpm: all_bin wfb_rtsp $(ENV)
7272
rm -rf dist
73-
$(PYTHON) ./setup.py bdist_rpm --force-arch $(ARCH)
73+
$$(PATH=$(ENV)/bin:$(ENV)/local/bin:$(PATH) which python3) ./setup.py bdist_rpm --force-arch $(ARCH) --requires python3-twisted,python3-pyroute2,python3-pyserial,python3-msgpack,python3-jinja2,python3-yaml,socat,iw
7474
rm -rf wfb_ng.egg-info/
7575

7676
deb: all_bin wfb_rtsp $(ENV)
7777
rm -rf deb_dist
7878
$$(PATH=$(ENV)/bin:$(ENV)/local/bin:$(PATH) which python3) ./setup.py --command-packages=stdeb.command sdist_dsc --debian-version 0~$(OS_CODENAME) bdist_deb
7979
rm -rf wfb_ng.egg-info/ wfb-ng-$(VERSION).tar.gz
8080

81-
bdist: all_bin
81+
bdist: all_bin wfb_rtsp
8282
rm -rf dist
83-
$(PYTHON) ./setup.py bdist --plat-name linux-$(ARCH)
83+
$$(PATH=$(ENV)/bin:$(ENV)/local/bin:$(PATH) which python3) ./setup.py bdist --plat-name linux-$(ARCH)
8484
rm -rf wfb_ng.egg-info/
8585

8686
check:
@@ -99,6 +99,14 @@ deb_docker: /opt/qemu/bin
9999
@if ! [ -d /opt/qemu ]; then echo "Docker cross build requires patched QEMU!\nApply ./scripts/qemu/qemu.patch to qemu-7.2.0 and build it:\n ./configure --prefix=/opt/qemu --static --disable-system && make && sudo make install"; exit 1; fi
100100
if ! ls /proc/sys/fs/binfmt_misc | grep -q qemu ; then sudo ./scripts/qemu/qemu-binfmt-conf.sh --qemu-path /opt/qemu/bin --persistent yes; fi
101101
cp -a Makefile docker/src/
102-
TAG="wfb-ng:build-`date +%s`"; docker build --platform linux/$(DOCKER_ARCH) -t $$TAG --build-arg SRC_IMAGE=$(DOCKER_SRC_IMAGE) --build-arg QEMU_CPU=$(QEMU_CPU) docker && \
102+
TAG="wfb-ng:build-`date +%s`"; docker build --platform linux/$(DOCKER_ARCH) -t $$TAG --build-arg SRC_IMAGE=$(DOCKER_SRC_IMAGE) --build-arg QEMU_CPU=$(QEMU_CPU) -f docker/Dockerfile.debian docker && \
103103
docker run --privileged --platform linux/$(DOCKER_ARCH) -i --rm -v $(PWD):/build $$TAG bash -c "trap 'chown -R --reference=. .' EXIT; export VERSION=$(VERSION) COMMIT=$(COMMIT) SOURCE_DATE_EPOCH=$(SOURCE_DATE_EPOCH) && /sbin/sysctl net.unix.max_dgram_qlen=512 && cd /build && make clean && make test && make deb"
104104
docker image ls -q "wfb-ng:build-*" | uniq | tail -n+6 | while read i ; do docker rmi -f $$i; done
105+
106+
rpm_docker: /opt/qemu/bin
107+
@if ! [ -d /opt/qemu ]; then echo "Docker cross build requires patched QEMU!\nApply ./scripts/qemu/qemu.patch to qemu-7.2.0 and build it:\n ./configure --prefix=/opt/qemu --static --disable-system && make && sudo make install"; exit 1; fi
108+
if ! ls /proc/sys/fs/binfmt_misc | grep -q qemu ; then sudo ./scripts/qemu/qemu-binfmt-conf.sh --qemu-path /opt/qemu/bin --persistent yes; fi
109+
cp -a Makefile docker/src/
110+
TAG="wfb-ng:build-`date +%s`"; docker build --platform linux/$(DOCKER_ARCH) -t $$TAG --build-arg SRC_IMAGE=$(DOCKER_SRC_IMAGE) --build-arg QEMU_CPU=$(QEMU_CPU) -f docker/Dockerfile.redhat docker && \
111+
docker run --privileged --platform linux/$(DOCKER_ARCH) -i --rm -v $(PWD):/build $$TAG bash -c "trap 'chown -R --reference=. .' EXIT; export VERSION=$(VERSION) COMMIT=$(COMMIT) SOURCE_DATE_EPOCH=$(SOURCE_DATE_EPOCH) && /sbin/sysctl net.unix.max_dgram_qlen=512 && cd /build && make clean && make test && make rpm"
112+
docker image ls -q "wfb-ng:build-*" | uniq | tail -n+6 | while read i ; do docker rmi -f $$i; done
File renamed without changes.

docker/Dockerfile.redhat

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
ARG SRC_IMAGE
2+
FROM $SRC_IMAGE
3+
4+
ARG QEMU_CPU
5+
ENV QEMU_CPU=$QEMU_CPU
6+
7+
RUN (. /etc/os-release; echo $VERSION_ID | cut -f1 -d .) > /etc/release
8+
RUN rpm -ihv https://dl.fedoraproject.org/pub/epel/epel-release-latest-$(cat /etc/release).noarch.rpm
9+
RUN dnf -y upgrade
10+
RUN dnf -y groupinstall "Development Tools"
11+
RUN dnf -y install --enablerepo=devel git wget \
12+
python3-virtualenv rpm-build \
13+
libpcap-devel libsodium-devel libevent-devel \
14+
python3-twisted python3-pyroute2 \
15+
python3-devel \
16+
python3-pyserial python3-setuptools python3-msgpack python3-jinja2 python3-yaml \
17+
gstreamer1-rtsp-server-devel gstreamer1-devel procps net-tools iproute iputils
18+
19+
RUN ln -sf /usr/bin/trial /usr/bin/trial3
20+
RUN echo "%debug_package %{nil}" > ~/.rpmmacros
21+
COPY src/Makefile /tmp
22+
ENV ENV=/opt/env
23+
ENV PYTHON=python3
24+
RUN cd /tmp && make $ENV

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def _long_description():
3939

4040
setup(
4141
url="http://wfb-ng.org",
42-
name="wfb-ng",
42+
name="wfb_ng",
4343
version=version,
4444
packages=find_packages(exclude=["*.tests", "*.tests.*", "tests.*", "tests"]),
4545
zip_safe=False,

stdeb.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[DEFAULT]
1+
[wfb_ng]
22
Depends3: python3-twisted, python3-pyroute2, python3-serial, python3-msgpack, python3-jinja2, python3-yaml, socat, iw
33
Package3: wfb-ng
44
Replaces3: wifibroadcast

0 commit comments

Comments
 (0)