[ovs-dev] [PATCH v3 2/3] rhel: remove openvswitch-kmod package from build, rhel6

Martin Xu martinxu9.ovs at gmail.com
Thu Jul 12 22:17:27 UTC 2018


On Thu, Jul 12, 2018 at 12:23 PM, Flavio Leitner <fbl at redhat.com> wrote:

> On Thu, Jul 12, 2018 at 10:35:55AM -0700, Martin Xu wrote:
> > This patch only affects rhel6 spec file.
> >
> > Previouly the kernel_module_package macro is used to generate spec file
> > template to build kmod-openvswitch RPM. The main package only contains
> > the openvswitch.conf for depmod. The macro is now removed. Everything is
> > built in the main package instead. This effectively removes the redudant
> > openvswitch-kmod package from the build.
> >
> > Signed-off-by: Martin Xu <martinxu9.ovs at gmail.com>
> > CC: Greg Rose <gvrose8192 at gmail.com>
> > CC: Ben Pfaff <blp at ovn.org>
> > CC: Flavio Leitner <fbl at redhat.com>
> > CC: Aaron Conole <aconole at redhat.com>
> > ---
> >  rhel/automake.mk                    |  1 -
> >  rhel/kmod-openvswitch-rhel6.spec.in | 32 ++++++++++++++++--------------
> --
> >  rhel/openvswitch-kmod.files         |  3 ---
> >  3 files changed, 16 insertions(+), 20 deletions(-)
> >  delete mode 100644 rhel/openvswitch-kmod.files
> >
> > diff --git a/rhel/automake.mk b/rhel/automake.mk
> > index 82a450831..180419427 100644
> > --- a/rhel/automake.mk
> > +++ b/rhel/automake.mk
> > @@ -17,7 +17,6 @@ EXTRA_DIST += \
> >       rhel/openvswitch-dkms.spec.in \
> >       rhel/kmod-openvswitch-rhel6.spec \
> >       rhel/kmod-openvswitch-rhel6.spec.in \
> > -     rhel/openvswitch-kmod.files \
> >       rhel/openvswitch-kmod-fedora.spec \
> >       rhel/openvswitch-kmod-fedora.spec.in \
> >       rhel/openvswitch.spec \
> > diff --git a/rhel/kmod-openvswitch-rhel6.spec.in b/rhel/
> kmod-openvswitch-rhel6.spec.in
> > index daa3dade1..7b9424968 100644
> > --- a/rhel/kmod-openvswitch-rhel6.spec.in
> > +++ b/rhel/kmod-openvswitch-rhel6.spec.in
> > @@ -1,7 +1,7 @@
> >  # Spec file for Open vSwitch kernel modules on Red Hat Enterprise
> >  # Linux 6.
> >
> > -# Copyright (C) 2011, 2012 Nicira, Inc.
> > +# Copyright (C) 2011, 2012, 2018 Nicira, Inc.
> >  #
> >  # Copying and distribution of this file, with or without modification,
> >  # are permitted in any medium without royalty provided the copyright
> > @@ -10,7 +10,7 @@
> >
> >  %define oname openvswitch
> >
> > -Name:           %{oname}-kmod
> > +Name:           kmod-%{oname}
> >  Version:        @VERSION@
> >  Release:        1%{?dist}
> >  Summary:        Open vSwitch kernel module
> > @@ -19,23 +19,22 @@ Group:          System/Kernel
> >  License:        GPLv2
> >  URL:            http://openvswitch.org/
> >  Source0:        %{oname}-%{version}.tar.gz
> > -Source1:        %{oname}-kmod.files
> >  BuildRoot:      %(mktemp -ud %{_tmppath}/%{name}-%{version}
> -%{release}-XXXXXX)
> > -BuildRequires:  %kernel_module_package_buildreqs
> >
> >  # Without this we get an empty openvswitch-debuginfo package (whose name
> >  # conflicts with the openvswitch-debuginfo package for OVS userspace).
> >  %undefine _enable_debug_packages
> >
> > +%define kernel_source_extended() /usr/src/kernels/%{2}$([ %{1} =
> default ] || echo ".%{1}")
> > +
> > +# By default, build against the latest installed kernel-devel
> > +%{!?kversion:%global kversion %(rpm -q --qf
> '%{VERSION}-%{RELEASE}.%{ARCH}' `rpm -qa | egrep
> "^kernel(-rt|-aarch64)?-devel" | /usr/lib/rpm/redhat/rpmsort -r | head -n
> 1` | head -n 1)}
>
> I am afraid that '%{VERSION}-%{RELEASE}.%{ARCH}' will be expanded by
> rpm when building the package to the openvswitch's one in this
> package, so you end up with:
> rpm -q --qf '2.9.0-1.xxx.x86_64' $kernel_pkg_name
>
> otherwise LGTM.
> fbl
>
> Hi Flavio,

Thanks for the review. I hadn't noticed it. I just tried again, but I don't
see that %{VERSION} being expanded to 2.9.0 for example. If I changed that
long rpm command to query with lower case pattern
'%{version}-%{release}.%{arch}, it did get expanded. Maybe I'm missing
something here?
I kinda prefer to use it as it is right now than inventing my own. Since
this is from a macro nested inside the definition
for kernel_module_package. I think it's safe to assume it's written more
correctly than mine.

> >  # Use -D 'kversion 2.6.32-131.6.1.el6.x86_64' to build package
> >  # for specified kernel version.
> > -%{?kversion:%define kernel_version %kversion}
> >
> >  # Use -D 'kflavors default debug kdump' to build packages for
> >  # specified kernel variants.
> > -%{!?kflavors:%define kflavors default}
> > -
> > -%kernel_module_package -n %{oname} -f %{SOURCE1} %kflavors
> > +%{!?kflavors:%global kflavors default}
> >
> >  %description
> >  Open vSwitch Linux kernel module.
> > @@ -45,24 +44,24 @@ Open vSwitch Linux kernel module.
> >  %setup -n %{oname}-%{version}
> >
> >  %build
> > -for flavor in %flavors_to_build; do
> > +for flavor in %{kflavors} ; do
> >          mkdir _$flavor
> > -        (cd _$flavor && ../configure --with-linux="%{kernel_source
> $flavor}")
> > +        (cd _$flavor && ../configure --with-linux="%{kernel_source_extended
> $flavor %{kversion}}")
> >          %{__make} -C _$flavor/datapath/linux %{?_smp_mflags}
> >  done
> >
> >  %install
> >  export INSTALL_MOD_PATH=$RPM_BUILD_ROOT
> >  export INSTALL_MOD_DIR=extra/%{oname}
> > -for flavor in %flavors_to_build ; do
> > -         make -C %{kernel_source $flavor} modules_install \
> > +for flavor in %{kflavors} ; do
> > +         make -C %{kernel_source_extended $flavor %{kversion}}
> modules_install \
> >                   M="`pwd`"/_$flavor/datapath/linux
> >
> >           # Cleanup unnecessary kernel-generated module dependency files.
> >           find $INSTALL_MOD_PATH/lib/modules -iname 'modules.*' -exec rm
> {} \;
> >  done
> >  install -d %{buildroot}%{_sysconfdir}/depmod.d/
> > -for module in %{buildroot}/lib/modules/%{kernel_version}/$INSTALL_MOD_
> DIR/*.ko;
> > +for module in %{buildroot}/lib/modules/%{kversion}/$INSTALL_MOD_DIR/*.
> ko;
> >  do
> >      modname="$(basename ${module})"
> >      echo "override ${modname%.ko} * extra/%{oname}" >> %{oname}.conf
> > @@ -78,7 +77,7 @@ done
> >  if [ -x "/sbin/weak-modules" ]; then
> >      for m in openvswitch vport-gre vport-stt vport-geneve \
> >               vport-lisp vport-vxlan; do
> > -        echo "/lib/modules/%{kernel}/extra/$m.ko"
> > +        echo "/lib/modules/%{kversion}/extra/$m.ko"
> >      done | /sbin/weak-modules --add-modules
> >  fi
> >
> > @@ -90,14 +89,15 @@ if [ "$1" = 0 ]; then  # Erase, not upgrade
> >      if [ -x "/sbin/weak-modules" ]; then
> >          for m in openvswitch vport-gre vport-stt vport-geneve \
> >                   vport-lisp vport-vxlan; do
> > -        echo "/lib/modules/%{kernel}/extra/$m.ko"
> > +        echo "/lib/modules/%{kversion}/extra/$m.ko"
> >      done | /sbin/weak-modules --remove-modules
> >      fi
> >  fi
> >
> >  %files
> > -%defattr(644,root,root)
> > +%defattr(644,root,root,755)
> >  /etc/depmod.d/%{oname}.conf
> > +/lib/modules/
> >
> >  %clean
> >  rm -rf $RPM_BUILD_ROOT
> > diff --git a/rhel/openvswitch-kmod.files b/rhel/openvswitch-kmod.files
> > deleted file mode 100644
> > index 357c2e8b7..000000000
> > --- a/rhel/openvswitch-kmod.files
> > +++ /dev/null
> > @@ -1,3 +0,0 @@
> > -%defattr(644,root,root,755)
> > -/lib/modules/%2-%1
> > -/etc/depmod.d/openvswitch.conf
> > --
> > 2.15.2 (Apple Git-101.1)
> >
>
> --
> Flavio
>


More information about the dev mailing list