Update the kernel module spec file to better reflect how I'm locally building the kmod RPM in mock and pushing it to COPR.
These changes also better align with RPM linting and uses the preferred macros for referring to the build root. Adds in some Requires and BuildRequires lines that define the RPM dependencies needed to build this RPM. Signed-off-by: Leif Madsen <[email protected]> --- rhel/openvswitch-kmod-fedora.spec.in | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/rhel/openvswitch-kmod-fedora.spec.in b/rhel/openvswitch-kmod-fedora.spec.in index 93adb03..b9e0825 100644 --- a/rhel/openvswitch-kmod-fedora.spec.in +++ b/rhel/openvswitch-kmod-fedora.spec.in @@ -23,9 +23,13 @@ Version: @VERSION@ # The entire source code is ASL 2.0 except datapath/ which is GPLv2 License: GPLv2 Release: 1%{?dist} -Source: openvswitch-%{version}.tar.gz -#Source1: openvswitch-init -Buildroot: /tmp/openvswitch-xen-rpm +Source0: openvswitch-%{version}.tar.gz + +Requires: kernel-uname-r = %{kernel}.%{_arch} +BuildRequires: openssl-devel kmod libcap-ng-devel python2-devel python-six +BuildRequires: kernel-devel-uname-r = %{kernel}.%{_arch} +Requires(post): /sbin/depmod +Requires(postun): /sbin/depmod %description Open vSwitch provides standard network bridging functions augmented with @@ -36,34 +40,34 @@ traffic. This package contains the kernel modules. %setup -q -n openvswitch-%{version} %build -%configure --with-linux=/lib/modules/%{kernel}/build --enable-ssl +%configure --with-linux=%{_usrsrc}/kernels/%{kernel}.%{_arch} --enable-ssl make %{_smp_mflags} -C datapath/linux %install -rm -rf $RPM_BUILD_ROOT -make INSTALL_MOD_PATH=$RPM_BUILD_ROOT -C datapath/linux modules_install -mkdir -p $RPM_BUILD_ROOT/etc/depmod.d -for module in $RPM_BUILD_ROOT/lib/modules/%{kernel}/extra/*.ko +rm -rf %{buildroot} +make INSTALL_MOD_PATH=%{buildroot} -C datapath/linux modules_install +mkdir -p %{buildroot}/etc/depmod.d +for module in %{buildroot}/lib/modules/%{kernel}.%{_arch}/extra/*.ko do modname="$(basename ${module})" echo "override ${modname%.ko} * extra" >> \ - $RPM_BUILD_ROOT/etc/depmod.d/kmod-openvswitch.conf + %{buildroot}/etc/depmod.d/kmod-openvswitch.conf echo "override ${modname%.ko} * weak-updates" >> \ - $RPM_BUILD_ROOT/etc/depmod.d/kmod-openvswitch.conf + %{buildroot}/etc/depmod.d/kmod-openvswitch.conf done %clean -rm -rf $RPM_BUILD_ROOT +rm -rf %{buildroot} %post # Ensure that modprobe will find our modules. -depmod %{kernel} +depmod %{kernel}.%{_arch} %files %defattr(0644,root,root) /lib/modules/%{kernel}/extra/*.ko +/lib/modules/%{kernel}/modules.* /etc/depmod.d/kmod-openvswitch.conf -%exclude /lib/modules/%{kernel}/modules.* %changelog * Wed Sep 21 2011 Kyle Mestery <[email protected]> -- 2.9.4 _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
