Skip to content

Commit 873e81e

Browse files
jonathanspwslyon
authored andcommitted
CI: Update rpmbuild to latest Fedora/EPEL spec
- Resync rpm spec file with latest Fedora - Re-enable Fedora rawhide builds - Enable EL10 builds This speeds up the RPM building CI tasks as well.
1 parent aa8f4d3 commit 873e81e

File tree

2 files changed

+89
-48
lines changed

2 files changed

+89
-48
lines changed

.github/workflows/rpmbuild.yml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,25 @@ jobs:
1717
fail-fast: false
1818
matrix:
1919
container:
20+
- fedora:rawhide
2021
- fedora:latest
21-
# - fedora:rawhide
22-
- rockylinux:9
22+
- almalinux:10-kitten
23+
- almalinux:10
24+
- almalinux:9
2325
container:
2426
image: ${{ matrix.container }}
2527
steps:
26-
- uses: actions/checkout@v2
27-
- name: Build & Test
28+
- name: Runner setup
2829
run: |
2930
cat /etc/os-release
30-
dnf -y install dnf-plugins-core rpmdevtools # for 'dnf builddep'
31+
dnf -y install gzip sudo rpmdevtools
32+
33+
- uses: actions/checkout@v4
34+
- name: Build & Test
35+
run: |
3136
dnf -y install epel-release || true
32-
dnf config-manager --set-enabled crb || true # Meson/CMocka on EL9
33-
dnf -y install centos-release-nfv-openvswitch || true # OVS on EL9
37+
crb enable || true # Meson/CMocka on EL10
3438
dnf -y builddep rpm/netplan.spec
3539
adduser test
3640
chown -R test:test .
37-
su test -c 'rpmbuild -bi -D "debug_package %{nil}" --build-in-place rpm/netplan.spec'
41+
sudo -u test rpmbuild -bi -D "debug_package %{nil}" --build-in-place rpm/netplan.spec

rpm/netplan.spec

Lines changed: 77 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,24 @@
88
%global libsomajor 1
99

1010
# networkd is not available everywhere
11-
%if 0%{?rhel}
11+
%if 0%{?rhel} && ! 0%{?epel}
1212
%bcond_with networkd_support
1313
%else
1414
%bcond_without networkd_support
1515
%endif
1616

17+
%bcond_with tests
18+
1719
Name: netplan
18-
Version: 0.106
19-
Release: 0%{?dist}
20+
Version: 1.1.2
21+
Release: 1%{?dist}
2022
Summary: Network configuration tool using YAML
21-
Group: System Environment/Base
2223
License: GPL-3.0-only
2324
URL: http://netplan.io/
2425
Source0: https://github.com/canonical/%{name}/archive/%{version}/%{name}-%{version}.tar.gz
2526

2627
BuildRequires: gcc
27-
BuildRequires: meson >= 0.61
28+
BuildRequires: meson
2829
BuildRequires: pkgconfig(bash-completion)
2930
BuildRequires: pkgconfig(glib-2.0)
3031
BuildRequires: pkgconfig(gio-2.0)
@@ -33,29 +34,24 @@ BuildRequires: pkgconfig(systemd)
3334
BuildRequires: pkgconfig(yaml-0.1)
3435
BuildRequires: pkgconfig(uuid)
3536
BuildRequires: python3-devel
36-
BuildRequires: python3-cffi
3737
BuildRequires: systemd-rpm-macros
3838
BuildRequires: %{_bindir}/pandoc
39-
BuildRequires: %{_bindir}/find
39+
BuildRequires: python3dist(cffi)
40+
%if %{with tests}
4041
# For tests
4142
BuildRequires: %{_sbindir}/ip
42-
BuildRequires: pkgconfig(cmocka)
43+
BuildRequires: libcmocka-devel
4344
BuildRequires: python3dist(coverage)
44-
BuildRequires: dbus-x11
45+
BuildRequires: python3dist(pytest)
4546
BuildRequires: python3dist(netifaces)
4647
BuildRequires: python3dist(pycodestyle)
4748
BuildRequires: python3dist(pyflakes)
48-
BuildRequires: python3dist(pytest)
49-
BuildRequires: python3dist(pytest-cov)
5049
BuildRequires: python3dist(pyyaml)
51-
BuildRequires: python3dist(rich)
52-
BuildRequires: %{_bindir}/ovs-vsctl
53-
BuildRequires: systemd-udev
50+
%endif
5451

55-
# /usr/sbin/netplan is a Python 3 script that requires Python modules
52+
# /usr/sbin/netplan is a Python 3 script that requires netifaces and PyYAML
5653
Requires: python3dist(netifaces)
5754
Requires: python3dist(pyyaml)
58-
Requires: python3dist(rich)
5955
# 'ip' command is used in netplan apply subcommand
6056
Requires: %{_sbindir}/ip
6157
# netplan ships dbus files
@@ -69,10 +65,15 @@ Suggests: %{name}-default-backend-NetworkManager
6965
# Netplan requires its core libraries
7066
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
7167

68+
# Python bindings are in their own package but are required for CLI
69+
Requires: python3-%{name}%{?_isa} = %{version}-%{release}
70+
7271
# Provide the package name that Ubuntu uses for it too...
7372
Provides: %{ubuntu_name} = %{version}-%{release}
7473
Provides: %{ubuntu_name}%{?_isa} = %{version}-%{release}
7574

75+
76+
7677
%description
7778
netplan reads network configuration from /etc/netplan/*.yaml which are written by administrators,
7879
installers, cloud image instantiations, or other OS deployments. During early boot, it generates
@@ -84,25 +85,23 @@ Currently supported backends are NetworkManager and systemd-networkd.
8485
%files
8586
%license COPYING
8687
%doc %{_docdir}/%{name}/
87-
/usr/sbin/%{name}
88+
%{_sbindir}/%{name}
8889
%{_datadir}/%{name}/
89-
%{_datadir}/dbus-1/system-services/io.netplan.Netplan.service
90-
%{_datadir}/dbus-1/system.d/io.netplan.Netplan.conf
90+
%{_datadir}/dbus-1/system-services/io.%{name}.Netplan.service
91+
%{_datadir}/dbus-1/system.d/io.%{name}.Netplan.conf
9192
%{_systemdgeneratordir}/%{name}
9293
%{_mandir}/man5/%{name}.5*
9394
%{_mandir}/man8/%{name}*.8*
9495
%dir %{_sysconfdir}/%{name}
95-
%dir %{_prefix}/lib/%{name}
96-
%{_libexecdir}/%{name}/
96+
%dir %{_libexecdir}/%{name}
97+
%{_libexecdir}/%{name}/generate
98+
%{_libexecdir}/%{name}/%{name}-dbus
9799
%{_datadir}/bash-completion/completions/%{name}
98-
%{python3_sitelib}/%{name}/
99-
%{python3_sitearch}/%{name}/
100100

101101
# ------------------------------------------------------------------------------------------------
102102

103103
%package libs
104104
Summary: Network configuration tool using YAML (core library)
105-
Group: System Environment/Libraries
106105

107106
%description libs
108107
netplan reads network configuration from /etc/netplan/*.yaml which are written by administrators,
@@ -114,13 +113,12 @@ This package provides Netplan's core libraries.
114113

115114
%files libs
116115
%license COPYING
117-
%{_libdir}/libnetplan.so.%{libsomajor}{,.*}
116+
%{_libdir}/lib%{name}.so.%{libsomajor}{,.*}
118117

119118
# ------------------------------------------------------------------------------------------------
120119

121120
%package devel
122121
Summary: Network configuration tool using YAML (development files)
123-
Group: Development/Libraries
124122
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
125123

126124
%description devel
@@ -133,14 +131,13 @@ This package provides development headers and libraries for building application
133131

134132
%files devel
135133
%{_includedir}/%{name}/
136-
%{_libdir}/libnetplan.so
134+
%{_libdir}/lib%{name}.so
137135
%{_libdir}/pkgconfig/%{name}.pc
138136

139137
# ------------------------------------------------------------------------------------------------
140138

141139
%package default-backend-NetworkManager
142140
Summary: Network configuration tool using YAML (NetworkManager backend)
143-
Group: System Environment/Base
144141
Requires: %{name} = %{version}-%{release}
145142
# Netplan requires NetworkManager for configuration
146143
Requires: NetworkManager
@@ -166,14 +163,36 @@ networking daemon.
166163
This package configures Netplan to use NetworkManager as its backend.
167164

168165
%files default-backend-NetworkManager
169-
%{_prefix}/lib/%{name}/00-netplan-default-renderer-nm.yaml
166+
%attr(600,root,root) %{_prefix}/lib/%{name}/00-network-manager-all.yaml
167+
168+
# ------------------------------------------------------------------------------------------------
169+
170+
%package -n python3-%{name}
171+
Summary: Python bindings for lib%{name}
172+
173+
Requires: python3-cffi
174+
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
175+
176+
%description -n python3-%{name}
177+
Declarative network configuration Python bindings
178+
Netplan reads YAML network configuration files which are written
179+
by administrators, installers, cloud image instantiations, or other OS
180+
deployments. During early boot it then generates backend specific
181+
configuration files in /run to hand off control of devices to a particular
182+
networking daemon.
183+
184+
Currently supported backends are networkd and NetworkManager.
185+
186+
This package provides a CFFI based Python bindings to libnetplan.
187+
188+
%files -n python3-%{name}
189+
%{python3_sitearch}/%{name}/
170190

171191
# ------------------------------------------------------------------------------------------------
172192

173193
%if %{with networkd_support}
174194
%package default-backend-networkd
175195
Summary: Network configuration tool using YAML (systemd-networkd backend)
176-
Group: System Environment/Base
177196
Requires: %{name} = %{version}-%{release}
178197
# Netplan requires systemd-networkd for configuration
179198
Requires: systemd-networkd
@@ -202,47 +221,65 @@ This package configures Netplan to use systemd-networkd as its backend.
202221

203222
# ------------------------------------------------------------------------------------------------
204223

224+
205225
%prep
206226
%autosetup -p1
207227

208-
# Drop -Werror to avoid the following error:
209-
# /usr/include/glib-2.0/glib/glib-autocleanups.h:28:3: error: 'ip_str' may be used uninitialized in this function [-Werror=maybe-uninitialized]
210-
sed -e "s/werror=true/werror=false/g" -i meson.build
228+
# these tests all fail in containers, or are linting/codestyle which we don't care about
229+
sed -i -e "/ test('legacy-tests',/,+3d" \
230+
-e "/ test('codestyle',/,+3d" \
231+
-e "/ test('linting',/,+3d" \
232+
-e "/ test('unit-tests',/,+4d" \
233+
meson.build
211234

212235

213236
%build
214-
%meson --sbindir=sbin
237+
%if %{with tests}
238+
%meson
239+
%else
240+
%meson -Dtesting=false
241+
%endif
215242
%meson_build
216243

217244

218245
%install
219246
%meson_install
220247

221-
# Remove superfluous __pycache__
222-
rm -rf %{buildroot}/usr/lib/python3.11/site-packages/netplan/__pycache__
223-
224-
# Pre-create the config directories
248+
# Pre-create the config directory
225249
mkdir -p %{buildroot}%{_sysconfdir}/%{name}
250+
251+
# Create the lib dir for default config
226252
mkdir -p %{buildroot}%{_prefix}/lib/%{name}
227253

254+
mv -n %{buildroot}/%{python3_sitelib}/%{name}/* %{buildroot}/%{python3_sitearch}/%{name}/
255+
rm -f %{python3_sitelib}/%{name}/
256+
228257
# Generate Netplan default renderer configuration
229-
cat > %{buildroot}%{_prefix}/lib/%{name}/00-netplan-default-renderer-nm.yaml <<EOF
258+
cat > %{buildroot}%{_prefix}/lib/%{name}/00-network-manager-all.yaml <<EOF
230259
network:
260+
version: 2
231261
renderer: NetworkManager
232262
EOF
233263
%if %{with networkd_support}
234264
cat > %{buildroot}%{_prefix}/lib/%{name}/00-netplan-default-renderer-networkd.yaml <<EOF
235265
network:
266+
version: 2
236267
renderer: networkd
237268
EOF
238269
%endif
239270

240271

272+
%if %{with tests}
241273
%check
242274
%meson_test
275+
%endif
243276

244277

245278
%changelog
279+
* Thu Jul 10 2025 Jonathan Wright <jonathan@almalinux.org> - 1.1.2-0
280+
- Update to 1.1.2
281+
- Resync with Fedora spec
282+
246283
* Tue Feb 14 2023 Neal Gompa <ngompa13@gmail.com> - 0.106-0
247284
- Update to 0.106
248285
- Resync with Fedora spec
@@ -271,4 +308,4 @@ EOF
271308
- Rebase to 0.30
272309

273310
* Sun Jul 2 2017 Neal Gompa <ngompa13@gmail.com> - 0.23~17.04.1-1
274-
- Initial packaging
311+
- Initial packaging

0 commit comments

Comments
 (0)