[ovs-dev] [PATCH] rhel: Make openvswitch-kmod-fedora.spec build.
Guru Shetty
guru at ovn.org
Fri Jan 29 19:22:07 UTC 2016
On 29 January 2016 at 11:12, Flavio Leitner <fbl at redhat.com> wrote:
> On Thu, 28 Jan 2016 15:46:03 -0500
> Russell Bryant <russell at ovn.org> wrote:
>
> > I tried building this package on Fedora 23 and it failed for a couple
> > of different reasons.
> >
> > This package tried to install modules without specifying the rpm build
> > root as an install prefix. The result was just attempting to install
> > the modules on the system, which luckily failed since I wasn't running
> > rpmbuild as root.
> >
> > The package also then tried to manually install the modules into the
> > rpm build root, which is unnecessary once modules_install is pointed
> > to the right place.
> >
> > Finally, the package build failed with a completely unhelpful error
> > which turned out to be because it didn't know how to generate
> > a debuginfo pacakge. I turned off the debug package for now. At
> > least it builds now, which is an improvement.
>
> I tried this patch but it didn't work for me. The module loaded is the
> one provided by the kernel package, not from the kmod rpm package. This
> can be fixed using depmod override config line.
>
Right. I had mentioned it as part of the previous comment. But since this
one fixes a broken current behavior, I acked it anyway.
>
> It also packages unneeded files because those modules.* are generated by
> depmod every time the package is installed (%post).
>
> So, I correct those things and got it running:
>
> # dmesg -c &> /dev/null; rmmod openvswitch; modprobe openvswitch ; dmesg
> [ 2825.326855] openvswitch: Open vSwitch switching datapath 2.5.90
> [ 2825.329217] openvswitch: LISP tunneling driver
> [ 2825.329790] openvswitch: STT tunneling driver
>
> Here is the incremental patch, feel free to merge with yours.
>
> diff --git a/rhel/openvswitch-kmod-fedora.spec.in b/rhel/
> openvswitch-kmod-fedora.spec.in
> index 62e5ce7..ea89d15 100644
> --- a/rhel/openvswitch-kmod-fedora.spec.in
> +++ b/rhel/openvswitch-kmod-fedora.spec.in
> @@ -36,12 +36,19 @@ traffic. This package contains the kernel modules.
> %setup -q -n openvswitch-%{version}
>
> %build
> -./configure --prefix=/usr --sysconfdir=/etc
> --localstatedir=%{_localstatedir} --with-linux=/lib/modules/%{kernel}/build
> --enable-ssl
> +%configure --with-linux=/lib/modules/%{kernel}/build --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
> +do
> + modname="$(basename ${module})"
> + echo "override ${modname%.ko} * extra" >> \
> + $RPM_BUILD_ROOT/etc/depmod.d/kmod-openvswitch.conf
> +done
>
> %clean
> rm -rf $RPM_BUILD_ROOT
> @@ -51,9 +58,10 @@ rm -rf $RPM_BUILD_ROOT
> depmod %{kernel}
>
> %files
> -%defattr(-,root,root)
> +%defattr(0644,root,root)
> /lib/modules/%{kernel}/extra/*.ko
> -/lib/modules/%{kernel}/*
> +/etc/depmod.d/kmod-openvswitch.conf
> +%exclude /lib/modules/%{kernel}/modules.*
>
> %changelog
> * Wed Sep 21 2011 Kyle Mestery <kmestery at cisco.com>
>
>
>
>
> >
> > Signed-off-by: Russell Bryant <russell at ovn.org>
> > ---
> > rhel/openvswitch-kmod-fedora.spec.in | 12 +++++-------
> > 1 file changed, 5 insertions(+), 7 deletions(-)
> >
> > diff --git a/rhel/openvswitch-kmod-fedora.spec.in
> > b/rhel/openvswitch-kmod-fedora.spec.in index ecea16c..62e5ce7 100644
> > --- a/rhel/openvswitch-kmod-fedora.spec.in
> > +++ b/rhel/openvswitch-kmod-fedora.spec.in
> > @@ -7,6 +7,8 @@
> > # notice and this notice are preserved. This file is offered as-is,
> > # without warranty of any kind.
> >
> > +%global debug_package %{nil}
> > +
> > #%define kernel 3.1.5-1.fc16.x86_64
> > #define kernel %{kernel_source}
> > %{?kversion:%define kernel %kversion}
> > @@ -39,23 +41,19 @@ make %{_smp_mflags} -C datapath/linux
> >
> > %install
> > rm -rf $RPM_BUILD_ROOT
> > -make -C datapath/linux modules_install
> > -
> > -install -d -m 755
> > $RPM_BUILD_ROOT/lib/modules/%{kernel}/kernel/extra/openvswitch -find
> > datapath/linux -name *.ko -exec install -m 755 \{\}
> > $RPM_BUILD_ROOT/lib/modules/%{kernel}/kernel/extra/openvswitch \;
> > +make INSTALL_MOD_PATH=$RPM_BUILD_ROOT -C datapath/linux
> > modules_install %clean rm -rf $RPM_BUILD_ROOT
> >
> > -%preun
> > -
> > %post
> > # Ensure that modprobe will find our modules.
> > depmod %{kernel}
> >
> > %files
> > %defattr(-,root,root)
> > -/lib/modules/%{kernel}/kernel/extra/openvswitch/*.ko
> > +/lib/modules/%{kernel}/extra/*.ko
> > +/lib/modules/%{kernel}/*
> >
> > %changelog
> > * Wed Sep 21 2011 Kyle Mestery <kmestery at cisco.com>
>
>
>
> --
> fbl
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
>
More information about the dev
mailing list