Thanks for the suggestions. I removed the "obseletes" from the patch, so we can go either way for the kmod RPM naming. A new patch is sent out.
Martin On Mon, Jul 30, 2018 at 12:18 PM Flavio Leitner <f...@redhat.com> wrote: > On Fri, Jul 27, 2018 at 11:19:58AM -0700, Martin Xu wrote: > > Hi Flavio, > > > > Thanks for the review. I was thinking of using this to prevent a user to > > directly install openvswitch-kmod rpm built with the fedora spec file > when > > the system already has the kmod-openvswitch built from rhel6 spec file. > > Packages are named differently. In that case, it's not a matter of > > versions. They could be built off the identical source tree, but > shouldn't > > coexist. Perhaps there's other ways to implement what I intended to do > > here, if you have any suggestions? > > If the files are the same, rpm will complain about the file conflicts > when it tries to install. In that case we only need Conflicts and perhaps > it's ok to not add a version. > > But for obsoletes, it essentially says that your package should > replace the other one. If that is what you want, that's okay too. > However, we will be unable to roll back that in the future if we > need to revive kmod-openvswitch as this package once built cannot > be changed and it will always replace the other one. > > When you add a 'provides', you will create a "virtual package" named > after the provides, with the version and release you want, so RPM can > compare versions and releases as usual. For example: > > Provides: kmod-openvswitch = %{version}-%{release} > > That means you package is also known to rpm as > kmod-openvswitch-2.10.0-10.fc29.... > > fbl > > > > > > Best, > > Martin > > > > On Wed, Jul 25, 2018 at 9:10 AM, Flavio Leitner <f...@redhat.com> wrote: > > > > > On Fri, Jul 20, 2018 at 03:24:53PM -0700, Martin Xu wrote: > > > > This patch ports changes from kmod rhel6 spec file to fedora spec > file, > > > > to support packaging kernel modules built against multiple versions > of > > > > kernel sources. > > > > > > > > RHEL 7.4 introduced backward incompatible changes in the kernel. As > > > > a result, prebuilt PRM packages against kernels newer than 693.17.1 > > > > will cannot be used on systems with older kernels, vice versa. > > > > > > > > Intended to work only on RHEL 7.4 (kernel version 3.10.0-693.yy.zz). > > > > This patch allows multiple kernel version numbers delimited by > > > > whitespace to be passed as variable "kversion". The result RPM > packages > > > > the kernel module .ko files from all specified kernel versions. For > > > > example, > > > > > > > > make rpm-fedora-kmod \ > > > > RPMBUILD_OPT='-D "kversion 3.10.0-693.1.1.el7.x86_64 \ > > > > 3.10.0-693.17.1.el7.x86_64"' > > > > > > > > By default, make tries to build against the current running kernel. > > > > > > > > This patch also includes a script to update the weak-update symlinks > > > > if the system kernel version is upgraded or downgraded after > > > > openvswitch-kmod is installed. > > > > > > > > Signed-off-by: Martin Xu <martinxu9....@gmail.com> > > > > CC: Greg Rose <gvrose8...@gmail.com> > > > > CC: Flavio Leitner <f...@redhat.com> > > > > --- > > > > rhel/openvswitch-kmod-fedora.spec.in | 86 > > > +++++++++++++++++++++++------------- > > > > 1 file changed, 55 insertions(+), 31 deletions(-) > > > > > > > > diff --git a/rhel/openvswitch-kmod-fedora.spec.in b/rhel/ > > > openvswitch-kmod-fedora.spec.in > > > > index c0cd298..24f8290 100644 > > > > --- a/rhel/openvswitch-kmod-fedora.spec.in > > > > +++ b/rhel/openvswitch-kmod-fedora.spec.in > > > > @@ -1,6 +1,6 @@ > > > > # Spec file for Open vSwitch. > > > > > > > > -# Copyright (C) 2009, 2010, 2015 Nicira Networks, Inc. > > > > +# Copyright (C) 2009, 2010, 2015, 2018 Nicira Networks, Inc. > > > > # > > > > # Copying and distribution of this file, with or without > modification, > > > > # are permitted in any medium without royalty provided the copyright > > > > @@ -26,6 +26,9 @@ Release: 1%{?dist} > > > > Source: openvswitch-%{version}.tar.gz > > > > #Source1: openvswitch-init > > > > Buildroot: /tmp/openvswitch-xen-rpm > > > > +Provides: kmod-openvswitch > > > > +Conflicts: kmod-openvswitch > > > > +Obsoletes: kmod-openvswitch > > > > > > Usually the above is versioned to avoid future issues. > > > e.g.: Conflicts: kmod-openvswitch < %{version}-%{release} > > > > > > I didn't spot anything else other than the above, thanks! > > > fbl > > > > > > > > > > > %description > > > > Open vSwitch provides standard network bridging functions augmented > with > > > > @@ -36,55 +39,76 @@ traffic. This package contains the kernel > modules. > > > > %setup -q -n openvswitch-%{version} > > > > > > > > %build > > > > -%configure --with-linux=/lib/modules/%{kernel}/build --enable-ssl > > > > -make %{_smp_mflags} -C datapath/linux > > > > +for kv in %{kversion}; do > > > > + mkdir -p _$kv > > > > + (cd _$kv && /bin/cp -f ../configure . && %configure --srcdir=.. > \ > > > > + --with-linux=/usr/src/kernels/${kv}/ --enable-ssl) > > > > + make %{_smp_mflags} -C _$kv/datapath/linux > > > > +done > > > > > > > > %install > > > > +export INSTALL_MOD_DIR=extra/openvswitch > > > > rm -rf $RPM_BUILD_ROOT > > > > -make INSTALL_MOD_PATH=$RPM_BUILD_ROOT -C datapath/linux > modules_install > > > > +for kv in %{kversion}; do > > > > + make INSTALL_MOD_PATH=$RPM_BUILD_ROOT -C _$kv/datapath/linux > > > modules_install > > > > +done > > > > 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 > > > > - echo "override ${modname%.ko} * weak-updates" >> \ > > > > - $RPM_BUILD_ROOT/etc/depmod.d/kmod-openvswitch.conf > > > > +for kv in %{kversion}; do > > > > + for module in $RPM_BUILD_ROOT/lib/modules/${ > > > kv}/extra/openvswitch/*.ko > > > > + do > > > > + modname="$(basename ${module})" > > > > + grep -qsPo "^\s*override ${modname%.ko} \* > extra\/openvwitch" \ > > > > + $RPM_BUILD_ROOT/etc/depmod.d/kmod-openvswitch.conf || \ > > > > + echo "override ${modname%.ko} * extra/openvswitch" >> \ > > > > + $RPM_BUILD_ROOT/etc/depmod.d/kmod-openvswitch.conf > > > > + grep -qsPo "^\s*override ${modname%.ko} \* > > > weak-updates\/openvwitch" \ > > > > + $RPM_BUILD_ROOT/etc/depmod.d/kmod-openvswitch.conf || \ > > > > + echo "override ${modname%.ko} * > weak-updates/openvswitch" > > > >> \ > > > > + $RPM_BUILD_ROOT/etc/depmod.d/kmod-openvswitch.conf > > > > + done > > > > done > > > > +install -d -m 0755 $RPM_BUILD_ROOT/usr/share/openvswitch/scripts > > > > +install -p -m 0755 > rhel/usr_share_openvswitch_scripts_ovs-kmod-manage.sh > > > \ > > > > + $RPM_BUILD_ROOT/usr/share/openvswitch/scripts/ovs-kmod-manage.sh > > > > > > > > %clean > > > > rm -rf $RPM_BUILD_ROOT > > > > > > > > %post > > > > -# Ensure that modprobe will find our modules. > > > > -for k in $(cd /lib/modules && /bin/ls); do > > > > - [ -d "/lib/modules/$k/kernel/" ] && depmod -a "$k" > > > > -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" > > > > - done | /sbin/weak-modules --add-modules > > > > -fi > > > > - > > > > -%postun > > > > -for k in $(cd /lib/modules && /bin/ls); do > > > > - [ -d "/lib/modules/$k/kernel/" ] && depmod -a "$k" > > > > -done > > > > -if [ "$1" = 0 ]; then # Erase, not upgrade > > > > +current_kernel=$(uname -r) > > > > +IFS=. read installed_major installed_minor installed_micro > > > installed_arch \ > > > > + installed_build <<<"${current_kernel##*-}" > > > > +if [ "$installed_major" = "693" ]; then > > > > + # Workaround for RHEL 7.4 > > > > + if [ -x "/usr/share/openvswitch/scripts/ovs-kmod-manage.sh" ]; > then > > > > + /usr/share/openvswitch/scripts/ovs-kmod-manage.sh > > > > + fi > > > > +else > > > > + # Ensure that modprobe will find our modules. > > > > + for k in $(cd /lib/modules && /bin/ls); do > > > > + [ -d "/lib/modules/$k/kernel/" ] && depmod -a "$k" > > > > + 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" > > > > - done | /sbin/weak-modules --remove-modules > > > > + echo "/lib/modules/%{kernel}/extra/openvswitch/$m.ko" > > > > + done | /sbin/weak-modules --add-modules > > > > fi > > > > fi > > > > > > > > +%postun > > > > +for kname in `ls -d /lib/modules/*` > > > > +do > > > > + rm -rf $kname/weak-updates/openvswitch > > > > +done > > > > +/sbin/depmod -a > > > > + > > > > %files > > > > %defattr(0644,root,root) > > > > -/lib/modules/%{kernel}/extra/*.ko > > > > +/lib/modules/*/extra/openvswitch/*.ko > > > > /etc/depmod.d/kmod-openvswitch.conf > > > > -%exclude /lib/modules/%{kernel}/modules.* > > > > +%exclude /lib/modules/*/modules.* > > > > +%attr(755,root,root) > /usr/share/openvswitch/scripts/ovs-kmod-manage.sh > > > > > > > > %changelog > > > > * Wed Sep 21 2011 Kyle Mestery <kmest...@cisco.com> > > > > -- > > > > 1.8.3.1 > > > > > > > > > > -- > > > Flavio > > > > > -- > Flavio > _______________________________________________ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev