Skip to content

Commit eeaa039

Browse files
committed
chore: Fix rpm build; add a CI check for it.
1 parent 8328449 commit eeaa039

File tree

6 files changed

+74
-11
lines changed

6 files changed

+74
-11
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
analysis:
1717
strategy:
1818
matrix:
19-
tool: [autotools, clang-tidy, compcert, cppcheck, doxygen, goblint, infer, misra, tcc, tokstyle]
19+
tool: [autotools, clang-tidy, compcert, cppcheck, doxygen, goblint, infer, misra, rpm, tcc, tokstyle]
2020
runs-on: ubuntu-latest
2121
steps:
2222
- name: Set up Docker Buildx

other/docker/rpm/rpm.Dockerfile

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
FROM toxchat/c-toxcore:sources AS sources
2+
FROM fedora:39
3+
4+
RUN ["dnf", "install", "-y", \
5+
"cmake", \
6+
"g++", \
7+
"gcc", \
8+
"git", \
9+
"libconfig-devel", \
10+
"libsodium-devel", \
11+
"libvpx-devel", \
12+
"make", \
13+
"opus-devel", \
14+
"rpmdevtools", \
15+
"rpmlint", \
16+
"systemd-units"]
17+
18+
ARG PROJECT_VERSION=master
19+
ARG PROJECT_COMMIT_ID=master
20+
ARG PROJECT_COMMIT_ID_SHORT=master
21+
22+
COPY --from=sources /src/ /work/c-toxcore-${PROJECT_COMMIT_ID}
23+
WORKDIR /work/c-toxcore-${PROJECT_COMMIT_ID}/other/rpm
24+
25+
RUN make toxcore.spec \
26+
PROJECT_VERSION="$PROJECT_VERSION" \
27+
PROJECT_COMMIT_ID="$PROJECT_COMMIT_ID" \
28+
PROJECT_COMMIT_ID_SHORT="$PROJECT_COMMIT_ID_SHORT" \
29+
PROJECT_GIT_ROOT="/work/c-toxcore-$PROJECT_COMMIT_ID_SHORT"
30+
31+
WORKDIR /work
32+
RUN tar zcf "c-toxcore-${PROJECT_COMMIT_ID_SHORT}.tar.gz" "c-toxcore-${PROJECT_COMMIT_ID}" \
33+
&& mv "c-toxcore-${PROJECT_COMMIT_ID_SHORT}.tar.gz" "c-toxcore-${PROJECT_COMMIT_ID}/other/rpm"
34+
WORKDIR /work/c-toxcore-${PROJECT_COMMIT_ID}/other/rpm
35+
RUN make srpm \
36+
PROJECT_VERSION="$PROJECT_VERSION" \
37+
PROJECT_COMMIT_ID="$PROJECT_COMMIT_ID" \
38+
PROJECT_COMMIT_ID_SHORT="$PROJECT_COMMIT_ID_SHORT" \
39+
PROJECT_GIT_ROOT="$PROJECT_GIT_ROOT"
40+
41+
# Build the binary rpms.
42+
RUN rpmbuild --rebuild "toxcore-${PROJECT_VERSION}-1.fc39.src.rpm"
43+
44+
# Install them and try running the bootstrap daemon.
45+
RUN rpm -i /root/rpmbuild/RPMS/x86_64/*.rpm
46+
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
47+
RUN script tox-bootstrapd --help | grep Usage

other/docker/rpm/run

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/sh
2+
3+
set -eux
4+
PROJECT_VERSION="$(git describe | sed -e 's/^v//' -e 's/-/_/g')"
5+
PROJECT_COMMIT_ID="$(git rev-parse HEAD)"
6+
PROJECT_COMMIT_ID_SHORT="$(git rev-parse --short HEAD)"
7+
8+
BUILD=rpm
9+
other/docker/sources/build
10+
docker build -t "toxchat/c-toxcore:$BUILD" -f "other/docker/$BUILD/$BUILD.Dockerfile" . \
11+
--build-arg="PROJECT_VERSION=$PROJECT_VERSION" \
12+
--build-arg="PROJECT_COMMIT_ID=$PROJECT_COMMIT_ID" \
13+
--build-arg="PROJECT_COMMIT_ID_SHORT=$PROJECT_COMMIT_ID_SHORT"

other/rpm/toxcore.spec.in

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
%define full_name c-@PROJECT_NAME@
22
%define commit 0
33
%if "${commit}" != "0"
4-
%define shortcommit %(c=%{commit}; echo ${c:0:7})
4+
%define shortcommit %(c=%{commit}; echo ${c:0:9})
55
%endif
66

77
Name: @PROJECT_NAME@
@@ -18,10 +18,12 @@ Source0: https://github.com/TokTok/%{full_name}/archive/%{commit}/%{full_
1818
%endif
1919

2020
BuildRequires: cmake
21+
BuildRequires: g++
22+
BuildRequires: gcc
23+
BuildRequires: libconfig-devel
24+
BuildRequires: libsodium-devel
2125
BuildRequires: libvpx-devel
2226
BuildRequires: opus-devel
23-
BuildRequires: libsodium-devel
24-
BuildRequires: libconfig-devel
2527
BuildRequires: systemd-units
2628

2729
%description
@@ -63,18 +65,18 @@ Tox DHT bootstrap daemon.
6365

6466
%build
6567
%cmake
66-
%{__make} %{?_smp_mflags}
68+
%{__make} -C redhat-linux-build %{?_smp_mflags}
6769

6870
%install
69-
%make_install
71+
%make_install -C redhat-linux-build
7072
mkdir -p %{buildroot}%{_unitdir}
7173
install -m 0644 other/rpm/tox-bootstrapd.service %{buildroot}%{_unitdir}/tox-bootstrapd.service
7274
install -d "%{buildroot}%{_sharedstatedir}/tox-bootstrapd"
7375
mkdir -p %{buildroot}%{_sysconfdir}
7476
install -m 0644 other/bootstrap_daemon/tox-bootstrapd.conf %{buildroot}%{_sysconfdir}/tox-bootstrapd.conf
7577

7678
%check
77-
%{__make} %{?_smp_mflags} test
79+
%{__make} -C redhat-linux-build %{?_smp_mflags} test
7880

7981
%pre -n tox-bootstrapd
8082
getent group tox-bootstrapd >/dev/null || groupadd -r tox-bootstrapd
@@ -97,7 +99,7 @@ getent passwd tox-bootstrapd >/dev/null || \
9799

98100
%files
99101
%defattr(-, root, root)
100-
%doc LICENSE.md README.md CHANGELOG.md
102+
%doc LICENSE README.md CHANGELOG.md
101103
%{_libdir}/libtoxcore.so*
102104

103105
%files devel
@@ -111,9 +113,10 @@ getent passwd tox-bootstrapd >/dev/null || \
111113

112114
%files -n tox-bootstrapd
113115
%defattr(-, root, root)
116+
%{_bindir}/DHT_bootstrap
114117
%{_bindir}/tox-bootstrapd
115118
%{_unitdir}/tox-bootstrapd.service
116-
%{_sharedstatedir}/tox-bootstrapd
119+
%{_datadir}/bash-completion/completions/tox-bootstrapd
117120
%attr(-,tox-bootstrapd,tox-bootstrapd) %{_sharedstatedir}/tox-bootstrapd/
118121
%config(noreplace) %{_sysconfdir}/tox-bootstrapd.conf
119122

toxcore/LAN_discovery.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ static Broadcast_Info *fetch_broadcast_info(const Network *ns)
142142
}
143143

144144
/* Configure ifconf for the ioctl call. */
145-
struct ifreq i_faces[MAX_INTERFACES] = {{0}};
145+
struct ifreq i_faces[MAX_INTERFACES] = {{{0}}};
146146

147147
struct ifconf ifc;
148148
ifc.ifc_buf = (char *)i_faces;

toxcore/network.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1260,7 +1260,7 @@ Networking_Core *new_networking_ex(
12601260

12611261
#ifndef ESP_PLATFORM
12621262
/* multicast local nodes */
1263-
struct ipv6_mreq mreq = {{0}};
1263+
struct ipv6_mreq mreq = {{{{0}}}};
12641264
mreq.ipv6mr_multiaddr.s6_addr[ 0] = 0xFF;
12651265
mreq.ipv6mr_multiaddr.s6_addr[ 1] = 0x02;
12661266
mreq.ipv6mr_multiaddr.s6_addr[15] = 0x01;

0 commit comments

Comments
 (0)