diff --git a/.github/workflows/rpmbuild.yml b/.github/workflows/rpmbuild.yml index 2a788febc..9349acb8f 100644 --- a/.github/workflows/rpmbuild.yml +++ b/.github/workflows/rpmbuild.yml @@ -17,21 +17,25 @@ jobs: fail-fast: false matrix: container: + - fedora:rawhide - fedora:latest - # - fedora:rawhide - - rockylinux:9 + - almalinux:10-kitten + - almalinux:10 + - almalinux:9 container: image: ${{ matrix.container }} steps: - - uses: actions/checkout@v2 - - name: Build & Test + - name: Runner setup run: | cat /etc/os-release - dnf -y install dnf-plugins-core rpmdevtools # for 'dnf builddep' + dnf -y install gzip sudo rpmdevtools + + - uses: actions/checkout@v4 + - name: Build & Test + run: | dnf -y install epel-release || true - dnf config-manager --set-enabled crb || true # Meson/CMocka on EL9 - dnf -y install centos-release-nfv-openvswitch || true # OVS on EL9 + crb enable || true # Meson/CMocka on EL10 dnf -y builddep rpm/netplan.spec adduser test chown -R test:test . - su test -c 'rpmbuild -bi -D "debug_package %{nil}" --build-in-place rpm/netplan.spec' + sudo -u test rpmbuild -bi -D "debug_package %{nil}" --build-in-place rpm/netplan.spec diff --git a/rpm/netplan.spec b/rpm/netplan.spec index 69cf9df93..59caebec8 100644 --- a/rpm/netplan.spec +++ b/rpm/netplan.spec @@ -8,23 +8,24 @@ %global libsomajor 1 # networkd is not available everywhere -%if 0%{?rhel} +%if 0%{?rhel} && ! 0%{?epel} %bcond_with networkd_support %else %bcond_without networkd_support %endif +%bcond_with tests + Name: netplan -Version: 0.106 -Release: 0%{?dist} +Version: 1.1.2 +Release: 1%{?dist} Summary: Network configuration tool using YAML -Group: System Environment/Base License: GPL-3.0-only URL: http://netplan.io/ Source0: https://github.com/canonical/%{name}/archive/%{version}/%{name}-%{version}.tar.gz BuildRequires: gcc -BuildRequires: meson >= 0.61 +BuildRequires: meson BuildRequires: pkgconfig(bash-completion) BuildRequires: pkgconfig(glib-2.0) BuildRequires: pkgconfig(gio-2.0) @@ -33,29 +34,24 @@ BuildRequires: pkgconfig(systemd) BuildRequires: pkgconfig(yaml-0.1) BuildRequires: pkgconfig(uuid) BuildRequires: python3-devel -BuildRequires: python3-cffi BuildRequires: systemd-rpm-macros BuildRequires: %{_bindir}/pandoc -BuildRequires: %{_bindir}/find +BuildRequires: python3dist(cffi) +%if %{with tests} # For tests BuildRequires: %{_sbindir}/ip -BuildRequires: pkgconfig(cmocka) +BuildRequires: libcmocka-devel BuildRequires: python3dist(coverage) -BuildRequires: dbus-x11 +BuildRequires: python3dist(pytest) BuildRequires: python3dist(netifaces) BuildRequires: python3dist(pycodestyle) BuildRequires: python3dist(pyflakes) -BuildRequires: python3dist(pytest) -BuildRequires: python3dist(pytest-cov) BuildRequires: python3dist(pyyaml) -BuildRequires: python3dist(rich) -BuildRequires: %{_bindir}/ovs-vsctl -BuildRequires: systemd-udev +%endif -# /usr/sbin/netplan is a Python 3 script that requires Python modules +# /usr/sbin/netplan is a Python 3 script that requires netifaces and PyYAML Requires: python3dist(netifaces) Requires: python3dist(pyyaml) -Requires: python3dist(rich) # 'ip' command is used in netplan apply subcommand Requires: %{_sbindir}/ip # netplan ships dbus files @@ -69,10 +65,15 @@ Suggests: %{name}-default-backend-NetworkManager # Netplan requires its core libraries Requires: %{name}-libs%{?_isa} = %{version}-%{release} +# Python bindings are in their own package but are required for CLI +Requires: python3-%{name}%{?_isa} = %{version}-%{release} + # Provide the package name that Ubuntu uses for it too... Provides: %{ubuntu_name} = %{version}-%{release} Provides: %{ubuntu_name}%{?_isa} = %{version}-%{release} + + %description netplan reads network configuration from /etc/netplan/*.yaml which are written by administrators, 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. %files %license COPYING %doc %{_docdir}/%{name}/ -/usr/sbin/%{name} +%{_sbindir}/%{name} %{_datadir}/%{name}/ -%{_datadir}/dbus-1/system-services/io.netplan.Netplan.service -%{_datadir}/dbus-1/system.d/io.netplan.Netplan.conf +%{_datadir}/dbus-1/system-services/io.%{name}.Netplan.service +%{_datadir}/dbus-1/system.d/io.%{name}.Netplan.conf %{_systemdgeneratordir}/%{name} %{_mandir}/man5/%{name}.5* %{_mandir}/man8/%{name}*.8* %dir %{_sysconfdir}/%{name} -%dir %{_prefix}/lib/%{name} -%{_libexecdir}/%{name}/ +%dir %{_libexecdir}/%{name} +%{_libexecdir}/%{name}/generate +%{_libexecdir}/%{name}/%{name}-dbus %{_datadir}/bash-completion/completions/%{name} -%{python3_sitelib}/%{name}/ -%{python3_sitearch}/%{name}/ # ------------------------------------------------------------------------------------------------ %package libs Summary: Network configuration tool using YAML (core library) -Group: System Environment/Libraries %description libs netplan reads network configuration from /etc/netplan/*.yaml which are written by administrators, @@ -114,13 +113,12 @@ This package provides Netplan's core libraries. %files libs %license COPYING -%{_libdir}/libnetplan.so.%{libsomajor}{,.*} +%{_libdir}/lib%{name}.so.%{libsomajor}{,.*} # ------------------------------------------------------------------------------------------------ %package devel Summary: Network configuration tool using YAML (development files) -Group: Development/Libraries Requires: %{name}-libs%{?_isa} = %{version}-%{release} %description devel @@ -133,14 +131,13 @@ This package provides development headers and libraries for building application %files devel %{_includedir}/%{name}/ -%{_libdir}/libnetplan.so +%{_libdir}/lib%{name}.so %{_libdir}/pkgconfig/%{name}.pc # ------------------------------------------------------------------------------------------------ %package default-backend-NetworkManager Summary: Network configuration tool using YAML (NetworkManager backend) -Group: System Environment/Base Requires: %{name} = %{version}-%{release} # Netplan requires NetworkManager for configuration Requires: NetworkManager @@ -166,14 +163,36 @@ networking daemon. This package configures Netplan to use NetworkManager as its backend. %files default-backend-NetworkManager -%{_prefix}/lib/%{name}/00-netplan-default-renderer-nm.yaml +%attr(600,root,root) %{_prefix}/lib/%{name}/00-network-manager-all.yaml + +# ------------------------------------------------------------------------------------------------ + +%package -n python3-%{name} +Summary: Python bindings for lib%{name} + +Requires: python3-cffi +Requires: %{name}-libs%{?_isa} = %{version}-%{release} + +%description -n python3-%{name} +Declarative network configuration Python bindings +Netplan reads YAML network configuration files which are written +by administrators, installers, cloud image instantiations, or other OS +deployments. During early boot it then generates backend specific +configuration files in /run to hand off control of devices to a particular +networking daemon. + +Currently supported backends are networkd and NetworkManager. + +This package provides a CFFI based Python bindings to libnetplan. + +%files -n python3-%{name} +%{python3_sitearch}/%{name}/ # ------------------------------------------------------------------------------------------------ %if %{with networkd_support} %package default-backend-networkd Summary: Network configuration tool using YAML (systemd-networkd backend) -Group: System Environment/Base Requires: %{name} = %{version}-%{release} # Netplan requires systemd-networkd for configuration Requires: systemd-networkd @@ -202,47 +221,65 @@ This package configures Netplan to use systemd-networkd as its backend. # ------------------------------------------------------------------------------------------------ + %prep %autosetup -p1 -# Drop -Werror to avoid the following error: -# /usr/include/glib-2.0/glib/glib-autocleanups.h:28:3: error: 'ip_str' may be used uninitialized in this function [-Werror=maybe-uninitialized] -sed -e "s/werror=true/werror=false/g" -i meson.build +# these tests all fail in containers, or are linting/codestyle which we don't care about +sed -i -e "/ test('legacy-tests',/,+3d" \ + -e "/ test('codestyle',/,+3d" \ + -e "/ test('linting',/,+3d" \ + -e "/ test('unit-tests',/,+4d" \ + meson.build %build -%meson --sbindir=sbin +%if %{with tests} +%meson +%else +%meson -Dtesting=false +%endif %meson_build %install %meson_install -# Remove superfluous __pycache__ -rm -rf %{buildroot}/usr/lib/python3.11/site-packages/netplan/__pycache__ - -# Pre-create the config directories +# Pre-create the config directory mkdir -p %{buildroot}%{_sysconfdir}/%{name} + +# Create the lib dir for default config mkdir -p %{buildroot}%{_prefix}/lib/%{name} +mv -n %{buildroot}/%{python3_sitelib}/%{name}/* %{buildroot}/%{python3_sitearch}/%{name}/ +rm -f %{python3_sitelib}/%{name}/ + # Generate Netplan default renderer configuration -cat > %{buildroot}%{_prefix}/lib/%{name}/00-netplan-default-renderer-nm.yaml < %{buildroot}%{_prefix}/lib/%{name}/00-network-manager-all.yaml < %{buildroot}%{_prefix}/lib/%{name}/00-netplan-default-renderer-networkd.yaml < - 1.1.2-0 +- Update to 1.1.2 +- Resync with Fedora spec + * Tue Feb 14 2023 Neal Gompa - 0.106-0 - Update to 0.106 - Resync with Fedora spec @@ -271,4 +308,4 @@ EOF - Rebase to 0.30 * Sun Jul 2 2017 Neal Gompa - 0.23~17.04.1-1 -- Initial packaging +- Initial packaging \ No newline at end of file